@shijiu/jsview 2.3.0 → 2.3.151-test.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,2 +1,2 @@
1
- /* eslint-disable */ let e={sRenderBridge:null,sActivityManager:null,DesignMap:null};window.Forge=e;let t=function(e){},i=function(e){},n=function(e){},s=function(e){throw new Error(e)};class a{constructor(){this._EnqueueInfoList=[],this._EnqueueObjList=[],this._OnStartSyncCallback=[],this._AlterIdCandidateMap={}}RequestAlterId(e,t){this._AlterIdCandidateMap[e]=t}AddToQueue(e,t){this._EnqueueInfoList.push(t),this._EnqueueObjList.push(e)}HasUpdate(){return this._EnqueueInfoList.length>0}ReadSyncList(){if(this._OnStartSyncCallback.length>0){for(let e of this._OnStartSyncCallback)e();this._OnStartSyncCallback=[]}let e=this._EnqueueInfoList;return this.RenewSyncList(),e}AddStartSyncCallback(e){this._OnStartSyncCallback.push(e)}RenewSyncList(){if(this._EnqueueObjList)for(let e of this._EnqueueObjList)e.RenewSyncInfo(this,null);this._EnqueueInfoList=[],this._EnqueueObjList=[]}ProcAlterIds(e,t){for(let i=0;i<e.length;i++)if(this._AlterIdCandidateMap.hasOwnProperty(e[i])){let n=this._AlterIdCandidateMap[e[i]];n.OnAlterId(t[i]),n.RenewSyncInfo(this,null)}else console.error(`Error: ProcAlterIds not found proxyId=${e[i]}`);this._AlterIdCandidateMap={}}}class r{constructor(e,t=null,i=null){this._PrefSyncListRef=e,this.PrefSyncInfo=null,this._PrefTaskList=null,this._PrefEnqueued=!1,this._SuffSyncListRef=t,this.SuffSyncInfo=null,this._SuffTaskList=null,this._SuffEnqueued=!1,this.InitPackage(i),this.RenewSyncInfo(this._PrefSyncListRef,null),this.RenewSyncInfo(this._SuffSyncListRef,null)}AddStartSyncCallback(e){this._PrefSyncListRef.AddStartSyncCallback(e)}CallToNative(t,i,n=!1){let s={fn:t,a:i};return n?(this._SuffTaskList.push(s),this._SuffEnqueued||(this._SuffSyncListRef.AddToQueue(this,this.SuffSyncInfo),this._SuffEnqueued=!0)):(this._PrefTaskList.push(s),this._PrefEnqueued||(this._PrefSyncListRef.AddToQueue(this,this.PrefSyncInfo),this._PrefEnqueued=!0)),e.sRenderBridge.RequestSwap(),s}RequestAlterId(e,t=!1){t?this._SuffSyncListRef.RequestAlterId(e,this):this._PrefSyncListRef.RequestAlterId(e,this)}SuffCallToNative(e,t){return{fn:e,a:t}}AlterCallParams(e,t){e&&(e.a=t)}RenewSyncInfo(e,t){t||(t={}),this._PrefEnqueued=!1,this._SuffEnqueued=!1,e&&e==this._PrefSyncListRef&&(this._PrefTaskList=[],this.PrefSyncInfo={tl:this._PrefTaskList,...t}),e&&e==this._SuffSyncListRef&&(this._SuffTaskList=[],this.SuffSyncInfo={tl:this._SuffTaskList,...t})}InitPackage(e){}OnAlterId(e){}}let o=new a,l=new a;class h extends r{constructor(e){super(o,l,{id:e}),this._TextureRef=null,this._RenderTextureId=e}InitPackage(e){this._RenderTextureId=e.id}RenewSyncInfo(e,t){super.RenewSyncInfo(e,{tt:1,id:this._RenderTextureId})}NeedAlterId(e,t){this._TextureRef=e,super.RequestAlterId(this._RenderTextureId,t)}OnAlterId(e){this._RenderTextureId=e,this._TextureRef.TexId=e,this._TextureRef=null}}let c=new class extends r{constructor(){super(o,l)}RenewSyncInfo(e,t){super.RenewSyncInfo(e,{tt:0})}};let u=new class{constructor(){this._StoreArray=[1]}AddData(e){return this._StoreArray.push(e),this._StoreArray.length-1}TakeArray(){const e=this._StoreArray;return this._StoreArray=[1],e}PickArray(){return this._StoreArray}GetSize(){return this._StoreArray.length}ResetForNextSwap(){this._StoreArray=[1]}};let d=1;class _{constructor(e,t,i=!1){this._NativeSyncer=t,this.TexId=e,this._TextureReady=!1,this._TextureWidth=0,this._TextureHeight=0,this._InnerLoadCallback=null,this._CallbackMap={},this._DomDepends=i}GetTextureId(){return this.TexId}RequestSyncerAlterId(){this._NativeSyncer.NeedAlterId(this,this._DomDepends)}RegisterLoadImageCallback(e,t,i){if(null==t)return 0;if(this._TextureReady)return t({width:this._TextureWidth,height:this._TextureHeight},i),0;{this._RegisterInnerLoadCallback();const e=d++,n=this,s=(s,a,r)=>{t({width:s,height:a,extra:r?JSON.parse(r):null},i),delete n._CallbackMap[e]};this._CallbackMap[e]=s;const a=u.AddData(s);return this._NativeSyncer.CallToNative(1,[e,a],this._DomDepends),e}}UnregisterLoadImageCallback(e){e>0&&void 0!==this._CallbackMap[e]&&delete this._CallbackMap[e]}DispatchCommand(t,i){this._NativeSyncer.CallToNative(3,[t,i],this._DomDepends),e.sRenderBridge.RequestSwap()}_RegisterInnerLoadCallback(){if(null==this._InnerLoadCallback){const e=this;this._InnerLoadCallback=(t,i,n)=>{e._TextureReady=!0,e._TextureWidth=t,e._TextureHeight=i};const t=u.AddData(this._InnerLoadCallback);this._NativeSyncer.CallToNative(1,[d++,t],this._DomDepends)}}EnableBackgroundLoad(){this._TextureReady||(this._RegisterInnerLoadCallback(),this._NativeSyncer.CallToNative(4,null,this._DomDepends))}DisableBackgroundLoad(){this._NativeSyncer.CallToNative(5,null,this._DomDepends)}RequestToUnload(){this._NativeSyncer.CallToNative(6,null,this._DomDepends)}DisableAutoRecycle(){this._NativeSyncer.CallToNative(7,null,this._DomDepends)}}class S extends _{constructor(e,t,i=!1){super(e,t,i),this._GifTextureInfo=null}registerOnStart(e){this._EnableGifTextureInfo();let t=this._GifTextureInfo,i=++t.IdGen;if(t.StartMapCount++,t.StartMapCount>0&&0==t.GlobalStartCallbackId){t.GlobalStartCallbackId=i;const e=()=>{for(let e in t.OnStartMap)t.OnStartMap[e]?.()},n=u.AddData(e);this._NativeSyncer.CallToNative(10,[t.GlobalStartCallbackId,n],this._DomDepends)}return t.OnStartMap[i]=e,i}unregisterOnStart(e){if(!this._GifTextureInfo)return;let t=this._GifTextureInfo;t.OnStartMap.hasOwnProperty(e)&&t.StartMapCount--,0==t.StartMapCount&&0!=t.GlobalStartCallbackId&&(this._NativeSyncer.CallToNative(11,[t.GlobalStartCallbackId],this._DomDepends),t.GlobalStartCallbackId=0)}registerOnEnd(e){this._EnableGifTextureInfo();let t=this._GifTextureInfo,i=++t.IdGen;if(t.EndMapCount++,t.EndMapCount>0&&0==t.GlobalEndCallbackId){t.GlobalEndCallbackId=i;const e=()=>{for(let e in t.OnEndMap)t.OnEndMap[e]?.()},n=u.AddData(e);this._NativeSyncer.CallToNative(12,[t.GlobalEndCallbackId,n],this._DomDepends)}return t.OnEndMap[i]=e,i}unregisterOnEnd(e){if(!this._GifTextureInfo)return;let t=this._GifTextureInfo;t.OnEndMap.hasOwnProperty(e)&&t.EndMapCount--,0==t.EndMapCount&&0!=t.GlobalEndCallbackId&&(this._NativeSyncer.CallToNative(13,[t.GlobalEndCallbackId],this._DomDepends),t.GlobalEndCallbackId=0)}_EnableGifTextureInfo(){this._GifTextureInfo||(this._GifTextureInfo={IdGen:1,GlobalStartCallbackId:0,OnStartMap:{},StartMapCount:0,GlobalEndCallbackId:0,OnEndMap:{},EndMapCount:0})}}class p extends S{constructor(e,t){super(e,t,!0)}}let y=window.NativeGetIdGroupIntf();const v=10;class m{constructor(e){this._GroupType=e,this._TeamReadIndex=0,this._TeamFillIndex=0,this._Teams=new Array(v),this._ValidTeamsCount=0;for(let e=0;e<v;e++)this._Teams[e]={start:0,end:0,expired:!0}}genId(){this._Teams[this._TeamReadIndex].expired&&this._reserveNativeIds();let e=this._Teams[this._TeamReadIndex],t=e.start;return e.start++,e.start>e.end&&(e.expired=!0,this._TeamReadIndex=(this._TeamReadIndex+1)%v,this._ValidTeamsCount--),t}_reserveNativeIds(){let e=20*(v-this._ValidTeamsCount);if(e>0){let t=y.GetIdArray(this._GroupType,e);if(t){let e=JSON.parse(t);this._commitNativeIds(e[0],e[1])}}}_commitNativeIds(e,t){let i=t-e+1,n=Math.floor(i/20),s=e;for(let e=0;e<n;e++){let e=this._Teams[this._TeamFillIndex];e.start=s,e.end=s+20-1,e.expired=!1,this._TeamFillIndex=(this._TeamFillIndex+1)%v,s=e.end+1}this._ValidTeamsCount+=n,this._ValidTeamsCount>v&&console.error(`team over size to ${this._ValidTeamsCount}`)}}let C=new class{constructor(){this._ViewGroup=new m(0),this._TextureGroup=new m(1),this._AnimationGroup=new m(2),this._SensorGroup=new m(3)}genViewId(){return this._ViewGroup.genId()}genTextureId(){return this._TextureGroup.genId()}genAnimationId(){return this._AnimationGroup.genId()}genSensorId(){return this._SensorGroup.genId()}};var f,I,T;!function(e){e.RGBA_8888="RGBA_8888",e.RGBA_4444="RGBA_4444",e.RGBA_5551="RGBA_5551",e.RGB_565="RGB_565",e.RGB_ETC1="RGB_ETC1",e.RGBA_ETC1="RGBA_ETC1"}(f||(f={})),function(e){e.L=1,e.M=0,e.Q=3,e.H=2}(I||(I={})),function(e){e.AUTO=0,e.SYNC=1,e.ASYNC=2}(T||(T={}));class N{constructor(){this._NativeSyncer=c}GetId(){return 0}GetColorTexture(e){let t=C.genTextureId();this._NativeSyncer.CallToNative(1,[e,t]);let i=new _(t,new h(t));return i.RequestSyncerAlterId(),i}GetImage(e,t,i){return this.GetImage2(e,t,null,null,i)}GetImage2(e,t,i,s=f.RGBA_8888,a="",r=!1){if(!e||0==e.length)return n("GetImage2, url is not setted!"),null;let o=C.genTextureId(),l=0,c=0;i&&(l=i.width,c=i.height),s||(s=f.RGBA_8888),a||(a="");let u=null!=r&&r;this._NativeSyncer.CallToNative(2,[e,l,c,s,a,u,o]);let d=new _(o,new h(o));return d.RequestSyncerAlterId(),d}GetQRCodeTexture(e,t,i,n=T.AUTO,s=I.Q,a="#ffffff",r="#000000",o=-1){let l=C.genTextureId();return this._NativeSyncer.CallToNative(3,[e,t,i,s,a,r,o,n,l]),new _(l,new h(l))}GetDownloadTexture(e,t,i){if(!e)return n("GetDownloadTexture, url is null!"),null;let s=C.genTextureId();return this._NativeSyncer.CallToNative(4,[e,t,i,s]),new _(s,new h(s))}GetDomProxyTexture(e){let t=C.genTextureId();return this._NativeSyncer.CallToNative(5,[e,t],!0),new p(t,new h(t))}GetCanvasTexture(e,t){let i=C.genTextureId();return this._NativeSyncer.CallToNative(6,[e,t,i],!1),new _(i,new h(i))}GetPluginTexture(e,t){let i=C.genTextureId();return this._NativeSyncer.CallToNative(7,[e,t,i],!1),new _(i,new h(i))}GetCapturedTexture(){let e=C.genTextureId();return this._NativeSyncer.CallToNative(8,[e],!1),new _(e,new h(e))}}let g=new class{constructor(){this._count=1}get count(){return this._count}update(){this._count<Number.MAX_SAFE_INTEGER?++this._count:this._count=1}},A=new a,R=new a;let w=new class extends r{constructor(){super(A,R)}RenewSyncInfo(e){super.RenewSyncInfo(e,{tt:0})}};class E extends r{constructor(e){super(A,R,{id:e}),this._AnimId=e}InitPackage(e){this._AnimId=e.id}RenewSyncInfo(e){super.RenewSyncInfo(e,{tt:1,id:this._AnimId})}}let b=new a,D=new a;class x extends r{constructor(e){super(b,D,{id:e}),this._ViewId=e}InitPackage(e){this._ViewId=e.id}RenewSyncInfo(e){super.RenewSyncInfo(e,{tt:1,id:this._ViewId})}}let P=new class extends r{constructor(){super(b,D)}RenewSyncInfo(e){super.RenewSyncInfo(e,{tt:0})}},F=new a;class L extends r{constructor(e){super(null,F,{id:e}),this._SensorId=e}InitPackage(e){this._SensorId=e.id}RenewSyncInfo(e,t){super.RenewSyncInfo(e,{tt:1,id:this._SensorId})}}let k=new class extends r{constructor(){super(null,F)}RenewSyncInfo(e,t){super.RenewSyncInfo(e,{tt:0})}};var O=null,G=null;class V{constructor(){this._ScreenInfo={width:160,height:90,x:2/160,y:2/90,perspective:2/160,scaleRatio:1,designedWidth:1280},this.SwapCurrentTime=Date.now(),this.SwapCurrentCount=0,this._WillSwapCallbacks=new Map,this._DoWillSwapCallback=this._OnWillSwap.bind(this),this._NativeForgeRT={hdl:null},this._ApiLinkStatusReady=!0,this._SwapTimer=-1,this._OnRequesting=!1,this._OnRequestSeq=1,this._ApiLinkStatusReady=!1,this._InitNativeBridge(),this._EnableRequestSwap=!1,this._CommandParamsCache=[],this._NewSwapSeq=1,this._ForgeFrontRender.OnScreenHide&&window.JsView?.onVisibilityChange((e=>{'{"status":"hide"}'===e&&this._ForgeFrontRender.OnScreenHide()}))}_InitNativeBridge(){void 0!==global.NativeSendImpactSensorSyncData&&global.NativeSendImpactSensorSyncData.bind(this._NativeForgeRT),void 0!==global.NativeSetStepFpsSwitch&&(O=global.NativeSetStepFpsSwitch.bind(this._NativeForgeRT)),void 0!==global.NativeSetGlobalConfig&&(G=global.NativeSetGlobalConfig.bind(this._NativeForgeRT)),this._ForgeFrontRender=global.NativeGetRenderIntf(),this._ForgeFrontRender.RegisterSwapFunc((()=>{this.RequestSwap()})),this._DoRequestSwap=this._DoRequestSwap.bind(this),this._ForgeFrontRender.RegisterPreDomSyncFunc((()=>{this._ProcPreDomSync()})),this._ForgeFrontRender.RegisterOnScreenInfo(this._OnScreenInfoChange.bind(this))}SetStepFpsSwitch(e){this._ApiLinkStatusReady?O&&O(e):(console.warn("SetStepFpsSwitch(): API link status no ready!"),this._CommandParamsCache.push((()=>{this.SetStepFpsSwitch(e)})))}SetGlobalConfig(e){if(this._ApiLinkStatusReady){if(G){let t=JSON.stringify(e);console.log("SetGlobalConfig set with "+t),G(t),console.log("SetGlobalConfig set done")}}else console.warn("SetGlobalConfig(): API link status no ready!"),this._CommandParamsCache.push((()=>{this.SetGlobalConfig(e)}))}_PerformCachedCommand(){if(this._CommandParamsCache.length>0){for(let e=0;e<this._CommandParamsCache.length;e++)this._CommandParamsCache[e]();this._CommandParamsCache=[]}}RequestSwap(){this._OnRequesting?this._NewSwapSeq++:(this._OnRequesting=!0,this._NewSwapSeq++,this._OnRequestSeq++,this._PromiseRequestSwap(this._OnRequestSeq))}_PromiseRequestSwap(e){let t=this,i=this._NewSwapSeq;Promise.resolve().then((()=>{i==t._NewSwapSeq?t.InstantPerformSwap():e==this._OnRequestSeq&&t._PromiseRequestSwap(e)}))}NotifyNetTypeStatus(e,t){}EnableRequestSwap(e){this._EnableRequestSwap=e,this._ForgeFrontRender.EnableRequestSwap(e)}InstantPerformSwap(){this._OnRequesting&&(this._OnRequesting=!1,this._OnRequestSeq++,this._DoRequestSwap(!1))}_ProcSyncerList(e,t,i,n,s){let a=null,r=null,o=null,l=null,h=null;if(e.HasUpdate()&&(o=e.ReadSyncList()),t.HasUpdate()&&(r=t.ReadSyncList()),i.HasUpdate()&&(a=i.ReadSyncList()),n?.HasUpdate()&&(l=n.ReadSyncList()),null==a&&null==r&&null==o&&null==l||(h=this._ForgeFrontRender.SyncForgeJsCall(JSON.stringify({TexSync:o,AnimSync:r,ViewSync:a,SensorSync:l}),s)),h){let t;this._OnRequesting=!1,t=JSON.parse(h).TexSyncRet,t&&this._ProcTextureSyncRet(e,t)}}_ProcPreDomSync(){this._ProcSyncerList(o,A,b,null,u.PickArray())}_DoRequestSwap(e){if(!this._EnableRequestSwap)return void(this._OnRequesting=!1);g.update();let t=u.GetSize();if(this._ProcSyncerList(o,A,b,null,u.PickArray()),this._WillSwapCallbacks.size>0&&this._WillSwapCallbacks.forEach(this._DoWillSwapCallback),this._ProcSyncerList(l,R,D,F,u.PickArray()),t==u.GetSize())u.ResetForNextSwap();else{let e=u.GetSize();e>50&&console.warn("Warning: temp sync store kept with large size = "+e)}e=!!e,this._OnRequesting=!1,this.SwapCurrentTime=Date.now(),this.SwapCurrentCount++,this._ForgeFrontRender.DoRequestSwap(e)}GetScreenInfo(){return this._ScreenInfo}SetForgeRtHandler(e){this._NativeForgeRT.hdl=e,this._ApiLinkStatusReady=!0,this._ForgeFrontRender.SetForgeRtHandler(e),this._PerformCachedCommand()}InitScreenBuffer(e,t){isNaN(e)&&(e=1),isNaN(t)&&(t=1280);var i=t*e,n=i/16*9;this._ScreenInfo.width=Math.floor(i),this._ScreenInfo.height=Math.floor(n),this._ScreenInfo.x=2/this._ScreenInfo.width,this._ScreenInfo.y=2/this._ScreenInfo.height,this._ScreenInfo.perspective=this._ScreenInfo.x,this._ScreenInfo.scaleRatio=e,this._ScreenInfo.designedWidth=t}InitNativeScreenBuffer(){if(this._ApiLinkStatusReady){var e=JSON.stringify({displayScaleRatio:this._ScreenInfo.scaleRatio,designedMapWidth:this._ScreenInfo.designedWidth});this._ForgeFrontRender.InitScreenBuffer(e)}else console.info("InitNativeScreenBuffer(): API link status no ready!")}SyncBackStatus(e,t){this._ForgeFrontRender.SyncBackStatus(e,t)}TakeAndSyncBackStatus(){1==this._ForgeFrontRender.TakeAndSyncBackStatus()&&this.RequestSwap()}_OnScreenInfoChange(e,t,i,n,s){this._ScreenInfo.width=e,this._ScreenInfo.height=t,this._ScreenInfo.x=i,this._ScreenInfo.y=n,this._ScreenInfo.perspective=s}HasPendingRenderBreak(){return!!this._ApiLinkStatusReady&&this._ForgeFrontRender.HasPendingRenderBreak()}FinishRenderBreak(e){this._ApiLinkStatusReady?this._ForgeFrontRender.FinishRenderBreak(e):(console.warn("FinishRenderBreak(): API link status no ready, delay"),this._CommandParamsCache.push((()=>{this._ForgeFrontRender.FinishRenderBreak(e)})))}AddWillSwapListener(e,t){this._WillSwapCallbacks.set(e,t)}AddSwappedOnceObserver(e){this._ApiLinkStatusReady?this._ForgeFrontRender.AddSwappedOnceObserver(e):(console.warn("AddSwappedOnceObserver(): API link status no ready, delay"),this._CommandParamsCache.push((()=>{this._ForgeFrontRender.AddSwappedOnceObserver(e)})))}ActiveComponent(e){this._ApiLinkStatusReady?this._ForgeFrontRender.ActiveComponent(e):(console.warn("ActiveComponent(): API link status no ready, delay"),this._CommandParamsCache.push((()=>{this._ForgeFrontRender.ActiveComponent(e)})))}ShutdownComponents(e){this._ApiLinkStatusReady?this._ForgeFrontRender.ShutdownComponents(e):(console.warn("ShutdownComponents(): API link status no ready, delay"),this._CommandParamsCache.push((()=>{this._ForgeFrontRender.ShutdownComponents(e)})))}SetPlatformMsgDisp(e){this._PlatformMessageDispatch=e}GetPlatformMsgDisp(){return this._PlatformMessageDispatch}GetTextToolsApi(){return this._ForgeFrontRender.TextToolApi}_OnWillSwap(e){e()}_ProcTextureSyncRet(e,t){let i;i=t.idAlter,i&&e.ProcAlterIds(i.proxy,i.real)}}class M{constructor(){this._DisableKeyGuard=!1,this._LastEventTime=0,this._IsActivte=!1,this._BaseTime=0,this._BaseRemoteTime=0,this._SupportGetTimeFromApi=!1,this._IsSystemKeyDelaySuit=!1,this._ExpiredKeyCount=0,this._LastValidKeyTime=0,this._UseTimeFromApi=void 0!==window.jRuntimeBridge?.getSystemUptimeMillis,this._UseTimeFromApi&&(this._SupportGetTimeFromApi=!0,this._GetTimeFromApi())}SetTranslateDelay(e){M.sKeyTranslateDelay=e}CheckKey(e){if(!e.timeStamp||this._DisableKeyGuard)return!1;this._IsActivte=!0;const t=Date.now(),n=e.timeStamp;!this._SupportGetTimeFromApi&&n-this._LastEventTime>3e3&&(this._BaseTime=t,this._BaseRemoteTime=n,this._LastEventTime=n);let s=t-this._BaseTime;(s<0||s>5e3)&&(this._UseTimeFromApi?this._GetTimeFromApi():(this._BaseTime=t,this._BaseRemoteTime=n),s=0);return s+this._BaseRemoteTime-n>M.CONST_MAX_PASSING_GAP&&Math.abs(this._LastValidKeyTime-n)<M.CONST_MIN_VALID_KEY_GAP&&!e.repeat?(!this._IsSystemKeyDelaySuit&&this._SupportGetTimeFromApi&&(this._ExpiredKeyCount++,this._ExpiredKeyCount>50&&i("More than 50 keys are expired...")),!0):(this._IsSystemKeyDelaySuit||(this._IsSystemKeyDelaySuit=!0),this._LastValidKeyTime=n,!1)}toggleKeyGuard(){this._DisableKeyGuard=!this._DisableKeyGuard}IsActive(){return this._IsActivte}_GetTimeFromApi(){this._BaseTime=Date.now(),this._BaseRemoteTime=window.jRuntimeBridge.getSystemUptimeMillis()-M.sKeyTranslateDelay}}M.CONST_MAX_PASSING_GAP=20,M.CONST_MIN_VALID_KEY_GAP=180,M.sKeyTranslateDelay=5;let B,q=new M;class W{constructor(s,a,r){var o;if(this._MainActivity=null,this._DesignedMapWidth=1280,this._KeyLock=!1,this._CanvasHandler=0,o=4,console.log.bind(console),o>0&&console.error.bind(console),o>1&&(t=console.error.bind(console)),o>2&&(i=console.warn.bind(console)),o>3&&(n=console.log.bind(console)),o>4&&console.debug.bind(console),this._TextureManager=new N,this._RenderBridge=new V,e.sRenderBridge=this._RenderBridge,isNaN(r)&&(r=1280),this._DesignedMapWidth=r,this._KeyLock=!1,this._InitRenderer(s,a,r),this._EventHandlers={keyProc:null,keyUpProc:null,activityStateProc:null},this._RegisterKeyListener(this._EventHandlers),this._RegisterNativeActivityStateListener(this._EventHandlers),this._InstantSwapPromiseCallback=this._RenderBridge.InstantPerformSwap.bind(this._RenderBridge),null!=s){this._CanvasHandler=s.canvasNativeHandle;for(let e in this._EventHandlers)s[e]=this._EventHandlers[e]}e.sActivityManager=this,console.log("manager done")}GetTextureManager(){return this._TextureManager}DelayedActivateCanvas(e){if(0==this._CanvasHandler){this._CanvasHandler=e.canvasNativeHandle,this._EnableNativeBridge(e);for(let t in this._EventHandlers)e[t]=this._EventHandlers[t];this._RenderBridge.InitNativeScreenBuffer(),this._RenderBridge.RequestSwap()}else t("Error: already activated")}GetCanvasHandler(){return this._CanvasHandler}StartActivity(e){this._MainActivity=e}_InitRenderer(e,t,i){this._EnableNativeBridge(e),this._RenderBridge.InitScreenBuffer(t,i),this._RenderBridge.InitNativeScreenBuffer()}_EnableNativeBridge(e){null!=e&&(this._RenderBridge.SetForgeRtHandler(e.frtNativeHandle),e.renderBridge=this._RenderBridge,this._RenderBridge.EnableRequestSwap(!0))}_KeyProcDown(e){if(this._KeyLock)return!0;var t=!0;if(this._MainActivity){if(q.CheckKey(e))return console.log("keyEventGuard ignore keys"),!1;q.IsActive()&&this._RenderBridge.InstantPerformSwap(),t=!this._MainActivity.DispatchKeyDown(e),this._RenderBridge.TakeAndSyncBackStatus()}return t}_KeyProcUp(e){if(this._KeyLock)return!0;var t=!0;return this._MainActivity&&(t=!this._MainActivity.DispatchKeyUp(e),this._RenderBridge.TakeAndSyncBackStatus()),t}_RegisterKeyListener(e){e.keyProc=this._KeyProcDown.bind(this),e.keyUpProc=this._KeyProcUp.bind(this)}_RegisterNativeActivityStateListener(e){let t=this;var i=function(e){var i=e.State;switch(console.log("ActivityStateListenerChanged, state:"+i),i){case"onActivityResumed":t._RenderBridge.EnableRequestSwap(!0),t._RenderBridge.InstantPerformSwap();break;case"onActivityPaused":t._RenderBridge.EnableRequestSwap(!1)}}.bind(this);e.activityStateProc=i}}class K{constructor(){this._ActivityManager=null}Init(e){let t=1280,i=1;try{if(H){let e=H();"number"==typeof e.width&&(t=e.width),"number"==typeof e.displayScale&&(i=e.displayScale)}}catch(e){console.log("Note: DesignMap failed")}this._ActivityManager=new W(e,i,t),U?U(this._ActivityManager):console.error("FATAL: no found entry")}getActivityManager(){return this._ActivityManager}}let U=null,H=null;class J{constructor(e){this.PageName=e,this._FocusChild=null,this._LatestFocusChild=null,this.SubPages=[],this._ParentPage=null,this._KeyLock=!1}OnRenderFrame(){t("OnRenderFrame() MUST override")}OnKeyDown(e){return!1}OnKeyUp(e){return!1}DispatchKeyDown(e){if(this._KeyLock)return!0;let t=!1;return this._FocusChild&&(t=this._FocusChild.DispatchKeyDown(e)),t||(t=this.OnKeyDown(e)),t}OnCustomEvent(e){return!1}BubbleCustomEvent(e){this.OnCustomEvent(e)||this._ParentPage&&this._ParentPage.BubbleCustomEvent(e)}DispatchKeyUp(e){if(this._KeyLock)return!0;let t=!1;return this._FocusChild&&(t=this._FocusChild.DispatchKeyUp(e)),t||(t=this.OnKeyUp(e)),t}PrintLastFocusPage(){let e="------"+this.PageName+"\n",t=this._ParentPage;return t&&(e+=t.PrintLastFocusPage()),e}IsFocus(){return!this._ParentPage||this._ParentPage._FocusChild==this}_IsLeafInChain(){return this.IsFocus()&&!this._FocusChild}SetParent(e){null!=e?(this._ParentPage=e,e.SubPages.push(this)):s("ERROR: parent is null")}SetParentPage(e){this.SetParent(e)}OnRemoveFromTree(){if(this._ParentPage=null,this.SubPages&&this.SubPages.length>0){for(let e of this.SubPages)e.OnRemoveFromTree();this.SubPages=[]}}RemoveSubPage(e){e==this._FocusChild&&(this._FocusChild=null),e==this._LatestFocusChild&&(this._LatestFocusChild=null);for(let t=0;t<this.SubPages.length;t++)if(e==this.SubPages[t]){this.SubPages.splice(t,1);break}}ClearSubPages(){this.SubPages=[],this._FocusChild=null,this._LatestFocusChild=null}GetParentPage(){return this._ParentPage}Focus(e=!1){if(this.IsFocus()){if(!e)return void n("requestFocus(): Already focused name="+this.PageName);if(this._IsLeafInChain())return void n("requestFocus(): Already focused name="+this.PageName)}if(this._ParentPage){let t,i=[],n=this;for(;n._ParentPage&&!n.IsFocus();)i.push(n),n=n._ParentPage;t=e&&0==i.length?this._FocusChild:i[i.length-1]._ParentPage?._FocusChild;let a=[];for(;t;)a.push(t),t=t._FocusChild;for(let e=a.length-1;e>=0;e--)a[e]._BlurInternal();for(let e=i.length-1;e>=0;e--)i[e]._FocusInternal();if(e)this._LatestFocusChild=null;else{let e=i[0];for(;e._LatestFocusChild&&null==e._FocusChild;)e._LatestFocusChild._FocusInternal(),e=e._FocusChild,e||s("ERROR: focus chain is broken")}}}ReturnFocusToParent(){this._ParentPage&&(this.IsFocus()&&this._ParentPage.Focus(!0),this._ParentPage._FocusChild==this&&(this._ParentPage._FocusChild=null),this._ParentPage._LatestFocusChild==this&&(this._ParentPage._LatestFocusChild=null))}_FocusInternal(){this._ParentPage?(this._ParentPage._FocusChild=this,this._ParentPage._LatestFocusChild=this,this.OnFocus()):t("No dispatcher")}_BlurInternal(){this._ParentPage?this._ParentPage._FocusChild==this?(this._ParentPage._FocusChild=null,this.OnBlur()):i("Not focus yet, page name="+this.PageName):t("No dispacher")}GetFocusChild(){return this._FocusChild}OnFocus(){i("No overrided Page OnFocus event, page name="+this.PageName)}OnBlur(){i("No overrided Page OnBlur event, page name="+this.PageName)}KeyLock(){this._KeyLock=!0}UnKeyLock(){this._KeyLock=!1}}var j;!function(e){e.VIEW_COMMAND=0,e.TEXTURE_COMMAND=1,e.ANIM_COMMAND=2,e.SYNC_COMMAND=3,e.APIC_PLAY=0,e.APIC_STOP=1,e.GET_BOUNDING_RECT=0,e.FILTER_VIEW_WAVE=1,e.TRANSLATE_FRAME_ALT_SPEED=0,e.FREE_MOVE_RUN_CMDPACKS=1,e.EXE_DEFAULT=0,e.EXE_AFTER_RENDER=1}(j||(j={}));const z=(e,t)=>{let i=0,n=0,s=0;return isNaN(e)||(i|=1,n=e),isNaN(t)||(i|=2,s=t),{e:i,x:n,y:s}};var Y,X,Q;!function(e){e.ActEvent_ActFinish=1,e.ActEvent_Speed_X_Revert=2,e.ActEvent_Speed_Y_Revert=3,e.ActEvent_ActReject=4,e.ActEvent_ActDragStart=5,e.ActEvent_ActDragEnd=6,e.ActEvent_ActFlingStart=7,e.ActEvent_ActFlingProgress=8,e.ActEvent_ActFlingEnd=9,e.ActEvent_ActTouchDown=10,e.ActEvent_ActTouchRelease=11,e.ActEvent_ActFlingCancel=12,e.ActEvent_ActFlingDrop=13,e.ActEvent_MovementSync=14}(Y||(Y={})),function(e){e.GroupType_ActionAssoc=10,e.GroupType_Fling=11,e.GroupType_Invalid_Ext=65535}(X||(X={})),function(e){e.FLING_ON_PROGRESS_INTERVAL=200}(Q||(Q={}));const $=(e,t)=>{e.gtype=t.g,e.once=t.m?0:1;let i=t.s;i&&(e.name=i),e.brk=t.brk?1:0};const Z=51;function ee(e){return e?JSON.stringify(e.Package()):null}let te=new class{constructor(){this._NativeSyncer=w}CreateTranslate(e,t,i,n,s,a,r){s!=1/0&&null!=s||(console.warn("translate animation duration invalid="+s),s=0),this._NativeSyncer.CallToNative(1,[e,t,i,n,s,ee(a),r])}CreateRotate(e,t,i,n,s,a,r){s!=1/0&&null!=s||(console.warn("rotate animation duration invalid="+s),s=0),this._NativeSyncer.CallToNative(2,[e,t,i.x,i.y,i.z,n.x,n.y,n.z,s,ee(a),r])}CreateScale(e,t,i,n,s,a,r,o,l,h,c){l!=1/0&&null!=l||(console.warn("scale animation duration invalid="+l),l=0),this._NativeSyncer.CallToNative(3,[e,t,i,n,s,a,r,o,l,ee(h),c])}CreateTranslateFrame(e,t,i,n,s,a,r,o){this._NativeSyncer.CallToNative(5,[e,t,i,n,!!s,a,r,o])}CreateCssKeyframe(e,t,i,n,s,a){t!=1/0&&null!=t||(console.warn("css animation duration invalid="+t),t=0),this._NativeSyncer.CallToNative(6,[e,t,i,n,s,a])}CreateFreeMoveAnimation(e,t,i,n){this._NativeSyncer.CallToNative(7,[e,t?u.AddData(t):0,i,n?1:0])}CreateShaderAnimation(e,t,i){this._NativeSyncer.CallToNative(8,[e,t,i])}};class ie{constructor(){this.AnimNativeId=C.genAnimationId(),this._NativeSyncer=new E(this.AnimNativeId),this._ListenerObj=null,this._ListenerStatusCallback=null}SetAnimationListener(e){this._OnNewListener(e)}AddAnimationListener(e){this._ListenerObj&&e.AddInherit(this._ListenerObj),this._OnNewListener(e)}RemoveAnimationListener(){this._ListenerObj=null}Enable(e){this._NativeSyncer.CallToNative(2,[e])}EnableInfinite(){return this._NativeSyncer.CallToNative(3,null),this}SetRepeat(e){return this._NativeSyncer.CallToNative(5,[e]),this}EnableDelay(e){return this._NativeSyncer.CallToNative(4,[e]),this}SetStartPos(e){return e>=0&&e<=1?this._NativeSyncer.CallToNative(6,[e]):console.warn("Warning: SetStartPos() out of range"),this}_OnNewListener(e){let t=!0;if(this._ListenerObj&&(t=this._ListenerObj.ListenerEnabledFlags==e.ListenerEnabledFlags),this._ListenerObj=e,null!=this._ListenerObj&&(null==this._ListenerStatusCallback||!t)){let e=this;this._ListenerStatusCallback=t=>{e._ListenerObj?.InvokeFromNativeForge(t)};let t=u.AddData(this._ListenerStatusCallback);this._NativeSyncer.CallToNative(1,[t,this._ListenerObj.ListenerEnabledFlags])}}}var ne,se;!function(e){e.ReleaseAfterEndCallback=1,e.KeepTransform=2,e.AckFinalProgress=4,e.AckRepeat=8}(ne||(ne={})),function(e){e.AltSpeed=(e,t,i)=>{let n={S60:Math.floor(100*t/55)/100,T:i};e?.DispatchAnimCommand(j.TRANSLATE_FRAME_ALT_SPEED,JSON.stringify(n))},e.RunFreeMoveCmdPacks=(e,t)=>{e?.DispatchAnimCommand(j.FREE_MOVE_RUN_CMDPACKS,JSON.stringify(t))}}(se||(se={}));class ae{constructor(){this._MaskType="COMMON"}Type(){return this._MaskType}ToSyncJsonObj(e){return e||(e={}),e.typ=this._MaskType,e}}let re=new class{constructor(){this._InnerViews={},this._ViewToken=0}add(e){let t=e.view.ViewId;return this._InnerViews.hasOwnProperty(t)&&(this._InnerViews[t]=e),t}remove(e){this._InnerViews[e]&&delete this._InnerViews[e]}get(e){return this._InnerViews[e]}clear(){this._InnerViews={},this._ViewToken=0}};class oe{constructor(){this.SensorId=C.genViewId(),this._NativeSync=new L(this.SensorId),this.CreateSensor()}CreateSensor(){}CreateTypedSensor(e){k.CallToNative(1,[this.SensorId,e],!0)}Recycle(){this._NativeSync.CallToNative(1,null,!0)}}class le{constructor(e,t,i,n){this.Texture=e,this.MaskSetting=t,void 0===n&&(n=!0),this.HasAlpha=n}ToSyncJsonObj(e=void 0){return e||(e={}),e.texId=this.Texture?this.Texture.TexId:0,e.alpha=this.HasAlpha,this.MaskSetting?e.mask=this.MaskSetting.ToSyncJsonObj():e.mask=null,e}}var he;!function(e){var t,i,n;(t=e.ControlType||(e.ControlType={})).DoKeepInRender=1,t.RecycleKeptView=2,(i=e.SyncedType||(e.SyncedType={})).Synced=0,i.NotSynced=1,i.RequestKeepInRender=2,i.OnKeepingInRender=3,i.RecycleKeeping=4,(n=e.TextureCoordAnchor||(e.TextureCoordAnchor={})).LeftTop=1,n.CenterTop=2,n.RightTop=3,n.LeftMiddle=4,n.Center=5,n.RightMiddle=6,n.LeftBottom=7,n.CenterBottom=8,n.RightBottom=9}(he||(he={}));let ce=new class{constructor(){this._NativeSyncer=P}CreateNativeView(e,t,i){this._NativeSyncer.CallToNative(1,[e,t],i)}CreateJsRootView(e){this._NativeSyncer.CallToNative(2,[e])}CreateDomProxyView(e,t,i){this._NativeSyncer.CallToNative(3,[e,t,i?1:0],!0)}};class ue{constructor(e,t,i=!1){this.Visibility=void 0,this._NativeSyncer=new x(e),this.ViewId=e,this.TextureSetting=null,this._CallTextureSet=null,this._DomDepends=i,this._GetBCRCallback=null,this.CreateView(t)}CreateView(e=void 0){}ResetTexture(e=null){if(!this._CallTextureSet){this._CallTextureSet=this._NativeSyncer.CallToNative(1,null,this._DomDepends);let e=this;this._NativeSyncer.AddStartSyncCallback((()=>{this.TextureSetting?e._NativeSyncer.AlterCallParams(e._CallTextureSet,[e.TextureSetting.ToSyncJsonObj()]):e._NativeSyncer.AlterCallParams(e._CallTextureSet,[null]),e._CallTextureSet=null}))}this.TextureSetting=e}BindedPageBase(e){}SetVisibility(e){if("INHERIT"!==e&&void 0!==e||(e="VISIBLE"),this.Visibility!=e){this.Visibility=e;let t=0;switch(e){case"VISIBLE":t=1;break;case"GONE":t=2;break;case"HIDDEN":t=3;break;default:return void console.error("unknown visible type="+e)}this._NativeSyncer.CallToNative(2,[t],this._DomDepends)}}AddView(e,t){let i={x:0,y:0,width:0,height:0};t&&(i=this._FormatLayoutParams(t)),this._NativeSyncer.CallToNative(3,[e.ViewId,t?1:0,i.x,i.y,i.width,i.height],this._DomDepends)}ClearViews(){this._NativeSyncer.CallToNative(4,null,this._DomDepends)}ResetTextureCssTransform(e,t){e=e||"",t=t||"",this._NativeSyncer.CallToNative(5,[e,t],this._DomDepends)}SetTextureCoord(e,t,i,n,s=he.TextureCoordAnchor.Center){this._NativeSyncer.CallToNative(9,[e,t,i,n,s],this._DomDepends)}ResetLayoutParams(e){let t;null!=e?(t=this._FormatLayoutParams(e),this._NativeSyncer.CallToNative(6,[t.x,t.y,t.width,t.height],this._DomDepends)):s("ResetLayoutParams(): new params is null")}_FormatLayoutParams(e){return{x:isNaN(e.x)?0:e.x,y:isNaN(e.y)?0:e.y,width:isNaN(e.width)?0:e.width,height:isNaN(e.height)?0:e.height}}GetBoundingClientRect(){return new Promise(((e,t)=>{null!=this._GetBCRCallback&&(this._GetBCRCallback=null),this._GetBCRCallback=i=>{null!=this._GetBCRCallback&&(this._GetBCRCallback=null);const n=JSON.parse(i);0==n.status?e(n.data):t(n.error)};const i=u.AddData(this._GetBCRCallback);this._NativeSyncer.CallToNative(12,[i],this._DomDepends)}))}StartAnimation(e,t,i){let n=e?e.AnimNativeId:0;this._NativeSyncer.CallToNative(7,[n,isNaN(i)?0:i],this._DomDepends)}StopAnimation(){this._NativeSyncer.CallToNative(8,null,this._DomDepends)}DispatchAnimCommand(e,t){this._NativeSyncer.CallToNative(13,[e,t],this._DomDepends)}StartTextureAnimation(e){let t=e?e.AnimNativeId:0;this._NativeSyncer.CallToNative(10,[t],this._DomDepends)}StopTextureAnimation(){this._NativeSyncer.CallToNative(11,null,this._DomDepends)}DragEnables(e){this._NativeSyncer.CallToNative(14,[e],this._DomDepends)}SetTapListener(e=void 0){if(null!=e){const t=u.AddData(e);this._NativeSyncer.CallToNative(15,[t],this._DomDepends)}else this._NativeSyncer.CallToNative(15,[0],this._DomDepends)}EnableAutoSize(){this._NativeSyncer.CallToNative(16,[],this._DomDepends)}RegisterFlexAssigned(e=void 0){if(null!=e){const t=u.AddData(e);this._NativeSyncer.CallToNative(17,[t],this._DomDepends)}else this._NativeSyncer.CallToNative(17,[0],this._DomDepends)}EnableVisibleTestRect(){this._NativeSyncer.CallToNative(18,[],this._DomDepends)}Capture2Texture(e,t=void 0){if(!e)return void console.error("Error: Capture2Texture need target texture");let i=e.GetTextureId();if(!t)return void console.error("Error: Capture2Texture need callback");const n=u.AddData(t);this._NativeSyncer.CallToNative(19,[i,n],this._DomDepends)}}class de extends ue{constructor(e=null){!e||e instanceof le||s("ERROR:LayoutView need TextureSetting as parameter"),super(C.genViewId(),{DomDepends:!1}),this.Visibility="VISIBLE",e&&this.ResetTexture(e)}CreateView(e){ce.CreateNativeView(this.ViewId,0,e.DomDepends)}}function _e(e){let t=[];if(e instanceof Array)for(let i of e)i instanceof ue&&t.push(i.ViewId);return t}class Se extends oe{constructor(e,t,i,n){super(),this.InitSet(e,t,i,n)}CreateSensor(){this.CreateTypedSensor(3)}InitSet(e,t,i,n){let s=0;i&&(s=u.AddData((e=>{1==e?i.OnBeginContact?.():2==e&&i.OnEndContact?.()}))),this._NativeSync.CallToNative(20,[e.ViewId,t.ViewId,s,n?n.SensorId:0],!0)}}let pe={StartTrace:(e,t,i,n)=>new Se(e,t,i,n),Callback:class{constructor(e,t){this.OnBeginContact=e,this.OnEndContact=t}UpdateImpactCallback(e){this.OnBeginContact=e}UpdateLeaveCallback(e){this.OnEndContact=e}},AutoFroze:class extends oe{constructor(e,t){super(),this.InitSet(),this._UpdatePreImpactList(_e(e)),this._UpdateOnImpactList(_e(t)),this._FreshAutoRecycleRef()}CreateSensor(){this.CreateTypedSensor(2)}InitSet(){this._NativeSync.CallToNative(25,null,!0)}UpdatePreImpactList(e){this._UpdatePreImpactList(_e(e)),this._FreshAutoRecycleRef()}UpdateOnImpactList(e){this._UpdateOnImpactList(_e(e)),this._FreshAutoRecycleRef()}_UpdatePreImpactList(e){this._NativeSync.CallToNative(26,[...e],!0)}_UpdateOnImpactList(e){this._NativeSync.CallToNative(27,[...e],!0)}_FreshAutoRecycleRef(){this._NativeSync.CallToNative(28,null,!0)}}};var ye;!function(e){e[e.NONE=0]="NONE",e[e.TEXT=1]="TEXT",e[e.PASSWORD=2]="PASSWORD",e[e.TEXT_AREA=3]="TEXT_AREA",e[e.CONTENT_EDITABLE=4]="CONTENT_EDITABLE",e[e.SEARCH=5]="SEARCH",e[e.URL=6]="URL",e[e.EMAIL=7]="EMAIL",e[e.TELEPHONE=8]="TELEPHONE",e[e.NUMBER=9]="NUMBER"}(ye||(ye={}));var ve,me;!function(e){var t;(t=e.UniformType||(e.UniformType={}))[t.FLOAT=1]="FLOAT"}(ve||(ve={})),function(e){var t,i;(t=e.Type||(e.Type={}))[t.GRAY_DOWN=1]="GRAY_DOWN",t[t.WAVE=2]="WAVE",(i=e.Wave||(e.Wave={}))[i.CIRCLE_WAVE=1]="CIRCLE_WAVE",i[i.RECTANGLE_WAVE=2]="RECTANGLE_WAVE"}(me||(me={}));let Ce=0;class fe{constructor(){this.sourceList=[]}addSource(e,t,i,n,s){n=n??{type:me.Wave.CIRCLE_WAVE},s=s??{timeDecay:3,distanceDecay:10,speed:100,frequency:8,waveNum:2};const a=++Ce;let r=0,o=0,l=0;return n.type==me.Wave.RECTANGLE_WAVE&&(r=n.width,o=n.height,l=n.radius),this.sourceList.push(a,e,t,i,r,o,l,s.timeDecay,s.distanceDecay,s.speed,s.frequency,s.waveNum),a}getSourceList(){const e=this.sourceList;return this.sourceList=[],e}}class Ie extends ue{constructor(e,t){super(C.genViewId(),{DomElementId:e,UseMaskView:t},!0),this.Visibility="VISIBLE"}CreateView(e){ce.CreateDomProxyView(this.ViewId,e.DomElementId,e.UseMaskView)}RegisterOnProxyReady(e){e?.()}}function Te(e){return isNaN(e)?0:parseInt(e)}function Ne(e){return{fontFamily:e.fontFamily?e.fontFamily:be.sDefaultFont,fontSize:Te(e.fontSize),italic:"italic"===e.fontStyle,bold:"bold"===e.fontWeight,hasEmoji:1==e.JsvTextEmoji}}function ge(){return e.sRenderBridge.GetTextToolsApi()}function Ae(e,t){let i=Ne(t);return ge().GetTextWidth(e,JSON.stringify(i))}function Re(e,t){let i=Ne(t);const n=ge().GetOneLineTextDrawWidth(e,JSON.stringify(i)),s={totalWidth:n[0],sliceInfo:[]};for(let e=1;e<n.length;e+=3)s.sliceInfo.push({start:n[e],end:n[e+1],width:n[4]});return s}function we(e,t,i,n,s,a){let r;if(e>0)r=ge().GetCursorPosition(e,t,null,null,null,1);else{let o=Ne(n),l=function(e){let t=Te(e.height),i=Te(e.lineHeight),n="string"==typeof e.wordWrap?e.wordWrap:"none";return"nowrap"==e.whiteSpace&&(n="none"),{width:Te(e.width),height:t,textAlign:"string"==typeof e.textAlign?e.textAlign:"left",lineHeight:0==i?t:i,wordWrap:n,textOverflow:"string"==typeof e.textOverflow?e.textOverflow:"clip"}}(s);r=ge().GetCursorPosition(e,t,i,JSON.stringify(o),JSON.stringify(l),a?1:0)}return r}function Ee(e){ge().RemoveCursorTextCache(e)}var be;!function(e){e.sDefaultFont="黑体",e.sDefaultFontSize=30,e.sDefaultFontColor="#FFFFFF",e.sDefaultBackgroundColor="rgba(0, 0, 0, 0)",e.GetTextWidth=Ae,e.GetOneLineTextDrawWidth=Re,e.GetCursorPosition=we,e.RemoveCursorTextCache=Ee}(be||(be={}));let De=e;De.Run=function(e){return B=new K,B.Init(e),B},De.InitStarter=function(t,i){e.DesignMap=i,U=t,H=i},De.NewDomProxyView=function(e,t){return new Ie(e,t)},De.sFrameCount=g,De.NativeConstant=j,De.PageBase=J,De.ReactActivity=class extends J{constructor(e,t){super(e),this._TextureManager=t.GetTextureManager()}GetTextureManager(){return this._TextureManager}SetContentView(e,t){this._ContentView=e,this._ContentViewSize=t}},De.ViewTextureMask=class extends ae{constructor(e){super(),this._MaskType="TEXTURE",this.ImageTexture=e}ToSyncJsonObj(e){return e||(e={}),e.texId=this.ImageTexture.TexId,super.ToSyncJsonObj(e)}},De.ViewRoundCornerMask=class extends ae{constructor(e,t,i,n){super(),this._MaskType="CORNER",this._TopLeft=e,this._TopRight=isNaN(t)?e:t,this._BottomLeft=isNaN(i)?e:i,this._BottomRight=isNaN(n)?e:n}ToSyncJsonObj(e){return e||(e={}),e.tl=this._TopLeft,e.tr=this._TopRight,e.bl=this._BottomLeft,e.br=this._BottomRight,super.ToSyncJsonObj(e)}},De.sViewStore=re,De.ViewInfo=class{constructor(e,t){this.view=e,this.layout_params=t}},De.LayoutView=de,De.AutoStretchView=class extends de{constructor(e=null){super(e)}CreateView(e){ce.CreateNativeView(this.ViewId,12,e.DomDepends)}},De.EditControlView=class extends de{constructor(t=null){super(t),this._AppListeners=null,this._ImeSyncFunc=this._ImeEventListener.bind(this),this._MsgToken="_JscIme_"+this.ViewId,e.sRenderBridge.GetPlatformMsgDisp().subscribe(this._MsgToken,this._ImeSyncFunc)}CreateView(e){ce.CreateNativeView(this.ViewId,5,e.DomDepends)}releaseResource(){e.sRenderBridge.GetPlatformMsgDisp().unsubscribe(this._MsgToken,this._ImeSyncFunc)}setEditorStyle(e,t,i,n){this._NativeSyncer.CallToNative(5005,[e,t,i,n],this._DomDepends)}showIme(e,t,i,n,s){e!=ye.NONE?(void 0!==i&&null!=i||(i=t.length>0?t.length:0),i<0?i=0:i>t.length&&(i=t.length>0?t.length:0),this._NativeSyncer.CallToNative(5001,[e,encodeURIComponent(t),i,n,s],this._DomDepends)):console.log("showIme inputType error")}hideIme(){this._NativeSyncer.CallToNative(5002,null,this._DomDepends)}updateCursorOffset(e,t,i,n){this._NativeSyncer.CallToNative(5003,[e,t,i,n],this._DomDepends)}addImeEventListener(e){this._AppListeners=e}_OnStatusFromPlatform(e){this._NativeSyncer.CallToNative(5006,[e],this._DomDepends)}_ImeEventListener(e){if(e){var t=JSON.parse(e);if("text"==t.type){var i=t.text;let e=t.selectStart,n=t.scrollLeft,s=t.scrollTop;this._AppListeners?.OnTextChanged(decodeURIComponent(i),e,n,s)}else if("vstatus"==t.type){let e=t.isVisible?1:0;this._OnStatusFromPlatform(e),this._AppListeners?.OnStatusChanged(e)}else if("action"==t.type){var n=t.action;this._AppListeners?.OnEditAction(n)}}else console.log("EditControlView","_ImeEventListener input_data error")}},De.FilterView=class extends de{constructor(e=null,t){super(e),this._Type=t??me.Type.GRAY_DOWN,this._NativeSyncer.CallToNative(10002,[this._Type,[]],this._DomDepends)}CreateView(e){ce.CreateNativeView(this.ViewId,10,e.DomDepends)}FilterSwitch(e){this._NativeSyncer.CallToNative(10001,[e],this._DomDepends)}AddWaveSourceList(e){if(this._Type==me.Type.WAVE){const t={T:1,L:e.getSourceList()};this.DispatchCommand(j.FILTER_VIEW_WAVE,JSON.stringify(t))}else console.error("FilterView error: add wave source while filter view type is GRAY_DOWN.")}AddWaveSourceSingle(e,t,i,n={type:me.Wave.CIRCLE_WAVE},s={timeDecay:3,distanceDecay:10,speed:100,frequency:8,waveNum:2}){if(this._Type==me.Type.WAVE){const a=new fe,r=a.addSource(e,t,i,n,s);return this.AddWaveSourceList(a),r}return console.error("FilterView error: add wave source while filter view type is GRAY_DOWN."),-1}RemoveSource(e){if(this._Type==me.Type.WAVE){const t={T:2,L:e instanceof Array?e:[e]};this.DispatchCommand(j.FILTER_VIEW_WAVE,JSON.stringify(t))}else console.error("FilterView error: remove wave source while filter view type is GRAY_DOWN.")}DispatchCommand(e,t){t&&this._NativeSyncer.CallToNative(10003,[e,t],this._DomDepends)}},De.FragShaderView=class extends de{constructor(e=null){super(e)}CreateView(e){ce.CreateNativeView(this.ViewId,11,e.DomDepends)}SetShaderInfo(e,t,i,n){const s={shaderStr:e,uniformParams:t,textureParams:i};let a=0;null!=n&&(a=u.AddData(n)),this._NativeSyncer.CallToNative(7001,[JSON.stringify(s),a],this._DomDepends)}},De.NativeSharedView=class extends de{constructor(e){super(e),this._JsContextId=window.JsView?window.JsView.getJsContextId():0,this._TrackId=null,this.SetTrackId(this._JsContextId+"_"+this.ViewId)}CreateView(e){ce.CreateNativeView(this.ViewId,9,e.DomDepends)}GetTrackId(){return this._TrackId}SetTrackId(e){this._TrackId=e,this._NativeSyncer.CallToNative(10101,[this._TrackId],this._DomDepends)}SetOverSize(e){this._NativeSyncer.CallToNative(10102,[isNaN(e)?0:e],this._DomDepends)}},De.NinePatchView=class extends de{CreateView(e){ce.CreateNativeView(this.ViewId,4,e.DomDepends)}SetRepeat(e,t){this._NativeSyncer.CallToNative(4001,[e,t],this._DomDepends)}SetPadding(e,t){this._NativeSyncer.CallToNative(4002,[e,t],this._DomDepends)}SetImageDspSize(e,t){this._NativeSyncer.CallToNative(4003,[e,t],this._DomDepends)}SetDesignMapWidth(e){this._NativeSyncer.CallToNative(4004,[e],this._DomDepends)}EnableAlphaMix(e){this._NativeSyncer.CallToNative(4005,[e.TexId],this._DomDepends)}},De.PreloadView=class extends de{constructor(e=null){super(e)}CreateView(e){ce.CreateNativeView(this.ViewId,7,e.DomDepends)}},De.SprayView=class extends de{constructor(e=null){super(e),this.onStop=null}SetSprayInfo(e,t,i,n,s,a,r,o,l,h,c,u,d,_,S,p,y,v,m,C,f,I,T){this._NativeSyncer.CallToNative(6001,[e,t,i,n,s,a,r,o,l,h,c,u,d,_,!!S,!!p,!!y,v,m,C,f,I,T],this._DomDepends)}CreateView(e){ce.CreateNativeView(this.ViewId,6,e.DomDepends)}Start(){this._NativeSyncer.CallToNative(6002,[],this._DomDepends)}Stop(e=!1){this._NativeSyncer.CallToNative(6003,[e],this._DomDepends)}RegisterOnStop(e){this.onStop=e}_OnEvent(e){try{if("onStop"===JSON.parse(e).type)this.onStop?.()}catch(e){console.error("SprayView onEvent error",e)}}RegisterEventListener(){const e=u.AddData(this._OnEvent.bind(this));this._NativeSyncer.CallToNative(6004,[e])}},De.TextInputType=ye,De.FilterViewType=me,De.TextureSetting=le,De.ExternalTextureSetting=le,De.TextUtils=be,De.VisibleSensor=class extends oe{constructor(e,t=null){super(),this.InitSet(e,t)}CreateSensor(){this.CreateTypedSensor(1)}InitSet(e,t){let i=0;t&&(i=u.AddData(((e,i,n,s)=>{t(1==e,1==i,1==n,1==s)}))),this._NativeSync.CallToNative(11,[e.ViewId,i],!0)}ResetArea(e){"number"!=typeof e.horizon&&(console.log("horizon not set, default to 1.0"),e.horizon=1),"number"!=typeof e.vertical&&(console.log("vertical not set, default to 1.0"),e.vertical=1),this._NativeSync.CallToNative(12,[e.horizon,e.vertical],!0)}Enable(e){this._NativeSync.CallToNative(13,[!!e],!0)}ResetContainer(e){let t;t=e?e.ViewId:0,this._NativeSync.CallToNative(14,[t],!0)}},De.EnvBlockerSensor=class extends oe{constructor(e){super(),this.InitSet(e)}CreateSensor(){this.CreateTypedSensor(4)}InitSet(e){this._NativeSync.CallToNative(30,[e.ViewId],!0)}ResetTopGID(e){this._ResetSideGID(0,e)}ResetBottomGID(e){this._ResetSideGID(1,e)}ResetLeftGID(e){this._ResetSideGID(2,e)}ResetRightGID(e){this._ResetSideGID(3,e)}_ResetSideGID(e,t){this._NativeSync.CallToNative(31,[e,isNaN(t)?0:parseInt(t)],!0)}Enable(e){this._NativeSync.CallToNative(32,[e],!0)}},De.sImpactSensorManager=pe,De.TextureInstantLoad=T,De.QRCodeLevel=I,De.ColorSpace=f,De.TextureManager=N,De.FreeMoveExternType=X,De.AnimationListener=class{constructor(e,t,i){this.ListenerEnabledFlags=0,this.InvokeAnimationStart=e,this._OnAnimationStart=e,e&&(this.ListenerEnabledFlags|=1),this.InvokeAnimationEnd=t,this._OnAnimationEnd=t,t&&(this.ListenerEnabledFlags|=2),this.InvokeViewNoVisible=i,this._OnViewNoVisible=i,i&&(this.ListenerEnabledFlags|=4),this.InvokeAnimRepeat=null,this._OnAnimRepeat=null,this.InvokeAnimFinal=null,this._OnAnimFinal=null,this._AttachedGroup=null,this._InheritListener=[]}OnStart(e){return this.InvokeAnimationStart=this._OnAnimationStart=e,e?this.ListenerEnabledFlags|=1:this.ListenerEnabledFlags&=30,this}OnEnd(e){return this.InvokeAnimationEnd=this._OnAnimationEnd=e,e?this.ListenerEnabledFlags|=2:this.ListenerEnabledFlags&=29,this}OnRepeat(e){return this.InvokeAnimRepeat=this._OnAnimRepeat=e,e?this.ListenerEnabledFlags|=8:this.ListenerEnabledFlags&=23,this}OnFinalProgress(e){return this.InvokeAnimFinal=this._OnAnimFinal=e,e?this.ListenerEnabledFlags|=16:this.ListenerEnabledFlags&=15,this}AddInherit(e){if(e){if(0==this._InheritListener.length){var t=this;this.InvokeAnimationStart=function(){t._OnAnimationStart&&t._OnAnimationStart();for(var e=0;e<t._InheritListener.length;e++)t._InheritListener[e].InvokeAnimationStart?.()},this.InvokeAnimationEnd=function(e){t._OnAnimationEnd&&t._OnAnimationEnd(e);for(var i=0;i<t._InheritListener.length;i++)t._InheritListener[i].InvokeAnimationEnd?.(e)},this.InvokeViewNoVisible=function(){t._OnViewNoVisible&&t._OnViewNoVisible();for(var e=0;e<t._InheritListener.length;e++)t._InheritListener[e].InvokeViewNoVisible?.()},this.InvokeAnimFinal=function(e){t._OnAnimFinal&&t._OnAnimFinal(e);for(var i=0;i<t._InheritListener.length;i++)t._InheritListener[i].InvokeAnimFinal?.(e)},this.InvokeAnimRepeat=function(e){t._OnAnimRepeat&&t._OnAnimRepeat(e);for(var i=0;i<t._InheritListener.length;i++)t._InheritListener[i].InvokeAnimRepeat?.(e)},this.ListenerEnabledFlags=31}this._InheritListener.push(e)}}InvokeFromNativeForge(e){switch(e.type){case"end":this.InvokeAnimationEnd?.(1==e.normalEnd);break;case"novisible":this.InvokeViewNoVisible?.();break;case"final":this.InvokeAnimFinal?.(e.progress);break;case"repeat":this.InvokeAnimRepeat?.(e.timesCount)}}},De.AnimFireCommand=se,De.AnimationEnable=ne,De.TranslateAnimation=class extends ie{constructor(e,t,i,n,s,a){super(),te.CreateTranslate(e,t,i,n,s,a,this.AnimNativeId)}},De.RotateAnimation=class extends ie{constructor(e,t,i,n,s,a){super(),te.CreateRotate(e,t,i,n,s,a,this.AnimNativeId)}},De.ScaleAnimation=class extends ie{constructor(e,t,i,n,s,a,r,o,l=200,h=200){super(),te.CreateScale(e,t,i,n,s,a,l,h,r,o,this.AnimNativeId)}},De.TranslateFrameAnimation=class extends ie{constructor(e,t,i,n,s,a){super();let r=Math.floor(100*i/55)/100;te.CreateTranslateFrame(e,t,r,r,n,s,a,this.AnimNativeId)}},De.CssKeyframeAnimation=class extends ie{constructor(e,t,i,n,s){super(),te.CreateCssKeyframe(e,t,i,n,s,this.AnimNativeId)}},De.ShaderAnimation=class extends ie{constructor(e,t){super(),te.CreateShaderAnimation(e,t,this.AnimNativeId)}},De.FreeMoveAnimation=class extends ie{constructor(e,t,i){super(),this._EchoCallback=e,te.CreateFreeMoveAnimation(this.AnimNativeId,e,t,i)}},De.FreeMoveActEvtType=Y,De.FreeMoveCmdPackBuilder=class{static InitActCmdPack(e,t,i,n){return{t:1,cmds:n,tkn:isNaN(i)?0:i,spd:isNaN(e)?0:e,acc:isNaN(t)?0:t}}static InitStateCmdPack(e){return{t:2,cmd:e}}},De.FreeMoveConditionSet=class{static AppendSubCmd(e,t){const i="cmds";e.hasOwnProperty("cmdPacks")?console.error("Error: conflict with command pack list"):(e.hasOwnProperty(i)||(e[i]=[]),e[i]?.push(t))}static SetCmdList(e,t){t instanceof Array&&(e.hasOwnProperty("cmdPacks")?console.error("Error: conflict with command pack list"):e.cmds=t)}static SetCmdPackList(e,t){t instanceof Array&&(e.hasOwnProperty("cmds")?console.error("Error: conflict with sub-command list"):e.cmdPacks=t)}static InitCommonInfo(){return{g:0,m:!1,s:null,brk:!1}}static UpdateCommonInfo(e,t,i,n,s){e.g=t??0,e.m=i??!1,e.s=n??null,e.brk=s}static ReachPosition(e,t,i){let n=z(e,t),s={subt:1,react:1,e:n.e,xv:n.x,yv:n.y};return $(s,i),s}static AcrossPosition(e,t,i){let n=z(e,t),s={subt:1,react:2,e:n.e,xv:n.x,yv:n.y};return $(s,i),s}static BoxPosition(e,t,i,n,s){let a=0,r=0,o=0,l=0,h=0;isNaN(e)||(a=e,h|=1),isNaN(t)||(r=t,h|=2),isNaN(i)||(o=i,h|=4),isNaN(n)||(l=n,h|=8);let c={subt:1,react:7,de:h,lv:a,tv:r,rv:o,bv:l};return $(c,s),c}static StartMove(e,t){return this.OnMovement(t,1,1,e)}static OnMovement(e,t,i,n){let s={subt:1,react:9,xv:t,yv:i,e:n};return $(s,e),s}static OffsetPosition(e,t,i,n,s){let a=0,r=0,o=0,l=0,h=0;isNaN(e)||(a=e,h|=1),isNaN(t)||(r=t,h|=2),isNaN(i)||(o=i,h|=4),isNaN(n)||(l=n,h|=8);let c={subt:1,react:8,de:h,lv:a,tv:r,rv:o,bv:l};return $(c,s),c}static WallPosition(e,t,i,n){let s,a=z(t,i);switch(e){case"left":s=4;break;case"top":s=3;break;case"right":s=5;break;case"bottom":s=6;break;default:return console.error("WallPosition undefined direction",e),null}let r={subt:1,react:s,e:a.e,xv:a.x,yv:a.y};return $(r,n),r}static ReachSpeed(e,t,i){let n=z(e,t),s={subt:2,react:1,e:n.e,xv:n.x,yv:n.y};return $(s,i),s}static AcrossSpeed(e,t,i){let n=z(e,t),s={subt:2,react:2,e:n.e,xv:n.x,yv:n.y};return $(s,i),s}static TouchCount(e,t){let i={subt:5,react:2,tct:t};return $(i,e),i}static OnNexusEvent(e,t,i){let n={subt:3,nexus:e,etyp:t};return $(n,i),n}static OnDragStart(e,t){let i={subt:3,nexus:t,etyp:Y.ActEvent_ActDragStart};return $(i,e),i}static OnDragEnd(e,t){let i={subt:3,nexus:t,etyp:Y.ActEvent_ActDragEnd};return $(i,e),i}static OnTouchDown(e,t){let i={subt:3,nexus:t,etyp:Y.ActEvent_ActTouchDown};return $(i,e),i}static OnTouchRelease(e,t){let i={subt:3,nexus:t,etyp:Y.ActEvent_ActTouchRelease};return $(i,e),i}static OnFlingStart(e,t){let i={subt:3,nexus:t,etyp:Y.ActEvent_ActFlingStart};return $(i,e),i}static OnFlingProgress(e,t){let i={subt:3,nexus:t,etyp:Y.ActEvent_ActFlingProgress};return $(i,e),i}static OnFlingEnd(e,t){let i={subt:3,nexus:t,etyp:Y.ActEvent_ActFlingEnd};return $(i,e),i}static OnFlingCancel(e,t){let i={subt:3,nexus:t,etyp:Y.ActEvent_ActFlingCancel};return $(i,e),i}static OnFlingDrop(e,t){let i={subt:3,nexus:t,etyp:Y.ActEvent_ActFlingDrop};return $(i,e),i}static OnHitBlock(e,t){let i={subt:4,blkGid:e};return $(i,t),i}static OnNextTick(e,t){let i={subt:5,react:1,tgap:e};return t.m=!1,$(i,t),i}static MovementSyncNexus(e,t){let i={subt:3,nexus:t,etyp:Y.ActEvent_MovementSync};return $(i,e),i}},De.FreeMoveActionBuilder=class{static SetSpeed(e,t){let i=z(e,t);return{typ:2,set:{xv:i.x,yv:i.y,xye:i.e}}}static SetAccel(e,t){let i=z(e,t);return{typ:7,set:{xye:i.e,xv:i.x,yv:i.y}}}static AltSpeed(e,t,i){if(!i)return null;let n=z(e,t);return{typ:5,set:{xv:n.x,yv:n.y,xye:n.e,tim:Math.floor(i)}}}static StopMoving(){return{typ:3}}static StopMovingExact(){return{typ:9}}static BrakeToPos(e,t){let i=z(e,t);return{typ:4,set:{xv:Math.floor(i.x),yv:Math.floor(i.y),xye:i.e}}}static SetArrowSpeed(e,t,i,n){let s=z(e,t),a=z(i,n);return{typ:6,set:{xye:s.e,xv:Math.floor(s.x),yv:Math.floor(s.y),xye1:a.e,xv1:a.x,yv1:a.y}}}static TeleportTo(e,t,i){let n=z(e,t);return{typ:8,set:{xye:n.e,xv:Math.floor(n.x),yv:Math.floor(n.y),isAbs:!i}}}static AckMovementSync(e,t,i,n,s,a){return{typ:10,set:{hstart:e,hend:t,vstart:i,vend:n,xye:s,st:a}}}},De.FreeMoveStateBuilder=class{static FireEcho(e){return{typ:52,set:{tkn:e}}}static FireNexusEvent(e,t){return isNaN(t)||0==t?null:{typ:55,set:{etyp:isNaN(e)?0:e,nexus:t}}}static NewCondition(e){return{typ:Z,set:{sub:1,set:e}}}static DelActionAssocCondition(){return{typ:Z,set:{sub:5}}}static RemoveAllCondtions(){return{typ:Z,set:{sub:6}}}static RemoveByGroup(e){return{typ:Z,set:{sub:4,gt:e}}}static RemoveByName(e){return{typ:Z,set:{sub:7,sn:e}}}static ActiveCondition(e,t){return{typ:Z,set:{sub:2,gt:isNaN(e)||e<=0?X.GroupType_Invalid_Ext:e,sn:t}}}static DeactiveCondition(e,t){return{typ:Z,set:{sub:3,gt:isNaN(e)||e<=0?X.GroupType_Invalid_Ext:e,sn:t}}}static SetOffsetPos(e,t){let i=z(e,t);return{typ:53,set:{xv:Math.floor(i.x),yv:Math.floor(i.y),xye:i.e}}}static SetPos(e,t){let i=z(e,t);return{typ:54,set:{xv:Math.floor(i.x),yv:Math.floor(i.y),xye:i.e}}}static TouchLockSwitch(e,t,i=-1){return{typ:59,set:{il:e,dir:t,ut:i}}}static SetTouchAttractChild(e){return{typ:60,set:{cid:e?e.AnimNativeId:0}}}static SetHitWallOverflow(){return{typ:56}}static RevertWithHitBlock(){return{typ:57}}static StartMovementSync(e,t,i,n,s,a){return{typ:61,set:{hstart:t,hend:i,vstart:n,vend:s,xye:a,nexus:e}}}static StopMovementSync(){return{typ:62}}};
1
+ /* eslint-disable */ let e={sRenderBridge:null,sActivityManager:null,DesignMap:null};window.Forge=e;let t=function(e){},i=function(e){},n=function(e){},s=function(e){throw new Error(e)};class a{constructor(){this._EnqueueInfoList=[],this._EnqueueObjList=[],this._OnStartSyncCallback=[],this._AlterIdCandidateMap={}}RequestAlterId(e,t){this._AlterIdCandidateMap[e]=t}AddToQueue(e,t){this._EnqueueInfoList.push(t),this._EnqueueObjList.push(e)}HasUpdate(){return this._EnqueueInfoList.length>0}ReadSyncList(){if(this._OnStartSyncCallback.length>0){for(let e of this._OnStartSyncCallback)e();this._OnStartSyncCallback=[]}let e=this._EnqueueInfoList;return this.RenewSyncList(),e}AddStartSyncCallback(e){this._OnStartSyncCallback.push(e)}RenewSyncList(){if(this._EnqueueObjList)for(let e of this._EnqueueObjList)e.RenewSyncInfo(this,null);this._EnqueueInfoList=[],this._EnqueueObjList=[]}ProcAlterIds(e,t){for(let i=0;i<e.length;i++)if(this._AlterIdCandidateMap.hasOwnProperty(e[i])){let n=this._AlterIdCandidateMap[e[i]];n.OnAlterId(t[i]),n.RenewSyncInfo(this,null)}else console.error(`Error: ProcAlterIds not found proxyId=${e[i]}`);this._AlterIdCandidateMap={}}}class r{constructor(e,t=null,i=null){this._PrefSyncListRef=e,this.PrefSyncInfo=null,this._PrefTaskList=null,this._PrefEnqueued=!1,this._SuffSyncListRef=t,this.SuffSyncInfo=null,this._SuffTaskList=null,this._SuffEnqueued=!1,this.InitPackage(i),this.RenewSyncInfo(this._PrefSyncListRef,null),this.RenewSyncInfo(this._SuffSyncListRef,null)}AddStartSyncCallback(e){this._PrefSyncListRef.AddStartSyncCallback(e)}CallToNative(t,i,n=!1){let s={fn:t,a:i};return n?(this._SuffTaskList.push(s),this._SuffEnqueued||(this._SuffSyncListRef.AddToQueue(this,this.SuffSyncInfo),this._SuffEnqueued=!0)):(this._PrefTaskList.push(s),this._PrefEnqueued||(this._PrefSyncListRef.AddToQueue(this,this.PrefSyncInfo),this._PrefEnqueued=!0)),e.sRenderBridge.RequestSwap(),s}RequestAlterId(e,t=!1){t?this._SuffSyncListRef.RequestAlterId(e,this):this._PrefSyncListRef.RequestAlterId(e,this)}SuffCallToNative(e,t){return{fn:e,a:t}}AlterCallParams(e,t){e&&(e.a=t)}RenewSyncInfo(e,t){t||(t={}),this._PrefEnqueued=!1,this._SuffEnqueued=!1,e&&e==this._PrefSyncListRef&&(this._PrefTaskList=[],this.PrefSyncInfo={tl:this._PrefTaskList,...t}),e&&e==this._SuffSyncListRef&&(this._SuffTaskList=[],this.SuffSyncInfo={tl:this._SuffTaskList,...t})}InitPackage(e){}OnAlterId(e){}}let o=new a,l=new a;class h extends r{constructor(e){super(o,l,{id:e}),this._TextureRef=null,this._RenderTextureId=e}InitPackage(e){this._RenderTextureId=e.id}RenewSyncInfo(e,t){super.RenewSyncInfo(e,{tt:1,id:this._RenderTextureId})}NeedAlterId(e,t){this._TextureRef=e,super.RequestAlterId(this._RenderTextureId,t)}OnAlterId(e){this._RenderTextureId=e,this._TextureRef.TexId=e,this._TextureRef=null}}let c=new class extends r{constructor(){super(o,l)}RenewSyncInfo(e,t){super.RenewSyncInfo(e,{tt:0})}};let u=new class{constructor(){this._StoreArray=[1]}AddData(e){return this._StoreArray.push(e),this._StoreArray.length-1}TakeArray(){const e=this._StoreArray;return this._StoreArray=[1],e}PickArray(){return this._StoreArray}GetSize(){return this._StoreArray.length}ResetForNextSwap(){this._StoreArray=[1]}};let d=1;class _{constructor(e,t,i=!1){this._NativeSyncer=t,this.TexId=e,this._TextureReady=!1,this._TextureWidth=0,this._TextureHeight=0,this._InnerLoadCallback=null,this._CallbackMap={},this._DomDepends=i}GetTextureId(){return this.TexId}RequestSyncerAlterId(){this._NativeSyncer.NeedAlterId(this,this._DomDepends)}RegisterLoadImageCallback(e,t,i){if(null==t)return 0;if(this._TextureReady)return t({width:this._TextureWidth,height:this._TextureHeight},i),0;{this._RegisterInnerLoadCallback();const e=d++,n=this,s=(s,a,r)=>{t({width:s,height:a,extra:r?JSON.parse(r):null},i),delete n._CallbackMap[e]};this._CallbackMap[e]=s;const a=u.AddData(s);return this._NativeSyncer.CallToNative(1,[e,a],this._DomDepends),e}}UnregisterLoadImageCallback(e){e>0&&void 0!==this._CallbackMap[e]&&delete this._CallbackMap[e]}DispatchCommand(t,i){this._NativeSyncer.CallToNative(3,[t,i],this._DomDepends),e.sRenderBridge.RequestSwap()}_RegisterInnerLoadCallback(){if(null==this._InnerLoadCallback){const e=this;this._InnerLoadCallback=(t,i,n)=>{e._TextureReady=!0,e._TextureWidth=t,e._TextureHeight=i};const t=u.AddData(this._InnerLoadCallback);this._NativeSyncer.CallToNative(1,[d++,t],this._DomDepends)}}EnableBackgroundLoad(){this._TextureReady||(this._RegisterInnerLoadCallback(),this._NativeSyncer.CallToNative(4,null,this._DomDepends))}DisableBackgroundLoad(){this._NativeSyncer.CallToNative(5,null,this._DomDepends)}RequestToUnload(){this._NativeSyncer.CallToNative(6,null,this._DomDepends)}DisableAutoRecycle(){this._NativeSyncer.CallToNative(7,null,this._DomDepends)}}class S extends _{constructor(e,t,i=!1){super(e,t,i),this._GifTextureInfo=null}registerOnStart(e){this._EnableGifTextureInfo();let t=this._GifTextureInfo,i=++t.IdGen;if(t.StartMapCount++,t.StartMapCount>0&&0==t.GlobalStartCallbackId){t.GlobalStartCallbackId=i;const e=()=>{for(let e in t.OnStartMap)t.OnStartMap[e]?.()},n=u.AddData(e);this._NativeSyncer.CallToNative(10,[t.GlobalStartCallbackId,n],this._DomDepends)}return t.OnStartMap[i]=e,i}unregisterOnStart(e){if(!this._GifTextureInfo)return;let t=this._GifTextureInfo;t.OnStartMap.hasOwnProperty(e)&&t.StartMapCount--,0==t.StartMapCount&&0!=t.GlobalStartCallbackId&&(this._NativeSyncer.CallToNative(11,[t.GlobalStartCallbackId],this._DomDepends),t.GlobalStartCallbackId=0)}registerOnEnd(e){this._EnableGifTextureInfo();let t=this._GifTextureInfo,i=++t.IdGen;if(t.EndMapCount++,t.EndMapCount>0&&0==t.GlobalEndCallbackId){t.GlobalEndCallbackId=i;const e=()=>{for(let e in t.OnEndMap)t.OnEndMap[e]?.()},n=u.AddData(e);this._NativeSyncer.CallToNative(12,[t.GlobalEndCallbackId,n],this._DomDepends)}return t.OnEndMap[i]=e,i}unregisterOnEnd(e){if(!this._GifTextureInfo)return;let t=this._GifTextureInfo;t.OnEndMap.hasOwnProperty(e)&&t.EndMapCount--,0==t.EndMapCount&&0!=t.GlobalEndCallbackId&&(this._NativeSyncer.CallToNative(13,[t.GlobalEndCallbackId],this._DomDepends),t.GlobalEndCallbackId=0)}_EnableGifTextureInfo(){this._GifTextureInfo||(this._GifTextureInfo={IdGen:1,GlobalStartCallbackId:0,OnStartMap:{},StartMapCount:0,GlobalEndCallbackId:0,OnEndMap:{},EndMapCount:0})}}class p extends S{constructor(e,t){super(e,t,!0)}}let y=window.NativeGetIdGroupIntf();const v=10;class m{constructor(e){this._GroupType=e,this._TeamReadIndex=0,this._TeamFillIndex=0,this._Teams=new Array(v),this._ValidTeamsCount=0;for(let e=0;e<v;e++)this._Teams[e]={start:0,end:0,expired:!0}}genId(){this._Teams[this._TeamReadIndex].expired&&this._reserveNativeIds();let e=this._Teams[this._TeamReadIndex],t=e.start;return e.start++,e.start>e.end&&(e.expired=!0,this._TeamReadIndex=(this._TeamReadIndex+1)%v,this._ValidTeamsCount--),t}_reserveNativeIds(){let e=20*(v-this._ValidTeamsCount);if(e>0){let t=y.GetIdArray(this._GroupType,e);if(t){let e=JSON.parse(t);this._commitNativeIds(e[0],e[1])}}}_commitNativeIds(e,t){let i=t-e+1,n=Math.floor(i/20),s=e;for(let e=0;e<n;e++){let e=this._Teams[this._TeamFillIndex];e.start=s,e.end=s+20-1,e.expired=!1,this._TeamFillIndex=(this._TeamFillIndex+1)%v,s=e.end+1}this._ValidTeamsCount+=n,this._ValidTeamsCount>v&&console.error(`team over size to ${this._ValidTeamsCount}`)}}let C=new class{constructor(){this._ViewGroup=new m(0),this._TextureGroup=new m(1),this._AnimationGroup=new m(2),this._SensorGroup=new m(3)}genViewId(){return this._ViewGroup.genId()}genTextureId(){return this._TextureGroup.genId()}genAnimationId(){return this._AnimationGroup.genId()}genSensorId(){return this._SensorGroup.genId()}};var g,f,T;!function(e){e.RGBA_8888="RGBA_8888",e.RGBA_4444="RGBA_4444",e.RGBA_5551="RGBA_5551",e.RGB_565="RGB_565",e.RGB_ETC1="RGB_ETC1",e.RGBA_ETC1="RGBA_ETC1"}(g||(g={})),function(e){e.L=1,e.M=0,e.Q=3,e.H=2}(f||(f={})),function(e){e.AUTO=0,e.SYNC=1,e.ASYNC=2}(T||(T={}));class I{constructor(){this._NativeSyncer=c}GetId(){return 0}GetColorTexture(e){let t=C.genTextureId();this._NativeSyncer.CallToNative(1,[e,t]);let i=new _(t,new h(t));return i.RequestSyncerAlterId(),i}GetImage(e,t,i){return this.GetImage2(e,t,null,null,i)}GetImage2(e,t,i,s=g.RGBA_8888,a="",r=!1){if(!e||0==e.length)return n("GetImage2, url is not setted!"),null;let o=C.genTextureId(),l=0,c=0;i&&(l=i.width,c=i.height),s||(s=g.RGBA_8888),a||(a="");let u=null!=r&&r;this._NativeSyncer.CallToNative(2,[e,l,c,s,a,u,o]);let d=new _(o,new h(o));return d.RequestSyncerAlterId(),d}GetQRCodeTexture(e,t,i,n=T.AUTO,s=f.Q,a="#ffffff",r="#000000",o=-1){let l=C.genTextureId();return this._NativeSyncer.CallToNative(3,[e,t,i,s,a,r,o,n,l]),new _(l,new h(l))}GetDownloadTexture(e,t,i){if(!e)return n("GetDownloadTexture, url is null!"),null;let s=C.genTextureId();return this._NativeSyncer.CallToNative(4,[e,t,i,s]),new _(s,new h(s))}GetDomProxyTexture(e){let t=C.genTextureId();return this._NativeSyncer.CallToNative(5,[e,t],!0),new p(t,new h(t))}GetCanvasTexture(e,t){let i=C.genTextureId();return this._NativeSyncer.CallToNative(6,[e,t,i],!1),new _(i,new h(i))}GetPluginTexture(e,t){let i=C.genTextureId();return this._NativeSyncer.CallToNative(7,[e,t,i],!1),new _(i,new h(i))}GetCapturedTexture(){let e=C.genTextureId();return this._NativeSyncer.CallToNative(8,[e],!1),new _(e,new h(e))}GetImageProcessTexture(e){let t=C.genTextureId();return this._NativeSyncer.CallToNative(9,[e,t],!1),new _(t,new h(t))}}let N=new class{constructor(){this._count=1}get count(){return this._count}update(){this._count<Number.MAX_SAFE_INTEGER?++this._count:this._count=1}},A=new a,R=new a;let w=new class extends r{constructor(){super(A,R)}RenewSyncInfo(e){super.RenewSyncInfo(e,{tt:0})}};class E extends r{constructor(e){super(A,R,{id:e}),this._AnimId=e}InitPackage(e){this._AnimId=e.id}RenewSyncInfo(e){super.RenewSyncInfo(e,{tt:1,id:this._AnimId})}}let b=new a,x=new a;class D extends r{constructor(e){super(b,x,{id:e}),this._ViewId=e}InitPackage(e){this._ViewId=e.id}RenewSyncInfo(e){super.RenewSyncInfo(e,{tt:1,id:this._ViewId})}}let P=new class extends r{constructor(){super(b,x)}RenewSyncInfo(e){super.RenewSyncInfo(e,{tt:0})}},F=new a;class k extends r{constructor(e){super(null,F,{id:e}),this._SensorId=e}InitPackage(e){this._SensorId=e.id}RenewSyncInfo(e,t){super.RenewSyncInfo(e,{tt:1,id:this._SensorId})}}let L=new class extends r{constructor(){super(null,F)}RenewSyncInfo(e,t){super.RenewSyncInfo(e,{tt:0})}};var O=null,G=null;class V{constructor(){this._ScreenInfo={width:160,height:90,x:2/160,y:2/90,perspective:2/160,scaleRatio:1,designedWidth:1280},this.SwapCurrentTime=Date.now(),this.SwapCurrentCount=0,this._WillSwapCallbacks=new Map,this._DoWillSwapCallback=this._OnWillSwap.bind(this),this._NativeForgeRT={hdl:null},this._ApiLinkStatusReady=!0,this._SwapTimer=-1,this._OnRequesting=!1,this._OnRequestSeq=1,this._ApiLinkStatusReady=!1,this._InitNativeBridge(),this._EnableRequestSwap=!1,this._CommandParamsCache=[],this._NewSwapSeq=1,this._ForgeFrontRender.OnScreenHide&&window.JsView?.onVisibilityChange((e=>{'{"status":"hide"}'===e&&this._ForgeFrontRender.OnScreenHide()}))}_InitNativeBridge(){void 0!==global.NativeSendImpactSensorSyncData&&global.NativeSendImpactSensorSyncData.bind(this._NativeForgeRT),void 0!==global.NativeSetStepFpsSwitch&&(O=global.NativeSetStepFpsSwitch.bind(this._NativeForgeRT)),void 0!==global.NativeSetGlobalConfig&&(G=global.NativeSetGlobalConfig.bind(this._NativeForgeRT)),this._ForgeFrontRender=global.NativeGetRenderIntf(),this._ForgeFrontRender.RegisterSwapFunc((()=>{this.RequestSwap()})),this._DoRequestSwap=this._DoRequestSwap.bind(this),this._ForgeFrontRender.RegisterPreDomSyncFunc((()=>{this._ProcPreDomSync()})),this._ForgeFrontRender.RegisterOnScreenInfo(this._OnScreenInfoChange.bind(this))}SetStepFpsSwitch(e){this._ApiLinkStatusReady?O&&O(e):(console.warn("SetStepFpsSwitch(): API link status no ready!"),this._CommandParamsCache.push((()=>{this.SetStepFpsSwitch(e)})))}SetGlobalConfig(e){if(this._ApiLinkStatusReady){if(G){let t=JSON.stringify(e);console.log("SetGlobalConfig set with "+t),G(t),console.log("SetGlobalConfig set done")}}else console.warn("SetGlobalConfig(): API link status no ready!"),this._CommandParamsCache.push((()=>{this.SetGlobalConfig(e)}))}_PerformCachedCommand(){if(this._CommandParamsCache.length>0){for(let e=0;e<this._CommandParamsCache.length;e++)this._CommandParamsCache[e]();this._CommandParamsCache=[]}}RequestSwap(){this._OnRequesting?this._NewSwapSeq++:(this._OnRequesting=!0,this._NewSwapSeq++,this._OnRequestSeq++,this._PromiseRequestSwap(this._OnRequestSeq))}_PromiseRequestSwap(e){let t=this,i=this._NewSwapSeq;Promise.resolve().then((()=>{i==t._NewSwapSeq?t.InstantPerformSwap():e==this._OnRequestSeq&&t._PromiseRequestSwap(e)}))}NotifyNetTypeStatus(e,t){}EnableRequestSwap(e){this._EnableRequestSwap=e,this._ForgeFrontRender.EnableRequestSwap(e)}InstantPerformSwap(){this._OnRequesting&&(this._OnRequesting=!1,this._OnRequestSeq++,this._DoRequestSwap(!1))}_ProcSyncerList(e,t,i,n,s){let a=null,r=null,o=null,l=null,h=null;if(e.HasUpdate()&&(o=e.ReadSyncList()),t.HasUpdate()&&(r=t.ReadSyncList()),i.HasUpdate()&&(a=i.ReadSyncList()),n?.HasUpdate()&&(l=n.ReadSyncList()),null==a&&null==r&&null==o&&null==l||(h=this._ForgeFrontRender.SyncForgeJsCall(JSON.stringify({TexSync:o,AnimSync:r,ViewSync:a,SensorSync:l}),s)),h){let t;this._OnRequesting=!1,t=JSON.parse(h).TexSyncRet,t&&this._ProcTextureSyncRet(e,t)}}_ProcPreDomSync(){this._ProcSyncerList(o,A,b,null,u.PickArray())}_DoRequestSwap(e){if(!this._EnableRequestSwap)return void(this._OnRequesting=!1);N.update();let t=u.GetSize();if(this._ProcSyncerList(o,A,b,null,u.PickArray()),this._WillSwapCallbacks.size>0&&this._WillSwapCallbacks.forEach(this._DoWillSwapCallback),this._ProcSyncerList(l,R,x,F,u.PickArray()),t==u.GetSize())u.ResetForNextSwap();else{let e=u.GetSize();e>50&&console.warn("Warning: temp sync store kept with large size = "+e)}e=!!e,this._OnRequesting=!1,this.SwapCurrentTime=Date.now(),this.SwapCurrentCount++,this._ForgeFrontRender.DoRequestSwap(e)}GetScreenInfo(){return this._ScreenInfo}SetForgeRtHandler(e){this._NativeForgeRT.hdl=e,this._ApiLinkStatusReady=!0,this._ForgeFrontRender.SetForgeRtHandler(e),this._PerformCachedCommand()}InitScreenBuffer(e,t){isNaN(e)&&(e=1),isNaN(t)&&(t=1280);var i=t*e,n=i/16*9;this._ScreenInfo.width=Math.floor(i),this._ScreenInfo.height=Math.floor(n),this._ScreenInfo.x=2/this._ScreenInfo.width,this._ScreenInfo.y=2/this._ScreenInfo.height,this._ScreenInfo.perspective=this._ScreenInfo.x,this._ScreenInfo.scaleRatio=e,this._ScreenInfo.designedWidth=t}InitNativeScreenBuffer(){if(this._ApiLinkStatusReady){var e=JSON.stringify({displayScaleRatio:this._ScreenInfo.scaleRatio,designedMapWidth:this._ScreenInfo.designedWidth});this._ForgeFrontRender.InitScreenBuffer(e)}else console.info("InitNativeScreenBuffer(): API link status no ready!")}SyncBackStatus(e,t){this._ForgeFrontRender.SyncBackStatus(e,t)}TakeAndSyncBackStatus(){1==this._ForgeFrontRender.TakeAndSyncBackStatus()&&this.RequestSwap()}_OnScreenInfoChange(e,t,i,n,s){this._ScreenInfo.width=e,this._ScreenInfo.height=t,this._ScreenInfo.x=i,this._ScreenInfo.y=n,this._ScreenInfo.perspective=s}HasPendingRenderBreak(){return!!this._ApiLinkStatusReady&&this._ForgeFrontRender.HasPendingRenderBreak()}FinishRenderBreak(e){this._ApiLinkStatusReady?this._ForgeFrontRender.FinishRenderBreak(e):(console.warn("FinishRenderBreak(): API link status no ready, delay"),this._CommandParamsCache.push((()=>{this._ForgeFrontRender.FinishRenderBreak(e)})))}AddWillSwapListener(e,t){this._WillSwapCallbacks.set(e,t)}AddSwappedOnceObserver(e){this._ApiLinkStatusReady?this._ForgeFrontRender.AddSwappedOnceObserver(e):(console.warn("AddSwappedOnceObserver(): API link status no ready, delay"),this._CommandParamsCache.push((()=>{this._ForgeFrontRender.AddSwappedOnceObserver(e)})))}ActiveComponent(e){this._ApiLinkStatusReady?this._ForgeFrontRender.ActiveComponent(e):(console.warn("ActiveComponent(): API link status no ready, delay"),this._CommandParamsCache.push((()=>{this._ForgeFrontRender.ActiveComponent(e)})))}ShutdownComponents(e){this._ApiLinkStatusReady?this._ForgeFrontRender.ShutdownComponents(e):(console.warn("ShutdownComponents(): API link status no ready, delay"),this._CommandParamsCache.push((()=>{this._ForgeFrontRender.ShutdownComponents(e)})))}SetPlatformMsgDisp(e){this._PlatformMessageDispatch=e}GetPlatformMsgDisp(){return this._PlatformMessageDispatch}GetTextToolsApi(){return this._ForgeFrontRender.TextToolApi}_OnWillSwap(e){e()}_ProcTextureSyncRet(e,t){let i;i=t.idAlter,i&&e.ProcAlterIds(i.proxy,i.real)}}class M{constructor(){this._DisableKeyGuard=!1,this._LastEventTime=0,this._IsActivte=!1,this._BaseTime=0,this._BaseRemoteTime=0,this._SupportGetTimeFromApi=!1,this._IsSystemKeyDelaySuit=!1,this._ExpiredKeyCount=0,this._LastValidKeyTime=0,this._UseTimeFromApi=void 0!==window.jRuntimeBridge?.getSystemUptimeMillis,this._UseTimeFromApi&&(this._SupportGetTimeFromApi=!0,this._GetTimeFromApi())}SetTranslateDelay(e){M.sKeyTranslateDelay=e}CheckKey(e){if(!e.timeStamp||this._DisableKeyGuard)return!1;this._IsActivte=!0;const t=Date.now(),n=e.timeStamp;!this._SupportGetTimeFromApi&&n-this._LastEventTime>3e3&&(this._BaseTime=t,this._BaseRemoteTime=n,this._LastEventTime=n);let s=t-this._BaseTime;(s<0||s>5e3)&&(this._UseTimeFromApi?this._GetTimeFromApi():(this._BaseTime=t,this._BaseRemoteTime=n),s=0);return s+this._BaseRemoteTime-n>M.CONST_MAX_PASSING_GAP&&Math.abs(this._LastValidKeyTime-n)<M.CONST_MIN_VALID_KEY_GAP&&!e.repeat?(!this._IsSystemKeyDelaySuit&&this._SupportGetTimeFromApi&&(this._ExpiredKeyCount++,this._ExpiredKeyCount>50&&i("More than 50 keys are expired...")),!0):(this._IsSystemKeyDelaySuit||(this._IsSystemKeyDelaySuit=!0),this._LastValidKeyTime=n,!1)}toggleKeyGuard(){this._DisableKeyGuard=!this._DisableKeyGuard}IsActive(){return this._IsActivte}_GetTimeFromApi(){this._BaseTime=Date.now(),this._BaseRemoteTime=window.jRuntimeBridge.getSystemUptimeMillis()-M.sKeyTranslateDelay}}M.CONST_MAX_PASSING_GAP=20,M.CONST_MIN_VALID_KEY_GAP=180,M.sKeyTranslateDelay=5;let B,q=new M;class W{constructor(s,a,r){var o;if(this._MainActivity=null,this._DesignedMapWidth=1280,this._KeyLock=!1,this._CanvasHandler=0,o=4,console.log.bind(console),o>0&&console.error.bind(console),o>1&&(t=console.error.bind(console)),o>2&&(i=console.warn.bind(console)),o>3&&(n=console.log.bind(console)),o>4&&console.debug.bind(console),this._TextureManager=new I,this._RenderBridge=new V,e.sRenderBridge=this._RenderBridge,isNaN(r)&&(r=1280),this._DesignedMapWidth=r,this._KeyLock=!1,this._InitRenderer(s,a,r),this._EventHandlers={keyProc:null,keyUpProc:null,activityStateProc:null},this._RegisterKeyListener(this._EventHandlers),this._RegisterNativeActivityStateListener(this._EventHandlers),this._InstantSwapPromiseCallback=this._RenderBridge.InstantPerformSwap.bind(this._RenderBridge),null!=s){this._CanvasHandler=s.canvasNativeHandle;for(let e in this._EventHandlers)s[e]=this._EventHandlers[e]}e.sActivityManager=this,console.log("manager done")}GetTextureManager(){return this._TextureManager}DelayedActivateCanvas(e){if(0==this._CanvasHandler){this._CanvasHandler=e.canvasNativeHandle,this._EnableNativeBridge(e);for(let t in this._EventHandlers)e[t]=this._EventHandlers[t];this._RenderBridge.InitNativeScreenBuffer(),this._RenderBridge.RequestSwap()}else t("Error: already activated")}GetCanvasHandler(){return this._CanvasHandler}StartActivity(e){this._MainActivity=e}_InitRenderer(e,t,i){this._EnableNativeBridge(e),this._RenderBridge.InitScreenBuffer(t,i),this._RenderBridge.InitNativeScreenBuffer()}_EnableNativeBridge(e){null!=e&&(this._RenderBridge.SetForgeRtHandler(e.frtNativeHandle),e.renderBridge=this._RenderBridge,this._RenderBridge.EnableRequestSwap(!0))}_KeyProcDown(e){if(this._KeyLock)return!0;var t=!0;if(this._MainActivity){if(q.CheckKey(e))return console.log("keyEventGuard ignore keys"),!1;q.IsActive()&&this._RenderBridge.InstantPerformSwap(),t=!this._MainActivity.DispatchKeyDown(e),this._RenderBridge.TakeAndSyncBackStatus()}return t}_KeyProcUp(e){if(this._KeyLock)return!0;var t=!0;return this._MainActivity&&(t=!this._MainActivity.DispatchKeyUp(e),this._RenderBridge.TakeAndSyncBackStatus()),t}_RegisterKeyListener(e){e.keyProc=this._KeyProcDown.bind(this),e.keyUpProc=this._KeyProcUp.bind(this)}_RegisterNativeActivityStateListener(e){let t=this;var i=function(e){var i=e.State;switch(console.log("ActivityStateListenerChanged, state:"+i),i){case"onActivityResumed":t._RenderBridge.EnableRequestSwap(!0),t._RenderBridge.RequestSwap(),t._RenderBridge.InstantPerformSwap();break;case"onActivityPaused":t._RenderBridge.EnableRequestSwap(!1)}}.bind(this);e.activityStateProc=i}}class K{constructor(){this._ActivityManager=null}Init(e){let t=1280,i=1;try{if(H){let e=H();"number"==typeof e.width&&(t=e.width),"number"==typeof e.displayScale&&(i=e.displayScale)}}catch(e){console.log("Note: DesignMap failed")}this._ActivityManager=new W(e,i,t),U?U(this._ActivityManager):console.error("FATAL: no found entry")}getActivityManager(){return this._ActivityManager}}let U=null,H=null;class J{constructor(e){this.PageName=e,this._FocusChild=null,this._LatestFocusChild=null,this.SubPages=[],this._ParentPage=null,this._KeyLock=!1}OnRenderFrame(){t("OnRenderFrame() MUST override")}OnKeyDown(e){return!1}OnKeyUp(e){return!1}DispatchKeyDown(e){if(this._KeyLock)return!0;let t=!1;return this._FocusChild&&(t=this._FocusChild.DispatchKeyDown(e)),t||(t=this.OnKeyDown(e)),t}OnCustomEvent(e){return!1}BubbleCustomEvent(e){this.OnCustomEvent(e)||this._ParentPage&&this._ParentPage.BubbleCustomEvent(e)}DispatchKeyUp(e){if(this._KeyLock)return!0;let t=!1;return this._FocusChild&&(t=this._FocusChild.DispatchKeyUp(e)),t||(t=this.OnKeyUp(e)),t}PrintLastFocusPage(){let e="------"+this.PageName+"\n",t=this._ParentPage;return t&&(e+=t.PrintLastFocusPage()),e}IsFocus(){return!this._ParentPage||this._ParentPage._FocusChild==this}_IsLeafInChain(){return this.IsFocus()&&!this._FocusChild}SetParent(e){null!=e?(this._ParentPage=e,e.SubPages.push(this)):s("ERROR: parent is null")}SetParentPage(e){this.SetParent(e)}OnRemoveFromTree(){if(this._ParentPage=null,this.SubPages&&this.SubPages.length>0){for(let e of this.SubPages)e.OnRemoveFromTree();this.SubPages=[]}}RemoveSubPage(e){e==this._FocusChild&&(this._FocusChild=null),e==this._LatestFocusChild&&(this._LatestFocusChild=null);for(let t=0;t<this.SubPages.length;t++)if(e==this.SubPages[t]){this.SubPages.splice(t,1);break}}ClearSubPages(){this.SubPages=[],this._FocusChild=null,this._LatestFocusChild=null}GetParentPage(){return this._ParentPage}Focus(e=!1){if(this.IsFocus()){if(!e)return void n("requestFocus(): Already focused name="+this.PageName);if(this._IsLeafInChain())return void n("requestFocus(): Already focused name="+this.PageName)}if(this._ParentPage){let t,i=[],n=this;for(;n._ParentPage&&!n.IsFocus();)i.push(n),n=n._ParentPage;t=e&&0==i.length?this._FocusChild:i[i.length-1]._ParentPage?._FocusChild;let a=[];for(;t;)a.push(t),t=t._FocusChild;for(let e=a.length-1;e>=0;e--)a[e]._BlurInternal();for(let e=i.length-1;e>=0;e--)i[e]._FocusInternal();if(e)this._LatestFocusChild=null;else{let e=i[0];for(;e._LatestFocusChild&&null==e._FocusChild;)e._LatestFocusChild._FocusInternal(),e=e._FocusChild,e||s("ERROR: focus chain is broken")}}}ReturnFocusToParent(){this._ParentPage&&(this.IsFocus()&&this._ParentPage.Focus(!0),this._ParentPage._FocusChild==this&&(this._ParentPage._FocusChild=null),this._ParentPage._LatestFocusChild==this&&(this._ParentPage._LatestFocusChild=null))}_FocusInternal(){this._ParentPage?(this._ParentPage._FocusChild=this,this._ParentPage._LatestFocusChild=this,this.OnFocus()):t("No dispatcher")}_BlurInternal(){this._ParentPage?this._ParentPage._FocusChild==this?(this._ParentPage._FocusChild=null,this.OnBlur()):i("Not focus yet, page name="+this.PageName):t("No dispacher")}GetFocusChild(){return this._FocusChild}OnFocus(){i("No overrided Page OnFocus event, page name="+this.PageName)}OnBlur(){i("No overrided Page OnBlur event, page name="+this.PageName)}KeyLock(){this._KeyLock=!0}UnKeyLock(){this._KeyLock=!1}}var j;!function(e){e.VIEW_COMMAND=0,e.TEXTURE_COMMAND=1,e.ANIM_COMMAND=2,e.SYNC_COMMAND=3,e.APIC_PLAY=0,e.APIC_STOP=1,e.GET_BOUNDING_RECT=0,e.FILTER_VIEW_WAVE=1,e.TRANSLATE_FRAME_ALT_SPEED=0,e.FREE_MOVE_RUN_CMDPACKS=1,e.EXE_DEFAULT=0,e.EXE_AFTER_RENDER=1}(j||(j={}));const z=(e,t)=>{let i=0,n=0,s=0;return isNaN(e)||(i|=1,n=e),isNaN(t)||(i|=2,s=t),{e:i,x:n,y:s}};var Y,X,Q;!function(e){e.ActEvent_ActFinish=1,e.ActEvent_Speed_X_Revert=2,e.ActEvent_Speed_Y_Revert=3,e.ActEvent_ActReject=4,e.ActEvent_ActDragStart=5,e.ActEvent_ActDragEnd=6,e.ActEvent_ActFlingStart=7,e.ActEvent_ActFlingProgress=8,e.ActEvent_ActFlingEnd=9,e.ActEvent_ActTouchDown=10,e.ActEvent_ActTouchRelease=11,e.ActEvent_ActFlingCancel=12,e.ActEvent_ActFlingDrop=13,e.ActEvent_MovementSync=14}(Y||(Y={})),function(e){e.GroupType_ActionAssoc=10,e.GroupType_Fling=11,e.GroupType_Invalid_Ext=65535}(X||(X={})),function(e){e.FLING_ON_PROGRESS_INTERVAL=200}(Q||(Q={}));const $=(e,t)=>{e.gtype=t.g,e.once=t.m?0:1;let i=t.s;i&&(e.name=i),e.brk=t.brk?1:0};const Z=51;function ee(e){return e?JSON.stringify(e.Package()):null}let te=new class{constructor(){this._NativeSyncer=w}CreateTranslate(e,t,i,n,s,a,r){s!=1/0&&null!=s||(console.warn("translate animation duration invalid="+s),s=0),this._NativeSyncer.CallToNative(1,[e,t,i,n,s,ee(a),r])}CreateRotate(e,t,i,n,s,a,r){s!=1/0&&null!=s||(console.warn("rotate animation duration invalid="+s),s=0),this._NativeSyncer.CallToNative(2,[e,t,i.x,i.y,i.z,n.x,n.y,n.z,s,ee(a),r])}CreateScale(e,t,i,n,s,a,r,o,l,h,c){l!=1/0&&null!=l||(console.warn("scale animation duration invalid="+l),l=0),this._NativeSyncer.CallToNative(3,[e,t,i,n,s,a,r,o,l,ee(h),c])}CreateTranslateFrame(e,t,i,n,s,a,r,o){this._NativeSyncer.CallToNative(5,[e,t,i,n,!!s,a,r,o])}CreateCssKeyframe(e,t,i,n,s,a){t!=1/0&&null!=t||(console.warn("css animation duration invalid="+t),t=0),this._NativeSyncer.CallToNative(6,[e,t,ee(i),n,s,a])}CreateFreeMoveAnimation(e,t,i,n){this._NativeSyncer.CallToNative(7,[e,t?u.AddData(t):0,i,n?1:0])}CreateShaderAnimation(e,t,i){this._NativeSyncer.CallToNative(8,[e,ee(t),i])}};class ie{constructor(){this.AnimNativeId=C.genAnimationId(),this._NativeSyncer=new E(this.AnimNativeId),this._ListenerObj=null,this._ListenerStatusCallback=null}SetAnimationListener(e){this._OnNewListener(e)}AddAnimationListener(e){this._ListenerObj&&e.AddInherit(this._ListenerObj),this._OnNewListener(e)}RemoveAnimationListener(){this._ListenerObj=null}Enable(e){this._NativeSyncer.CallToNative(2,[e])}EnableInfinite(){return this._NativeSyncer.CallToNative(3,null),this}SetRepeat(e){return this._NativeSyncer.CallToNative(5,[e]),this}EnableDelay(e){return this._NativeSyncer.CallToNative(4,[e]),this}SetStartPos(e){return e>=0&&e<=1?this._NativeSyncer.CallToNative(6,[e]):console.warn("Warning: SetStartPos() out of range"),this}_OnNewListener(e){let t=!0;if(this._ListenerObj&&(t=this._ListenerObj.ListenerEnabledFlags==e.ListenerEnabledFlags),this._ListenerObj=e,null!=this._ListenerObj&&(null==this._ListenerStatusCallback||!t)){let e=this;this._ListenerStatusCallback=t=>{e._ListenerObj?.InvokeFromNativeForge(t)};let t=u.AddData(this._ListenerStatusCallback);this._NativeSyncer.CallToNative(1,[t,this._ListenerObj.ListenerEnabledFlags])}}}var ne,se;!function(e){e.ReleaseAfterEndCallback=1,e.KeepTransform=2,e.AckFinalProgress=4,e.AckRepeat=8,e.Reverse=16}(ne||(ne={})),function(e){e.AltSpeed=(e,t,i)=>{let n={S60:Math.floor(100*t/55)/100,T:i};e?.DispatchAnimCommand(j.TRANSLATE_FRAME_ALT_SPEED,JSON.stringify(n))},e.RunFreeMoveCmdPacks=(e,t)=>{e?.DispatchAnimCommand(j.FREE_MOVE_RUN_CMDPACKS,JSON.stringify(t))}}(se||(se={}));class ae{constructor(){this.Pacakge=this.Package.bind(this)}Package(){}_GetBasePackage(e){return{T:e,St:null}}}class re extends ae{constructor(){super()}Package(){return this._GetBasePackage(0)}}class oe extends ae{constructor(){super()}Package(){return this._GetBasePackage(1)}}class le extends ae{constructor(){super()}Package(){return this._GetBasePackage(2)}}class he extends ae{constructor(){super()}Package(){return this._GetBasePackage(5)}}class ce extends ae{constructor(e,t,i,n,s){super(),this._Inited=!1,this._X1=e,this._X2=i,this._Y1=t,this._Y2=n,this._Duration=s}Package(){var e=this._GetBasePackage(3);return e.St={X1:this._X1,X2:this._X2,Y1:this._Y1,Y2:this._Y2,Dur:this._Duration},e}}class ue extends ae{constructor(e,t,i){super(),this._InTime=e,this._OutTime=t,this._MaxSpeed=i}Package(){var e=this._GetBasePackage(7);return e.St={In:this._InTime,Out:this._OutTime,MS:this._MaxSpeed},e}}var de;!function(e){var t;(t=e.Circular||(e.Circular={})).In=new re,t.Out=new oe,t.InOut=new le,t.Deceleration=new he,e.str2Easing=function(t){if(!t||"string"!=typeof t)return null;if("ease-in"===t)return e.Circular.In;if("ease-out"===t)return e.Circular.Out;if("ease-in-out"===t)return e.Circular.InOut;if(-1!==t.indexOf("cubic-bezier")){const e=t.split("(")[1].split(")")[0].split(",");if(!(4!==e.length||isNaN(parseFloat(e[0]))||isNaN(parseFloat(e[1]))||isNaN(parseFloat(e[2]))||isNaN(parseFloat(e[3]))))return new ce(parseFloat(e[0]),parseFloat(e[1]),parseFloat(e[2]),parseFloat(e[3]),0)}else if(-1!==t.indexOf("jsv-ease")){const e=t.split("(")[1].split(")")[0].split(",");if(3===e.length&&!isNaN(parseFloat(e[0]))&&!isNaN(parseFloat(e[1]))&&!isNaN(parseFloat(e[2])))return new ue(parseFloat(e[0]),parseFloat(e[1]),parseFloat(e[2]))}return null}}(de||(de={}));class _e{constructor(){this._MaskType="COMMON"}Type(){return this._MaskType}ToSyncJsonObj(e){return e||(e={}),e.typ=this._MaskType,e}}let Se=new class{constructor(){this._InnerViews={},this._ViewToken=0}add(e){let t=e.view.ViewId;return this._InnerViews.hasOwnProperty(t)&&(this._InnerViews[t]=e),t}remove(e){this._InnerViews[e]&&delete this._InnerViews[e]}get(e){return this._InnerViews[e]}clear(){this._InnerViews={},this._ViewToken=0}};class pe{constructor(){this.SensorId=C.genViewId(),this._NativeSync=new k(this.SensorId),this.CreateSensor()}CreateSensor(){}CreateTypedSensor(e){L.CallToNative(1,[this.SensorId,e],!0)}Recycle(){this._NativeSync.CallToNative(1,null,!0)}}class ye{constructor(e,t,i,n){this.Texture=e,this.MaskSetting=t,void 0===n&&(n=!0),this.HasAlpha=n}ToSyncJsonObj(e=void 0){return e||(e={}),e.texId=this.Texture?this.Texture.TexId:0,e.alpha=this.HasAlpha,this.MaskSetting?e.mask=this.MaskSetting.ToSyncJsonObj():e.mask=null,e}}var ve;!function(e){var t,i,n;(t=e.ControlType||(e.ControlType={})).DoKeepInRender=1,t.RecycleKeptView=2,(i=e.SyncedType||(e.SyncedType={})).Synced=0,i.NotSynced=1,i.RequestKeepInRender=2,i.OnKeepingInRender=3,i.RecycleKeeping=4,(n=e.TextureCoordAnchor||(e.TextureCoordAnchor={})).LeftTop=1,n.CenterTop=2,n.RightTop=3,n.LeftMiddle=4,n.Center=5,n.RightMiddle=6,n.LeftBottom=7,n.CenterBottom=8,n.RightBottom=9}(ve||(ve={}));let me=new class{constructor(){this._NativeSyncer=P}CreateNativeView(e,t,i){this._NativeSyncer.CallToNative(1,[e,t],i)}CreateJsRootView(e){this._NativeSyncer.CallToNative(2,[e])}CreateDomProxyView(e,t,i){this._NativeSyncer.CallToNative(3,[e,t,i?1:0],!0)}};class Ce{constructor(e,t,i=!1){this.Visibility=void 0,this._NativeSyncer=new D(e),this.ViewId=e,this.TextureSetting=null,this._CallTextureSet=null,this._DomDepends=i,this._GetBCRCallback=null,this.CreateView(t)}CreateView(e=void 0){}ResetTexture(e=null){if(!this._CallTextureSet){this._CallTextureSet=this._NativeSyncer.CallToNative(1,null,this._DomDepends);let e=this;this._NativeSyncer.AddStartSyncCallback((()=>{this.TextureSetting?e._NativeSyncer.AlterCallParams(e._CallTextureSet,[e.TextureSetting.ToSyncJsonObj()]):e._NativeSyncer.AlterCallParams(e._CallTextureSet,[null]),e._CallTextureSet=null}))}this.TextureSetting=e}BindedPageBase(e){}SetVisibility(e){if("INHERIT"!==e&&void 0!==e||(e="VISIBLE"),this.Visibility!=e){this.Visibility=e;let t=0;switch(e){case"VISIBLE":t=1;break;case"GONE":t=2;break;case"HIDDEN":t=3;break;default:return void console.error("unknown visible type="+e)}this._NativeSyncer.CallToNative(2,[t],this._DomDepends)}}AddView(e,t){let i={x:0,y:0,width:0,height:0};t&&(i=this._FormatLayoutParams(t)),this._NativeSyncer.CallToNative(3,[e.ViewId,t?1:0,i.x,i.y,i.width,i.height],this._DomDepends)}ClearViews(){this._NativeSyncer.CallToNative(4,null,this._DomDepends)}ResetTextureCssTransform(e,t){e=e||"",t=t||"",this._NativeSyncer.CallToNative(5,[e,t],this._DomDepends)}SetTextureCoord(e,t,i,n,s=ve.TextureCoordAnchor.Center){this._NativeSyncer.CallToNative(9,[e,t,i,n,s],this._DomDepends)}ResetLayoutParams(e){let t;null!=e?(t=this._FormatLayoutParams(e),this._NativeSyncer.CallToNative(6,[t.x,t.y,t.width,t.height],this._DomDepends)):s("ResetLayoutParams(): new params is null")}_FormatLayoutParams(e){return{x:isNaN(e.x)?0:e.x,y:isNaN(e.y)?0:e.y,width:isNaN(e.width)?0:e.width,height:isNaN(e.height)?0:e.height}}GetBoundingClientRect(){return new Promise(((e,t)=>{null!=this._GetBCRCallback&&(this._GetBCRCallback=null),this._GetBCRCallback=i=>{null!=this._GetBCRCallback&&(this._GetBCRCallback=null);const n=JSON.parse(i);0==n.status?e(n.data):t(n.error)};const i=u.AddData(this._GetBCRCallback);this._NativeSyncer.CallToNative(12,[i],this._DomDepends)}))}StartAnimation(e,t,i){let n=e?e.AnimNativeId:0;this._NativeSyncer.CallToNative(7,[n,isNaN(i)?0:i],this._DomDepends)}StopAnimation(){this._NativeSyncer.CallToNative(8,null,this._DomDepends)}DispatchAnimCommand(e,t){this._NativeSyncer.CallToNative(13,[e,t],this._DomDepends)}StartTextureAnimation(e){let t=e?e.AnimNativeId:0;this._NativeSyncer.CallToNative(10,[t],this._DomDepends)}StopTextureAnimation(){this._NativeSyncer.CallToNative(11,null,this._DomDepends)}DragEnables(e){this._NativeSyncer.CallToNative(14,[e],this._DomDepends)}SetTapListener(e=void 0){if(null!=e){const t=u.AddData(e);this._NativeSyncer.CallToNative(15,[t],this._DomDepends)}else this._NativeSyncer.CallToNative(15,[0],this._DomDepends)}EnableAutoSize(){this._NativeSyncer.CallToNative(16,[],this._DomDepends)}RegisterFlexAssigned(e=void 0){if(null!=e){const t=u.AddData(e);this._NativeSyncer.CallToNative(17,[t],this._DomDepends)}else this._NativeSyncer.CallToNative(17,[0],this._DomDepends)}EnableVisibleTestRect(){this._NativeSyncer.CallToNative(18,[],this._DomDepends)}Capture2Texture(e,t=void 0,i=void 0){if(!e)return void console.error("Error: Capture2Texture need target texture");let n=e.GetTextureId();if(!t)return void console.error("Error: Capture2Texture need callback");const s=u.AddData(t),a=i?JSON.stringify(i):"";this._NativeSyncer.CallToNative(19,[n,s,a],this._DomDepends)}}class ge extends Ce{constructor(e=null){!e||e instanceof ye||s("ERROR:LayoutView need TextureSetting as parameter"),super(C.genViewId(),{DomDepends:!1}),this.Visibility="VISIBLE",e&&this.ResetTexture(e)}CreateView(e){me.CreateNativeView(this.ViewId,0,e.DomDepends)}}function fe(e){let t=[];if(e instanceof Array)for(let i of e)i instanceof Ce&&t.push(i.ViewId);return t}class Te extends pe{constructor(e,t,i,n){super(),this.InitSet(e,t,i,n)}CreateSensor(){this.CreateTypedSensor(3)}InitSet(e,t,i,n){let s=0;i&&(s=u.AddData((e=>{1==e?i.OnBeginContact?.():2==e&&i.OnEndContact?.()}))),this._NativeSync.CallToNative(20,[e.ViewId,t.ViewId,s,n?n.SensorId:0],!0)}}let Ie={StartTrace:(e,t,i,n)=>new Te(e,t,i,n),Callback:class{constructor(e,t){this.OnBeginContact=e,this.OnEndContact=t}UpdateImpactCallback(e){this.OnBeginContact=e}UpdateLeaveCallback(e){this.OnEndContact=e}},AutoFroze:class extends pe{constructor(e,t){super(),this.InitSet(),this._UpdatePreImpactList(fe(e)),this._UpdateOnImpactList(fe(t)),this._FreshAutoRecycleRef()}CreateSensor(){this.CreateTypedSensor(2)}InitSet(){this._NativeSync.CallToNative(25,null,!0)}UpdatePreImpactList(e){this._UpdatePreImpactList(fe(e)),this._FreshAutoRecycleRef()}UpdateOnImpactList(e){this._UpdateOnImpactList(fe(e)),this._FreshAutoRecycleRef()}_UpdatePreImpactList(e){this._NativeSync.CallToNative(26,[...e],!0)}_UpdateOnImpactList(e){this._NativeSync.CallToNative(27,[...e],!0)}_FreshAutoRecycleRef(){this._NativeSync.CallToNative(28,null,!0)}}};var Ne;!function(e){e[e.NONE=0]="NONE",e[e.TEXT=1]="TEXT",e[e.PASSWORD=2]="PASSWORD",e[e.TEXT_AREA=3]="TEXT_AREA",e[e.CONTENT_EDITABLE=4]="CONTENT_EDITABLE",e[e.SEARCH=5]="SEARCH",e[e.URL=6]="URL",e[e.EMAIL=7]="EMAIL",e[e.TELEPHONE=8]="TELEPHONE",e[e.NUMBER=9]="NUMBER"}(Ne||(Ne={}));var Ae,Re;!function(e){var t;(t=e.UniformType||(e.UniformType={}))[t.FLOAT=1]="FLOAT"}(Ae||(Ae={})),function(e){var t,i;(t=e.Type||(e.Type={}))[t.GRAY_DOWN=1]="GRAY_DOWN",t[t.WAVE=2]="WAVE",(i=e.Wave||(e.Wave={}))[i.CIRCLE_WAVE=1]="CIRCLE_WAVE",i[i.RECTANGLE_WAVE=2]="RECTANGLE_WAVE"}(Re||(Re={}));let we=0;class Ee{constructor(){this.sourceList=[]}addSource(e,t,i,n,s){n=n??{type:Re.Wave.CIRCLE_WAVE},s=s??{timeDecay:3,distanceDecay:10,speed:100,frequency:8,waveNum:2};const a=++we;let r=0,o=0,l=0;return n.type==Re.Wave.RECTANGLE_WAVE&&(r=n.width,o=n.height,l=n.radius),this.sourceList.push(a,e,t,i,r,o,l,s.timeDecay,s.distanceDecay,s.speed,s.frequency,s.waveNum),a}getSourceList(){const e=this.sourceList;return this.sourceList=[],e}}class be extends Ce{constructor(e,t){super(C.genViewId(),{DomElementId:e,UseMaskView:t},!0),this.Visibility="VISIBLE"}CreateView(e){me.CreateDomProxyView(this.ViewId,e.DomElementId,e.UseMaskView)}RegisterOnProxyReady(e){e?.()}}function xe(e){return isNaN(e)?0:parseInt(e)}function De(e){return{fontFamily:e.fontFamily?e.fontFamily:Ge.sDefaultFont,fontSize:xe(e.fontSize),italic:"italic"===e.fontStyle,bold:"bold"===e.fontWeight,hasEmoji:1==e.JsvTextEmoji}}function Pe(){return e.sRenderBridge.GetTextToolsApi()}function Fe(e,t){let i=De(t);return Pe().GetTextWidth(e,JSON.stringify(i))}function ke(e,t){let i=De(t);const n=Pe().GetOneLineTextDrawWidth(e,JSON.stringify(i)),s={totalWidth:n[0],sliceInfo:[]};for(let e=1;e<n.length;e+=3)s.sliceInfo.push({start:n[e],end:n[e+1],width:n[4]});return s}function Le(e,t,i,n,s,a){let r;if(e>0)r=Pe().GetCursorPosition(e,t,null,null,null,1);else{let o=De(n),l=function(e){let t=xe(e.height),i=xe(e.lineHeight),n="string"==typeof e.wordWrap?e.wordWrap:"none";return"nowrap"==e.whiteSpace&&(n="none"),{width:xe(e.width),height:t,textAlign:"string"==typeof e.textAlign?e.textAlign:"left",lineHeight:0==i?t:i,wordWrap:n,textOverflow:"string"==typeof e.textOverflow?e.textOverflow:"clip"}}(s);r=Pe().GetCursorPosition(e,t,i,JSON.stringify(o),JSON.stringify(l),a?1:0)}return r}function Oe(e){Pe().RemoveCursorTextCache(e)}var Ge;!function(e){e.sDefaultFont="黑体",e.sDefaultFontSize=30,e.sDefaultFontColor="#FFFFFF",e.sDefaultBackgroundColor="rgba(0, 0, 0, 0)",e.GetTextWidth=Fe,e.GetOneLineTextDrawWidth=ke,e.GetCursorPosition=Le,e.RemoveCursorTextCache=Oe}(Ge||(Ge={}));let Ve=e;Ve.Run=function(e){return B=new K,B.Init(e),B},Ve.InitStarter=function(t,i){e.DesignMap=i,U=t,H=i},Ve.NewDomProxyView=function(e,t){return new be(e,t)},Ve.sFrameCount=N,Ve.NativeConstant=j,Ve.PageBase=J,Ve.ReactActivity=class extends J{constructor(e,t){super(e),this._TextureManager=t.GetTextureManager()}GetTextureManager(){return this._TextureManager}SetContentView(e,t){this._ContentView=e,this._ContentViewSize=t}},Ve.ViewTextureMask=class extends _e{constructor(e){super(),this._MaskType="TEXTURE",this.ImageTexture=e}ToSyncJsonObj(e){return e||(e={}),e.texId=this.ImageTexture.TexId,super.ToSyncJsonObj(e)}},Ve.ViewRoundCornerMask=class extends _e{constructor(e,t,i,n){super(),this._MaskType="CORNER",this._TopLeft=e,this._TopRight=isNaN(t)?e:t,this._BottomLeft=isNaN(i)?e:i,this._BottomRight=isNaN(n)?e:n}ToSyncJsonObj(e){return e||(e={}),e.tl=this._TopLeft,e.tr=this._TopRight,e.bl=this._BottomLeft,e.br=this._BottomRight,super.ToSyncJsonObj(e)}},Ve.sViewStore=Se,Ve.ViewInfo=class{constructor(e,t){this.view=e,this.layout_params=t}},Ve.LayoutView=ge,Ve.AutoStretchView=class extends ge{constructor(e=null){super(e)}CreateView(e){me.CreateNativeView(this.ViewId,12,e.DomDepends)}},Ve.EditControlView=class extends ge{constructor(t=null){super(t),this._AppListeners=null,this._ImeSyncFunc=this._ImeEventListener.bind(this),this._MsgToken="_JscIme_"+this.ViewId,e.sRenderBridge.GetPlatformMsgDisp().subscribe(this._MsgToken,this._ImeSyncFunc)}CreateView(e){me.CreateNativeView(this.ViewId,5,e.DomDepends)}releaseResource(){e.sRenderBridge.GetPlatformMsgDisp().unsubscribe(this._MsgToken,this._ImeSyncFunc)}setEditorStyle(e,t,i,n){this._NativeSyncer.CallToNative(5005,[e,t,i,n],this._DomDepends)}showIme(e,t,i,n,s){e!=Ne.NONE?(void 0!==i&&null!=i||(i=t.length>0?t.length:0),i<0?i=0:i>t.length&&(i=t.length>0?t.length:0),this._NativeSyncer.CallToNative(5001,[e,encodeURIComponent(t),i,n,s],this._DomDepends)):console.log("showIme inputType error")}hideIme(){this._NativeSyncer.CallToNative(5002,null,this._DomDepends)}updateCursorOffset(e,t,i,n){this._NativeSyncer.CallToNative(5003,[e,t,i,n],this._DomDepends)}addImeEventListener(e){this._AppListeners=e}_OnStatusFromPlatform(e){this._NativeSyncer.CallToNative(5006,[e],this._DomDepends)}_ImeEventListener(e){if(e){var t=JSON.parse(e);if("text"==t.type){var i=t.text;let e=t.selectStart,n=t.scrollLeft,s=t.scrollTop;this._AppListeners?.OnTextChanged(decodeURIComponent(i),e,n,s)}else if("vstatus"==t.type){let e=t.isVisible?1:0;this._OnStatusFromPlatform(e),this._AppListeners?.OnStatusChanged(e)}else if("action"==t.type){var n=t.action;this._AppListeners?.OnEditAction(n)}}else console.log("EditControlView","_ImeEventListener input_data error")}},Ve.FilterView=class extends ge{constructor(e=null,t){super(e),this._Type=t??Re.Type.GRAY_DOWN,this._NativeSyncer.CallToNative(10002,[this._Type,[]],this._DomDepends)}CreateView(e){me.CreateNativeView(this.ViewId,10,e.DomDepends)}FilterSwitch(e){this._NativeSyncer.CallToNative(10001,[e],this._DomDepends)}AddWaveSourceList(e){if(this._Type==Re.Type.WAVE){const t={T:1,L:e.getSourceList()};this.DispatchCommand(j.FILTER_VIEW_WAVE,JSON.stringify(t))}else console.error("FilterView error: add wave source while filter view type is GRAY_DOWN.")}AddWaveSourceSingle(e,t,i,n={type:Re.Wave.CIRCLE_WAVE},s={timeDecay:3,distanceDecay:10,speed:100,frequency:8,waveNum:2}){if(this._Type==Re.Type.WAVE){const a=new Ee,r=a.addSource(e,t,i,n,s);return this.AddWaveSourceList(a),r}return console.error("FilterView error: add wave source while filter view type is GRAY_DOWN."),-1}RemoveSource(e){if(this._Type==Re.Type.WAVE){const t={T:2,L:e instanceof Array?e:[e]};this.DispatchCommand(j.FILTER_VIEW_WAVE,JSON.stringify(t))}else console.error("FilterView error: remove wave source while filter view type is GRAY_DOWN.")}DispatchCommand(e,t){t&&this._NativeSyncer.CallToNative(10003,[e,t],this._DomDepends)}},Ve.FragShaderView=class extends ge{constructor(e=null){super(e)}CreateView(e){me.CreateNativeView(this.ViewId,11,e.DomDepends)}SetShaderInfo(e,t,i,n){const s={shaderStr:e,uniformParams:t,textureParams:i};let a=0;null!=n&&(a=u.AddData(n)),this._NativeSyncer.CallToNative(7001,[JSON.stringify(s),a],this._DomDepends)}},Ve.NativeSharedView=class extends ge{constructor(e){super(e),this._JsContextId=window.JsView?window.JsView.getJsContextId():0,this._TrackId=null,this.SetTrackId(this._JsContextId+"_"+this.ViewId)}CreateView(e){me.CreateNativeView(this.ViewId,9,e.DomDepends)}GetTrackId(){return this._TrackId}SetTrackId(e){this._TrackId=e,this._NativeSyncer.CallToNative(10101,[this._TrackId],this._DomDepends)}SetOverSize(e){this._NativeSyncer.CallToNative(10102,[isNaN(e)?0:e],this._DomDepends)}},Ve.NinePatchView=class extends ge{CreateView(e){me.CreateNativeView(this.ViewId,4,e.DomDepends)}SetRepeat(e,t){this._NativeSyncer.CallToNative(4001,[e,t],this._DomDepends)}SetPadding(e,t){this._NativeSyncer.CallToNative(4002,[e,t],this._DomDepends)}SetImageDspSize(e,t){this._NativeSyncer.CallToNative(4003,[e,t],this._DomDepends)}SetDesignMapWidth(e){this._NativeSyncer.CallToNative(4004,[e],this._DomDepends)}EnableAlphaMix(e){this._NativeSyncer.CallToNative(4005,[e.TexId],this._DomDepends)}},Ve.PreloadView=class extends ge{constructor(e=null){super(e)}CreateView(e){me.CreateNativeView(this.ViewId,7,e.DomDepends)}},Ve.SprayView=class extends ge{constructor(e=null){super(e),this.onStop=null}SetSprayInfo(e,t,i,n,s,a,r,o,l,h,c,u,d,_,S,p,y,v,m,C,g,f,T){this._NativeSyncer.CallToNative(6001,[e,t,i,n,s,a,r,o,l,h,c,u,d,_,!!S,!!p,!!y,v,m,C,g,f,T],this._DomDepends)}CreateView(e){me.CreateNativeView(this.ViewId,6,e.DomDepends)}Start(){this._NativeSyncer.CallToNative(6002,[],this._DomDepends)}Stop(e=!1){this._NativeSyncer.CallToNative(6003,[e],this._DomDepends)}RegisterOnStop(e){this.onStop=e}_OnEvent(e){try{if("onStop"===JSON.parse(e).type)this.onStop?.()}catch(e){console.error("SprayView onEvent error",e)}}RegisterEventListener(){const e=u.AddData(this._OnEvent.bind(this));this._NativeSyncer.CallToNative(6004,[e])}},Ve.TextInputType=Ne,Ve.FilterViewType=Re,Ve.TextureSetting=ye,Ve.ExternalTextureSetting=ye,Ve.TextUtils=Ge,Ve.VisibleSensor=class extends pe{constructor(e,t=null){super(),this.InitSet(e,t)}CreateSensor(){this.CreateTypedSensor(1)}InitSet(e,t){let i=0;t&&(i=u.AddData(((e,i,n,s)=>{t(1==e,1==i,1==n,1==s)}))),this._NativeSync.CallToNative(11,[e.ViewId,i],!0)}ResetArea(e){"number"!=typeof e.horizon&&(console.log("horizon not set, default to 1.0"),e.horizon=1),"number"!=typeof e.vertical&&(console.log("vertical not set, default to 1.0"),e.vertical=1),this._NativeSync.CallToNative(12,[e.horizon,e.vertical],!0)}Enable(e){this._NativeSync.CallToNative(13,[!!e],!0)}ResetContainer(e){let t;t=e?e.ViewId:0,this._NativeSync.CallToNative(14,[t],!0)}},Ve.EnvBlockerSensor=class extends pe{constructor(e){super(),this.InitSet(e)}CreateSensor(){this.CreateTypedSensor(4)}InitSet(e){this._NativeSync.CallToNative(30,[e.ViewId],!0)}ResetTopGID(e){this._ResetSideGID(0,e)}ResetBottomGID(e){this._ResetSideGID(1,e)}ResetLeftGID(e){this._ResetSideGID(2,e)}ResetRightGID(e){this._ResetSideGID(3,e)}_ResetSideGID(e,t){this._NativeSync.CallToNative(31,[e,isNaN(t)?0:parseInt(t)],!0)}Enable(e){this._NativeSync.CallToNative(32,[e],!0)}},Ve.sImpactSensorManager=Ie,Ve.TextureInstantLoad=T,Ve.QRCodeLevel=f,Ve.ColorSpace=g,Ve.TextureManager=I,Ve.FreeMoveExternType=X,Ve.AnimationListener=class{constructor(e,t,i){this.ListenerEnabledFlags=0,this.InvokeAnimationStart=e,this._OnAnimationStart=e,e&&(this.ListenerEnabledFlags|=1),this.InvokeAnimationEnd=t,this._OnAnimationEnd=t,t&&(this.ListenerEnabledFlags|=2),this.InvokeViewNoVisible=i,this._OnViewNoVisible=i,i&&(this.ListenerEnabledFlags|=4),this.InvokeAnimRepeat=null,this._OnAnimRepeat=null,this.InvokeAnimFinal=null,this._OnAnimFinal=null,this._AttachedGroup=null,this._InheritListener=[]}OnStart(e){return this.InvokeAnimationStart=this._OnAnimationStart=e,e?this.ListenerEnabledFlags|=1:this.ListenerEnabledFlags&=30,this}OnEnd(e){return this.InvokeAnimationEnd=this._OnAnimationEnd=e,e?this.ListenerEnabledFlags|=2:this.ListenerEnabledFlags&=29,this}OnRepeat(e){return this.InvokeAnimRepeat=this._OnAnimRepeat=e,e?this.ListenerEnabledFlags|=8:this.ListenerEnabledFlags&=23,this}OnFinalProgress(e){return this.InvokeAnimFinal=this._OnAnimFinal=e,e?this.ListenerEnabledFlags|=16:this.ListenerEnabledFlags&=15,this}AddInherit(e){if(e){if(0==this._InheritListener.length){var t=this;this.InvokeAnimationStart=function(){t._OnAnimationStart&&t._OnAnimationStart();for(var e=0;e<t._InheritListener.length;e++)t._InheritListener[e].InvokeAnimationStart?.()},this.InvokeAnimationEnd=function(e){t._OnAnimationEnd&&t._OnAnimationEnd(e);for(var i=0;i<t._InheritListener.length;i++)t._InheritListener[i].InvokeAnimationEnd?.(e)},this.InvokeViewNoVisible=function(){t._OnViewNoVisible&&t._OnViewNoVisible();for(var e=0;e<t._InheritListener.length;e++)t._InheritListener[e].InvokeViewNoVisible?.()},this.InvokeAnimFinal=function(e){t._OnAnimFinal&&t._OnAnimFinal(e);for(var i=0;i<t._InheritListener.length;i++)t._InheritListener[i].InvokeAnimFinal?.(e)},this.InvokeAnimRepeat=function(e){t._OnAnimRepeat&&t._OnAnimRepeat(e);for(var i=0;i<t._InheritListener.length;i++)t._InheritListener[i].InvokeAnimRepeat?.(e)},this.ListenerEnabledFlags=31}this._InheritListener.push(e)}}InvokeFromNativeForge(e){switch(e.type){case"end":this.InvokeAnimationEnd?.(1==e.normalEnd);break;case"novisible":this.InvokeViewNoVisible?.();break;case"final":this.InvokeAnimFinal?.(e.progress);break;case"repeat":this.InvokeAnimRepeat?.(e.timesCount)}}},Ve.AnimFireCommand=se,Ve.AnimationEnable=ne,Ve.TranslateAnimation=class extends ie{constructor(e,t,i,n,s,a){super(),te.CreateTranslate(e,t,i,n,s,a,this.AnimNativeId)}},Ve.RotateAnimation=class extends ie{constructor(e,t,i,n,s,a){super(),te.CreateRotate(e,t,i,n,s,a,this.AnimNativeId)}},Ve.ScaleAnimation=class extends ie{constructor(e,t,i,n,s,a,r,o,l=200,h=200){super(),te.CreateScale(e,t,i,n,s,a,l,h,r,o,this.AnimNativeId)}},Ve.TranslateFrameAnimation=class extends ie{constructor(e,t,i,n,s,a){super();let r=Math.floor(100*i/55)/100;te.CreateTranslateFrame(e,t,r,r,n,s,a,this.AnimNativeId)}},Ve.CssKeyframeAnimation=class extends ie{constructor(e,t,i,n,s){super(),te.CreateCssKeyframe(e,t,i,n,s,this.AnimNativeId)}},Ve.ShaderAnimation=class extends ie{constructor(e,t){super(),te.CreateShaderAnimation(e,t,this.AnimNativeId)}},Ve.FreeMoveAnimation=class extends ie{constructor(e,t,i){super(),this._EchoCallback=e,te.CreateFreeMoveAnimation(this.AnimNativeId,e,t,i)}},Ve.FreeMoveActEvtType=Y,Ve.BezierEasing=ce,Ve.StepsEasing=class extends ae{constructor(e,t){super(),this._Steps=e,this._Type=t}Package(){var e=this._GetBasePackage(6);return e.St={S:this._Steps,T:this._Type},e}},Ve.Easing=de,Ve.FreeMoveCmdPackBuilder=class{static InitActCmdPack(e,t,i,n){return{t:1,cmds:n,tkn:isNaN(i)?0:i,spd:isNaN(e)?0:e,acc:isNaN(t)?0:t}}static InitStateCmdPack(e){return{t:2,cmd:e}}},Ve.FreeMoveConditionSet=class{static AppendSubCmd(e,t){const i="cmds";e.hasOwnProperty("cmdPacks")?console.error("Error: conflict with command pack list"):(e.hasOwnProperty(i)||(e[i]=[]),e[i]?.push(t))}static SetCmdList(e,t){t instanceof Array&&(e.hasOwnProperty("cmdPacks")?console.error("Error: conflict with command pack list"):e.cmds=t)}static SetCmdPackList(e,t){t instanceof Array&&(e.hasOwnProperty("cmds")?console.error("Error: conflict with sub-command list"):e.cmdPacks=t)}static InitCommonInfo(){return{g:0,m:!1,s:null,brk:!1}}static UpdateCommonInfo(e,t,i,n,s){e.g=t??0,e.m=i??!1,e.s=n??null,e.brk=s}static ReachPosition(e,t,i){let n=z(e,t),s={subt:1,react:1,e:n.e,xv:n.x,yv:n.y};return $(s,i),s}static AcrossPosition(e,t,i){let n=z(e,t),s={subt:1,react:2,e:n.e,xv:n.x,yv:n.y};return $(s,i),s}static BoxPosition(e,t,i,n,s){let a=0,r=0,o=0,l=0,h=0;isNaN(e)||(a=e,h|=1),isNaN(t)||(r=t,h|=2),isNaN(i)||(o=i,h|=4),isNaN(n)||(l=n,h|=8);let c={subt:1,react:7,de:h,lv:a,tv:r,rv:o,bv:l};return $(c,s),c}static StartMove(e,t){return this.OnMovement(t,1,1,e)}static OnMovement(e,t,i,n){let s={subt:1,react:9,xv:t,yv:i,e:n};return $(s,e),s}static OffsetPosition(e,t,i,n,s){let a=0,r=0,o=0,l=0,h=0;isNaN(e)||(a=e,h|=1),isNaN(t)||(r=t,h|=2),isNaN(i)||(o=i,h|=4),isNaN(n)||(l=n,h|=8);let c={subt:1,react:8,de:h,lv:a,tv:r,rv:o,bv:l};return $(c,s),c}static WallPosition(e,t,i,n){let s,a=z(t,i);switch(e){case"left":s=4;break;case"top":s=3;break;case"right":s=5;break;case"bottom":s=6;break;default:return console.error("WallPosition undefined direction",e),null}let r={subt:1,react:s,e:a.e,xv:a.x,yv:a.y};return $(r,n),r}static ReachSpeed(e,t,i){let n=z(e,t),s={subt:2,react:1,e:n.e,xv:n.x,yv:n.y};return $(s,i),s}static AcrossSpeed(e,t,i){let n=z(e,t),s={subt:2,react:2,e:n.e,xv:n.x,yv:n.y};return $(s,i),s}static TouchCount(e,t){let i={subt:5,react:2,tct:t};return $(i,e),i}static OnNexusEvent(e,t,i){let n={subt:3,nexus:e,etyp:t};return $(n,i),n}static OnDragStart(e,t){let i={subt:3,nexus:t,etyp:Y.ActEvent_ActDragStart};return $(i,e),i}static OnDragEnd(e,t){let i={subt:3,nexus:t,etyp:Y.ActEvent_ActDragEnd};return $(i,e),i}static OnTouchDown(e,t){let i={subt:3,nexus:t,etyp:Y.ActEvent_ActTouchDown};return $(i,e),i}static OnTouchRelease(e,t){let i={subt:3,nexus:t,etyp:Y.ActEvent_ActTouchRelease};return $(i,e),i}static OnFlingStart(e,t){let i={subt:3,nexus:t,etyp:Y.ActEvent_ActFlingStart};return $(i,e),i}static OnFlingProgress(e,t){let i={subt:3,nexus:t,etyp:Y.ActEvent_ActFlingProgress};return $(i,e),i}static OnFlingEnd(e,t){let i={subt:3,nexus:t,etyp:Y.ActEvent_ActFlingEnd};return $(i,e),i}static OnFlingCancel(e,t){let i={subt:3,nexus:t,etyp:Y.ActEvent_ActFlingCancel};return $(i,e),i}static OnFlingDrop(e,t){let i={subt:3,nexus:t,etyp:Y.ActEvent_ActFlingDrop};return $(i,e),i}static OnHitBlock(e,t){let i={subt:4,blkGid:e};return $(i,t),i}static OnNextTick(e,t){let i={subt:5,react:1,tgap:e};return t.m=!1,$(i,t),i}static MovementSyncNexus(e,t){let i={subt:3,nexus:t,etyp:Y.ActEvent_MovementSync};return $(i,e),i}},Ve.FreeMoveActionBuilder=class{static SetSpeed(e,t){let i=z(e,t);return{typ:2,set:{xv:i.x,yv:i.y,xye:i.e}}}static SetAccel(e,t){let i=z(e,t);return{typ:7,set:{xye:i.e,xv:i.x,yv:i.y}}}static AltSpeed(e,t,i){if(!i)return null;let n=z(e,t);return{typ:5,set:{xv:n.x,yv:n.y,xye:n.e,tim:Math.floor(i)}}}static StopMoving(){return{typ:3}}static StopMovingExact(){return{typ:9}}static BrakeToPos(e,t){let i=z(e,t);return{typ:4,set:{xv:Math.floor(i.x),yv:Math.floor(i.y),xye:i.e}}}static SetArrowSpeed(e,t,i,n){let s=z(e,t),a=z(i,n);return{typ:6,set:{xye:s.e,xv:Math.floor(s.x),yv:Math.floor(s.y),xye1:a.e,xv1:a.x,yv1:a.y}}}static TeleportTo(e,t,i){let n=z(e,t);return{typ:8,set:{xye:n.e,xv:Math.floor(n.x),yv:Math.floor(n.y),isAbs:!i}}}static AckMovementSync(e,t,i,n,s,a){return{typ:10,set:{hstart:e,hend:t,vstart:i,vend:n,xye:s,st:a}}}},Ve.FreeMoveStateBuilder=class{static FireEcho(e){return{typ:52,set:{tkn:e}}}static FireNexusEvent(e,t){return isNaN(t)||0==t?null:{typ:55,set:{etyp:isNaN(e)?0:e,nexus:t}}}static NewCondition(e){return{typ:Z,set:{sub:1,set:e}}}static DelActionAssocCondition(){return{typ:Z,set:{sub:5}}}static RemoveAllCondtions(){return{typ:Z,set:{sub:6}}}static RemoveByGroup(e){return{typ:Z,set:{sub:4,gt:e}}}static RemoveByName(e){return{typ:Z,set:{sub:7,sn:e}}}static ActiveCondition(e,t){return{typ:Z,set:{sub:2,gt:isNaN(e)||e<=0?X.GroupType_Invalid_Ext:e,sn:t}}}static DeactiveCondition(e,t){return{typ:Z,set:{sub:3,gt:isNaN(e)||e<=0?X.GroupType_Invalid_Ext:e,sn:t}}}static SetOffsetPos(e,t){let i=z(e,t);return{typ:53,set:{xv:Math.floor(i.x),yv:Math.floor(i.y),xye:i.e}}}static SetPos(e,t){let i=z(e,t);return{typ:54,set:{xv:Math.floor(i.x),yv:Math.floor(i.y),xye:i.e}}}static TouchLockSwitch(e,t,i=-1){return{typ:59,set:{il:e,dir:t,ut:i}}}static SetTouchAttractChild(e){return{typ:60,set:{cid:e?e.AnimNativeId:0}}}static SetHitWallOverflow(){return{typ:56}}static RevertWithHitBlock(){return{typ:57}}static StartMovementSync(e,t,i,n,s,a){return{typ:61,set:{hstart:t,hend:i,vstart:n,vend:s,xye:a,nexus:e}}}static StopMovementSync(){return{typ:62}}};
2
2