@nnepoch/dtc-sdk 3.0.7 → 3.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser/dtc-sdk-3.0.8.js +2 -0
- package/dist/cjs/index.cjs +1 -1
- package/dist/cjs/index.d.cts +48 -0
- package/dist/esm/index.d.ts +48 -0
- package/dist/esm/index.js +1 -1
- package/package.json +1 -1
- package/dist/browser/dtc-sdk-3.0.7.js +0 -2
package/dist/esm/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{EventEmitter as e,LogLevel as t,Logger as n}from"@epicgames-ps/lib-pixelstreamingcommon-ue5.6";import{z as r}from"zod";import i from"axios";import{Config as a,Flags as o,NumericParameters as s,OptionParameters as c,PixelStreaming as l}from"@epicgames-ps/lib-pixelstreamingfrontend-ue5.6";import{inflate as u}from"pako";var d=class extends Error{constructor(e,t,n){super(`Invalid payload for ${e}.${t}: ${n.map(e=>`${e.field}: ${e.reason}`).join(`; `)}`),this.moduleName=e,this.methodName=t,this.issues=n,this.name=`SDKValidationError`,this.code=`VALIDATION_ERROR`}toJSON(){return{name:this.name,code:this.code,message:this.message,module:this.moduleName,method:this.methodName,issues:this.issues}}};function f(e,t,n,r){let i=e.safeParse(t);if(i.success)return i.data;throw new d(n,r,i.error.issues.map(e=>({field:e.path.length>0?e.path.join(`.`):`<root>`,reason:e.message,code:e.code})))}function p(e){return e instanceof d?JSON.stringify(e.toJSON()):e instanceof Error?`${e.name}: ${e.message}`:String(e)}const ee={InitLogging(){},Debug(e){console.log(`[Debug] - ${e}`)},Info(e){console.log(`[Info] - ${e}`)},Warning(e){console.warn(`[Warning] - ${e}`)},Error(e){console.error(`[Error] - ${e}`)}},m={debug(){},info(){},warn(){},error(){}},te=[`silent`,`error`,`warn`,`info`,`debug`],h={silent:0,error:1,warn:2,info:3,debug:4};function ne(e){switch(e){case`silent`:return t.Disabled;case`error`:return t.Error;case`warn`:return t.Warning;case`info`:return t.Info;default:return t.Debug}}function re(e){n.InitLogging(ne(e),!1)}function g(e){return typeof e==`string`&&te.includes(e)}function _(e){if(e===void 0)return`info`;if(g(e))return e;let t=typeof e==`string`?e:JSON.stringify(e);throw Error(`Invalid logger level: ${t}. Expected one of: ${te.join(`, `)}.`)}function ie(e){if(e===void 0)return``;try{let t=JSON.stringify(e);return t?` ${t}`:``}catch{return` ${String(e)}`}}function ae(){let e=Error().stack;return e?e.replace(/^Error(?::\s*)?\n?/,``):`No Stack Available for this browser`}var oe=class{constructor(e,t,n,r,i,a){this.driver=e,this.prefix=t,this.level=n,this.moduleName=r,this.includeStack=i,this.reporter=a}formatMessage(e,t,n){let r=`${this.prefix} ${t}${ie(n)}`.trim();return this.shouldIncludeStack(e)?`${r}\nStack: ${ae()}`:r}shouldLog(e){return h[this.level]>=h[e]}shouldIncludeStack(e){return h[this.includeStack]>=h[e]}debug(e,t){this.shouldLog(`debug`)&&this.driver.Debug(this.formatMessage(`debug`,e,t))}info(e,t){this.shouldLog(`info`)&&this.driver.Info(this.formatMessage(`info`,e,t))}warn(e,t){this.reportWarnOrError(`warn`,e,t),this.shouldLog(`warn`)&&this.driver.Warning(this.formatMessage(`warn`,e,t))}error(e,t){this.reportWarnOrError(`error`,e,t),this.shouldLog(`error`)&&this.driver.Error(this.formatMessage(`error`,e,t))}reportWarnOrError(e,t,n){this.reporter?.recordLogSignal({level:e,moduleName:this.moduleName,message:t,meta:n})}},se=class{constructor(e,t=ee,n){this.level=_(e),this.driver=t,this.includeStack=n?.includeStack??`warn`,this.driver.InitLogging(ne(this.level),!1),this.reporter=n?.reporter??n?.qosMonitor}setReporter(e){this.reporter=e}child(e){return new oe(this.driver,`[DTCEngine:${e}]`,this.level,e,this.includeStack,this.reporter)}};const v={EngineIniting:`云渲染引擎初始化中...`,ServiceUrlInValid:`调度中心地址不正确,请检查中心地址!`,SerriceError:`调度中心连接失败,尝试重连中...`,SerriceUnAvaible:`没有服务资源,请检查服务是否启动!`,SerriceLoadingForWaiting:`服务资源启动中,请稍候!`,EngineWaiting:`云渲染服务坐席已满,当前排队人数:1人....`,EngineTockenChecking:`云引擎授权文件验证中...`,EngineTokenCheckFail:`云引擎授权许可无效,请联系管理员!`,EngineConnectioning:`云渲染引擎连接中...`,EngineConnectionSuccess:`云渲染引擎连接成功...`,EngineClose:`云渲染引擎连接断开,请检查服务状态!`,SourcePreparing:`资源准备中...`,TokenInValid:`许可未激活!`,TokenExpired:`许可授权已过期,实时渲染服务已停止!`,TokenWillExpired:`您的授权许可将于 YYYY-MM-DD 到期,请尽快续期!`};var ce=class{constructor(e){this.options=e,this.logger=e.logger??m}show(e,t,n=!0){if(console.log(`loading show`,e,t,n),this.options.emit({message:e,key:t,isFinish:!n}),!this.options.enabled)return;let r=this.getRoot();r&&(this.progressDiv||=this.createTipDiv(r,`engineProgressTips`),this.progressDiv.textContent=e,n||(this.clearAutoCloseTimer(),this.autoCloseTimer=setTimeout(()=>{this.removeProgressBar()},2e3)))}showTokenWillExpire(e,t=`TokenWillExpired`,n=!0){let r=this.formatTokenWillExpireMessage(e);if(this.options.emit({message:r,key:t,isFinish:!n}),!this.options.enabled)return;let i=this.getRoot();i&&(this.tokenWillExpireDiv||(this.tokenWillExpireDiv=this.createTipDiv(i,`TokenWillExpireTips`),this.tokenWillExpireDiv.style.top=`60px`),this.tokenWillExpireDiv.textContent=r)}dispose(){this.clearAutoCloseTimer(),this.removeProgressBar(),this.removeTokenWillExpireBar()}getRoot(){if(this.options.hostElement?.ownerDocument?.body)return this.options.hostElement.ownerDocument.body;if(typeof document<`u`&&document.body)return document.body;this.logger.debug(`skip loading progress ui render: document is unavailable`)}createTipDiv(e,t){let n=e.ownerDocument.createElement(`div`);return n.id=t,n.style.position=`fixed`,n.style.left=`50%`,n.style.top=`16px`,n.style.transform=`translateX(-50%)`,n.style.zIndex=`99999`,n.style.padding=`8px 14px`,n.style.borderRadius=`6px`,n.style.background=`rgba(0, 0, 0, 0.72)`,n.style.color=`#fff`,n.style.fontSize=`14px`,n.style.lineHeight=`1.4`,n.style.pointerEvents=`none`,n.style.maxWidth=`80vw`,n.style.textAlign=`center`,e.appendChild(n),n}removeProgressBar(){this.progressDiv&&=(this.progressDiv.remove(),void 0)}removeTokenWillExpireBar(){this.tokenWillExpireDiv&&=(this.tokenWillExpireDiv.remove(),void 0)}clearAutoCloseTimer(){this.autoCloseTimer&&=(clearTimeout(this.autoCloseTimer),void 0)}formatTokenWillExpireMessage(e){let t=e.trim();return t?t.includes(`到期`)?t:`您的授权许可将于 ${t}到期,请尽快续期!`:v.TokenWillExpired}};const le=`sdk3-agent-bridge/v1`;function ue(e){if(typeof WebSocket>`u`)throw Error(`WebSocket is not available in current runtime.`);return new WebSocket(e)}function de(e){return{ok:!0,data:e,ts:Date.now()}}function fe(e,t){return{ok:!1,error:{code:`PROTOCOL_ERROR`,message:e,details:t},ts:Date.now()}}function pe(e){if(typeof e==`string`)try{let t=JSON.parse(e);if(typeof t!=`object`||!t)return;let n=t;return n.protocolVersion!==`sdk3-agent-bridge/v1`||typeof n.type!=`string`||typeof n.callId!=`string`?void 0:n}catch{return}}var me=class{constructor(e,t,n={}){this.runtime=e,this.options=t,this.reconnectAttempt=0,this.running=!1,this.startedAt=0,this.beforeUnloadHandler=()=>{this.stop(`pagehide`)},this.socketFactory=n.socketFactory??ue}start(){this.socket||(this.running=!0,this.openSocket(),typeof window<`u`&&(window.addEventListener(`beforeunload`,this.beforeUnloadHandler),window.addEventListener(`pagehide`,this.beforeUnloadHandler)))}stop(e=`stop`){this.running=!1,this.clearReconnect(),typeof window<`u`&&(window.removeEventListener(`beforeunload`,this.beforeUnloadHandler),window.removeEventListener(`pagehide`,this.beforeUnloadHandler)),this.clearHeartbeat(),this.runtime.dispose?.();let t=this.socket;t&&(t.readyState===1&&this.sendUnregister(e),this.clearSocketHandlers(t),t.close(1e3,e),this.socket=void 0)}openSocket(){this.startedAt=Date.now();let e=this.socketFactory(this.options.serverUrl??`ws://127.0.0.1:8787/sdk3-bridge`);this.socket=e,e.onopen=()=>{this.reconnectAttempt=0,this.sendRegister(),this.startHeartbeat()},e.onmessage=e=>{this.handleMessage(e.data)},e.onclose=()=>{this.clearSocketHandlers(e),this.clearHeartbeat(),this.runtime.closeAllStreams?.(`Agent bridge WebSocket disconnected`),this.runtime.cancelAllPrograms?.(`Agent bridge WebSocket disconnected`),this.socket===e&&(this.socket=void 0),this.scheduleReconnect()},e.onerror=()=>{this.clearHeartbeat()}}scheduleReconnect(){if(!this.running||this.reconnectTimer!==void 0||this.options.reconnect===!1)return;let e=this.getReconnectDelay();this.reconnectTimer=setTimeout(()=>{this.reconnectTimer=void 0,!(!this.running||this.socket)&&this.openSocket()},e),this.reconnectAttempt+=1}getReconnectDelay(){let e=typeof this.options.reconnect==`object`?this.options.reconnect:void 0,t=Math.max(0,e?.initialDelayMs??1e3),n=Math.max(t,e?.maxDelayMs??15e3),r=Math.max(0,e?.jitterMs??500);return Math.min(n,t*2**this.reconnectAttempt)+Math.floor(Math.random()*(r+1))}clearReconnect(){this.reconnectTimer!==void 0&&(clearTimeout(this.reconnectTimer),this.reconnectTimer=void 0)}sendRegister(){let e={...this.runtime.getSnapshot(),heartbeatIntervalMs:this.getHeartbeatInterval(),capabilities:{catalog:!0,schema:!0,validateActions:!0,invoke:!0,stream:!0,businessPrograms:!0,businessProgramProtocolVersion:1}};this.send({type:`register`,protocolVersion:le,bridgeId:e.bridgeId,ts:Date.now(),payload:e})}sendUnregister(e){let t={...this.runtime.getSnapshot(),reason:e};this.send({type:`unregister`,protocolVersion:le,bridgeId:t.bridgeId,ts:Date.now(),payload:t})}sendHeartbeat(){let e={...this.runtime.getSnapshot(),heartbeatIntervalMs:this.getHeartbeatInterval(),uptimeMs:Math.max(0,Date.now()-this.startedAt)};this.send({type:`heartbeat`,protocolVersion:le,bridgeId:e.bridgeId,ts:Date.now(),payload:e})}getHeartbeatInterval(){return Math.max(1e3,this.options.heartbeatIntervalMs??5e3)}startHeartbeat(){this.clearHeartbeat(),this.heartbeatTimer=setInterval(()=>{this.sendHeartbeat()},this.getHeartbeatInterval())}clearHeartbeat(){this.heartbeatTimer!==void 0&&(clearInterval(this.heartbeatTimer),this.heartbeatTimer=void 0)}async handleMessage(e){let t=pe(e);if(t){if(t.type===`catalog`){let e=t.payload,n=e.kind===`modules`?de(this.runtime.listModules()):this.runtime.listMethods(e.moduleName??``);this.sendResult(t,`catalog`,n);return}if(t.type===`schema`){let e=t.payload;this.sendResult(t,`schema`,this.runtime.getMethodSchema(e.moduleName,e.methodName));return}if(t.type===`validate-actions`){this.sendResult(t,`validate-actions`,this.runtime.validateActions(t.payload));return}if(t.type===`invoke`){this.sendResult(t,`invoke`,await this.runtime.invoke(t.payload));return}if(t.type===`stream-start`){let e=t.payload,n=await this.runtime.startStream(e,e=>{this.sendStreamEvent(e)});this.sendResult(t,`stream-start`,n);return}if(t.type===`stream-close`){this.sendResult(t,`stream-close`,await this.runtime.closeStream(t.payload));return}if(t.type===`load-program`){this.sendResult(t,`load-program`,await this.runtime.loadProgram(t.payload));return}if(t.type===`start-program`){this.sendResult(t,`start-program`,await this.runtime.startProgram(t.payload,e=>{this.sendProgramEvent(e)}));return}if(t.type===`cancel-program`){this.sendResult(t,`cancel-program`,await this.runtime.cancelProgram(t.payload));return}this.sendResult(t,`catalog`,fe(`Unsupported message type "${t.type}".`))}}sendStreamEvent(e){this.send({type:`stream-event`,protocolVersion:le,bridgeId:this.runtime.getSnapshot().bridgeId,ts:Date.now(),payload:e})}sendProgramEvent(e){this.send({type:`program-event`,protocolVersion:le,bridgeId:this.runtime.getSnapshot().bridgeId,traceId:e.traceId,ts:Date.now(),payload:e})}sendResult(e,t,n){let r={requestType:t,result:n,traceId:e.traceId};this.send({type:`result`,protocolVersion:le,bridgeId:this.runtime.getSnapshot().bridgeId,callId:e.callId,traceId:e.traceId,ts:Date.now(),payload:r})}send(e){!this.socket||this.socket.readyState!==1||this.socket.send(JSON.stringify(e))}clearSocketHandlers(e){e.onopen=null,e.onmessage=null,e.onclose=null,e.onerror=null}};function he(e,t){return t&&e.then(e=>{t(e)}).catch(e=>{t(e)}),e}var y=class{constructor(e,t,n){this.bridge=e,this.moduleName=t,this.logger=n?.logger??m}request(e,t,n,r){return he(Promise.resolve().then(()=>{let n=r?f(r,t,this.moduleName,e):t;return r||this.logger.debug(`validation schema not configured`,{method:e}),this.logger.debug(`sending request`,{method:e}),this.bridge.sendRequest(this.moduleName,e,n)}).then(t=>(this.logger.info(`request success`,{method:e,code:t.code}),t)).catch(t=>{throw this.logger.warn(`request failed`,{method:e,error:p(t)}),t}),n)}requestStream(e,t,n,r){try{if(!this.bridge.sendStreamRequest)throw Error(`Current bridge does not support stream request`);let i=r?f(r,t,this.moduleName,e):t;return r||this.logger.debug(`validation schema not configured`,{method:e}),this.logger.debug(`sending stream request`,{method:e}),this.bridge.sendStreamRequest(this.moduleName,e,i,n)}catch(t){let r=t instanceof Error?t:Error(String(t));if(this.logger.warn(`stream request failed before send`,{method:e,error:p(r)}),n)try{n({type:`error`,requestId:``,error:r})}catch(t){this.logger.warn(`stream error callback failed`,{method:e,error:p(t)})}let i=Promise.reject(r);return Object.defineProperty(i,"requestId",{value:``,enumerable:!0}),i.cancel=()=>{},i}}},ge=class e{constructor(e=0,t=0){this.x=e,this.y=t}set(e,t){return this.x=e,this.y=t,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}clone(){return new e(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e,t){return t==null?(this.x+=e.x,this.y+=e.y,this):this.addVectors(e,t)}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}sub(e,t){return t==null?(this.x-=e.x,this.y-=e.y,this):this.subVectors(e,t)}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}angle(){let e=Math.atan2(this.y,this.x);return e<0&&(e+=2*Math.PI),e}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){let t=this.x-e.x,n=this.y-e.y;return t*t+n*n}equals(e){return e.x==this.x&&e.y==this.y}toString(){return JSON.stringify(this)}};function _e(e,t){let n=e*20037508.34/180,r=Math.log(Math.tan((90+t)*Math.PI/360))/(Math.PI/180);return r=r*20037508.34/180,{x:n,y:r}}function ve(e,t){let n=e/20037508.34*180,r=t/20037508.34*180;return r=180/Math.PI*(2*Math.atan(Math.exp(r*Math.PI/180))-Math.PI/2),{x:n,y:r}}const b={EPSGType:{EPSG84:`4326`,EPSGWeb:`3857`,EPSGWorld:`0000`}};var x=class e{constructor(e=0,t=0,n=0,r=b.EPSGType.EPSG84){typeof e!=`number`&&(e=this.parseFloatDeal(e)),typeof t!=`number`&&(t=this.parseFloatDeal(t)),typeof n!=`number`&&(n=this.parseFloatDeal(n)),e!=e&&(e=0),t!=t&&(t=0),n!=n&&(n=0),this.x=e,this.y=t,this.z=n,this.ePSGType=r}parseFloatDeal(e){try{return parseFloat(e)}catch(e){return console.log(e),0}}set(e,t,n){return typeof e!=`number`&&(e=0),typeof t!=`number`&&(t=0),typeof n!=`number`&&(n=0),e!=e&&(e=0),t!=t&&(t=0),n!=n&&(n=0),this.x=e,this.y=t,this.z=n,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}clone(){return new e(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e,t){return t==null?(this.x+=e.x,this.y+=e.y,this.z+=e.z,this):this.addVectors(e,t)}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}sub(e,t){return t==null?(this.x-=e.x,this.y-=e.y,this.z-=e.z,this):this.subVectors(e,t)}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}multiply(e,t){return t==null?(this.x*=e.x,this.y*=e.y,this.z*=e.z,this):this.multiplyVectors(e,t)}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this}clampScalar(t,n){let r=new e,i=new e;return r.set(t,t,t),i.set(n,n,n),this.clamp(r,i)}clampLength(e,t){let n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,n){return this.subVectors(t,e).multiplyScalar(n).add(e)}cross(e,t){return t==null?this.crossVectors(this,e):this.crossVectors(e,t)}crossVectors(e,t){let n=e.x,r=e.y,i=e.z,a=t.x,o=t.y,s=t.z;return this.x=r*s-i*o,this.y=i*a-n*s,this.z=n*o-r*a,this}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){let t=this.x-e.x,n=this.y-e.y,r=this.z-e.z;return t*t+n*n+r*r}equals(e){return e.x==this.x&&e.y==this.y&&e.z==this.z}toString(){return JSON.stringify(this)}changeEPSGType(e){if(this.ePSGType!=e){if(e==b.EPSGType.EPSG84){let e=ve(this.x,this.y);this.x=e.x,this.y=e.y}else if(e==b.EPSGType.EPSGWeb){let e=_e(this.x,this.y);this.x=e.x,this.y=e.y}else console.log(`暂不支持[${this.ePSGType}]转换为${e}`);return this.ePSGType=e,this}}};const S={Off:0,Auto:1,DLAA:2,UltraQuality:3,Quality:4,Balanced:5,Performance:6,UltraPerformance:7},C={Auto:`auto`,Low:`low`,High:`high`,Super:`super`,Blue:`blue`},ye=[{label:`自动`,type:C.Auto,value:12e6},{label:`标清`,type:C.Low,value:4e6},{label:`高清`,type:C.High,value:8e6},{label:`超清`,type:C.Super,value:12e6},{label:`蓝光`,type:C.Blue,value:24e6}],be={[C.Auto]:12e6,[C.Low]:4e6,[C.High]:8e6,[C.Super]:12e6,[C.Blue]:24e6};let xe=function(e){return e.VP8=`VP8`,e.VP9=`VP9`,e.AV1=`AV1`,e.H264=`H264`,e}({}),Se=function(e){return e.Model=`MODEL`,e.POI=`POI`,e}({});const Ce={Spring:0,Summer:1,Autumn:2,Winter:3};let we=function(e){return e[e.Linear=0]=`Linear`,e[e.EaseInQuad=1]=`EaseInQuad`,e[e.EaseOutQuad=2]=`EaseOutQuad`,e[e.EaseInOutQuad=3]=`EaseInOutQuad`,e[e.EaseOutInQuad=4]=`EaseOutInQuad`,e[e.EaseInCubic=5]=`EaseInCubic`,e[e.EaseOutCubic=6]=`EaseOutCubic`,e[e.EaseInOutCubic=7]=`EaseInOutCubic`,e[e.EaseOutInCubic=8]=`EaseOutInCubic`,e[e.EaseInQuart=9]=`EaseInQuart`,e[e.EaseOutQuart=10]=`EaseOutQuart`,e[e.EaseInOutQuart=11]=`EaseInOutQuart`,e[e.EaseOutInQuart=12]=`EaseOutInQuart`,e[e.EaseInQuint=13]=`EaseInQuint`,e[e.EaseOutQuint=14]=`EaseOutQuint`,e[e.EaseInOutQuint=15]=`EaseInOutQuint`,e[e.EaseOutInQuint=16]=`EaseOutInQuint`,e[e.EaseInSine=17]=`EaseInSine`,e[e.EaseOutSine=18]=`EaseOutSine`,e[e.EaseInOutSine=19]=`EaseInOutSine`,e[e.EaseOutInSine=20]=`EaseOutInSine`,e[e.EaseInExpo=21]=`EaseInExpo`,e[e.EaseOutExpo=22]=`EaseOutExpo`,e[e.EaseInOutExpo=23]=`EaseInOutExpo`,e[e.EaseOutInExpo=24]=`EaseOutInExpo`,e[e.EaseInCirc=25]=`EaseInCirc`,e[e.EaseOutCirc=26]=`EaseOutCirc`,e[e.EaseInOutCirc=27]=`EaseInOutCirc`,e[e.EaseOutInCirc=28]=`EaseOutInCirc`,e[e.EaseInElastic=29]=`EaseInElastic`,e[e.EaseOutElastic=30]=`EaseOutElastic`,e[e.EaseInOutElastic=31]=`EaseInOutElastic`,e[e.EaseOutInElastic=32]=`EaseOutInElastic`,e[e.EaseInBack=33]=`EaseInBack`,e[e.EaseOutBack=34]=`EaseOutBack`,e[e.EaseInOutBack=35]=`EaseInOutBack`,e[e.EaseOutInBack=36]=`EaseOutInBack`,e[e.EaseInBounce=37]=`EaseInBounce`,e[e.EaseOutBounce=38]=`EaseOutBounce`,e[e.EaseInOutBounce=39]=`EaseInOutBounce`,e[e.EaseOutInBounce=40]=`EaseOutInBounce`,e}({}),Te=function(e){return e[e.Loose=0]=`Loose`,e[e.Strict=1]=`Strict`,e}({}),Ee=function(e){return e.StopAtTheEnd=`StopAtTheEnd`,e.Loop=`Loop`,e.BackAndForward=`BackAndForward`,e}({});const w=r.string().min(1),T=w.optional(),E=r.number().finite(),D=E.optional(),O=r.instanceof(x),De=r.object({x:E,y:E,z:E,ePSGType:w}),Oe=r.union([r.instanceof(ge),r.object({x:E,y:E})]),k=r.union([O,De]),ke=O.optional(),Ae=k.optional(),je=r.union([r.literal(Ce.Spring).describe(`春季`),r.literal(Ce.Summer).describe(`夏季`),r.literal(Ce.Autumn).describe(`秋季`),r.literal(Ce.Winter).describe(`冬季`)]).describe(`场景季节`),Me=r.union([r.literal(S.Off).describe(`关闭 DLSS`),r.literal(S.Auto).describe(`自动质量档位`),r.literal(S.DLAA).describe(`DLAA 2倍效果`),r.literal(S.UltraQuality).describe(`超高质量`),r.literal(S.Quality).describe(`高质量`),r.literal(S.Balanced).describe(`平衡`),r.literal(S.Performance).describe(`性能`),r.literal(S.UltraPerformance).describe(`超高性能`)]).describe(`DLSS 质量档位`),Ne=r.union([r.literal(C.Auto).describe(`自动`),r.literal(C.Low).describe(`标清`),r.literal(C.High).describe(`高清`),r.literal(C.Super).describe(`超清`),r.literal(C.Blue).describe(`蓝光`)]).describe(`渲染码率档位`),Pe=r.union([r.literal(`VP8`).describe(`VP8`),r.literal(`VP9`).describe(`VP9`),r.literal(`AV1`).describe(`AV1`),r.literal(`H264`).describe(`H264`)]).describe(`视频解码器类别`),Fe=r.union([r.literal(`MODEL`).describe(`模型图层`),r.literal(`POI`).describe(`POI 图层`)]).describe(`图层类别`),Ie=r.union([w,r.array(w).min(1)]),A=r.undefined().optional(),Le=r.object({ids:r.array(w).min(1)}),Re={show:Le,hide:Le,showByGroup:Le,hideByGroup:Le,showAll:A,hideAll:A},ze=r.object({parentId:r.string().optional(),id:T}),Be=e=>e.refine(e=>!!(e.id||e.timelineId),{message:`id or timelineId is required`}),Ve={connect:A,disconnect:A,reconnect:A,KickOtherConnect:A,KeepConnect:A,GetEngineServiceStatus:A},j={lookAt:r.object({parentId:r.string().optional(),id:Ie,offSet:Ae,positionOffSetDistance:D,offSetX:D,distance:D,time:D,isRotate:r.boolean().optional(),isHighlight:r.boolean().optional(),showBack:r.boolean().optional()}),lookAtArray:r.object({parentId:T,ids:r.array(w).min(1),offSet:Ae,offSetX:D,distance:D,time:D,isRotate:r.boolean().optional(),isHighlight:r.boolean().optional()}),flyToTarget:r.object({point:Ae,target:Ae,fov:r.number().finite().min(10).max(150).optional(),time:D}),flyByPath:r.object({points:r.union([r.array(O),r.string()]).optional(),lookAts:r.union([r.array(O),r.string()]).optional(),nodes:r.string().optional(),time:D,smoothMode:r.union([r.literal(0),r.literal(1)]).optional()}),setFlySpeed:r.object({speed:E}),endFly:A,pauseFly:A,resumeFly:A,getCameraInfo:A,setCameraPositionAndRotation:r.object({point:O,rotation:O}),setCameraFov:r.object({fov:E}),startCameraObjFollow:r.object({parentId:r.string().optional(),id:w,offSet:k,smooth:E.optional().default(.85).refine(e=>e>=0&&e<=1,{message:`smooth must be in [0, 1]`,path:[`smooth`]})}),endCameraObjFollow:A,resetCameraFov:A,reset:A},He={getAllSceneName:A,switchSceneByName:r.object({sceneName:w}),getCurrentSceneName:A,listenMapCompass:r.object({enable:r.boolean()}),setFeatureToggle:r.object({key:w,enabled:r.boolean()}),getSceneMeta:A},Ue={setVisible:r.object({parentId:r.string().optional().default(``),id:Ie,visible:r.boolean().optional()}),setVisibleResolved:r.object({parentId:r.string().optional(),ids:r.array(w).min(1),visible:r.boolean()}),setVisibleByTags:r.object({tags:Ie,visible:r.boolean()}),setVisibleByAttibute:r.object({attributes:r.record(r.string(),r.any()),filterMode:r.nativeEnum(Te).optional().default(0),visible:r.boolean().optional().default(!0),otherVisible:r.boolean().optional().default(!1)}),add:r.object({parentId:r.string().optional().default(``),id:w,assetsPath:T,position:ke,angle:ke,scale:ke,description:r.string().optional()}),remove:r.object({parentId:r.string().optional().default(``),ids:r.array(w).min(1)}),getElementTree:r.object({parentId:r.string().optional().default(``),id:w}),getModelInfo:r.object({parentId:r.string().optional().default(``),id:w}),getModelBoundsInfo:r.object({parentId:r.string().optional().default(``),id:Ie}),getModelBoundsInfoResolved:r.object({parentId:r.string().optional(),ids:r.array(w).min(1)})},M=r.object({parentId:r.string().optional(),id:w}),We=r.object({parentId:r.string().optional(),ids:r.array(w).min(1)}),Ge=M.extend({rotate:O}),N={startMoveByNodes:M.extend({nodes:r.array(k).min(1),speed:E.optional().default(1),linear:E.optional().default(1),isLookAtTarget:r.boolean().optional().default(!1),needDirection:r.boolean().optional().default(!0)}),pauseMove:M,resumeMove:M,endMove:M,restoreMove:We,rotate:Ge,endRotate:M,continuedRotate:Ge,rotateByTarget:M.extend({parentTargetId:T,targetID:w,point:O,axisX:E.optional().default(0),axisY:E.optional().default(0),axisZ:E.optional().default(0),angle:E.optional().default(0),isPersistence:r.boolean().optional().default(!1)}),restoreRotate:We,setScale:M.extend({scale:O,duration:E.optional().default(.5)}),endScale:M,restoreScale:We},Ke={enable:r.object({enable:r.boolean()}),setHighLightModel:r.object({parentId:r.string().optional().default(``),ids:r.array(w).min(1),showBack:r.boolean()}),removeHighLightModel:r.object({parentId:r.string().optional(),ids:r.array(w).min(1)}),clear:r.object({})},qe=r.object({parentId:T,id:T}),Je=e=>e.refine(e=>!!(e.id||e.parentId),{message:`id or parentId is required`}),P={addLayer:Je(qe.extend({layerName:r.string().optional(),show:r.boolean().optional(),poiEnabled:r.boolean().optional(),type:Fe.optional(),description:r.string().optional()})),addLayerResolved:r.object({parentId:r.string().optional(),id:w,layerName:r.string().optional(),show:r.boolean().optional().default(!0),poiEnabled:r.boolean().optional().default(!0),description:r.string().optional().default(``),isSystem:r.boolean().optional().default(!1),poiOffsetY:r.number().optional().default(0)}),layerSelector:Je(qe),removeLayer:Je(qe),isLayerOrGroupExit:Je(qe),layerSelectorResolved:r.object({parentId:r.string().optional().default(``),id:w}),switchModelLayer:r.object({parentId:w,ids:r.array(w).min(1),toParentId:w}),showUIPop:r.object({parentId:r.string().optional(),id:w,visible:r.boolean().optional().default(!0),assetsPath:r.string().optional().default(``),offSet:k,scale:k}),addModel:r.object({parentId:w,id:w,assetsPath:T,position:k,name:r.string().optional().default(``),rotation:k,scale:k,description:r.string().optional(),isSystem:r.boolean().optional(),tags:r.array(r.string()).optional(),extraProps:r.any().optional()}),addPOI:r.object({parentId:r.string().optional(),id:w,assetsPath:w,position:k,targetParentId:r.string().optional(),targetId:r.string().optional(),rotation:k,scale:k,offSet:k,description:r.string().optional(),isSystem:r.boolean().optional(),text:r.string(),fontSize:r.number().optional(),tags:r.array(r.string()).optional(),extraProps:r.any().optional()}),removeModel:r.object({parentId:w,ids:r.array(w).min(1)}),getLayerChildElement:r.object({parentId:r.string().optional().default(``),id:w})},F={closeCameraFog:A,getWeatherTypes:A,resetWeather:A,resetWeatherAndTime:A,openCameraFog:r.object({fogIntensity:D,fogStartColor:r.string().optional(),fogEndColor:r.string().optional(),fogStartDistance:D,fogEndDistance:D,directionalIntensity:D,directionalFallOff:D,directionalColor:r.string().optional()}).refine(e=>e.fogIntensity===void 0||e.fogIntensity>=0&&e.fogIntensity<=1,{message:`fogIntensity must be between 0 and 1`,path:[`fogIntensity`]}),setSceneTime:r.object({hour:E,timeDuration:D}).refine(e=>e.hour>=0&&e.hour<24,{message:`hour must be in [0, 24)`,path:[`hour`]}),changeWeatherType:r.object({type:E,timeDuration:D}),setAnimateTimeOfDay:r.object({isAnimate:r.boolean(),dayLength:D,nightLength:D}),changeSeason:r.object({season:je,duration:D.describe(`切换过渡时长,单位秒`)}),resetSeason:r.object({}),setTimeSync:r.object({syncSystemTime:r.boolean()}),resetSceneTime:r.object({}),setDayAndNight:r.object({dayType:w})},I={add:r.object({groupName:w,poiInfos:r.array(r.record(r.unknown())).min(1)}),deleteById:r.object({groupName:w,id:w}),deleteByGroup:r.object({groupName:w}),update:r.object({groupName:w,poiInfos:r.array(r.record(r.unknown())).min(1)}),updatePopStates:r.object({groupName:w,popStates:r.array(r.record(r.unknown())).min(1)}),enableOverlap:r.object({enable:r.boolean()}),showDistance:r.object({distance:E})},L={add:r.object({id:w,groupName:w,assetPath:w,targetParentId:T,targetId:T,visible:r.boolean().optional()}),deleteById:r.object({groupName:w,ids:r.array(w).min(1)}),deleteByGroup:r.object({groupName:w}),getPOIInfo:r.object({groupName:w,id:w}),update:r.object({id:w,groupName:w,assetPath:T,targetParentId:T,targetId:T,visible:r.boolean().optional()}),setVisibleByGroup:r.object({groupName:w,visible:r.boolean()})},Ye=r.array(r.object({groupName:w,id:w,parentId:r.string().optional().default(``),position:ke})),Xe={addPop:Ye,removePop:Ye,removeAll:Ye,show:Ye,showAll:Ye,setPopDelayFrame:r.object({time:E}),setPopShowDistance:r.object({distance:E})},Ze={startLoopAnimation:r.object({parentId:T,id:w,stateName:w,loopStartTime:D,loopEndTime:D,speed:D}).refine(e=>e.loopStartTime===void 0||e.loopStartTime>=0&&(e.loopEndTime===void 0||e.loopEndTime>e.loopStartTime),{message:`loopStartTime must be >= 0 and loopEndTime must be greater than loopStartTime`,path:[`loopStartTime`]}),stopLoopAnimation:r.object({parentId:T,id:w}),playAnimator:r.object({parentId:T,id:w,stateName:w,speed:D,startTime:D,endTime:D,isStop:r.boolean().optional()}),setAnimatorSpeed:r.object({parentId:T,id:w,speed:E}),getAnimationLength:r.object({parentId:T,id:w,stateName:w}),stopAnimator:r.object({parentId:T,id:w})},Qe={play:Be(ze.extend({initialTime:D,speed:D,keepLastFrame:r.boolean().optional()}).refine(e=>e.speed===void 0||e.speed<0||e.speed>=.1,{message:`speed must be negative or >= 0.1`,path:[`speed`]})),pause:Be(ze),resume:Be(ze),stop:Be(ze.extend({resetTime:D,isCameraToStart:r.boolean().optional()})),stopAll:r.object({}).optional(),setSpeed:Be(ze.extend({speed:E}).refine(e=>e.speed<0||e.speed>=.1,{message:`speed must be negative or >= 0.1`,path:[`speed`]}))},$e={setSceneRenderBitrate:r.object({bitrate:Ne.optional()}),setSceneRenderBitrateResolved:r.object({bitrate:E}).refine(e=>e.bitrate>=1e6,{message:`bitrate must be >= 1000000`,path:[`bitrate`]}),setSceneFPS:r.object({fps:E}).refine(e=>e.fps>=1&&e.fps<=300,{message:`fps must be in [1, 300]`,path:[`fps`]}),setVideoDecode:r.object({decode:Pe}),setScreenResolution:r.object({width:E,height:E}).refine(e=>e.width>0&&e.height>0,{message:`width and height must be > 0`,path:[`width`]})},et={setDlssEnable:r.object({enable:r.boolean(),quality:Me}),setDlss:r.object({enable:r.boolean(),quality:Me}),setDlssQuality:r.object({quality:Me})},tt=r.object({node:k,time:r.string()}),nt=r.object({parentId:r.string().optional().default(``),id:w}),R={add:r.object({parentId:r.string().optional().default(``),id:w,assetPath:r.string().optional().default(``),scale:k,showPath:r.boolean().optional().default(!0),passedColor:r.string().optional().default(`#ffffff`),lineColor:r.string().optional().default(`#00ff00`),lineWidth:E,duration:D,nodes:r.array(k).optional(),timeNodes:r.array(tt).optional(),lineLayer:T,afterRender:r.boolean().optional().default(!1),isAutoClear:r.boolean().optional().default(!0)}),update:r.object({parentId:r.string().optional().default(``),id:w,lineColor:r.string().optional(),lineWidth:D,passedColor:r.string().optional(),speed:D}).refine(e=>e.speed===void 0||e.speed>=0,{message:`speed must be >= 0`,path:[`speed`]}),setTimeNode:r.object({parentId:r.string().optional().default(``),id:w,timeStart:r.string().optional(),startNodeIndex:r.string().optional()}).refine(e=>e.timeStart!==void 0||e.startNodeIndex!==void 0,{message:`timeStart or startNodeIndex is required`,path:[`timeStart`]}).refine(e=>e.startNodeIndex===void 0||parseInt(e.startNodeIndex)>=0,{message:`startNodeIndex must be >= 0`,path:[`startNodeIndex`]}),node:nt,pause:nt,resume:nt,stop:nt,clear:r.object({}).optional()},rt=r.object({position:k,value:E.min(0).max(999).optional().default(1)}),it={create:r.object({parentId:r.string().optional().default(``),id:r.string().optional(),textureSize:Oe.optional().default({x:256,y:256}),mapSize:Oe.optional().default({x:1e3,y:1e3}),influenceSize:r.number().int().positive().optional().default(13),points:r.union([r.array(rt).min(1),r.array(k).min(1)]),opacity:r.number().min(0).max(1).optional().default(.7),heightScale:r.number().positive().optional().default(3.5),lerpScale:r.number().positive().optional().default(2.5),isAddAsset:r.boolean().optional().default(!1)}),remove:r.object({parentId:r.string().optional().default(``),id:r.string().optional()}),clear:A,setConfig:r.object({parentId:r.string().optional().default(``),id:r.string().optional(),opacity:r.number().min(0).max(1).optional().default(.7),heightScale:r.number().positive().optional().default(3.5),lerpScale:r.number().positive().optional().default(2.5),influenceSize:r.number().int().positive().optional().default(13)})},at={updateWebView:r.object({parentId:r.string().optional().default(``),id:w,url:w})},ot=r.object({parentId:r.string().optional().default(``),id:r.string()}),st=e=>e.refine(e=>{let t=e;return t.nodes!==void 0||t.targetIds!==void 0},{message:`nodes or targetIds is required`,path:[`nodes`]}),ct=r.object({parentId:r.string().optional().default(``),id:r.string(),nodes:r.array(k).optional(),targetIds:r.array(w).optional(),targetCodes:r.array(w).optional(),speed:r.number().positive().optional().default(2),isCache:r.boolean().optional().default(!0),planColor:r.string().optional(),passColor:r.string().optional(),lineWidth:r.number().positive().optional().default(3),isAutoPlay:r.boolean().optional().default(!0),assetPath:r.string().optional(),isAutoClear:r.boolean().optional().default(!0),offSetZ:r.number().optional().default(.5),scale:O.default(new x(1,1,1))}),z={startNav:st(ct),getMeshNavDistance:st(ct.extend({isCache:r.boolean().optional().default(!1),isAutoPlay:r.boolean().optional().default(!1)})),pauseNav:ot,resumeNav:ot,stopNav:ot,updateNav:r.object({parentId:r.string().optional().default(``),id:r.string(),speed:r.number().finite().optional().default(-1),planColor:r.string().optional(),passColor:r.string().optional()}),updateSpeed:r.object({parentId:r.string().optional().default(``),id:r.string(),speed:r.number().finite().optional().default(-1),planColor:r.string().optional(),passColor:r.string().optional()}),startNavByPath:r.object({parentId:r.string().optional().default(``),id:r.array(w).min(1),nodes:r.array(k).min(1),isCache:r.boolean().optional().default(!0),duration:r.number().positive().optional().default(10),planColor:r.string().optional(),passColor:r.string().optional()}),pauseNavPath:ot,resumeNavPath:ot,stopNavPath:ot,updateNavPath:r.object({parentId:r.string().optional().default(``),id:r.array(w).min(1),duration:r.number().finite().optional().default(-1),planColor:r.string().optional(),passColor:r.string().optional()})},lt=r.array(w).min(1).describe(`查询的图层组编号集合`),ut={layerQueryByModel:r.object({parentId:r.string().optional(),id:r.string().optional(),queryRadius:r.number().positive().optional().default(50),queryMinHeight:r.number().optional().default(0),queryMaxHeight:r.number().optional().default(20),queryParentIds:lt}),layerQueryByPosition:r.object({queryPosition:k.optional(),queryRadius:r.number().positive().optional().default(50),queryMinHeight:r.number().optional().default(0),queryMaxHeight:r.number().optional().default(20),queryParentIds:lt}),layerQueryByModelBox:r.object({parentId:r.string().optional(),id:r.string().optional(),queryParentIds:lt})},dt={startTrain:r.object({parentId:T,id:w,trainCode:r.string().optional(),startStationName:r.string().optional(),endStationName:r.string().optional(),direction:r.string().optional(),action:r.string().optional(),stopTime:D,moveType:r.nativeEnum(Ee).optional()}),setTrainBehavior:r.object({parentId:T,id:w,moveType:r.nativeEnum(Ee).optional()}),setCameraFollowTrain:r.object({parentId:T,id:w,offSet:Ae}),setTrainVolume:r.object({parentId:T,id:w,volume:r.number().finite().min(0).max(1).optional()}),cancelCameraFollowTrain:A},ft={},pt={Connect:Ve,Camera:j,Scene:He,Layer:P,Model:Ue,ModelTransform:N,HighlighterEffect:Ke,UIPOI:I,ModelPOI:L,Popup:Xe,Animation:Ze,TimeLine:Qe,Screen:$e,Dlss:et,WeatherSystem:F,PathPatrol:R,pointIcon:Re,HeatMap:it,WebView:at,Navigation:z,SpatialQuery:ut,TrainSimulate:dt};var mt=class extends y{constructor(e,t){super(e,`Animation`,t)}startLoopAnimation(e,t){let n={...e,speed:e.speed??1};return this.request(`startLoopAnimation`,n,t,Ze.startLoopAnimation)}stopLoopAnimation(e,t){return this.request(`stopLoopAnimation`,e,t,Ze.stopLoopAnimation)}playAnimator(e,t){let n={...e,speed:e.speed??1,startTime:e.startTime??0,endTime:e.endTime??1,isStop:e.isStop??!1};return this.request(`playAnimator`,n,t,Ze.playAnimator)}setAnimatorSpeed(e,t){return this.request(`setAnimatorSpeed`,e,t,Ze.setAnimatorSpeed)}getAnimationLength(e,t){return this.request(`getAnimationLength`,e,t,Ze.getAnimationLength)}stopAnimator(e,t){return this.request(`stopAnimator`,e,t,Ze.stopAnimator)}},ht=class extends y{constructor(e,t){super(e,`CameraService`,t)}lookAt(e,t){let n={...e,time:e.time??1.5,distance:e.distance??20,isRotate:e.isRotate??!0,isHighlight:e.isHighlight??!0,offSet:e.offSet??new x(50,150,100)};if(n.offSet&&(n.offSet.ePSGType=`0000`),Array.isArray(n.id)){let e={parentId:n.parentId,ids:n.id,offSet:n.offSet,offSetX:n.offSetX,distance:n.distance,time:n.time,isRotate:n.isRotate,isHighlight:n.isHighlight};return this.request(`LookAtArray`,e,t,j.lookAtArray)}return this.request(`LookAt`,n,t,j.lookAt)}flyToTarget(e,t){let n={...e,time:e.time??2};return this.request(`FlyToTarget`,n,t,j.flyToTarget)}flyByPath(e,t){let n=Array.isArray(e.points)?JSON.stringify(e.points):e.points,r=Array.isArray(e.lookAts)?JSON.stringify(e.lookAts):e.lookAts,i={...e,points:n,lookAts:r,nodes:JSON.stringify(e.points),time:e.time??4,smoothMode:e.smoothMode??0};return this.request(`flyByPath`,i,t,j.flyByPath)}setFlySpeed(e,t){return this.request(`setFlySpeed`,e,t,j.setFlySpeed)}endFly(e){return this.request(`endFly`,void 0,e,A)}pauseFly(e){return this.request(`pauseFly`,void 0,e,A)}resumeFly(e){return this.request(`resumeFly`,void 0,e,A)}getCameraInfo(e){return this.request(`GetCameraInfo`,void 0,e,A)}setCameraPositionAndRotation(e,t){return e.rotation&&(e.rotation.ePSGType=`0000`),this.request(`setCameraPositionAndRotation`,e,t,j.setCameraPositionAndRotation)}setCameraFov(e,t){return this.request(`setCameraFov`,e,t,j.setCameraFov)}resetCameraFov(e){return this.request(`resetCameraFov`,void 0,e,A)}reset(e){return this.request(`reset`,void 0,e,A)}startCameraObjFollow(e,t){e.offSet&&(e.offSet.ePSGType=`0000`);let n={...e,offSet:e.offSet??new x(-30,0,10,`0000`)};return this.request(`StartCameraObjFollow`,n,t,j.startCameraObjFollow)}endCameraObjFollow(e){return this.request(`EndCameraObjFollow`,void 0,e,A)}},gt=class extends y{constructor(e,t,n){super(e,`Connect`,n),this.connectionLifecycle=t}connect(e){return he(Promise.resolve().then(()=>(this.logger.warn(`connect called as compatibility API; SDK auto-connects after DTCEngine init`),this.connectionLifecycle.connect().then(()=>({requestId:``,success:!0,code:`CONNECT_OK`,message:`Connect requested (compatibility path)`,ts:Date.now()})))),e)}disconnect(e){return he(Promise.resolve().then(()=>(this.logger.info(`disconnect requested`),Promise.resolve(this.connectionLifecycle.disconnect()).then(()=>({requestId:``,success:!0,code:`DISCONNECT_OK`,message:`Disconnected`,ts:Date.now()})))),e)}reconnect(e){return he(Promise.resolve().then(()=>(this.logger.info(`reconnect requested`),this.connectionLifecycle.reconnect().then(()=>({requestId:``,success:!0,code:`RECONNECT_OK`,message:`Reconnect requested`,ts:Date.now()})))),e)}KickOtherConnect(e){return this.request(`KickOtherConnect`,void 0,e,A)}KeepConnect(e){return this.request(`KeepConnect`,void 0,e,A)}GetEngineServiceStatus(e){return this.request(`GetEngineServiceStatus`,void 0,e,A)}},_t=class extends y{constructor(e,t){super(e,`DLSSService`,t)}setDlss(e={},t){let n={enable:e.enable??!1,quality:e.quality??S.Balanced};return this.request(`SetDlss`,n,t,et.setDlss)}},vt=class extends y{constructor(e,t){super(e,`HeatMapService`,t)}create(e,t){let n={...e,opacity:e.opacity??.7,heightScale:e.heightScale??3.5,lerpScale:e.lerpScale??2.5,influenceSize:e.influenceSize??13,points:e.points.map(e=>`position`in e?e:{position:e,value:1})};return n.heightScale*=100,this.request(`CreateHeatMap`,n,t,it.create)}remove(e,t){return this.request(`RemoveHeatMap`,e,t,it.remove)}clear(e){return this.request(`ClearHeatMap`,void 0,e,it.clear)}setConfig(e,t){let n={...e,opacity:e.opacity??.7,heightScale:e.heightScale??3.5,lerpScale:e.lerpScale??2.5,influenceSize:e.influenceSize??13};return n.heightScale*=100,this.request(`SetHeatMapConfig`,n,t,it.setConfig)}},yt=class extends y{constructor(e,t){super(e,`HighLighterService`,t)}enable(e,t){return this.request(`HighlightEnable`,e,t,Ke.enable)}setHighLightModel(e,t){return this.request(`AddHighLighterModel`,e,t,Ke.setHighLightModel)}removeHighLightModel(e,t){return this.request(`RemoveHighLightModel`,e,t,Ke.removeHighLightModel)}clear(e){return this.request(`Clear`,{},e,Ke.clear)}},bt=class e{constructor(e=0,t=0,n=0,r=0,i=b.EPSGType.EPSG84){this.x=e,this.y=t,this.z=n,this.v=r,this.EPSGType=i}set(e,t,n,r){return this.x=e,this.y=t,this.z=n,this.v=r,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}clone(){return new e(this.x,this.y,this.z,this.v)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.v=e.v,this}add(e,t){return t==null?(this.x+=e.x,this.y+=e.y,this.z+=e.z,this.v+=e.v,this):this.addVectors(e,t)}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.v+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.v=e.v+t.v,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.v+=e.v*t,this}sub(e,t){return t==null?(this.x-=e.x,this.y-=e.y,this.z-=e.z,this.v-=e.v,this):this.subVectors(e,t)}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.v-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.v=e.v-t.v,this}multiply(e,t){return t==null?(this.x*=e.x,this.y*=e.y,this.z*=e.z,this.v*=e.v,this):this.multiplyVectors(e,t)}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.v*=e,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this.v=e.v*t.v,this}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this.v/=e.v,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.v=Math.min(this.v,e.v),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.v=Math.max(this.v,e.v),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this.v=Math.max(e.v,Math.min(t.v,this.v)),this}clampScalar(t,n){let r=new e,i=new e;return r.set(t,t,t,t),i.set(n,n,n,n),this.clamp(r,i)}clampLength(e,t){let n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.v=Math.floor(this.v),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.v=Math.ceil(this.v),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.v=Math.round(this.v),this}roundToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this.v=this.v<0?Math.ceil(this.v):Math.floor(this.v),this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.v*e.v}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.v*this.v}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.v*this.v)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.v)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.v+=(e.v-this.v)*t,this}lerpVectors(e,t,n){return this.subVectors(t,e).multiplyScalar(n).add(e)}cross(e,t){return t==null?this.crossVectors(this,e):this.crossVectors(e,t)}crossVectors(e,t){let n=e.x,r=e.y,i=e.z,a=t.x,o=t.y,s=t.z;return this.x=r*s-i*o,this.y=i*a-n*s,this.z=n*o-r*a,this}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){let t=this.x-e.x,n=this.y-e.y,r=this.z-e.z,i=this.v-e.v;return t*t+n*n+r*r+i*i}equals(e){return e.x==this.x&&e.y==this.y&&e.z==this.z&&e.v==this.v}toString(){return JSON.stringify(this)}changeEPSGType(e){if(this.EPSGType!=e){if(e==b.EPSGType.EPSG84){let e=ve(this.x,this.y);this.x=e.x,this.y=e.y}else if(e==b.EPSGType.EPSGWeb){let e=_e(this.x,this.y);this.x=e.x,this.y=e.y}else console.log(`暂不支持[${this.EPSGType}]转换为${e}`);return this.EPSGType=e,this}}},xt=class{constructor(){this.Vector2=ge,this.Vector3=x,this.Vector4=bt}},St=class extends y{constructor(e,t){super(e,`LayerService`,t)}addLayer(e,t){let n={...e,show:e.show??!0,poiEnabled:e.poiEnabled??!0,isSystem:e.isSystem??!1,poiOffsetY:e.poiOffsetY??0};return this.request(`AddLayer`,n,t,P.addLayerResolved)}removeLayer(e,t){let n={...e};return this.request(`RemoveLayer`,n,t,P.layerSelectorResolved)}isLayerOrGroupExit(e,t){let n={...e};return this.request(`IsLayerOrGroupExit`,n,t,P.layerSelectorResolved)}switchModelLayer(e,t){return this.request(`SwitchLayer`,e,t,P.switchModelLayer)}showUIPop(e,t){let n={...e,id:e.id.trim(),visible:e.visible??!0,assetsPath:e.assetsPath??`/Game/Resources/POIS/BluePrints/BP_Camera.uasset`,scale:e.scale??new x(1,1,1),offSet:e.offSet??new x(0,0,0)};return n.scale&&(n.scale.ePSGType=`0000`),n.offSet&&(n.offSet.ePSGType=`0000`),console.log(n),this.request(`ShowLayerUIPop`,n,t,P.showUIPop)}addModel(e,t){let n={...e,id:e.id.trim(),name:e.name?.trim()||``,scale:e.scale??new x(1,1,1),rotation:e.rotation??new x(0,0,0)};return n.extraProps&&=JSON.stringify(n.extraProps),n.scale&&(n.scale.ePSGType=`0000`),n.rotation&&(n.rotation.ePSGType=`0000`),this.request(`AddModel`,n,t,P.addModel)}addPOI(e,t){let n={...e,id:e.id.trim(),scale:e.scale??new x(1,1,1),rotation:e.rotation??new x(0,0,0),fontSize:e.fontSize??16,isSystem:e.isSystem??!1,text:e.text??``,targetParentId:e.targetParentId??``,targetId:e.targetId??``,offSet:e.offSet??new x(0,0,0)};return n.extraProps=n.extraProps?JSON.stringify(n.extraProps):`{}`,n.scale&&(n.scale.ePSGType=`0000`),n.rotation&&(n.rotation.ePSGType=`0000`),n.offSet&&(n.offSet.ePSGType=`0000`),this.request(`AddPOI`,n,t,P.addPOI)}removeModel(e,t){return this.request(`RemoveModelByIds`,e,t,P.removeModel)}getLayerChildElement(e,t){return this.request(`GetLayerChildElements`,e,t,P.getLayerChildElement)}},Ct=class extends y{constructor(e,t){super(e,`ModelService`,t)}toIdArray(e){return Array.isArray(e)?e:[e]}setVisible(e,t){let n={parentId:e.parentId,ids:this.toIdArray(e.id),visible:e.visible??!0};return this.request(`SetVisible`,n,t,Ue.setVisibleResolved)}setVisibleByTags(e,t){let n={tags:this.toIdArray(e.tags),visible:e.visible??!0};return this.request(`SetVisibleByTags`,n,t,Ue.setVisibleByTags)}setVisibleByAttibute(e,t){let n={attributes:e.attributes,filterMode:e.filterMode??0,visible:e.visible??!0,otherVisible:e.otherVisible??!1};return this.request(`SetVisibleByAttribute`,n,t,Ue.setVisibleByAttibute)}getElementTree(e,t){return this.request(`GetElementTree`,e,t,Ue.getElementTree)}getModelInfo(e,t){return this.request(`GetModelInfo`,e,t,Ue.getModelInfo)}},wt=class extends y{constructor(e,t){super(e,`ModelPOI`,t)}add(e,t){let n={...e,visible:e.visible??!0};return this.request(`add`,n,t,L.add)}deleteById(e,t){return this.request(`deleteById`,e,t,L.deleteById)}deleteByGroup(e,t){return this.request(`deleteByGroup`,e,t,L.deleteByGroup)}getPOIInfo(e,t){return this.request(`getPOIInfo`,e,t,L.getPOIInfo)}update(e,t){let n={...e,visible:e.visible??!0};return this.request(`update`,n,t,L.update)}setVisibleByGroup(e,t){return this.request(`setVisibleByGroup`,e,t,L.setVisibleByGroup)}},Tt=class extends y{constructor(e,t){super(e,`ModelTransformService`,t)}startMoveByNodes(e,t){return this.request(`StartMoveByNodes`,e,t,N.startMoveByNodes)}pauseMove(e,t){return this.request(`PauseMove`,e,t,N.pauseMove)}resumeMove(e,t){return this.request(`ResumeMove`,e,t,N.resumeMove)}endMove(e,t){return this.request(`EndMove`,e,t,N.endMove)}restoreMove(e,t){return this.request(`RestoreMove`,e,t,N.restoreMove)}rotate(e,t){return e.rotate.ePSGType=b.EPSGType.EPSGWorld,this.request(`StartRotate`,e,t,N.rotate)}endRotate(e,t){return this.request(`EndRotate`,e,t,N.endRotate)}continuedRotate(e,t){return e.rotate.ePSGType=b.EPSGType.EPSGWorld,this.request(`ContinuedRotate`,e,t,N.continuedRotate)}rotateByTarget(e,t){return this.request(`RotateByTarget`,e,t,N.rotateByTarget)}restoreRotate(e,t){return this.request(`RestoreRotate`,e,t,N.restoreRotate)}setScale(e,t){e.scale.ePSGType=b.EPSGType.EPSGWorld;let n={...e,id:e.id.trim()};return n.scale&&(n.scale.ePSGType=`0000`),this.request(`SetScale`,n,t,N.setScale)}endScale(e,t){return this.request(`EndScale`,e,t,N.endScale)}restoreScale(e,t){return this.request(`RestoreScale`,e,t,N.restoreScale)}},Et=class extends y{constructor(e,t){super(e,`NavigationService`,t)}startNav(e,t){let n={...e,scale:e.scale??new x(1,1,1)};return n.scale&&(n.scale.ePSGType=`0000`),this.request(`PlayMeshNavByNodes`,n,t,z.startNav)}getMeshNavDistance(e,t){return this.request(`PlayMeshNavByNodes`,e,t,z.getMeshNavDistance)}pauseNav(e,t){return this.request(`PauseMeshNav`,e,t,z.pauseNav)}resumeNav(e,t){return this.request(`ResumeMeshNav`,e,t,z.resumeNav)}stopNav(e,t){return this.request(`StopMeshNav`,e,t,z.resumeNav)}updateNav(e,t){return this.request(`UpdateMeshNavProperty`,e,t,z.updateNav)}updateSpeed(e,t){return this.request(`UpdateNavSpeed`,e,t,z.updateSpeed)}startNavByPath(e,t){return this.request(`StartNavByPath`,e,t,z.startNavByPath)}pauseNavPath(e,t){return this.request(`PauseNavPath`,e,t,z.pauseNavPath)}resumeNavPath(e,t){return this.request(`ResumeNavPath`,e,t,z.resumeNavPath)}stopNavPath(e,t){return this.request(`StopNavPath`,e,t,z.stopNavPath)}updateNavPath(e,t){return this.request(`UpdateNavPathProperty`,e,t,z.updateNavPath)}},Dt=class extends y{constructor(e,t){super(e,`PathPatrolService`,t)}add(e,t){return e.scale&&(e.scale.ePSGType=b.EPSGType.EPSGWorld),this.requestStream(`AddPath`,e,t,R.add)}update(e,t){return this.request(`UpdatePath`,e,t,R.update)}setTimeNode(e,t){return this.request(`CuriserTimeSet`,e,t,R.setTimeNode)}clear(e){return this.request(`ClearPath`,void 0,e,R.clear)}pause(e,t){return this.request(`Pause`,e,t,R.node)}resume(e,t){return this.request(`Resume`,e,t,R.node)}stop(e,t){return this.request(`Stop`,e,t,R.node)}};function Ot(e){return Array.isArray(e)?{ids:e}:e}var kt=class extends y{constructor(e,t){super(e,`PointIcon`,t)}show(e,t){return this.request(`Show`,Ot(e),t,Re.show)}hide(e,t){return this.request(`Hide`,Ot(e),t,Re.hide)}showByGroup(e,t){return this.request(`ShowByGroup`,Ot(e),t,Re.showByGroup)}hideByGroup(e,t){return this.request(`HideByGroup`,Ot(e),t,Re.hideByGroup)}showAll(e){return this.request(`ShowAll`,void 0,e,Re.showAll)}hideAll(e){return this.request(`HideAll`,void 0,e,Re.hideAll)}},At=class{static getUUID(e=11){let t=16,n=`0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz`.split(``),r=[],i;if(t||=n.length,e)for(i=0;i<e;i++)r[i]=n[0|Math.random()*t];else{let e;for(r[8]=r[13]=r[18]=r[23]=`-`,r[14]=`4`,i=0;i<36;i++)r[i]||(e=0|Math.random()*16,r[i]=n[i==19?e&3|8:e])}return`U`+r.join(``)}static warn(e,t=!1){console.log(`warn`,e,t);let n=document.createElement(`div`);return n.innerHTML=e,document.body.appendChild(n),n.setAttribute(`id`,`engineWarnTips`),n.style.cssText=`
|
|
1
|
+
import{EventEmitter as e,LogLevel as t,Logger as n}from"@epicgames-ps/lib-pixelstreamingcommon-ue5.6";import{z as r}from"zod";import i from"axios";import{Config as a,Flags as o,NumericParameters as s,OptionParameters as c,PixelStreaming as l}from"@epicgames-ps/lib-pixelstreamingfrontend-ue5.6";import{inflate as u}from"pako";var d=class extends Error{constructor(e,t,n){super(`Invalid payload for ${e}.${t}: ${n.map(e=>`${e.field}: ${e.reason}`).join(`; `)}`),this.moduleName=e,this.methodName=t,this.issues=n,this.name=`SDKValidationError`,this.code=`VALIDATION_ERROR`}toJSON(){return{name:this.name,code:this.code,message:this.message,module:this.moduleName,method:this.methodName,issues:this.issues}}};function f(e,t,n,r){let i=e.safeParse(t);if(i.success)return i.data;throw new d(n,r,i.error.issues.map(e=>({field:e.path.length>0?e.path.join(`.`):`<root>`,reason:e.message,code:e.code})))}function p(e){return e instanceof d?JSON.stringify(e.toJSON()):e instanceof Error?`${e.name}: ${e.message}`:String(e)}const ee={InitLogging(){},Debug(e){console.log(`[Debug] - ${e}`)},Info(e){console.log(`[Info] - ${e}`)},Warning(e){console.warn(`[Warning] - ${e}`)},Error(e){console.error(`[Error] - ${e}`)}},m={debug(){},info(){},warn(){},error(){}},te=[`silent`,`error`,`warn`,`info`,`debug`],h={silent:0,error:1,warn:2,info:3,debug:4};function ne(e){switch(e){case`silent`:return t.Disabled;case`error`:return t.Error;case`warn`:return t.Warning;case`info`:return t.Info;default:return t.Debug}}function re(e){n.InitLogging(ne(e),!1)}function g(e){return typeof e==`string`&&te.includes(e)}function _(e){if(e===void 0)return`info`;if(g(e))return e;let t=typeof e==`string`?e:JSON.stringify(e);throw Error(`Invalid logger level: ${t}. Expected one of: ${te.join(`, `)}.`)}function ie(e){if(e===void 0)return``;try{let t=JSON.stringify(e);return t?` ${t}`:``}catch{return` ${String(e)}`}}function ae(){let e=Error().stack;return e?e.replace(/^Error(?::\s*)?\n?/,``):`No Stack Available for this browser`}var oe=class{constructor(e,t,n,r,i,a){this.driver=e,this.prefix=t,this.level=n,this.moduleName=r,this.includeStack=i,this.reporter=a}formatMessage(e,t,n){let r=`${this.prefix} ${t}${ie(n)}`.trim();return this.shouldIncludeStack(e)?`${r}\nStack: ${ae()}`:r}shouldLog(e){return h[this.level]>=h[e]}shouldIncludeStack(e){return h[this.includeStack]>=h[e]}debug(e,t){this.shouldLog(`debug`)&&this.driver.Debug(this.formatMessage(`debug`,e,t))}info(e,t){this.shouldLog(`info`)&&this.driver.Info(this.formatMessage(`info`,e,t))}warn(e,t){this.reportWarnOrError(`warn`,e,t),this.shouldLog(`warn`)&&this.driver.Warning(this.formatMessage(`warn`,e,t))}error(e,t){this.reportWarnOrError(`error`,e,t),this.shouldLog(`error`)&&this.driver.Error(this.formatMessage(`error`,e,t))}reportWarnOrError(e,t,n){this.reporter?.recordLogSignal({level:e,moduleName:this.moduleName,message:t,meta:n})}},se=class{constructor(e,t=ee,n){this.level=_(e),this.driver=t,this.includeStack=n?.includeStack??`warn`,this.driver.InitLogging(ne(this.level),!1),this.reporter=n?.reporter??n?.qosMonitor}setReporter(e){this.reporter=e}child(e){return new oe(this.driver,`[DTCEngine:${e}]`,this.level,e,this.includeStack,this.reporter)}};const v={EngineIniting:`云渲染引擎初始化中...`,ServiceUrlInValid:`调度中心地址不正确,请检查中心地址!`,SerriceError:`调度中心连接失败,尝试重连中...`,SerriceUnAvaible:`没有服务资源,请检查服务是否启动!`,SerriceLoadingForWaiting:`服务资源启动中,请稍候!`,EngineWaiting:`云渲染服务坐席已满,当前排队人数:1人....`,EngineTockenChecking:`云引擎授权文件验证中...`,EngineTokenCheckFail:`云引擎授权许可无效,请联系管理员!`,EngineConnectioning:`云渲染引擎连接中...`,EngineConnectionSuccess:`云渲染引擎连接成功...`,EngineClose:`云渲染引擎连接断开,请检查服务状态!`,SourcePreparing:`资源准备中...`,TokenInValid:`许可未激活!`,TokenExpired:`许可授权已过期,实时渲染服务已停止!`,TokenWillExpired:`您的授权许可将于 YYYY-MM-DD 到期,请尽快续期!`};var ce=class{constructor(e){this.options=e,this.logger=e.logger??m}show(e,t,n=!0){if(console.log(`loading show`,e,t,n),this.options.emit({message:e,key:t,isFinish:!n}),!this.options.enabled)return;let r=this.getRoot();r&&(this.progressDiv||=this.createTipDiv(r,`engineProgressTips`),this.progressDiv.textContent=e,n||(this.clearAutoCloseTimer(),this.autoCloseTimer=setTimeout(()=>{this.removeProgressBar()},2e3)))}showTokenWillExpire(e,t=`TokenWillExpired`,n=!0){let r=this.formatTokenWillExpireMessage(e);if(this.options.emit({message:r,key:t,isFinish:!n}),!this.options.enabled)return;let i=this.getRoot();i&&(this.tokenWillExpireDiv||(this.tokenWillExpireDiv=this.createTipDiv(i,`TokenWillExpireTips`),this.tokenWillExpireDiv.style.top=`60px`),this.tokenWillExpireDiv.textContent=r)}dispose(){this.clearAutoCloseTimer(),this.removeProgressBar(),this.removeTokenWillExpireBar()}getRoot(){if(this.options.hostElement?.ownerDocument?.body)return this.options.hostElement.ownerDocument.body;if(typeof document<`u`&&document.body)return document.body;this.logger.debug(`skip loading progress ui render: document is unavailable`)}createTipDiv(e,t){let n=e.ownerDocument.createElement(`div`);return n.id=t,n.style.position=`fixed`,n.style.left=`50%`,n.style.top=`16px`,n.style.transform=`translateX(-50%)`,n.style.zIndex=`99999`,n.style.padding=`8px 14px`,n.style.borderRadius=`6px`,n.style.background=`rgba(0, 0, 0, 0.72)`,n.style.color=`#fff`,n.style.fontSize=`14px`,n.style.lineHeight=`1.4`,n.style.pointerEvents=`none`,n.style.maxWidth=`80vw`,n.style.textAlign=`center`,e.appendChild(n),n}removeProgressBar(){this.progressDiv&&=(this.progressDiv.remove(),void 0)}removeTokenWillExpireBar(){this.tokenWillExpireDiv&&=(this.tokenWillExpireDiv.remove(),void 0)}clearAutoCloseTimer(){this.autoCloseTimer&&=(clearTimeout(this.autoCloseTimer),void 0)}formatTokenWillExpireMessage(e){let t=e.trim();return t?t.includes(`到期`)?t:`您的授权许可将于 ${t}到期,请尽快续期!`:v.TokenWillExpired}};const le=`sdk3-agent-bridge/v1`;function ue(e){if(typeof WebSocket>`u`)throw Error(`WebSocket is not available in current runtime.`);return new WebSocket(e)}function de(e){return{ok:!0,data:e,ts:Date.now()}}function fe(e,t){return{ok:!1,error:{code:`PROTOCOL_ERROR`,message:e,details:t},ts:Date.now()}}function pe(e){if(typeof e==`string`)try{let t=JSON.parse(e);if(typeof t!=`object`||!t)return;let n=t;return n.protocolVersion!==`sdk3-agent-bridge/v1`||typeof n.type!=`string`||typeof n.callId!=`string`?void 0:n}catch{return}}var me=class{constructor(e,t,n={}){this.runtime=e,this.options=t,this.reconnectAttempt=0,this.running=!1,this.startedAt=0,this.beforeUnloadHandler=()=>{this.stop(`pagehide`)},this.socketFactory=n.socketFactory??ue}start(){this.socket||(this.running=!0,this.openSocket(),typeof window<`u`&&(window.addEventListener(`beforeunload`,this.beforeUnloadHandler),window.addEventListener(`pagehide`,this.beforeUnloadHandler)))}stop(e=`stop`){this.running=!1,this.clearReconnect(),typeof window<`u`&&(window.removeEventListener(`beforeunload`,this.beforeUnloadHandler),window.removeEventListener(`pagehide`,this.beforeUnloadHandler)),this.clearHeartbeat(),this.runtime.dispose?.();let t=this.socket;t&&(t.readyState===1&&this.sendUnregister(e),this.clearSocketHandlers(t),t.close(1e3,e),this.socket=void 0)}openSocket(){this.startedAt=Date.now();let e=this.socketFactory(this.options.serverUrl??`ws://127.0.0.1:8787/sdk3-bridge`);this.socket=e,e.onopen=()=>{this.reconnectAttempt=0,this.sendRegister(),this.startHeartbeat()},e.onmessage=e=>{this.handleMessage(e.data)},e.onclose=()=>{this.clearSocketHandlers(e),this.clearHeartbeat(),this.runtime.closeAllStreams?.(`Agent bridge WebSocket disconnected`),this.runtime.cancelAllPrograms?.(`Agent bridge WebSocket disconnected`),this.socket===e&&(this.socket=void 0),this.scheduleReconnect()},e.onerror=()=>{this.clearHeartbeat()}}scheduleReconnect(){if(!this.running||this.reconnectTimer!==void 0||this.options.reconnect===!1)return;let e=this.getReconnectDelay();this.reconnectTimer=setTimeout(()=>{this.reconnectTimer=void 0,!(!this.running||this.socket)&&this.openSocket()},e),this.reconnectAttempt+=1}getReconnectDelay(){let e=typeof this.options.reconnect==`object`?this.options.reconnect:void 0,t=Math.max(0,e?.initialDelayMs??1e3),n=Math.max(t,e?.maxDelayMs??15e3),r=Math.max(0,e?.jitterMs??500);return Math.min(n,t*2**this.reconnectAttempt)+Math.floor(Math.random()*(r+1))}clearReconnect(){this.reconnectTimer!==void 0&&(clearTimeout(this.reconnectTimer),this.reconnectTimer=void 0)}sendRegister(){let e={...this.runtime.getSnapshot(),heartbeatIntervalMs:this.getHeartbeatInterval(),capabilities:{catalog:!0,schema:!0,validateActions:!0,invoke:!0,stream:!0,businessPrograms:!0,businessProgramProtocolVersion:1}};this.send({type:`register`,protocolVersion:le,bridgeId:e.bridgeId,ts:Date.now(),payload:e})}sendUnregister(e){let t={...this.runtime.getSnapshot(),reason:e};this.send({type:`unregister`,protocolVersion:le,bridgeId:t.bridgeId,ts:Date.now(),payload:t})}sendHeartbeat(){let e={...this.runtime.getSnapshot(),heartbeatIntervalMs:this.getHeartbeatInterval(),uptimeMs:Math.max(0,Date.now()-this.startedAt)};this.send({type:`heartbeat`,protocolVersion:le,bridgeId:e.bridgeId,ts:Date.now(),payload:e})}getHeartbeatInterval(){return Math.max(1e3,this.options.heartbeatIntervalMs??5e3)}startHeartbeat(){this.clearHeartbeat(),this.heartbeatTimer=setInterval(()=>{this.sendHeartbeat()},this.getHeartbeatInterval())}clearHeartbeat(){this.heartbeatTimer!==void 0&&(clearInterval(this.heartbeatTimer),this.heartbeatTimer=void 0)}async handleMessage(e){let t=pe(e);if(t){if(t.type===`catalog`){let e=t.payload,n=e.kind===`modules`?de(this.runtime.listModules()):this.runtime.listMethods(e.moduleName??``);this.sendResult(t,`catalog`,n);return}if(t.type===`schema`){let e=t.payload;this.sendResult(t,`schema`,this.runtime.getMethodSchema(e.moduleName,e.methodName));return}if(t.type===`validate-actions`){this.sendResult(t,`validate-actions`,this.runtime.validateActions(t.payload));return}if(t.type===`invoke`){this.sendResult(t,`invoke`,await this.runtime.invoke(t.payload));return}if(t.type===`stream-start`){let e=t.payload,n=await this.runtime.startStream(e,e=>{this.sendStreamEvent(e)});this.sendResult(t,`stream-start`,n);return}if(t.type===`stream-close`){this.sendResult(t,`stream-close`,await this.runtime.closeStream(t.payload));return}if(t.type===`load-program`){this.sendResult(t,`load-program`,await this.runtime.loadProgram(t.payload));return}if(t.type===`start-program`){this.sendResult(t,`start-program`,await this.runtime.startProgram(t.payload,e=>{this.sendProgramEvent(e)}));return}if(t.type===`cancel-program`){this.sendResult(t,`cancel-program`,await this.runtime.cancelProgram(t.payload));return}this.sendResult(t,`catalog`,fe(`Unsupported message type "${t.type}".`))}}sendStreamEvent(e){this.send({type:`stream-event`,protocolVersion:le,bridgeId:this.runtime.getSnapshot().bridgeId,ts:Date.now(),payload:e})}sendProgramEvent(e){this.send({type:`program-event`,protocolVersion:le,bridgeId:this.runtime.getSnapshot().bridgeId,traceId:e.traceId,ts:Date.now(),payload:e})}sendResult(e,t,n){let r={requestType:t,result:n,traceId:e.traceId};this.send({type:`result`,protocolVersion:le,bridgeId:this.runtime.getSnapshot().bridgeId,callId:e.callId,traceId:e.traceId,ts:Date.now(),payload:r})}send(e){!this.socket||this.socket.readyState!==1||this.socket.send(JSON.stringify(e))}clearSocketHandlers(e){e.onopen=null,e.onmessage=null,e.onclose=null,e.onerror=null}};function he(e,t){return t&&e.then(e=>{t(e)}).catch(e=>{t(e)}),e}var y=class{constructor(e,t,n){this.bridge=e,this.moduleName=t,this.logger=n?.logger??m}request(e,t,n,r){return he(Promise.resolve().then(()=>{let n=r?f(r,t,this.moduleName,e):t;return r||this.logger.debug(`validation schema not configured`,{method:e}),this.logger.debug(`sending request`,{method:e}),this.bridge.sendRequest(this.moduleName,e,n)}).then(t=>(this.logger.info(`request success`,{method:e,code:t.code}),t)).catch(t=>{throw this.logger.warn(`request failed`,{method:e,error:p(t)}),t}),n)}requestStream(e,t,n,r){try{if(!this.bridge.sendStreamRequest)throw Error(`Current bridge does not support stream request`);let i=r?f(r,t,this.moduleName,e):t;return r||this.logger.debug(`validation schema not configured`,{method:e}),this.logger.debug(`sending stream request`,{method:e}),this.bridge.sendStreamRequest(this.moduleName,e,i,n)}catch(t){let r=t instanceof Error?t:Error(String(t));if(this.logger.warn(`stream request failed before send`,{method:e,error:p(r)}),n)try{n({type:`error`,requestId:``,error:r})}catch(t){this.logger.warn(`stream error callback failed`,{method:e,error:p(t)})}let i=Promise.reject(r);return Object.defineProperty(i,"requestId",{value:``,enumerable:!0}),i.cancel=()=>{},i}}},ge=class e{constructor(e=0,t=0){this.x=e,this.y=t}set(e,t){return this.x=e,this.y=t,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}clone(){return new e(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e,t){return t==null?(this.x+=e.x,this.y+=e.y,this):this.addVectors(e,t)}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}sub(e,t){return t==null?(this.x-=e.x,this.y-=e.y,this):this.subVectors(e,t)}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}angle(){let e=Math.atan2(this.y,this.x);return e<0&&(e+=2*Math.PI),e}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){let t=this.x-e.x,n=this.y-e.y;return t*t+n*n}equals(e){return e.x==this.x&&e.y==this.y}toString(){return JSON.stringify(this)}};function _e(e,t){let n=e*20037508.34/180,r=Math.log(Math.tan((90+t)*Math.PI/360))/(Math.PI/180);return r=r*20037508.34/180,{x:n,y:r}}function ve(e,t){let n=e/20037508.34*180,r=t/20037508.34*180;return r=180/Math.PI*(2*Math.atan(Math.exp(r*Math.PI/180))-Math.PI/2),{x:n,y:r}}const b={EPSGType:{EPSG84:`4326`,EPSGWeb:`3857`,EPSGWorld:`0000`}};var x=class e{constructor(e=0,t=0,n=0,r=b.EPSGType.EPSG84){typeof e!=`number`&&(e=this.parseFloatDeal(e)),typeof t!=`number`&&(t=this.parseFloatDeal(t)),typeof n!=`number`&&(n=this.parseFloatDeal(n)),e!=e&&(e=0),t!=t&&(t=0),n!=n&&(n=0),this.x=e,this.y=t,this.z=n,this.ePSGType=r}parseFloatDeal(e){try{return parseFloat(e)}catch(e){return console.log(e),0}}set(e,t,n){return typeof e!=`number`&&(e=0),typeof t!=`number`&&(t=0),typeof n!=`number`&&(n=0),e!=e&&(e=0),t!=t&&(t=0),n!=n&&(n=0),this.x=e,this.y=t,this.z=n,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}clone(){return new e(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e,t){return t==null?(this.x+=e.x,this.y+=e.y,this.z+=e.z,this):this.addVectors(e,t)}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}sub(e,t){return t==null?(this.x-=e.x,this.y-=e.y,this.z-=e.z,this):this.subVectors(e,t)}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}multiply(e,t){return t==null?(this.x*=e.x,this.y*=e.y,this.z*=e.z,this):this.multiplyVectors(e,t)}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this}clampScalar(t,n){let r=new e,i=new e;return r.set(t,t,t),i.set(n,n,n),this.clamp(r,i)}clampLength(e,t){let n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,n){return this.subVectors(t,e).multiplyScalar(n).add(e)}cross(e,t){return t==null?this.crossVectors(this,e):this.crossVectors(e,t)}crossVectors(e,t){let n=e.x,r=e.y,i=e.z,a=t.x,o=t.y,s=t.z;return this.x=r*s-i*o,this.y=i*a-n*s,this.z=n*o-r*a,this}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){let t=this.x-e.x,n=this.y-e.y,r=this.z-e.z;return t*t+n*n+r*r}equals(e){return e.x==this.x&&e.y==this.y&&e.z==this.z}toString(){return JSON.stringify(this)}changeEPSGType(e){if(this.ePSGType!=e){if(e==b.EPSGType.EPSG84){let e=ve(this.x,this.y);this.x=e.x,this.y=e.y}else if(e==b.EPSGType.EPSGWeb){let e=_e(this.x,this.y);this.x=e.x,this.y=e.y}else console.log(`暂不支持[${this.ePSGType}]转换为${e}`);return this.ePSGType=e,this}}};const S={Off:0,Auto:1,DLAA:2,UltraQuality:3,Quality:4,Balanced:5,Performance:6,UltraPerformance:7},C={Auto:`auto`,Low:`low`,High:`high`,Super:`super`,Blue:`blue`},ye=[{label:`自动`,type:C.Auto,value:12e6},{label:`标清`,type:C.Low,value:4e6},{label:`高清`,type:C.High,value:8e6},{label:`超清`,type:C.Super,value:12e6},{label:`蓝光`,type:C.Blue,value:24e6}],be={[C.Auto]:12e6,[C.Low]:4e6,[C.High]:8e6,[C.Super]:12e6,[C.Blue]:24e6};let xe=function(e){return e.VP8=`VP8`,e.VP9=`VP9`,e.AV1=`AV1`,e.H264=`H264`,e}({}),Se=function(e){return e.Model=`MODEL`,e.POI=`POI`,e}({});const Ce={Spring:0,Summer:1,Autumn:2,Winter:3};let we=function(e){return e[e.Linear=0]=`Linear`,e[e.EaseInQuad=1]=`EaseInQuad`,e[e.EaseOutQuad=2]=`EaseOutQuad`,e[e.EaseInOutQuad=3]=`EaseInOutQuad`,e[e.EaseOutInQuad=4]=`EaseOutInQuad`,e[e.EaseInCubic=5]=`EaseInCubic`,e[e.EaseOutCubic=6]=`EaseOutCubic`,e[e.EaseInOutCubic=7]=`EaseInOutCubic`,e[e.EaseOutInCubic=8]=`EaseOutInCubic`,e[e.EaseInQuart=9]=`EaseInQuart`,e[e.EaseOutQuart=10]=`EaseOutQuart`,e[e.EaseInOutQuart=11]=`EaseInOutQuart`,e[e.EaseOutInQuart=12]=`EaseOutInQuart`,e[e.EaseInQuint=13]=`EaseInQuint`,e[e.EaseOutQuint=14]=`EaseOutQuint`,e[e.EaseInOutQuint=15]=`EaseInOutQuint`,e[e.EaseOutInQuint=16]=`EaseOutInQuint`,e[e.EaseInSine=17]=`EaseInSine`,e[e.EaseOutSine=18]=`EaseOutSine`,e[e.EaseInOutSine=19]=`EaseInOutSine`,e[e.EaseOutInSine=20]=`EaseOutInSine`,e[e.EaseInExpo=21]=`EaseInExpo`,e[e.EaseOutExpo=22]=`EaseOutExpo`,e[e.EaseInOutExpo=23]=`EaseInOutExpo`,e[e.EaseOutInExpo=24]=`EaseOutInExpo`,e[e.EaseInCirc=25]=`EaseInCirc`,e[e.EaseOutCirc=26]=`EaseOutCirc`,e[e.EaseInOutCirc=27]=`EaseInOutCirc`,e[e.EaseOutInCirc=28]=`EaseOutInCirc`,e[e.EaseInElastic=29]=`EaseInElastic`,e[e.EaseOutElastic=30]=`EaseOutElastic`,e[e.EaseInOutElastic=31]=`EaseInOutElastic`,e[e.EaseOutInElastic=32]=`EaseOutInElastic`,e[e.EaseInBack=33]=`EaseInBack`,e[e.EaseOutBack=34]=`EaseOutBack`,e[e.EaseInOutBack=35]=`EaseInOutBack`,e[e.EaseOutInBack=36]=`EaseOutInBack`,e[e.EaseInBounce=37]=`EaseInBounce`,e[e.EaseOutBounce=38]=`EaseOutBounce`,e[e.EaseInOutBounce=39]=`EaseInOutBounce`,e[e.EaseOutInBounce=40]=`EaseOutInBounce`,e}({}),Te=function(e){return e[e.Loose=0]=`Loose`,e[e.Strict=1]=`Strict`,e}({}),Ee=function(e){return e.StopAtTheEnd=`StopAtTheEnd`,e.Loop=`Loop`,e.BackAndForward=`BackAndForward`,e}({});const w=r.string().min(1),T=w.optional(),E=r.number().finite(),D=E.optional(),O=r.instanceof(x),De=r.object({x:E,y:E,z:E,ePSGType:w}),Oe=r.union([r.instanceof(ge),r.object({x:E,y:E})]),k=r.union([O,De]),ke=O.optional(),Ae=k.optional(),je=r.union([r.literal(Ce.Spring).describe(`春季`),r.literal(Ce.Summer).describe(`夏季`),r.literal(Ce.Autumn).describe(`秋季`),r.literal(Ce.Winter).describe(`冬季`)]).describe(`场景季节`),Me=r.union([r.literal(S.Off).describe(`关闭 DLSS`),r.literal(S.Auto).describe(`自动质量档位`),r.literal(S.DLAA).describe(`DLAA 2倍效果`),r.literal(S.UltraQuality).describe(`超高质量`),r.literal(S.Quality).describe(`高质量`),r.literal(S.Balanced).describe(`平衡`),r.literal(S.Performance).describe(`性能`),r.literal(S.UltraPerformance).describe(`超高性能`)]).describe(`DLSS 质量档位`),Ne=r.union([r.literal(C.Auto).describe(`自动`),r.literal(C.Low).describe(`标清`),r.literal(C.High).describe(`高清`),r.literal(C.Super).describe(`超清`),r.literal(C.Blue).describe(`蓝光`)]).describe(`渲染码率档位`),Pe=r.union([r.literal(`VP8`).describe(`VP8`),r.literal(`VP9`).describe(`VP9`),r.literal(`AV1`).describe(`AV1`),r.literal(`H264`).describe(`H264`)]).describe(`视频解码器类别`),Fe=r.union([r.literal(`MODEL`).describe(`模型图层`),r.literal(`POI`).describe(`POI 图层`)]).describe(`图层类别`),Ie=r.union([w,r.array(w).min(1)]),A=r.undefined().optional(),Le=r.object({ids:r.array(w).min(1)}),Re={show:Le,hide:Le,showByGroup:Le,hideByGroup:Le,showAll:A,hideAll:A},ze=r.object({parentId:r.string().optional(),id:T}),Be=e=>e.refine(e=>!!(e.id||e.timelineId),{message:`id or timelineId is required`}),Ve={connect:A,disconnect:A,reconnect:A,KickOtherConnect:A,KeepConnect:A,GetEngineServiceStatus:A},j={lookAt:r.object({parentId:r.string().optional(),id:Ie,offSet:Ae,positionOffSetDistance:D,offSetX:D,distance:D,time:D,isRotate:r.boolean().optional(),isHighlight:r.boolean().optional(),showBack:r.boolean().optional()}),lookAtArray:r.object({parentId:T,ids:r.array(w).min(1),offSet:Ae,offSetX:D,distance:D,time:D,isRotate:r.boolean().optional(),isHighlight:r.boolean().optional()}),flyToTarget:r.object({point:Ae,target:Ae,fov:r.number().finite().min(10).max(150).optional(),time:D}),flyByPath:r.object({points:r.union([r.array(O),r.string()]).optional(),lookAts:r.union([r.array(O),r.string()]).optional(),nodes:r.string().optional(),time:D,smoothMode:r.union([r.literal(0),r.literal(1)]).optional()}),setFlySpeed:r.object({speed:E}),endFly:A,pauseFly:A,resumeFly:A,getCameraInfo:A,setCameraPositionAndRotation:r.object({point:O,rotation:O}),setCameraFov:r.object({fov:E}),startCameraObjFollow:r.object({parentId:r.string().optional(),id:w,offSet:k,smooth:E.optional().default(.85).refine(e=>e>=0&&e<=1,{message:`smooth must be in [0, 1]`,path:[`smooth`]})}),endCameraObjFollow:A,resetCameraFov:A,reset:A},He={getAllSceneName:A,switchSceneByName:r.object({sceneName:w}),getCurrentSceneName:A,listenMapCompass:r.object({enable:r.boolean()}),setFeatureToggle:r.object({key:w,enabled:r.boolean()}),getSceneMeta:A},Ue={setVisible:r.object({parentId:r.string().optional().default(``),id:Ie,visible:r.boolean().optional()}),setVisibleResolved:r.object({parentId:r.string().optional(),ids:r.array(w).min(1),visible:r.boolean()}),setVisibleByTags:r.object({tags:Ie,visible:r.boolean()}),setVisibleByAttibute:r.object({attributes:r.record(r.string(),r.any()),filterMode:r.nativeEnum(Te).optional().default(0),visible:r.boolean().optional().default(!0),otherVisible:r.boolean().optional().default(!1)}),add:r.object({parentId:r.string().optional().default(``),id:w,assetsPath:T,position:ke,angle:ke,scale:ke,description:r.string().optional()}),remove:r.object({parentId:r.string().optional().default(``),ids:r.array(w).min(1)}),getElementTree:r.object({parentId:r.string().optional().default(``),id:w}),getModelInfo:r.object({parentId:r.string().optional().default(``),id:w}),getModelBoundsInfo:r.object({parentId:r.string().optional().default(``),id:Ie}),getModelBoundsInfoResolved:r.object({parentId:r.string().optional(),ids:r.array(w).min(1)})},M=r.object({parentId:r.string().optional(),id:w}),We=r.object({parentId:r.string().optional(),ids:r.array(w).min(1)}),Ge=M.extend({rotate:O}),N={startMoveByNodes:M.extend({nodes:r.array(k).min(1),speed:E.optional().default(1),linear:E.optional().default(1),isLookAtTarget:r.boolean().optional().default(!1),needDirection:r.boolean().optional().default(!0)}),pauseMove:M,resumeMove:M,endMove:M,restoreMove:We,rotate:Ge,endRotate:M,continuedRotate:Ge,rotateByTarget:M.extend({parentTargetId:T,targetID:w,point:O,axisX:E.optional().default(0),axisY:E.optional().default(0),axisZ:E.optional().default(0),angle:E.optional().default(0),isPersistence:r.boolean().optional().default(!1)}),restoreRotate:We,setScale:M.extend({scale:O,duration:E.optional().default(.5)}),endScale:M,restoreScale:We},Ke={enable:r.object({enable:r.boolean()}),setHighLightModel:r.object({parentId:r.string().optional().default(``),ids:r.array(w).min(1),showBack:r.boolean()}),removeHighLightModel:r.object({parentId:r.string().optional(),ids:r.array(w).min(1)}),clear:r.object({})},qe=r.object({parentId:T,id:T}),Je=e=>e.refine(e=>!!(e.id||e.parentId),{message:`id or parentId is required`}),P={addLayer:Je(qe.extend({layerName:r.string().optional(),show:r.boolean().optional(),poiEnabled:r.boolean().optional(),type:Fe.optional(),description:r.string().optional()})),addLayerResolved:r.object({parentId:r.string().optional(),id:w,layerName:r.string().optional(),show:r.boolean().optional().default(!0),poiEnabled:r.boolean().optional().default(!0),description:r.string().optional().default(``),isSystem:r.boolean().optional().default(!1),poiOffsetY:r.number().optional().default(0)}),layerSelector:Je(qe),removeLayer:Je(qe),isLayerOrGroupExit:Je(qe),layerSelectorResolved:r.object({parentId:r.string().optional().default(``),id:w}),switchModelLayer:r.object({parentId:w,ids:r.array(w).min(1),toParentId:w}),showUIPop:r.object({parentId:r.string().optional(),id:w,visible:r.boolean().optional().default(!0),assetsPath:r.string().optional().default(``),offSet:k,scale:k}),addModel:r.object({parentId:w,id:w,assetsPath:T,position:k,name:r.string().optional().default(``),rotation:k,scale:k,description:r.string().optional(),isSystem:r.boolean().optional(),tags:r.array(r.string()).optional(),extraProps:r.any().optional()}),addPOI:r.object({parentId:r.string().optional(),id:w,assetsPath:w,position:k,targetParentId:r.string().optional(),targetId:r.string().optional(),rotation:k,scale:k,offSet:k,description:r.string().optional(),isSystem:r.boolean().optional(),text:r.string(),fontSize:r.number().optional(),tags:r.array(r.string()).optional(),extraProps:r.any().optional()}),removeModel:r.object({parentId:w,ids:r.array(w).min(1)}),getLayerChildElement:r.object({parentId:r.string().optional().default(``),id:w})},F={closeCameraFog:A,getWeatherTypes:A,resetWeather:A,resetWeatherAndTime:A,openCameraFog:r.object({fogIntensity:D,fogStartColor:r.string().optional(),fogEndColor:r.string().optional(),fogStartDistance:D,fogEndDistance:D,directionalIntensity:D,directionalFallOff:D,directionalColor:r.string().optional()}).refine(e=>e.fogIntensity===void 0||e.fogIntensity>=0&&e.fogIntensity<=1,{message:`fogIntensity must be between 0 and 1`,path:[`fogIntensity`]}),setSceneTime:r.object({hour:E,timeDuration:D}).refine(e=>e.hour>=0&&e.hour<24,{message:`hour must be in [0, 24)`,path:[`hour`]}),changeWeatherType:r.object({type:E,timeDuration:D}),setAnimateTimeOfDay:r.object({isAnimate:r.boolean(),dayLength:D,nightLength:D}),changeSeason:r.object({season:je,duration:D.describe(`切换过渡时长,单位秒`)}),resetSeason:r.object({}),setTimeSync:r.object({syncSystemTime:r.boolean()}),resetSceneTime:r.object({}),setDayAndNight:r.object({dayType:w})},I={add:r.object({groupName:w,poiInfos:r.array(r.record(r.unknown())).min(1)}),deleteById:r.object({groupName:w,id:w}),deleteByGroup:r.object({groupName:w}),update:r.object({groupName:w,poiInfos:r.array(r.record(r.unknown())).min(1)}),updatePopStates:r.object({groupName:w,popStates:r.array(r.record(r.unknown())).min(1)}),enableOverlap:r.object({enable:r.boolean()}),showDistance:r.object({distance:E})},L={add:r.object({id:w,groupName:w,assetPath:w,targetParentId:T,targetId:T,visible:r.boolean().optional()}),deleteById:r.object({groupName:w,ids:r.array(w).min(1)}),deleteByGroup:r.object({groupName:w}),getPOIInfo:r.object({groupName:w,id:w}),update:r.object({id:w,groupName:w,assetPath:T,targetParentId:T,targetId:T,visible:r.boolean().optional()}),setVisibleByGroup:r.object({groupName:w,visible:r.boolean()})},Ye=r.array(r.object({groupName:w,id:w,parentId:r.string().optional().default(``),position:ke})),Xe={addPop:Ye,removePop:Ye,removeAll:Ye,show:Ye,showAll:Ye,setPopDelayFrame:r.object({time:E}),setPopShowDistance:r.object({distance:E})},Ze={startLoopAnimation:r.object({parentId:T,id:w,stateName:w,loopStartTime:D,loopEndTime:D,speed:D}).refine(e=>e.loopStartTime===void 0||e.loopStartTime>=0&&(e.loopEndTime===void 0||e.loopEndTime>e.loopStartTime),{message:`loopStartTime must be >= 0 and loopEndTime must be greater than loopStartTime`,path:[`loopStartTime`]}),stopLoopAnimation:r.object({parentId:T,id:w}),playAnimator:r.object({parentId:T,id:w,stateName:w,speed:D,startTime:D,endTime:D,isStop:r.boolean().optional()}),setAnimatorSpeed:r.object({parentId:T,id:w,speed:E}),getAnimationLength:r.object({parentId:T,id:w,stateName:w}),stopAnimator:r.object({parentId:T,id:w})},Qe={play:Be(ze.extend({initialTime:D,speed:D,keepLastFrame:r.boolean().optional()}).refine(e=>e.speed===void 0||e.speed<0||e.speed>=.1,{message:`speed must be negative or >= 0.1`,path:[`speed`]})),pause:Be(ze),resume:Be(ze),stop:Be(ze.extend({resetTime:D,isCameraToStart:r.boolean().optional()})),stopAll:r.object({}).optional(),setSpeed:Be(ze.extend({speed:E}).refine(e=>e.speed<0||e.speed>=.1,{message:`speed must be negative or >= 0.1`,path:[`speed`]}))},$e={setSceneRenderBitrate:r.object({bitrate:Ne.optional()}),setSceneRenderBitrateResolved:r.object({bitrate:E}).refine(e=>e.bitrate>=1e6,{message:`bitrate must be >= 1000000`,path:[`bitrate`]}),setSceneFPS:r.object({fps:E}).refine(e=>e.fps>=1&&e.fps<=300,{message:`fps must be in [1, 300]`,path:[`fps`]}),setVideoDecode:r.object({decode:Pe}),setScreenResolution:r.object({width:E,height:E}).refine(e=>e.width>0&&e.height>0,{message:`width and height must be > 0`,path:[`width`]})},et={setDlssEnable:r.object({enable:r.boolean(),quality:Me}),setDlss:r.object({enable:r.boolean(),quality:Me}),setDlssQuality:r.object({quality:Me})},tt=r.object({node:k,time:r.string()}),nt=r.object({parentId:r.string().optional().default(``),id:w}),R={add:r.object({parentId:r.string().optional().default(``),id:w,assetPath:r.string().optional().default(``),scale:k,showPath:r.boolean().optional().default(!0),passedColor:r.string().optional().default(`#ffffff`),lineColor:r.string().optional().default(`#00ff00`),lineWidth:E,duration:D,nodes:r.array(k).optional(),timeNodes:r.array(tt).optional(),lineLayer:T,afterRender:r.boolean().optional().default(!1),isAutoClear:r.boolean().optional().default(!0)}),update:r.object({parentId:r.string().optional().default(``),id:w,lineColor:r.string().optional(),lineWidth:D,passedColor:r.string().optional(),speed:D}).refine(e=>e.speed===void 0||e.speed>=0,{message:`speed must be >= 0`,path:[`speed`]}),setTimeNode:r.object({parentId:r.string().optional().default(``),id:w,timeStart:r.string().optional(),startNodeIndex:r.string().optional()}).refine(e=>e.timeStart!==void 0||e.startNodeIndex!==void 0,{message:`timeStart or startNodeIndex is required`,path:[`timeStart`]}).refine(e=>e.startNodeIndex===void 0||parseInt(e.startNodeIndex)>=0,{message:`startNodeIndex must be >= 0`,path:[`startNodeIndex`]}),node:nt,pause:nt,resume:nt,stop:nt,clear:r.object({}).optional()},rt=r.object({position:k,value:E.min(0).max(999).optional().default(1)}),it={create:r.object({parentId:r.string().optional().default(``),id:r.string().optional(),textureSize:Oe.optional().default({x:256,y:256}),mapSize:Oe.optional().default({x:1e3,y:1e3}),influenceSize:r.number().int().positive().optional().default(13),points:r.union([r.array(rt).min(1),r.array(k).min(1)]),opacity:r.number().min(0).max(1).optional().default(.7),heightScale:r.number().positive().optional().default(3.5),lerpScale:r.number().positive().optional().default(2.5),isAddAsset:r.boolean().optional().default(!1)}),remove:r.object({parentId:r.string().optional().default(``),id:r.string().optional()}),clear:A,setConfig:r.object({parentId:r.string().optional().default(``),id:r.string().optional(),opacity:r.number().min(0).max(1).optional().default(.7),heightScale:r.number().positive().optional().default(3.5),lerpScale:r.number().positive().optional().default(2.5),influenceSize:r.number().int().positive().optional().default(13)})},at={updateWebView:r.object({parentId:r.string().optional().default(``),id:w,url:w})},ot=r.object({parentId:r.string().optional().default(``),id:r.string()}),st=e=>e.refine(e=>{let t=e;return t.nodes!==void 0||t.targetIds!==void 0||t.targetCodes!==void 0},{message:`nodes or targetIds or targetCodes is required`,path:[`nodes`,`targetIds`,`targetCodes`]}),ct=r.object({parentId:r.string().optional().default(``),id:r.string(),nodes:r.array(k).optional(),targetIds:r.array(w).optional(),targetCodes:r.array(w).optional(),speed:r.number().positive().optional().default(2),isCache:r.boolean().optional().default(!0),planColor:r.string().optional(),passColor:r.string().optional(),lineWidth:r.number().positive().optional().default(3),isAutoPlay:r.boolean().optional().default(!0),assetPath:r.string().optional(),isAutoClear:r.boolean().optional().default(!0),offSetZ:r.number().optional().default(.5),scale:O.default(new x(1,1,1))}),z={startNav:st(ct),getMeshNavDistance:st(ct.extend({isCache:r.boolean().optional().default(!1),isAutoPlay:r.boolean().optional().default(!1)})),pauseNav:ot,resumeNav:ot,stopNav:ot,updateNav:r.object({parentId:r.string().optional().default(``),id:r.string(),speed:r.number().finite().optional().default(-1),planColor:r.string().optional(),passColor:r.string().optional()}),updateSpeed:r.object({parentId:r.string().optional().default(``),id:r.string(),speed:r.number().finite().optional().default(-1),planColor:r.string().optional(),passColor:r.string().optional()}),startNavByPath:r.object({parentId:r.string().optional().default(``),id:r.array(w).min(1),nodes:r.array(k).min(1),isCache:r.boolean().optional().default(!0),duration:r.number().positive().optional().default(10),planColor:r.string().optional(),passColor:r.string().optional()}),pauseNavPath:ot,resumeNavPath:ot,stopNavPath:ot,updateNavPath:r.object({parentId:r.string().optional().default(``),id:r.array(w).min(1),duration:r.number().finite().optional().default(-1),planColor:r.string().optional(),passColor:r.string().optional()})},lt=r.array(w).min(1).describe(`查询的图层组编号集合`),ut={layerQueryByModel:r.object({parentId:r.string().optional(),id:r.string().optional(),queryRadius:r.number().positive().optional().default(50),queryMinHeight:r.number().optional().default(0),queryMaxHeight:r.number().optional().default(20),queryParentIds:lt}),layerQueryByPosition:r.object({queryPosition:k.optional(),queryRadius:r.number().positive().optional().default(50),queryMinHeight:r.number().optional().default(0),queryMaxHeight:r.number().optional().default(20),queryParentIds:lt}),layerQueryByModelBox:r.object({parentId:r.string().optional(),id:r.string().optional(),queryParentIds:lt})},dt={startTrain:r.object({parentId:T,id:w,trainCode:r.string().optional(),startStationName:r.string().optional(),endStationName:r.string().optional(),direction:r.string().optional(),action:r.string().optional(),stopTime:D,moveType:r.nativeEnum(Ee).optional()}),setTrainBehavior:r.object({parentId:T,id:w,moveType:r.nativeEnum(Ee).optional()}),setCameraFollowTrain:r.object({parentId:T,id:w,offSet:Ae}),setTrainVolume:r.object({parentId:T,id:w,volume:r.number().finite().min(0).max(1).optional()}),cancelCameraFollowTrain:A},ft={},pt={Connect:Ve,Camera:j,Scene:He,Layer:P,Model:Ue,ModelTransform:N,HighlighterEffect:Ke,UIPOI:I,ModelPOI:L,Popup:Xe,Animation:Ze,TimeLine:Qe,Screen:$e,Dlss:et,WeatherSystem:F,PathPatrol:R,pointIcon:Re,HeatMap:it,WebView:at,Navigation:z,SpatialQuery:ut,TrainSimulate:dt};var mt=class extends y{constructor(e,t){super(e,`Animation`,t)}startLoopAnimation(e,t){let n={...e,speed:e.speed??1};return this.request(`startLoopAnimation`,n,t,Ze.startLoopAnimation)}stopLoopAnimation(e,t){return this.request(`stopLoopAnimation`,e,t,Ze.stopLoopAnimation)}playAnimator(e,t){let n={...e,speed:e.speed??1,startTime:e.startTime??0,endTime:e.endTime??1,isStop:e.isStop??!1};return this.request(`playAnimator`,n,t,Ze.playAnimator)}setAnimatorSpeed(e,t){return this.request(`setAnimatorSpeed`,e,t,Ze.setAnimatorSpeed)}getAnimationLength(e,t){return this.request(`getAnimationLength`,e,t,Ze.getAnimationLength)}stopAnimator(e,t){return this.request(`stopAnimator`,e,t,Ze.stopAnimator)}},ht=class extends y{constructor(e,t){super(e,`CameraService`,t)}lookAt(e,t){let n={...e,time:e.time??1.5,distance:e.distance??20,isRotate:e.isRotate??!0,isHighlight:e.isHighlight??!0,offSet:e.offSet??new x(50,150,100)};if(n.offSet&&(n.offSet.ePSGType=`0000`),Array.isArray(n.id)){let e={parentId:n.parentId,ids:n.id,offSet:n.offSet,offSetX:n.offSetX,distance:n.distance,time:n.time,isRotate:n.isRotate,isHighlight:n.isHighlight};return this.request(`LookAtArray`,e,t,j.lookAtArray)}return this.request(`LookAt`,n,t,j.lookAt)}flyToTarget(e,t){let n={...e,time:e.time??2};return this.request(`FlyToTarget`,n,t,j.flyToTarget)}flyByPath(e,t){let n=Array.isArray(e.points)?JSON.stringify(e.points):e.points,r=Array.isArray(e.lookAts)?JSON.stringify(e.lookAts):e.lookAts,i={...e,points:n,lookAts:r,nodes:JSON.stringify(e.points),time:e.time??4,smoothMode:e.smoothMode??0};return this.request(`flyByPath`,i,t,j.flyByPath)}setFlySpeed(e,t){return this.request(`setFlySpeed`,e,t,j.setFlySpeed)}endFly(e){return this.request(`endFly`,void 0,e,A)}pauseFly(e){return this.request(`pauseFly`,void 0,e,A)}resumeFly(e){return this.request(`resumeFly`,void 0,e,A)}getCameraInfo(e){return this.request(`GetCameraInfo`,void 0,e,A)}setCameraPositionAndRotation(e,t){return e.rotation&&(e.rotation.ePSGType=`0000`),this.request(`setCameraPositionAndRotation`,e,t,j.setCameraPositionAndRotation)}setCameraFov(e,t){return this.request(`setCameraFov`,e,t,j.setCameraFov)}resetCameraFov(e){return this.request(`resetCameraFov`,void 0,e,A)}reset(e){return this.request(`reset`,void 0,e,A)}startCameraObjFollow(e,t){e.offSet&&(e.offSet.ePSGType=`0000`);let n={...e,offSet:e.offSet??new x(-30,0,10,`0000`)};return this.request(`StartCameraObjFollow`,n,t,j.startCameraObjFollow)}endCameraObjFollow(e){return this.request(`EndCameraObjFollow`,void 0,e,A)}},gt=class extends y{constructor(e,t,n){super(e,`Connect`,n),this.connectionLifecycle=t}connect(e){return he(Promise.resolve().then(()=>(this.logger.warn(`connect called as compatibility API; SDK auto-connects after DTCEngine init`),this.connectionLifecycle.connect().then(()=>({requestId:``,success:!0,code:`CONNECT_OK`,message:`Connect requested (compatibility path)`,ts:Date.now()})))),e)}disconnect(e){return he(Promise.resolve().then(()=>(this.logger.info(`disconnect requested`),Promise.resolve(this.connectionLifecycle.disconnect()).then(()=>({requestId:``,success:!0,code:`DISCONNECT_OK`,message:`Disconnected`,ts:Date.now()})))),e)}reconnect(e){return he(Promise.resolve().then(()=>(this.logger.info(`reconnect requested`),this.connectionLifecycle.reconnect().then(()=>({requestId:``,success:!0,code:`RECONNECT_OK`,message:`Reconnect requested`,ts:Date.now()})))),e)}KickOtherConnect(e){return this.request(`KickOtherConnect`,void 0,e,A)}KeepConnect(e){return this.request(`KeepConnect`,void 0,e,A)}GetEngineServiceStatus(e){return this.request(`GetEngineServiceStatus`,void 0,e,A)}},_t=class extends y{constructor(e,t){super(e,`DLSSService`,t)}setDlss(e={},t){let n={enable:e.enable??!1,quality:e.quality??S.Balanced};return this.request(`SetDlss`,n,t,et.setDlss)}},vt=class extends y{constructor(e,t){super(e,`HeatMapService`,t)}create(e,t){let n={...e,opacity:e.opacity??.7,heightScale:e.heightScale??3.5,lerpScale:e.lerpScale??2.5,influenceSize:e.influenceSize??13,points:e.points.map(e=>`position`in e?e:{position:e,value:1})};return n.heightScale*=100,this.request(`CreateHeatMap`,n,t,it.create)}remove(e,t){return this.request(`RemoveHeatMap`,e,t,it.remove)}clear(e){return this.request(`ClearHeatMap`,void 0,e,it.clear)}setConfig(e,t){let n={...e,opacity:e.opacity??.7,heightScale:e.heightScale??3.5,lerpScale:e.lerpScale??2.5,influenceSize:e.influenceSize??13};return n.heightScale*=100,this.request(`SetHeatMapConfig`,n,t,it.setConfig)}},yt=class extends y{constructor(e,t){super(e,`HighLighterService`,t)}enable(e,t){return this.request(`HighlightEnable`,e,t,Ke.enable)}setHighLightModel(e,t){return this.request(`AddHighLighterModel`,e,t,Ke.setHighLightModel)}removeHighLightModel(e,t){return this.request(`RemoveHighLightModel`,e,t,Ke.removeHighLightModel)}clear(e){return this.request(`Clear`,{},e,Ke.clear)}},bt=class e{constructor(e=0,t=0,n=0,r=0,i=b.EPSGType.EPSG84){this.x=e,this.y=t,this.z=n,this.v=r,this.EPSGType=i}set(e,t,n,r){return this.x=e,this.y=t,this.z=n,this.v=r,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}clone(){return new e(this.x,this.y,this.z,this.v)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.v=e.v,this}add(e,t){return t==null?(this.x+=e.x,this.y+=e.y,this.z+=e.z,this.v+=e.v,this):this.addVectors(e,t)}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.v+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.v=e.v+t.v,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.v+=e.v*t,this}sub(e,t){return t==null?(this.x-=e.x,this.y-=e.y,this.z-=e.z,this.v-=e.v,this):this.subVectors(e,t)}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.v-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.v=e.v-t.v,this}multiply(e,t){return t==null?(this.x*=e.x,this.y*=e.y,this.z*=e.z,this.v*=e.v,this):this.multiplyVectors(e,t)}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.v*=e,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this.v=e.v*t.v,this}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this.v/=e.v,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.v=Math.min(this.v,e.v),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.v=Math.max(this.v,e.v),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this.v=Math.max(e.v,Math.min(t.v,this.v)),this}clampScalar(t,n){let r=new e,i=new e;return r.set(t,t,t,t),i.set(n,n,n,n),this.clamp(r,i)}clampLength(e,t){let n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.v=Math.floor(this.v),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.v=Math.ceil(this.v),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.v=Math.round(this.v),this}roundToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this.v=this.v<0?Math.ceil(this.v):Math.floor(this.v),this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.v*e.v}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.v*this.v}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.v*this.v)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.v)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.v+=(e.v-this.v)*t,this}lerpVectors(e,t,n){return this.subVectors(t,e).multiplyScalar(n).add(e)}cross(e,t){return t==null?this.crossVectors(this,e):this.crossVectors(e,t)}crossVectors(e,t){let n=e.x,r=e.y,i=e.z,a=t.x,o=t.y,s=t.z;return this.x=r*s-i*o,this.y=i*a-n*s,this.z=n*o-r*a,this}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){let t=this.x-e.x,n=this.y-e.y,r=this.z-e.z,i=this.v-e.v;return t*t+n*n+r*r+i*i}equals(e){return e.x==this.x&&e.y==this.y&&e.z==this.z&&e.v==this.v}toString(){return JSON.stringify(this)}changeEPSGType(e){if(this.EPSGType!=e){if(e==b.EPSGType.EPSG84){let e=ve(this.x,this.y);this.x=e.x,this.y=e.y}else if(e==b.EPSGType.EPSGWeb){let e=_e(this.x,this.y);this.x=e.x,this.y=e.y}else console.log(`暂不支持[${this.EPSGType}]转换为${e}`);return this.EPSGType=e,this}}},xt=class{constructor(){this.Vector2=ge,this.Vector3=x,this.Vector4=bt}},St=class extends y{constructor(e,t){super(e,`LayerService`,t)}addLayer(e,t){let n={...e,show:e.show??!0,poiEnabled:e.poiEnabled??!0,isSystem:e.isSystem??!1,poiOffsetY:e.poiOffsetY??0};return this.request(`AddLayer`,n,t,P.addLayerResolved)}removeLayer(e,t){let n={...e};return this.request(`RemoveLayer`,n,t,P.layerSelectorResolved)}isLayerOrGroupExit(e,t){let n={...e};return this.request(`IsLayerOrGroupExit`,n,t,P.layerSelectorResolved)}switchModelLayer(e,t){return this.request(`SwitchLayer`,e,t,P.switchModelLayer)}showUIPop(e,t){let n={...e,id:e.id.trim(),visible:e.visible??!0,assetsPath:e.assetsPath??`/Game/Resources/POIS/BluePrints/BP_Camera.uasset`,scale:e.scale??new x(1,1,1),offSet:e.offSet??new x(0,0,0)};return n.scale&&(n.scale.ePSGType=`0000`),n.offSet&&(n.offSet.ePSGType=`0000`),console.log(n),this.request(`ShowLayerUIPop`,n,t,P.showUIPop)}addModel(e,t){let n={...e,id:e.id.trim(),name:e.name?.trim()||``,scale:e.scale??new x(1,1,1),rotation:e.rotation??new x(0,0,0)};return n.extraProps&&=JSON.stringify(n.extraProps),n.scale&&(n.scale.ePSGType=`0000`),n.rotation&&(n.rotation.ePSGType=`0000`),this.request(`AddModel`,n,t,P.addModel)}addPOI(e,t){let n={...e,id:e.id.trim(),scale:e.scale??new x(1,1,1),rotation:e.rotation??new x(0,0,0),fontSize:e.fontSize??16,isSystem:e.isSystem??!1,text:e.text??``,targetParentId:e.targetParentId??``,targetId:e.targetId??``,offSet:e.offSet??new x(0,0,0)};return n.extraProps=n.extraProps?JSON.stringify(n.extraProps):`{}`,n.scale&&(n.scale.ePSGType=`0000`),n.rotation&&(n.rotation.ePSGType=`0000`),n.offSet&&(n.offSet.ePSGType=`0000`),this.request(`AddPOI`,n,t,P.addPOI)}removeModel(e,t){return this.request(`RemoveModelByIds`,e,t,P.removeModel)}getLayerChildElement(e,t){return this.request(`GetLayerChildElements`,e,t,P.getLayerChildElement)}},Ct=class extends y{constructor(e,t){super(e,`ModelService`,t)}toIdArray(e){return Array.isArray(e)?e:[e]}setVisible(e,t){let n={parentId:e.parentId,ids:this.toIdArray(e.id),visible:e.visible??!0};return this.request(`SetVisible`,n,t,Ue.setVisibleResolved)}setVisibleByTags(e,t){let n={tags:this.toIdArray(e.tags),visible:e.visible??!0};return this.request(`SetVisibleByTags`,n,t,Ue.setVisibleByTags)}setVisibleByAttibute(e,t){let n={attributes:e.attributes,filterMode:e.filterMode??0,visible:e.visible??!0,otherVisible:e.otherVisible??!1};return this.request(`SetVisibleByAttribute`,n,t,Ue.setVisibleByAttibute)}getElementTree(e,t){return this.request(`GetElementTree`,e,t,Ue.getElementTree)}getModelInfo(e,t){return this.request(`GetModelInfo`,e,t,Ue.getModelInfo)}},wt=class extends y{constructor(e,t){super(e,`ModelPOI`,t)}add(e,t){let n={...e,visible:e.visible??!0};return this.request(`add`,n,t,L.add)}deleteById(e,t){return this.request(`deleteById`,e,t,L.deleteById)}deleteByGroup(e,t){return this.request(`deleteByGroup`,e,t,L.deleteByGroup)}getPOIInfo(e,t){return this.request(`getPOIInfo`,e,t,L.getPOIInfo)}update(e,t){let n={...e,visible:e.visible??!0};return this.request(`update`,n,t,L.update)}setVisibleByGroup(e,t){return this.request(`setVisibleByGroup`,e,t,L.setVisibleByGroup)}},Tt=class extends y{constructor(e,t){super(e,`ModelTransformService`,t)}startMoveByNodes(e,t){return this.request(`StartMoveByNodes`,e,t,N.startMoveByNodes)}pauseMove(e,t){return this.request(`PauseMove`,e,t,N.pauseMove)}resumeMove(e,t){return this.request(`ResumeMove`,e,t,N.resumeMove)}endMove(e,t){return this.request(`EndMove`,e,t,N.endMove)}restoreMove(e,t){return this.request(`RestoreMove`,e,t,N.restoreMove)}rotate(e,t){return e.rotate.ePSGType=b.EPSGType.EPSGWorld,this.request(`StartRotate`,e,t,N.rotate)}endRotate(e,t){return this.request(`EndRotate`,e,t,N.endRotate)}continuedRotate(e,t){return e.rotate.ePSGType=b.EPSGType.EPSGWorld,this.request(`ContinuedRotate`,e,t,N.continuedRotate)}rotateByTarget(e,t){return this.request(`RotateByTarget`,e,t,N.rotateByTarget)}restoreRotate(e,t){return this.request(`RestoreRotate`,e,t,N.restoreRotate)}setScale(e,t){e.scale.ePSGType=b.EPSGType.EPSGWorld;let n={...e,id:e.id.trim()};return n.scale&&(n.scale.ePSGType=`0000`),this.request(`SetScale`,n,t,N.setScale)}endScale(e,t){return this.request(`EndScale`,e,t,N.endScale)}restoreScale(e,t){return this.request(`RestoreScale`,e,t,N.restoreScale)}},Et=class extends y{constructor(e,t){super(e,`NavigationService`,t)}startNav(e,t){let n={...e,scale:e.scale??new x(1,1,1)};return n.scale&&(n.scale.ePSGType=`0000`),this.request(`PlayMeshNavByNodes`,n,t,z.startNav)}getMeshNavDistance(e,t){return this.request(`PlayMeshNavByNodes`,e,t,z.getMeshNavDistance)}pauseNav(e,t){return this.request(`PauseMeshNav`,e,t,z.pauseNav)}resumeNav(e,t){return this.request(`ResumeMeshNav`,e,t,z.resumeNav)}stopNav(e,t){return this.request(`StopMeshNav`,e,t,z.resumeNav)}updateNav(e,t){return this.request(`UpdateMeshNavProperty`,e,t,z.updateNav)}updateSpeed(e,t){return this.request(`UpdateNavSpeed`,e,t,z.updateSpeed)}startNavByPath(e,t){return this.request(`StartNavByPath`,e,t,z.startNavByPath)}pauseNavPath(e,t){return this.request(`PauseNavPath`,e,t,z.pauseNavPath)}resumeNavPath(e,t){return this.request(`ResumeNavPath`,e,t,z.resumeNavPath)}stopNavPath(e,t){return this.request(`StopNavPath`,e,t,z.stopNavPath)}updateNavPath(e,t){return this.request(`UpdateNavPathProperty`,e,t,z.updateNavPath)}},Dt=class extends y{constructor(e,t){super(e,`PathPatrolService`,t)}add(e,t){return e.scale&&(e.scale.ePSGType=b.EPSGType.EPSGWorld),this.requestStream(`AddPath`,e,t,R.add)}update(e,t){return this.request(`UpdatePath`,e,t,R.update)}setTimeNode(e,t){return this.request(`CuriserTimeSet`,e,t,R.setTimeNode)}clear(e){return this.request(`ClearPath`,void 0,e,R.clear)}pause(e,t){return this.request(`Pause`,e,t,R.node)}resume(e,t){return this.request(`Resume`,e,t,R.node)}stop(e,t){return this.request(`Stop`,e,t,R.node)}};function Ot(e){return Array.isArray(e)?{ids:e}:e}var kt=class extends y{constructor(e,t){super(e,`PointIcon`,t)}show(e,t){return this.request(`Show`,Ot(e),t,Re.show)}hide(e,t){return this.request(`Hide`,Ot(e),t,Re.hide)}showByGroup(e,t){return this.request(`ShowByGroup`,Ot(e),t,Re.showByGroup)}hideByGroup(e,t){return this.request(`HideByGroup`,Ot(e),t,Re.hideByGroup)}showAll(e){return this.request(`ShowAll`,void 0,e,Re.showAll)}hideAll(e){return this.request(`HideAll`,void 0,e,Re.hideAll)}},At=class{static getUUID(e=11){let t=16,n=`0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz`.split(``),r=[],i;if(t||=n.length,e)for(i=0;i<e;i++)r[i]=n[0|Math.random()*t];else{let e;for(r[8]=r[13]=r[18]=r[23]=`-`,r[14]=`4`,i=0;i<36;i++)r[i]||(e=0|Math.random()*16,r[i]=n[i==19?e&3|8:e])}return`U`+r.join(``)}static warn(e,t=!1){console.log(`warn`,e,t);let n=document.createElement(`div`);return n.innerHTML=e,document.body.appendChild(n),n.setAttribute(`id`,`engineWarnTips`),n.style.cssText=`
|
|
2
2
|
pointer-events: none;
|
|
3
3
|
padding: 10px 40px;
|
|
4
4
|
letter-spacing: 1px;
|