@shijiu/jsview 2.1.6-alpha.0 → 2.1.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dom/bin/jsview-dom-browser.min.js +1 -1
- package/dom/bin/jsview-dom-native.min.js +1 -1
- package/dom/bin/jsview-engine-js-browser.min.js +1 -1
- package/dom/target_core_revision.mjs +4 -4
- package/loader/jsview-loader.js +24 -2
- package/loader/jsview.config.default.js +25 -12
- package/package.json +1 -1
- package/patches/node_modules/@vue/runtime-core/dist/runtime-core.esm-bundler.js +10 -9
- package/patches/node_modules/vite/dist/node/jsview-vite-extension.js +2 -0
- package/tools/jsview-post-build.mjs +32 -8
- package/tools/jsview-post-install.mjs +3 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/* eslint-disable */ import{parseGIF as t,decompressFrames as e}from"gifuct-js";void 0===window.Forge?(window.Forge={},console.log("Define forge browser")):console.log("Define using JsView forge engine-js");var i=window.Forge;class n{static ToString(t){switch(t){case n.UnknownError:return"UnknownError("+t+")";case n.UnimplementedError:return"UnimplementedError("+t+")";case n.UnsupportedError:return"UnsupportedError("+t+")";case n.NotFoundError:return"NotFoundError("+t+")";case n.InvalidArgument:return"InvalidArgument("+t+")";case n.BadArgumentSize:return"BadArgumentSize("+t+")";case n.InvalidElement:return"InvalidElement("+t+")";case n.BadElementType:return"BadElementType("+t+")";case n.CssStyleNotExists:return"CssStyleNotExists("+t+")";case n.CssStyleNotChanged:return"CssStyleNotChanged("+t+")";case n.CssStyleBadType:return"CssStyleBadType("+t+")";case n.CssClassNotChanged:return"CssClassNotChanged("+t+")";case n.ForgeInsertView:return"ForgeInsertView("+t+")";default:return"UnknownError("+t+")"}}static GetFormattedMethod(t){var e,i;e=t.indexOf(" ")+1,i=t.indexOf("(")-e;return t.substr(e,i)+"()"}static GetErrorMessage(t=[]){var e="";for(const i of t)e+=i;return e}static PrintErrorMessage(t,e,i=[]){const s=n.GetErrorMessage(i);console.error("ForgeDom","Error@ "+t+":"+e+", "+s)}static UnknownError=-1;static UnimplementedError=-2;static UnsupportedError=-3;static NotFoundError=-4;static InvalidArgument=-5;static BadArgumentSize=-6;static InvalidElement=-100;static BadElementType=-101;static BadTaskType=-102;static CssStyleNotExists=-120;static CssStyleNotChanged=-121;static CssStyleBadName=-122;static CssStyleBadType=-123;static CssClassNotChanged=-124;static ForgeInsertView=-200;constructor(){throw new Error("new ErrCode() is forbidden.")}}function s(t,e,i=[]){u(t,n.GetErrorMessage(i),e)}function r(t,e,i=[]){u(t,n.GetErrorMessage(i),e)}function a(t,e=[]){u(t,n.GetErrorMessage(e))}function o(t,e=[]){c(t,n.GetErrorMessage(e),t)}function l(t,e,i=[]){c(t,n.GetErrorMessage(i),e)}function h(t,e=[]){c(t,n.GetErrorMessage(e))}function c(t,e,i){if(t<0)throw n.PrintErrorMessage("__FILE_NAME__","__LINE__",[n.ToString(t),". ",e]),new Error(i)}function u(t,e,i){if(!t)throw n.PrintErrorMessage("__FILE_NAME__","__LINE__",["ASSERT("+t+")",". ",e]),new Error(i)}class d{static Layout=class{static Height="height";static Left="left";static Top="top";static Width="width";constructor(){throw new Error("new StyleName.Layout() is forbidden.")}};static Background=class{static BackgroundColor="backgroundColor";static BackgroundImage="backgroundImage";static BorderRadius="borderRadius";constructor(){throw new Error("new StyleName.Background() is forbidden.")}};static Effect=class{static BackfaceVisibility="backfaceVisibility";static BorderImage="borderImage";static BorderImageWidth="borderImageWidth";static BorderImageOutset="borderImageOutset";static Display="display";static ObjectFit="objectFit";static Opacity="opacity";static Overflow="overflow";static Perspective="perspective";static PerspectiveOrigin="perspectiveOrigin";static Transform="transform";static TransformOrigin="transformOrigin";static TransformStyle="transformStyle";static Visibility="visibility";static ZIndex="zIndex";constructor(){throw new Error("new StyleName.Effect() is forbidden.")}};static Text=class{static Color="color";static FontFamily="fontFamily";static FontSize="fontSize";static FontStyle="fontStyle";static FontWeight="fontWeight";static LineHeight="lineHeight";static TextAlign="textAlign";static TextOverflow="textOverflow";static TextShadow="textShadow";static WebkitTextStroke="WebkitTextStroke";static WhiteSpace="whiteSpace";static WordWrap="wordWrap";static Direction="direction";static JsvTextEmoji="JsvTextEmoji";static JsvTextLatex="JsvTextLatex";static JsvTextAlignMinWidth="JsvTextAlignMinWidth";static JsvTextVerticalAlign="JsvTextVerticalAlign";static JsvTextLineAlign="JsvTextLineAlign";static JsvTextInnerDirection="JsvTextInnerDirection";constructor(){throw new Error("new StyleName.Text() is forbidden.")}};static Motion=class{static Animation="animation";static Transition="transition";constructor(){throw new Error("new StyleName.Motion() is forbidden.")}};static HasGetterMethod(t){switch(t){case d.Layout.Height:case d.Layout.Left:case d.Layout.Top:case d.Layout.Width:case d.Effect.ObjectFit:return!0;default:return!1}}static ToConst(t){return t==d.Layout.Height?d.Layout.Height:t==d.Layout.Left?d.Layout.Left:t==d.Layout.Top?d.Layout.Top:t==d.Layout.Width?d.Layout.Width:t==d.Background.BackgroundColor?d.Background.BackgroundColor:t==d.Background.BackgroundImage?d.Background.BackgroundImage:t==d.Background.BorderRadius?d.Background.BorderRadius:t==d.Effect.BackfaceVisibility?d.Effect.BackfaceVisibility:t==d.Effect.BorderImage?d.Effect.BorderImage:t==d.Effect.BorderImageWidth?d.Effect.BorderImageWidth:t==d.Effect.BorderImageOutset?d.Effect.BorderImageOutset:t==d.Effect.Display?d.Effect.Display:t==d.Effect.ObjectFit?d.Effect.ObjectFit:t==d.Effect.Opacity?d.Effect.Opacity:t==d.Effect.Overflow?d.Effect.Overflow:t==d.Effect.Perspective?d.Effect.Perspective:t==d.Effect.PerspectiveOrigin?d.Effect.PerspectiveOrigin:t==d.Effect.Transform?d.Effect.Transform:t==d.Effect.TransformOrigin?d.Effect.TransformOrigin:t==d.Effect.TransformStyle?d.Effect.TransformStyle:t==d.Effect.Visibility?d.Effect.Visibility:t==d.Effect.ZIndex?d.Effect.ZIndex:t==d.Text.Color?d.Text.Color:t==d.Text.FontFamily?d.Text.FontFamily:t==d.Text.FontSize?d.Text.FontSize:t==d.Text.FontStyle?d.Text.FontStyle:t==d.Text.FontWeight?d.Text.FontWeight:t==d.Text.LineHeight?d.Text.LineHeight:t==d.Text.TextAlign?d.Text.TextAlign:t==d.Text.TextOverflow?d.Text.TextOverflow:t==d.Text.TextShadow?d.Text.TextShadow:t==d.Text.WebkitTextStroke?d.Text.WebkitTextStroke:t==d.Text.WhiteSpace?d.Text.WhiteSpace:t==d.Text.WordWrap?d.Text.WordWrap:t==d.Text.Direction?d.Text.Direction:t==d.Text.JsvTextEmoji?d.Text.JsvTextEmoji:t==d.Text.JsvTextLatex?d.Text.JsvTextLatex:t==d.Text.JsvTextAlignMinWidth?d.Text.JsvTextAlignMinWidth:t==d.Text.JsvTextVerticalAlign?d.Text.JsvTextVerticalAlign:t==d.Text.JsvTextLineAlign?d.Text.JsvTextLineAlign:t==d.Text.JsvTextInnerDirection?d.Text.JsvTextInnerDirection:t==d.Motion.Animation?d.Motion.Animation:t==d.Motion.Transition?d.Motion.Transition:null}constructor(){throw new Error("new StyleName() is forbidden.")}}class g{static Base=class{constructor(t){this.rawValue=t}rawValue};static AnimationImpl=class extends g.Base{constructor(t){super(t)}name="";duration=0;timingFunction=null;delay=0;iterationCount=0;direction=!1};static CornerImpl=class extends g.Base{constructor(t){super(t)}topLeft=0;topRight=0;bottomRight=0;bottomLeft=0};static RectImpl=class extends g.Base{constructor(t){super(t)}top=0;right=0;left=0;bottom=0};static TextShadowImpl=class extends g.Base{constructor(t){super(t)}hShadow=0;vShadow=0;blur=0;color=void 0};static WebkitTextStrokeImpl=class extends g.Base{constructor(t){super(t)}length=0;color=void 0};static TransitionImpl=class extends g.Base{constructor(t){super(t)}animationMap=new Map};static BorderImageImpl=class extends g.Base{constructor(t){super(t)}source="";slice=null};static BackgroundImageImpl=class extends g.Base{constructor(t){super(t)}type=0;static eType={UNKNOWN:0,LINEAR_GRADIENT:1,URL_PATH:2};static LinearGradient=class{fromX=0;fromY=0;toX=0;toY=0;stops=[]};linearGradient;urlPath=""};static DataType=class{static Null=0;static Int32=1;static Float=2;static String=3;static Animation=4;static Corner=5;static Rect=6;static TextShadow=7;static WebkitTextStroke=8;static Transition=9;static BorderImage=10;static BackgroundImage=11};static InvalidInt32=Number.MIN_VALUE;static InvalidFloat=Number.NaN;static InvalidPointer=null;constructor(t){let e=-1,i=null;null==t?e=g.DataType.Null:Number(t)===t&&t%1==0?e=g.DataType.Int32:Number(t)===t&&t%1!=0?e=g.DataType.Float:"string"==typeof t||t instanceof String?e=g.DataType.String:t instanceof g.AnimationImpl?e=g.DataType.Animation:t instanceof g.CornerImpl?e=g.DataType.Corner:t instanceof g.RectImpl?e=g.DataType.Rect:t instanceof g.TextShadowImpl?e=g.DataType.TextShadow:t instanceof g.WebkitTextStrokeImpl?e=g.DataType.WebkitTextStroke:t instanceof g.TransitionImpl?e=g.DataType.Transition:t instanceof g.BorderImageImpl&&(e=g.DataType.BorderImage),t!=g.InvalidInt32&&t!=g.InvalidFloat&&t!=g.InvalidPointer?i=t:(e=g.DataType.Null,i=null),this.data=new g.DataInfo,this.data.index=e,this.data.value=i}toString(){let t=null;switch(this.data.index){case g.DataType.Null:return"";case g.DataType.Int32:case g.DataType.Float:return String(this.get());case g.DataType.String:t=this.get();break;case g.DataType.Animation:case g.DataType.Corner:case g.DataType.Rect:case g.DataType.TextShadow:case g.DataType.WebkitTextStroke:case g.DataType.Transition:case g.DataType.BorderImage:case g.DataType.BackgroundImage:t=this.get().rawValue;break;default:console.error("Failed to do StyleValue.toString()")}return t??""}is(t){return this.data.index==t}get(){return this.data.value}reset(t){this.data.value=t.data.value,this.data.index=t.data.index}equals(t){return this.data.value===t.data.value&&this.data.index===t.data.index}static DataInfo=class{value=null;index=-1};data}class f{static Text=class{static Color="#000000";static FontFamily="黑体";static FontSize=10;static FontStyle="normal";static FontWeight="normal";static LineHeight=0;static TextAlign="start";static TextOverflow="clip";static TextShadow=null;static WebkitTextStroke=null;static WhiteSpace="normal";static WordWrap="normal";static Direction="ltr";static JsvTextEmoji=0;static JsvTextLatex=0;static JsvTextAlignMinWidth=0;static JsvTextVerticalAlign="top";static JsvTextLineAlign="middle";static JsvTextInnerDirection="unset"}}class m{static FormatVariableName(t){return t.startsWith("--")?"var("+t+")":t.startsWith("var(--")?t:(r(!1,null),null)}static IsVariable(t){let e;if(t instanceof g){if(0==t.is(g.DataType.String))return!1;e=t.get()}else{if("string"!=typeof t)return!1;e=t}return e.startsWith("--")||e.startsWith("var(--")}constructor(){throw new Error("new StyleVariable() is forbidden.")}}class p{static Layout=class{height=g.InvalidInt32;left=g.InvalidInt32;top=g.InvalidInt32;width=g.InvalidInt32;static Name="layout"};static Background=class{backgroundColor=g.InvalidPointer;backgroundImage=g.InvalidPointer;borderRadius=g.InvalidPointer;static Name="background"};static Effect=class{backfaceVisibility=g.InvalidPointer;borderImage=g.InvalidPointer;borderImageWidth=g.InvalidPointer;borderImageOutset=g.InvalidPointer;display=g.InvalidPointer;objectFit=g.InvalidPointer;opacity=g.InvalidFloat;overflow=g.InvalidPointer;perspective=g.InvalidInt32;perspectiveOrigin=g.InvalidPointer;transform=g.InvalidPointer;transformOrigin=g.InvalidPointer;transformStyle=g.InvalidPointer;visibility=g.InvalidPointer;zIndex=g.InvalidInt32;static Name="effect"};static Text=class{color=g.InvalidPointer;fontFamily=g.InvalidPointer;fontSize=g.InvalidInt32;fontStyle=g.InvalidPointer;fontWeight=g.InvalidPointer;lineHeight=g.InvalidInt32;textAlign=g.InvalidPointer;textOverflow=g.InvalidPointer;textShadow=g.InvalidPointer;webkitTextStroke=g.InvalidPointer;whiteSpace=g.InvalidPointer;wordWrap=g.InvalidPointer;direction=g.InvalidPointer;jsvTextEmoji=g.InvalidInt32;jsvTextLatex=g.InvalidInt32;jsvTextAlignMinWidth=g.InvalidInt32;jsvTextVerticalAlign=g.InvalidPointer;jsvTextLineAlign=g.InvalidPointer;jsvTextInnerDirection=g.InvalidPointer;static Name="text"};static Motion=class{animation=g.InvalidPointer;transition=g.InvalidPointer;static Name="motion"};constructor(){throw new Error("new StyleGroup() is forbidden.")}}void 0===window.ForgeFront&&(window.ForgeFront={},console.log("Define global ForgeFront browser"));let _=window.ForgeFront;const T=new class{constructor(){this._count=1}get count(){return this._count}update(){this._count<Number.MAX_SAFE_INTEGER?++this._count:this._count=1}};_.sFrameCount=T;class y{static getTextPixelWith(t,e){null===y.sCanvas&&(y.sCanvas=window.originDocument.createElement("canvas"));const i=y.sCanvas.getContext("2d");i.font=e;const n=i.measureText(t);return Math.ceil(n.width)}static GetOneLineTextDrawWidth(t,e,i,n,s){const r=[];r.push(0);const a=n?"bold":"",o=s?"italic":"",l=Math.floor(2048/i);let h=0,c=0;for(;h<t.length;){const n=h+l;let s;if(h+l>=t.length)s=t.length-h;else{let e=t.lastIndexOf(" ",n);s=e>h?e-h+1:l}const u=t.slice(h,h+s),d=y.getTextPixelWith(u,`${a} ${o} ${i}px ${e}`);r.push(h),r.push(h+s),r.push(d),c+=d,h+=s}return r[0]=c,r}static GetTextWidth(t){let e="";t.bold&&(e="bold");let i="";return t.italic&&(i="italic"),this.getTextPixelWith(t.str,`${e} ${i} ${t.size}px ${t.font}`)}static GetTextRect(t,e,i,n,s){let r=Math.ceil(i.size*t.length/e.width)*s;r>e.height&&(r=e.height);return{width:e.width,height:r}}static GetCursorOffset(t,e,i,n,s,r,a){let o="";i.bold&&(o="bold");let l="";i.italic&&(l="italic");let h=0;if("right"===i.alignment){const n=this.getTextPixelWith(t,`${o} ${l} ${i.size}px ${i.font}`);(r-=e.width-n)<0&&(r=0)}let c=0;for(;r>=c&&h!==t.length;)c=this.getTextPixelWith(t.substr(0,h+1),`${o} ${l} ${i.size}px ${i.font}`),r>=c&&h++;return h}static GetCursorPosition(t,e,i,n,s,r){let a="";i.bold&&(a="bold");let o="";i.italic&&(o="italic");let l=0,h=t;if(r<t.length&&(h=h.substr(0,r)),l=this.getTextPixelWith(h,`${a} ${o} ${i.size}px ${i.font}`),"right"===i.alignment){const n=this.getTextPixelWith(t,`${a} ${o} ${i.size}px ${i.font}`);l=e.width-n+l}return{x:l,y:0}}}y.sCanvas=null,window.PlatformUtils=y;class w{constructor(t){this.state={},this.type=t,this._AutoPlay=!1}buildPlatformInstance(){this.Ele=window.originDocument.createElement(this.type),this.Ele.addEventListener("loadedmetadata",(()=>{this.hasOwnProperty("onload")&&this.onload(),this.hasOwnProperty("onloadedmetadata")&&this.onloadedmetadata()}))}set autoplay(t){void 0!==t&&(this._AutoPlay=!0,this.Ele.paused&&setTimeout((()=>{this.play()}),0))}get currentTime(){return this.Ele.currentTime}set currentTime(t){this.Ele.currentTime=t,this.setState("seek",t,"number")}get duration(){return this.Ele.duration}set loop(t){this.Ele.loop="boolean"==typeof t||void 0!==t}get muted(){return this.getState("muted")}set muted(t){this.setState("muted",t,"boolean")}get paused(){return this.Ele.paused}get playbackRate(){return this.getState("playbackRate")}set playbackRate(t){this.setState("playbackRate",t,"number")}set src(t){this.setState("src",t,"string"),t&&this._AutoPlay&&setTimeout((()=>{this.play()}),0)}get style(){const t=this;return{set bottom(e){t.setState("style",`{"bottom":"${e}"}`,"string")},set left(e){t.setState("style",`{"left":"${e}"}`,"string")},set right(e){t.setState("style",`{"right":"${e}"}`,"string")},set top(e){t.setState("style",`{"top":"${e}"}`,"string")},set height(e){t.setState("style",`{"height":"${e}"}`,"string")},set width(e){t.setState("style",`{"width":"${e}"}`,"string")}}}get volume(){return this.getState("volume")}set volume(t){this.setState("volume",t,"number")}get playableDuration(){return this.Ele.playableDuration}addEventListener(t,e){this[`on${t}`]=e,this.Ele.addEventListener(t,(e=>{this[`on${t}`](e)}))}load(){this.Ele.load()}pause(){this.Ele.pause(),this.setState("paused",!0,"boolean"),this.hasOwnProperty("onpause")&&this.onpause()}play(){this.setState("paused",!1,"boolean"),this.Ele.play(),this.hasOwnProperty("onplay")&&this.onplay()}unload(){this.setState("paused",!0,"boolean"),this.Ele.pause(),this.Ele.removeAttribute("src"),this.Ele.load()}setState(t,e,i){typeof e===i?("playbackRate"==t?this.Ele.playbackRate=e:"muted"==t?this.Ele.muted=e:this.Ele.setAttribute(t,e),this.state[t]=e,console.log(`set ${t} = ${e}`)):console.warn(`invalid paramter type to set ${t}. value is not ${i}`)}getState(t){let e=this.state[t];return console.log(`get ${t} = ${e}`),void 0===e&&(e=this.Ele.getAttribute(t),this.state[t]=e),e}onEnd(t){this.setState("paused",!0,"boolean"),this.hasOwnProperty("onended")&&this.onended()}onError(t){this.hasOwnProperty("onerror")&&this.onerror(t.currentTarget.error.code)}mediaHandler(){return this.Ele}static setDesignMapWidth(t){"number"==typeof t?w.prototype.designMapWidth=t:console.warn(`Invalid paramter type to set ${t}. It is not number.`)}}w.prototype.designMapWidth=0;class S extends w{constructor(t){super(t),super.buildPlatformInstance(t)}}class x extends S{constructor(){super("audio")}}window._ExtAudio=x;class b extends S{constructor(){super("video"),this.state.height=0,this.state.width=0,this.state.aspectRatiow="origin"}get height(){return this.getState("height")}set height(t){this.style.height=t,this.state.height=t}get poster(){return console.log("Video.poster() TODO"),null}set poster(t){console.log("Video.poster() TODO")}get videoAspectRatio(){return this.getState("aspectRatio")}set videoAspectRatio(t){this.setState("aspectRatio",t,"string")}get videoHeight(){return this.Ele.videoHeight}get videoWidth(){return this.Ele.videoWidth}get width(){return this.getState("width")}set width(t){this.style.width=t,this.state.width=t}onLoad(t){super.onLoad(t)}setRotation(t,e,i,n){let s=function(){let s=`rotate3d(0, 0, 1, ${t}deg)`;if(90==t||-90==t){let t,r;if(n?(t=i/e,r=e/i):(t=this.videoHeight/this.videoWidth,r=this.videoWidth/this.videoHeight),isNaN(t)||isNaN(r))return!1;s+=` scale3d(${t}, ${r}, 1)`}return this.Ele.style.transform=s,this.Ele.parentNode&&(this.Ele.parentNode.style.overflow="hidden"),!0};s=s.bind(this);s()||this.Ele.addEventListener("loadedmetadata",(()=>{s()}))}}window._ExtVideo=b;class v extends w{constructor(){super("video"),this._ReleaseCallbacks=[],this._ResourceTerminater=null,super.buildPlatformInstance()}setResourceTerminator(t){this._ResourceTerminater=t}hasTerminator(){return null!==this._ResourceTerminater}listenToRelease(t){this._ReleaseCallbacks.push(t)}unload(){super.unload(),null!==this._ResourceTerminater&&this._ResourceTerminater(),this._ResourceTerminater=null}releaseResource(){for(let t=0;t<this._ReleaseCallbacks.length;t++)this._ReleaseCallbacks[t]();null!==this._ResourceTerminater&&this._ResourceTerminater(),this._ResourceTerminater=null}confirmInitSetup(){}setRotation(){console.log("media.setRotation no implemented")}onPlatformDestroy(){}get videoHeight(){return this.Ele.videoHeight}get videoWidth(){return this.Ele.videoWidth}}window._ExtOVP=v,window.Audio=x,window.Video=b,window.OffscreenVideoPlayer=v;class E{constructor(t,e){if(this.href="",this.origin="",this.protocol="",this.host="",this.hostname="",this.port="",this.pathname="",this.search="",this.hash="",!t)return;if(!0===t.startsWith("url")){const e=t.indexOf("(")+1,i=t.lastIndexOf(")");t=t.substring(e,i).trim()}if(!0===t.startsWith("data:"))return void(this.href=t);if(!0===t.startsWith("/")&&(t=document.location.origin+t),!0===t.startsWith("./")){const e=document.location.pathname.lastIndexOf("/");let i="";e>0&&(i=document.location.pathname.substring(0,e)),t=document.location.origin+i+t.substring(1)}if(this.href=t,!e)return;let i=this.href.indexOf("?");const n=i>0?this.href.substring(0,i):this.href;this.search=i>1?this.href.substring(i):"",i=n.indexOf("://"),this.protocol=i>0?n.substring(0,i+1):"";const s=i>1?n.substring(i+3):"";i=s.indexOf("/"),this.host=i>0?s.substring(0,i):"",this.pathname=i>1?s.substring(i):"",this.origin=i>0?`${this.protocol}//${this.host}`:"",i=this.host.indexOf(":"),this.hostname=i>0?this.host.substring(0,i):this.host,this.port=i>1?this.host.substring(i+1):"",console.log("create total parse URL, this=",this)}replace(t){this.href=t}}const I=window.AudioContext||window.webkitAudioContext;if(I){const t=new I;let e=0,i=0;class n{constructor(t,e,i){this._Context=t,this._BufferSource=e,this._Gain=i,this._BufferSource.connect(this._Gain),this._Gain.connect(this._Context.destination)}start(t,e,i){this._BufferSource.start(t,e,i)}setVolume(t){this._Gain.gain.setValueAtTime(t,this._Context.currentTime)}stop(t){this._BufferSource.stop(t)}}class s{constructor(){this._SoundBufferMap={},this._StreamMap={}}load(i,n,s,r){const a=new E(i).href,o=e++;return this._requestBuffer(a,((e,i)=>{0===e?t.decodeAudioData(i,(t=>{this._SoundBufferMap[o]=t,r(o,0)})):r(-1,-1)})),o}unload(t){delete this._SoundBufferMap[t]}autoPause(){}autoResume(){}play(e,s,r,a,o,l){if(this._SoundBufferMap[e]){const r=i++,a=t.createBufferSource();a.buffer=this._SoundBufferMap[e],a.playbackRate.value=l,a.onended=t=>{this.stop(r)},o>0&&(a.loop=!0);const h=t.createGain();h.gain.setValueAtTime(s,t.currentTime);const c=new n(t,a,h);return this._StreamMap[r]=c,console.log("loop test",(o+1)*this._SoundBufferMap[e].duration),c.start(0,0,(o+1)*this._SoundBufferMap[e].duration),r}return-1}pause(t){}resume(t){}stop(t){this._StreamMap[t]&&(this._StreamMap[t].stop(),delete this._StreamMap[t])}release(){this._SoundBufferMap={},this._StreamMap={}}setVolume(t,e,i){this._StreamMap[t]&&this._StreamMap[t].setVolume(e)}setPriority(t,e){}setRate(t,e){}setLoop(t,e){}_requestBuffer(t,e){const i=new XMLHttpRequest;i.open("GET",t,!0),i.responseType="arraybuffer",i.onload=()=>{200===i.status?(console.log("http request succeed"),e(0,i.response)):(console.error(`download audio ${t} failed.`,i.status),e(-1,null))},i.send()}}window.SoundPool=s}else window.SoundPool=null;_.LogF=function(t){},_.LogE=function(t){},_.LogW=function(t){},_.LogI=function(t){},_.LogD=function(t){},_.LogM=function(t){},_.ThrowError=function(t){throw new Error(t)},_.Assert=function(t){if(!t)throw new Error("ASSERT!!!!!")},_.EnableLog=function(t){_.LogM=console.log.bind(console),t>0&&(_.LogF=console.error.bind(console)),t>1&&(_.LogE=console.error.bind(console)),t>2&&(_.LogW=console.warn.bind(console)),t>3&&(_.LogI=console.log.bind(console)),t>4&&(_.LogD=console.debug.bind(console))};class C{constructor(t,e,i,n){this.x="number"==typeof t?t:0,this.y="number"==typeof e?e:0,("number"!=typeof i||i<0)&&(i=0),this.width=i,("number"!=typeof n||n<0)&&(n=0),this.height=n}Equals(t){return null!==t&&(t.x===this.x&&t.y===this.y&&t.width===this.width&&t.height===this.height)}}_.RectArea=C;_.Coordinate=class{constructor(t,e){this.x=t,this.y=e}};_.Size=class{constructor(t,e){this.width=t,this.height=e}};_.RectUtils=class{FormatRectArea(t){let e=null;if(t instanceof _.RectArea)e=t;else if("object"==typeof t&&null!==t){if(isNaN(t.width)||isNaN(t.height))throw new Error("ERROR: target_size format should be {width:XXXX, height:XXXX}");e=new _.RectArea(0,0,t.width,t.height)}return e}},_.sRectUitls=new _.RectUtils,_.TextShaderType={LinearGradient:0,Image:1};_.TextShader=class{constructor(t,e){this.Type=t,this.Params=e}};class A{constructor(){const t=(new _.LayoutView).GetRenderer();this._Renderer=t,this.StringWithFont=_.sTextUtils.StringWithFont("",0,void 0,"center","middle",void 0,!1,!1,void 0,void 0,"top"),this.RectArea=new _.RectArea(0,0,0,0),this.TextAttr=_.sTextUtils.TextAttr("ellipsis","none"),this.Marquee=null,this.Shader=null,this.IsInstantLoad=!0,this.LineHeight=0,this.LatexMode=!1}SetInstantLoad(t){return this.IsInstantLoad=t,this}SetStringWithFont(t){return this.StringWithFont=t,this}SetLatexMode(t){return this.LatexMode=t,this}SetFontStyle(t,e,i,n,s,r,a,o,l,h){return this.StringWithFont="object"==typeof t?_.sTextUtils.StringWithFont("",void 0!==t.size?t.size:10,void 0!==t.font?t.font:"宋体",void 0!==t.hAlign?t.hAlign:"center",void 0!==t.vAlign?t.vAlign:"middle",void 0!==t.textColor?t.textColor:"#000000",void 0!==t.italic&&t.italic,void 0!==t.bold&&t.bold,void 0!==t.shadow?t.shadow:null,void 0!==t.strokeWidth?t.strokeWidth:null,void 0!==t.vAreaAlign?t.vAreaAlign:"top"):_.sTextUtils.StringWithFont("",t,e,i,n,s,r,a,o,l,h),this}SetRectArea(t){return t instanceof _.RectArea?this.RectArea=t:this.RectArea=new _.RectArea(t.x,t.y,t.width,t.height),this}SetViewSize(t){return t instanceof _.RectArea||(t=new _.RectArea(t.x,t.y,t.width,t.height)),this.SetRectArea(t),0===this.LineHeight&&0!==t.height&&(this.LineHeight=t.height),this}SetTextAttr(t){let e,i;return e=t.hasOwnProperty("textOverflow")?t.textOverflow:t.hasOwnProperty("text_overflow")?t.text_overflow:"clip",i=t.hasOwnProperty("wordWrap")?t.wordWrap:t.hasOwnProperty("word_wrap")?t.word_wrap:"none",this.TextAttr={word_wrap:i,text_overflow:e},this}SetMarquee(t){return t&&(this.Marquee={repetition:"infinite",direction:"left",speed:"normal"},t.repetition&&(this.Marquee.repetition=t.repetition),t.direction&&(this.Marquee.direction=t.direction),t.speed&&(this.Marquee.speed=t.speed)),this}SetShader(t){return this.Shader=t,this}SetLineHeight(t){return this.LineHeight=t,this}EnableDuplicateBuilder(){this.BuildCopyBag=!0}Clone(){const t=new A(null);return t.StringWithFont=this.StringWithFont,t.RectArea=this.RectArea,t.TextAttr=this.TextAttr,t.LineHeight=this.LineHeight,t}}_.TextViewParams=A,window.TextViewParams=_.TextViewParams;class P{constructor(t,e,i,n,s){this._layoutView=null,this._textWidth=0,this._textViewReahHeight=0,this._marqueeRunning=!0,this._marqueePause=!1,this._marqueeCurrentNum=2,this._textView=null,this._TextViewParams=e,this._NeedQuick=void 0!==n&&n,this._marquee=e.Marquee,this._rectArea=e.RectArea,this._DrawCount=0,this._ShowInterval=0,this._TextureManager=t,this._LatexMode=e.LatexMode,this._Shader=e.Shader,this._IsInstantLoad=e.IsInstantLoad?1:0,this._AutoHeight=!1,this._EnableTextureOnloadCallback=!!s,this._DuplicateBag=e.BuildCopyBag?{Set:null,Swf:null,Siz:null}:null;const r=this;let a=null;const o=e.RectArea.width,l=e.RectArea.height;let h=null,c=null;null!==this._marquee?(c=new _.ClipView,c.Init(),c.SetClipRect(0,0,o,l,!0),c.SetId("matrixClipLayoutview"),c.OnDettachFromSystem=function(){r._marqueeRunning=!1,_.ClipView.prototype.OnDettachFromSystem.call(this)}):(c=new _.LayoutView,c.OnDettachFromSystem=function(){this._TextureOnloadCallbacksTimer&&(clearTimeout(this._TextureOnloadCallbacksTimer),this._TextureOnloadCallbacksTimer=null)}),a=c.GetRenderer(),this._Renderer=a;let u=i;u||(u=e.StringWithFont.str),u=this._ConvertEscToString(u);let d=!1;e.StringWithFont.italic.length>0&&(d=!0);let g=!1;e.StringWithFont.bold.length>0&&(g=!0),h=_.sTextUtils.StringWithFont(u,e.StringWithFont.size,e.StringWithFont.font,e.StringWithFont.alignment,e.StringWithFont.vertical_align,e.StringWithFont.textColour,d,g,e.StringWithFont.shadow,e.StringWithFont.stroke_width,e.StringWithFont.vertical_area_align),void 0!==e.Marquee&&null!==e.Marquee?this._textWidth=_.sTextUtils.GetTextWidth(h):this._NeedQuick?this._textWidth=e.RectArea.width-2*e.RectArea.x:this._textWidth=_.sTextUtils.GetTextWidth(h),this.addTextView(c,h,e.TextAttr,e.RectArea,e.Marquee,e.LineHeight),this._TextureOnloadCallbacksTimer&&(clearTimeout(this._TextureOnloadCallbacksTimer),this._TextureOnloadCallbacksTimer=null),this._TextureOnloadCallbacksTimer=setTimeout((()=>{s&&s({width:this._textView.Element.clientWidth,height:this._textView.Element.clientHeight})}),0),this._layoutView=c,this._TextTexture=null,this._MarqueeTimer=null}_ConvertEscToString(t){let e=`${t}`;return-1!==e.indexOf(""")&&(e=e.replace(/"/gi,'"')),-1!==e.indexOf("&")&&(e=e.replace(/&/gi,"&")),-1!==e.indexOf("<")&&(e=e.replace(/</gi,">")),-1!==e.indexOf(">")&&(e=e.replace(/>/gi,"<")),-1!==e.indexOf(" ")&&(e=e.replace(/ /gi," ")),e}EnableAutoHeight(){this._AutoHeight=!0,this._textView.EnableAutoHeight()}addTextView(t,e,i,n,s,r){const a=n.height;let o;const l=_.Clone(n);let h=null;0!==e.str.length?(o=this._TextureManager.GetTextTextureByMultiRows(e,i,l,r,this._NeedQuick,this._Shader,this._IsInstantLoad,this._LatexMode,this._DuplicateBag),this._TextTexture=o.texture,this._textViewReahHeight=o.real_height,h=new _.LayoutView,h.Init(new _.TextureSetting(o.texture,null,null,!0)),h.SetId(`Text-${e.str}`),"middle"!==e.vertical_area_align&&"bottom"!==e.vertical_area_align||(h.Element.style.display="table-cell",h.Element.style.position="static",t.Element.style.display="table",t.Element.style.position="static"),t.AddView(h,0,0,l.width,a),this._textView=h):(this._textViewReahHeight=0,_.LogI("t_StringWithFont.str.length is 0"))}GetDuplicateBuilder(){return this._DuplicateBag}GetLayoutView(){return this._layoutView}GetTextWidth(){return this._textView?this._textView.Element.clientWidth:Math.floor(this._textWidth+.5)}StartAnimation(t){t&&null!==this._textView&&this._textView.StartAnimation(t)}}_.TextViewEx=P,_.TextViewControl=P;_.CopiedTextViewEx=class{constructor(t,e,i,n,s){const r={x:0,y:0,width:i.width,height:i.height};this._ContainerView=new _.LayoutView,this._TextView=this._AddTextView(t,e,r,this._ContainerView,n,s)}_AddTextView(t,e,i,n,s,r){let a=null;if(e&&0!==e.length){const o=t.GetCopiedTextTexture(e,i,s,r);a=new _.LayoutView,a.Init(new _.TextureSetting(o,null,null,!0)),e.length<15?a.SetId(`Text-${e}`):a.SetId(`Text-Long${e.length}`),n.AddView(a,0,0,i.width,i.height),r&&o.RegisterLoadImageCallback(null,r,null)}return a}EnableAutoHeight(){this._TextView&&this._TextView.EnableAutoHeight()}GetLayoutView(){return this._ContainerView}},_.Clone=function(t){return JSON.parse(JSON.stringify(t))},window.Clone=_.Clone;_.PersistTimer=new class{constructor(){this._AlreadyExited=!1,window.PersistTimer&&(this._AlreadyExited=!0)}setTimeout(t,e){return this._AlreadyExited&&window.PersistTimer.setTimeout?window.PersistTimer.setTimeout(t,e):window.setTimeout(t,e)}clearTimeout(t){this._AlreadyExited&&window.PersistTimer.clearTimeout?window.PersistTimer.clearTimeout(t):window.clearTimeout(t)}setInterval(t,e){if(!this._AlreadyExited||!window.PersistTimer.setInterval)return window.setInterval(t,e);window.PersistTimer.setInterval(t,e)}clearInterval(t){this._AlreadyExited&&window.PersistTimer.clearInterval?window.PersistTimer.clearInterval(t):window.clearInterval(t)}};_.ForegroundTimer=new class{setTimeout(t,e){return window.setTimeout(t,e)}clearTimeout(t){window.clearTimeout(t)}setInterval(t,e){return window.setInterval(t,e)}clearInterval(t){window.clearInterval(t)}},_.EasingTypeIn=0,_.EasingTypeOut=1,_.EasingTypeInOut=2,_.EasingTypeBezier=3,_.EasingTypeBlink=4,_.EasingTypeDeceleration=5,_.EasingTypeSteps=6;_.EasingBase=class{constructor(){this.Pacakge=this.Package}Package(){}_GetBasePackage(t){return{T:t,St:null}}};class L extends _.EasingBase{Package(){return this._GetBasePackage(_.EasingTypeIn)}}_.EasingIn=L;class R extends _.EasingBase{Package(){return this._GetBasePackage(_.EasingTypeOut)}}_.EasingOut=R;class k extends _.EasingBase{Package(){return this._GetBasePackage(_.EasingTypeInOut)}}_.EasingInOut=k;class D extends _.EasingBase{Package(){return this._GetBasePackage(_.EasingTypeDeceleration)}}_.EasingDeceleration=D;class V extends _.EasingBase{Package(){return this._GetBasePackage(_.EasingTypeBlink)}}_.EasingBlink=V;class O extends _.EasingBase{constructor(t,e,i,n,s){super(),this._Inited=!1,this._X1=t,this._X2=i,this._Y1=e,this._Y2=n,this._Duration=s}Package(){const t=this._GetBasePackage(_.EasingTypeBezier);return t.St={X1:this._X1,X2:this._X2,Y1:this._Y1,Y2:this._Y2,Dur:this._Duration},t}}_.BezierEasing=O;class M extends _.EasingBase{constructor(t,e){super(),this._Steps=t,this._Type=e}Package(){const t=this._GetBasePackage(_.EasingTypeSteps);return t.St={S:this._Steps,T:this._Type},t}}_.StepsEasing=M,_.Easing={Circular:{In:new _.EasingIn,Out:new _.EasingOut,InOut:new _.EasingInOut,Deceleration:new _.EasingDeceleration}},window.Easing=_.Easing,_.ColorSpace={RGBA_8888:"RGBA_8888",RGBA_4444:"RGBA_4444",RGBA_5551:"RGBA_5551",RGB_565:"RGB_565",RGB_ETC1:"RGB_ETC1",RGBA_ETC1:"RGBA_ETC1"},_.QRCodeLevel={L:1,M:0,Q:3,H:2};class F{constructor(t,e,i){if(this._Manager=t,i){_.sRenderTextureDelegateManager.CreateTextureStatus().SetResourceInfo(i)}this.RenderTexture=_.sRenderTextureDelegateManager.CreateTexture(),this.RenderTexture.SetResourceInfo(e),this._CallbackIdToken=0,this._OnLoadCallback=[],_.ForgeDebug.EnableTextureTracer&&(t._ImageTextureTracer.push(this),this._TracerDescript="")}get Unloaded(){return null===this.RenderTexture||this.RenderTexture.Unloaded}set Unloaded(t){}get LoadTime(){return null!==this.RenderTexture?this.RenderTexture.LoadTime:0}set LoadTime(t){}get Width(){return null!==this.RenderTexture?this.RenderTexture.Width:0}set Width(t){}get Height(){return null!==this.RenderTexture?this.RenderTexture.Height:0}set Height(t){}UnloadTex(){this._OnLoadCallback=[],null!==this.RenderTexture&&(this._CallbackIdToken>0&&(this.RenderTexture.UnregisterOnloadCallback(this._CallbackIdToken),this._CallbackIdToken=0),this.RenderTexture.UndoRef(),this.RenderTexture=null),this._TracerDescript=""}RegisterLoadImageCallback(t){if(this.IsLoaded()&&null!=t)return this.RenderTexture&&t(this.RenderTexture.Width,this.RenderTexture.Height),null;let e=null;return null!=t&&(e={callback:t},this._OnLoadCallback.push(e),0===this._CallbackIdToken&&(_.Assert(null!==this.RenderTexture),this._CallbackIdToken=this.RenderTexture.RegisterOnloadCallback(F.prototype._InvokeOnLoadCallbacks.bind(this)))),e}UnregisterLoadImageCallback(t){t&&this._OnLoadCallback.some(((e,i,n)=>{if(e===t)return n.splice(i,1),!0}))}EnableBackgroundLoad(t){}DisableBackgroundLoad(t){}_InvokeOnLoadCallbacks(t,e){const i=this._OnLoadCallback;this._OnLoadCallback=[];for(let n=0;n<i.length;n++){i[n].callback(t,e)}this.RenderTexture&&this.RenderTexture.UnregisterOnloadCallback(this._CallbackIdToken)}IsLoaded(){return 0!==this.LoadTime&&!this.Unloaded}SetTextureTracerDescript(t){this._TracerDescript=t}ReallocRenderTexture(){}}_.ImageTexture=F;class G extends _.ImageTexture{constructor(t,e,i,n,s,r){const a=_.sRenderTextureDelegateManager.CreateResourceInfo(t.GetId(),"IMG");a.Set={URL:e,Siz:n,Clr:s||"",IsF:i?1:0,NtS:r,ILd:0},super(t,a),this.Name="IMG",this.Source=e,this.IsForever=i?1:0,this.TargetSize=n,this.ColorSpace=s||"",this.NetSetting=r||null,this._InstantLoad=0,this._ImageElement=new Image,this._ImageElement.onload=function(){this._Loaded()}.bind(this),this._ImageElement.onerror=function(){this._Loaded()}.bind(this),this._ImageElement.src=e,this.RenderTexture.NeedCheckExpired=!0}_Loaded(){this.RenderTexture.Unloaded=!1,this.RenderTexture.LoadTime=Date.now(),this.RenderTexture.Width=this._ImageElement.width,this.RenderTexture.Height=this._ImageElement.height,this.RenderTexture.InvokeOnloadCallbacks(this._ImageElement.width,this._ImageElement.height)}InstantLoad(t){if(this._InstantLoad=t?1:0,this.RenderTexture){const t=this.RenderTexture.GetResourceInfo();null!==t&&(t.Set.ILd=this._InstantLoad,this.RenderTexture.SetResourceInfo(t))}return this}ReallocRenderTexture(){if(this.IsForever)return void _.LogE("ReallocRenderTexture(): NOT need for forever texture");const t=this.Source,e=this.TargetSize,i=this.ColorSpace,n=this.IsForever,s=_.sRenderTextureDelegateManager.CreateResourceInfo(this._Manager.GetId(),this.Name);s.Set={URL:t,Siz:e,Clr:i,IsF:n,ILd:this._InstantLoad},this.RenderTexture=_.sRenderTextureDelegateManager.CreateTexture(),this.RenderTexture.SetResourceInfo(s),this._Manager.CachedTextureManager.CacheTheTexture(this)}}_.UrlImageTexture=G;class N extends _.ImageTexture{constructor(t,e,i,n,s){const r=_.sRenderTextureDelegateManager.CreateResourceInfo(t.GetId(),"GRAD");r.Set={URL:s},super(t,r),this.Gradient=s}}_.GradientTexture=N;class B extends _.ImageTexture{constructor(t,e,i,n){const s=_.sRenderTextureDelegateManager.CreateResourceInfo(t.GetId(),"LGT");s.Set={L:e,S:i},super(t,s),this.Gradient=n}static StopPoint=class{constructor(){this.stopPosition=0,this.color=""}}}_.LinearGradientTexture=B;class W extends _.ImageTexture{constructor(t,e,i,n,s,r,a,o,l,h,c){const u=_.sRenderTextureDelegateManager.CreateResourceInfo(t.GetId(),"TST");let d=null;c&&(d={x:0,y:0,w:0,h:0},Object.assign(d,c)),u.Set={ST:e,IDS:i.GetIdsPack(),W:Math.floor(s.width+.5),H:Math.floor(s.height+.5),FS:r,LA:l,EM:h,LH:Math.floor(a+.5),ILD:o?1:0,TLC:n?1:0,EA:d},super(t,u),this.Name="TST",this._TextStylePack=i,i.DoRef()}UnloadTex(){this._TextStylePack.UnRef(),super.UnloadTex()}}_.TextStyleTexture=W;_.CachedTextureManager=class{constructor(t){this._TextureManager=t,this._Renderer=t.GetRenderer(),this._CachedTextureStack=[],this._LockedTextureStack=[],this._MemoryLimited=10485760,this._VisibleMark=1}SetMemoryLimited(t){this._MemoryLimited=1024*t*1024}_FindTexture(t,e,i){for(let n=this._CachedTextureStack.length-1;n>=0;n--){const s=this._CachedTextureStack[n];if(s.Source===t&&(e===s.TargetSize||null!==e&&e.Equals(s.TargetSize))&&i===s.ColorSpace){if(null===s.RenderTexture)continue;return s}}return null}CacheTheTexture(t){for(let e=this._CachedTextureStack.length-1;e>=0;e--)if(t===this._CachedTextureStack[e])return;this._CachedTextureStack.push(t)}_MarkVisibleViewTextures(t,e){t.TextureSetting&&t.TextureSetting.Texture&&(t.TextureSetting.Texture.VisibleMark=e);const i=t.ChildViews.length;for(let n=0;n<i;n++){const i=t.ChildViews[n];i&&"VISIBLE"!==i.Visibility||this._MarkVisibleViewTextures(i,e)}}ReduceInvisibleTexture(t){this._MarkVisibleViewTextures(t,++this._VisibleMark);for(let t=0;t<this._CachedTextureStack.length;t++){const e=this._CachedTextureStack[t];e.VisibleMark!==this._VisibleMark&&(e.UnloadTex(),this._CachedTextureStack.splice(t,1),t--)}}GetCacheSize(){return this._CachedTextureStack.length}};const H=new Map;let Y=0;const $=new Map;let U=0;class j{constructor(){this.CachedTextureManager=new _.CachedTextureManager(this),this._ForeverCachedTextureManager=new _.CachedTextureManager(this),this._AtlasDataInfo={atlas_data:[],buffer_data_offset:0,textures:[]},this._ClearTimer=-1,this._ImageTextureTracer=[],this._Id=j.sTextureManagerToken++,this._CacheMaxSize=100,this.StartScavengerCachedTimer()}StartScavengerCachedTimer(){-1===this._ClearTimer&&(this._ClearTimer=_.ForegroundTimer.setInterval(this.ScavengerCached.bind(this),3e4))}GetId(){return this._Id}GetRenderer(){return _.sDeprecatedRenderer}GetGifImage(t,e,i){return this.GetImage(t,e,i)}GetImage(t,e,i){if(!t)return _.LogI("GetImage, url is null!"),null;return this._GetImageInternal(t,null,_.ColorSpace.RGBA_8888,e,!1,i)}GetImage2(t,e,i,n,s){if(!t)return _.LogI("GetImage2, url is null!"),null;const r=_.sRectUitls.FormatRectArea(i);"string"!=typeof n&&(n=t.indexOf(".pkm")>=0?t.indexOf(".pkma")>=0?_.ColorSpace.RGBA_ETC1:_.ColorSpace.RGB_ETC1:_.ColorSpace.RGB_565);return this._GetImageInternal(t,r,n,e,!1,s)}CreateMiniGradientTexture(t,e,i,n){return new _.GradientTexture(this,t,e,i,n)}_GetImageInternal(t,e,i,n,s,r){if(n){const n=this._ForeverCachedTextureManager._FindTexture(t,e,i);if(n)return n}else{const n=this.CachedTextureManager._FindTexture(t,e,i);if(n)return n}const a=new _.UrlImageTexture(this,t,n,e,i,r);return a.IsForever?this._ForeverCachedTextureManager.CacheTheTexture(a):this.CachedTextureManager.CacheTheTexture(a),a}GetRoundCornerMask(t,e){return this.GetCustomCornerMask(t,e,e,e,e)}GetCustomCornerMask(t,e,i,n,s){const r=_.sRectUitls.FormatRectArea(t),a=Math.max(e,i,n,s);if(a>r.width/2||a>r.height/2)return _.LogE(`TextureManager.GetRoundCornerMask(): radius is too large, radius=${a} w=${r.width} h=${r.height}`),null;const o=_.sRenderTextureDelegateManager.CreateResourceInfo(this._Id,"CCM");o.Set={W:r.width,H:r.height,LT:e,RT:i,LB:n,RB:s};const l=new _.ImageTexture(this,o);return _.ForgeDebug.EnableTextureTracer&&l.SetTextureTracerDescript("CornerMask"),l}GetOneCornerMask(t){const e=_.sRenderTextureDelegateManager.CreateResourceInfo(this._Id,"OCM");e.Set={Rad:t};const i=new _.ImageTexture(this,e);return _.ForgeDebug.EnableTextureTracer&&i.SetTextureTracerDescript("OneCornerMask"),i}GetTextTextureFromStylePack(t,e,i,n,s,r,a,o,l,h){return t&&0!==t.length?new _.TextStyleTexture(this,t,e,i,n,s,r,a,o,l,h):null}_getParamsId(t,e,i){const n=t.font,s=t.size,r=t.italic,a=t.bold,o=t.alignment,l=t.vertical_align,h=t.vertical_area_align,c=t.textColour,u=t.backgroundColour,d=t.shadow;let g="";t.stroke_width&&(g=t.stroke_width);const f=e.text_overflow,m=e.word_wrap,p=[n,r,a,d,g].join(":"),_=[s,o,l,h,f,m].join(":");let T="",y="";return H.has(p)?T=H.get(p):(T=`TS${Y}`,H.set(p,T),Y++),$.has(_)?y=$.get(_):(y=`DS${U}`,$.set(_,y),U++),[T,y,c,u]}GetTextTextureByMultiRows(t,e,i,n,s,r,a,o,l){const h=t.str;if(null===h||0===h.length)return null;const c=_.sRenderBridge.GetScreenInfo().scaleRatio,u=Object.assign(i);u.x*=c,u.y*=c,u.width*=c,u.height*=c;const d=Object.assign(t);d.size=Math.ceil(d.size*c),n*=c;const g={ST:t.str,AT:JSON.stringify({TO:e.text_overflow,WW:e.word_wrap}),RA:JSON.stringify({X:parseInt(u.x+.5,10),Y:parseInt(u.y+.5,10),W:parseInt(u.width+.5,10),H:parseInt(u.height+.5,10)}),LA:o,LH:parseInt(n+.5,10),ILD:void 0!==a?a:1};if(r&&(g.SH=JSON.stringify({T:r.Type,P:r.Params})),void 0!==window.JsView&&void 0!==window.JsView.ForgeNativeRevision&&window.JsView.ForgeNativeRevision>0){const t=this._getParamsId(d,e,r);g.PI={FS:t[0],DS:t[1],TC:t[2],BC:t[3]}}const f=this._BuildTextTextureAndSerialStatus(g,d);if(null!==l){const t=Object.assign({},g);t.ST=null,t.TLC=0,l.Set=t,l.Swf=Object.assign({},d)}let m=u.height;if(void 0!==window.PlatformUtils&&!1===s){m=window.PlatformUtils.GetTextRect(h,u,d,e,n).height}if(m=Math.floor(m/c+.5),_.ForgeDebug.EnableTextureTracer){let e=t.str;e.length>8&&(e=`${t.str.substr(0,8)}...`),f.SetTextureTracerDescript(`[${e}]`)}return{texture:f,real_height:m}}GetCopiedTextTexture(t,e,i,n){const s=Object.assign({},i.Set);s.ST=t,s.TLC=void 0!==n&&n?1:0;const r=i.Swf,a=_.sRenderBridge.GetScreenInfo().scaleRatio;s.RA=JSON.stringify({X:parseInt(e.x*a+.5,10),Y:parseInt(e.y*a+.5,10),W:parseInt(e.width*a+.5,10),H:parseInt(e.height*a+.5,10)});const o=this._BuildTextTextureAndSerialStatus(s,r);if(_.ForgeDebug.EnableTextureTracer&&t){let e=t;e.length>8&&(e=`${t.substr(0,8)}...`),o.SetTextureTracerDescript(`[${e}]`)}return o}_BuildTextTextureAndSerialStatus(t,e){_.sRenderTextureDelegateManager.AppendFontStatusIfNeed(t,e);let i=null;t.FO&&(i={STA:{Nam:"T",Sta:t.FO}});const n=_.sRenderTextureDelegateManager.CreateResourceInfo(this._Id,"T");return n.Set=t,new _.ImageTexture(this,n,i)}GetColorTexture(t){const e=_.sRenderTextureDelegateManager.CreateResourceInfo(this._Id,"CT");e.Set={Clr:t};const i=new _.ImageTexture(this,e);return _.ForgeDebug.EnableTextureTracer&&i.SetTextureTracerDescript(`Color[${t}]`),i}GetColorTextureCached(t){return this.GetColorTexture(t)}GetNamedCachedTexture(t){return null}CreateCssGradientColorTexture(t,e,i,n,s,r){let a=[];for(let t of r){let e={stop:t.stopPosition,color:t.color};a.push(e)}return new _.LinearGradientTexture(this,JSON.stringify({x0:e,y0:i,x1:n,y1:s}),JSON.stringify(a),t)}ScavengerCached(){this.CachedTextureManager.GetCacheSize()>=this._CacheMaxSize&&this.CachedTextureManager.ReduceInvisibleTexture(_.sRootView)}GetOffScreenMediaTexture(t){if(void 0===window.OffscreenVideoPlayer||!(t instanceof window.OffscreenVideoPlayer))return null;if(!t.hasTerminator()){const e=this._BuildVideoTexture(t);t.setResourceTerminator((()=>{e.UnloadTex()}))}return this._BuildVideoTexture(t)}_BuildVideoTexture(t){const e=_.sRenderTextureDelegateManager.CreateResourceInfo(this._Id,"VPLY");e.Set={Hdl:t.mediaHandler()};const i=new _.ImageTexture(this,e);return _.ForgeDebug.EnableTextureTracer&&i.SetTextureTracerDescript(`Video[${t.mediaHandler()}]`),i}}j.sTextureManagerToken=100,_.TextureManager=j,window.TextureManager=_.TextureManager;_.LayoutViewDebugClass=class{SetTextureTracer(t){}GetTextureTracer(){return null}},_.ForgeDebug=new _.LayoutViewDebugClass,window.ForgeDebug=_.ForgeDebug;class z{constructor(){this.Width=0,this.Height=0,this.MarginTop=0,this.MarginLeft=0,this.MarginRight=0,this.MarginBottom=0,this.Z=0,this.SizeAdjust=!1}SetPosition(t,e,i){this.MarginTop=e,this.MarginLeft=t,i&&(this.Z=i)}SetSize(t,e){this.Width=t,this.Height=e}Clone(){const t=new z(null);return t.Width=this.Width,t.Height=this.Height,t.MarginTop=this.MarginTop,t.MarginLeft=this.MarginLeft,t.MarginRight=this.MarginRight,t.MarginBottom=this.MarginBottom,t.Z=this.Z,t.SizeAdjust=this.SizeAdjust,t}Equals(t){return t.Width===this.Width&&t.Height===this.Height&&t.MarginTop===this.MarginTop&&t.MarginLeft===this.MarginLeft&&t.MarginRight===this.MarginRight&&t.MarginBottom===this.MarginBottom&&t.Z===this.Z}}_.LayoutParamsBase=z;class X extends _.LayoutParamsBase{constructor(t){super(),t instanceof _.RectArea&&(t={x:t.x,y:t.y,width:t.width,height:t.height}),t&&(t.x?this.MarginLeft=t.x:t.marginLeft&&(this.MarginLeft=t.marginLeft),t.y?this.MarginTop=t.y:t.marginTop&&(this.MarginTop=t.marginTop),t.z&&(this.Z=t.z),t.width&&(this.Width=t.width),t.height&&(this.Height=t.height),isNaN(this.MarginTop)&&(_.LogE("isNaN(this.MarginTop)!"),this.MarginTop=0),isNaN(this.MarginLeft)&&(_.LogE("isNaN(this.MarginLeft)!"),this.MarginLeft=0),"MatchParent"!==this.Width?isNaN(this.Width)&&_.LogE("isNaN(this.Width)!"):this.SizeAdjust=!0,"MatchParent"!==this.Height?isNaN(this.Height)&&_.LogE("isNaN(this.Height)!"):this.SizeAdjust=!0)}}_.LayoutParams=X,window.LayoutParams=_.LayoutParams;_.RenderTextureDelegateManager=class{constructor(){this._IdTokenGenerator=66,_.sRenderTextureDelegateManager=this,this._CheckExpiredTime=0}CreateTextureHeadStatus(){const t=new _.RenderTextureDelegate(this,0);return t.DoRef(),t}CreateTextureStatus(){const t=new _.RenderTextureDelegate(this,0);return t.DoRef(),t}CreateTexture(){const t=new _.RenderTextureDelegate(this,this._IdTokenGenerator++);return t.DoRef(),t}RecycleTexture(t){}CreateResourceInfo(t,e){return{Id:0,Nam:e,Set:null,TmId:t,NdLd:0}}AppendFontStatusIfNeed(t,e){const i={};i.Fo=e.font,i.Si=e.size,i.It=e.italic,i.Bo=e.bold,i.Al=e.alignment,i.Ve=e.vertical_align,i.Vaa=e.vertical_area_align,i.Tx=e.textColour,i.Ba=e.backgroundColour,i.En=e.enableBlend,i.Sh=e.shadow,e.stroke_width?i.Stk=e.stroke_width:i.Stk=-1,t.FO=JSON.stringify(i)}},_.sRenderTextureDelegateManager=new _.RenderTextureDelegateManager;_.RenderTextureDelegate=class{constructor(t,e){this.IdToken=e,this._Manager=t,this._Reference=0,this._SyncingResourceInfo=null,this._OnloadCallbacks={},this._OnloadCallbacksSize=0,this._OnloadCallbackIdGenerator=1,this.Unloaded=!0,this.LoadTime=0,this.RequireTime=0,this.ForceExpire=!1,this.NeedCheckExpired=!1;if(_.ForgeDebug.GetTextureTracer()){const t=new Error;this.Stack=t.stack}}DoRef(){this._Reference++}UndoRef(){this._Reference--,0===this._Reference&&(this._OnloadCallbacksSize>0&&(this._OnloadCallbacks={}),this._Manager.RecycleTexture(this))}SetResourceInfo(t){t.Id=this.IdToken,this._SyncingResourceInfo=t}GetResourceInfo(){return this._SyncingResourceInfo}ReadSyncInfo(){const t=this._SyncingResourceInfo;return this._SyncingResourceInfo=null,t}RegisterOnloadCallback(t){const e=this._OnloadCallbackIdGenerator++;return this._OnloadCallbacks[`${e}`]=t,this._OnloadCallbacksSize++,null!==this._SyncingResourceInfo&&(this._SyncingResourceInfo.NdLd=1),e}UnregisterOnloadCallback(t){delete this._OnloadCallbacks[`${t}`],this._OnloadCallbacksSize--}InvokeOnloadCallbacks(t,e){if(this._OnloadCallbacksSize>0)for(const i in this._OnloadCallbacks)this._OnloadCallbacks.hasOwnProperty(i)&&this._OnloadCallbacks[i](t,e)}IsLoaded(){return 0!==this.LoadTime&&!this.Unloaded}};_.DeprecatedRenderer=class{constructor(){_.sDeprecatedRenderer=this,this._SharedTextureManager=this.CreateTextureManager()}SetUserId(t){_.sRenderBridge.UpdateUserId(t)}GetScreenInfo(){return _.sRenderBridge.GetScreenInfo()}StringWithFont(){return _.sTextUtils.StringWithFont.apply(this,arguments)}GetTextWidth(){return _.sTextUtils.GetTextWidth.apply(this,arguments)}GetTextUtils(){return _.sTextUtils}RectArea(t,e,i,n){return new _.RectArea(t,e,i,n)}TextAttr(){return _.sTextUtils.TextAttr.apply(this,arguments)}GarbageCollect(){_.LogM("GarbageCollect called")}TriggerFrameDraw(){_.sRenderBridge.RequestSwap()}GetSharedTextureManager(){return this._SharedTextureManager}CreateTextureManager(){return new _.TextureManager}},_.sDeprecatedRenderer=null;const K={STRING:Symbol("STRING"),FUNCTION:Symbol("FUNCTION"),LINE_FEED:Symbol("LINE_FEED"),LEFT_BRACE:Symbol("LEFT_BRACE"),RIGHT_BRACE:Symbol("RIGHT_BRACE")};const J={},q={BASE:Symbol("BASE"),COLOR:Symbol("COLOR"),BOLD:Symbol("BOLD"),ITALIC:Symbol("ITALIC"),DECORATION:Symbol("DECORATION"),SUPERSCRIPT:Symbol("SUPERSCRIPT"),SUBSCRIPT:Symbol("SUBSCRIPT")};class Z{constructor(){this.style,this.styleValue=""}}class Q{constructor(){this.textStyle=new Z,this.childNodes=[],this.parent}}class tt extends Q{constructor(){super(),this.styleList=[],this.indexPair,this.lineFeedNode=!1,this.testValue}}function et(t){if(null===t||0===t.length)return null;const e=function(t){const e=[];let i=0;for(;i<t.length;)if("\\"===t[i])if(i<t.length-1)if("\\"===t[i+1]||"{"===t[i+1]||"}"===t[i+1]){const t={type:K.STRING,indexPair:[i+1,i+2]};e.push(t),i+=2}else{++i;const n=i;let s=i,r=!1;for(;i<t.length&&"{"!==t[i]&&"}"!==t[i];)" "!==t[i]&&(r=!0)," "===t[i]&&r?++i:s=++i;const a={type:K.FUNCTION,indexPair:[n,s]};e.push(a)}else console.error("backslash at end.");else if("{"===t[i]){const t={type:K.LEFT_BRACE,indexPair:null};e.push(t),++i}else if("}"===t[i]){const t={type:K.RIGHT_BRACE,indexPair:null};e.push(t),++i}else if("\n"===t[i]){const t={type:K.LINE_FEED,indexPair:null};e.push(t),++i}else{const n=i;let s=i;for(;i<t.length&&"\\"!==t[i]&&"{"!==t[i]&&"}"!==t[i]&&"\n"!==t[i];)++i,s=i;const r={type:K.STRING,indexPair:[n,s]};e.push(r)}for(let i=e.length-1;i>=0;i--){const n=e[i];if(n.type===K.STRING){let s=!0;for(let e=n.indexPair[0];e<n.indexPair[1];e++)if(" "!==t[e]){s=!1;break}!(s&&i>0&&i<e.length-1)||e[i-1].type!==K.LEFT_BRACE&&e[i-1].type!==K.RIGHT_BRACE||e[i+1].type!==K.RIGHT_BRACE&&e[i+1].type!==K.LEFT_BRACE||e.splice(i,1)}}return e}(t),i=[],n=[];let s=0;for(;s<e.length;){const r=e[s];if(r.type===K.STRING){const t=new tt;n.push(t),t.indexPair=r.indexPair,t.textStyle.style=q.BASE,i.push(t)}else if(r.type===K.LINE_FEED){const t=new tt;n.push(t),t.lineFeedNode=!0}else if(r.type===K.LEFT_BRACE)i.push(J);else if(r.type===K.RIGHT_BRACE)if(i.length>0){const t=[];let e=i.pop();for(;e!==J&&(t.push(e),i.length>0);)e=i.pop();if(i.length>0){const e=i[i.length-1];if(e.textStyle.style===q.BASE)console.error("lack of function");else for(;t.length>0;){const i=t.pop();e.childNodes.push(i),i.parent=e}}else console.error("lack of function")}else console.error("extra }");else if(r.type===K.FUNCTION){const n=t.substring(r.indexPair[0],r.indexPair[1]),a=new Q;switch(n){case"textcolor":if(s<e.length-3){a.textStyle.style=q.COLOR;const i=e[s+1],n=e[s+2],r=e[s+3];i.type===K.LEFT_BRACE&&n.type===K.STRING&&r.type===K.RIGHT_BRACE?(a.textStyle.styleValue=t.substring(n.indexPair[0],n.indexPair[1]),s+=3):console.error("textcolor param format error.")}else console.error("textcolor param format error.");break;case"textb":a.textStyle.style=q.BOLD;break;case"texti":a.textStyle.style=q.ITALIC;break;case"textdecoration":if(s<e.length-3){a.textStyle.style=q.DECORATION;const i=e[s+1],n=e[s+2],r=e[s+3];i.type===K.LEFT_BRACE&&n.type===K.STRING&&r.type===K.RIGHT_BRACE?(a.textStyle.styleValue=t.substring(n.indexPair[0],n.indexPair[1]),s+=3):console.error("textdecoration param format error.")}else console.error("textdecoration param format error.");break;case"textsup":a.textStyle.style=q.SUPERSCRIPT;break;case"textsub":a.textStyle.style=q.SUBSCRIPT;break;default:console.error(`undefined style type: ${n}`)}i.push(a)}++s}return n.forEach(((t,e,i)=>{let n=t.parent;for(;n;)t.styleList.push(n.textStyle),n=n.parent})),{nodeList:n,text:t}}function it(){this.positionQueue=[],this.timeQueue=[]}it.prototype.reset=function(){this.positionQueue=[],this.timeQueue=[]},it.prototype.pruneQueue=function(t){for(;this.timeQueue.length&&this.timeQueue[0]<Date.now()-t;)this.timeQueue.shift(),this.positionQueue.shift()},it.prototype.updatePosition=function(t){this.positionQueue.push(t),this.timeQueue.push(Date.now()),this.pruneQueue(50)},it.prototype.getVelocity=function(){this.pruneQueue(1e3);const t=this.timeQueue.length;if(t<2)return 0;const e=(this.timeQueue[t-1]-this.timeQueue[0])/1e3,i=this.positionQueue[t-1]-this.positionQueue[0];return console.log(`getVelocity distance:${i}, time:${e}, velocity:${i/e}, this.timeQueue[length-1]:${this.timeQueue[t-1]}, this.timeQueue[0]:${this.timeQueue[0]}`),i/e},window.gRootView=null,_.sRootView=null;class nt{constructor(t,e,i,n){this.Texture=t,this._IsTextureExternal=!1,e instanceof _.ImageTexture?(e&&e.RenderTexture&&e.RenderTexture.NeedCheckExpired&&(e.RenderTexture.RequireTime=0),this.MaskSetting=new _.ViewTextureMask(e)):this.MaskSetting=e,t&&t.RenderTexture&&t.RenderTexture.NeedCheckExpired&&(t.RenderTexture.RequireTime=0),this._IsMaskTextureExternal=!1,this.TextureBeforeImageLoad=i,this._IsPreloadImageTextureExternal=!1,void 0===n&&(n=!0),this.HasAlpha=n}SetExternal(t,e,i){this._IsTextureExternal=t,this._IsMaskTextureExternal=e,this._IsPreloadImageTextureExternal=i}ReleaseInternalTexture(t,e){!this._IsTextureExternal&&this.Texture&&(this.Texture.UnloadTex(),this.Texture=null),!this._IsMaskTextureExternal&&this.MaskSetting&&(this.MaskSetting.UnLoad(),this.MaskSetting=null),!this._IsPreloadImageTextureExternal&&this.TextureBeforeImageLoad&&(this.TextureBeforeImageLoad.UnloadTex(),this.TextureBeforeImageLoad=null)}DebugPrint(){return` _IsTextureExternal=${this._IsTextureExternal}`}}_.TextureSetting=nt,window.TextureSetting=_.TextureSetting;class st extends _.TextureSetting{constructor(t,e,i,n){super(t,e,i,n),this.SetExternal(!0,!0,!0)}}_.ExternalTextureSetting=st,window.ExternalTextureSetting=_.ExternalTextureSetting;_.PackedLayout=class{constructor(t){const e=t.RectInfo;this.RectInfo={coordX:e.coordX,coordY:e.coordY,width:e.width,height:e.height},this.LayoutParams=JSON.parse(JSON.stringify(t.LayoutParams))}ApplyToView(t){const e=this.RectInfo;t.RectInfo={coordX:e.coordX,coordY:e.coordY,width:e.width,height:e.height},t.LayoutParams=JSON.parse(JSON.stringify(this.LayoutParams))}};class rt{constructor(){this._MaskType="COMMON"}Type(){return this._MaskType}UnLoad(){}}_.ViewMask=rt;class at extends _.ViewMask{constructor(t){super(),this._MaskType="TEXTURE",this.ImageTexture=t}UnLoad(){this.ImageTexture.UnloadTex()}}_.ViewTextureMask=at;class ot extends _.ViewMask{constructor(t,e,i,n){super(),this._MaskType="CORNER",this._TopLeft=t,this._TopRight=isNaN(e)?t:e,this._BottomLeft=isNaN(i)?t:i,this._BottomRight=isNaN(n)?t:n,this._CornersWidth=[0,0,0,0],this._CornersDisable=[0===this._TopLeft?1:0,0===this._TopRight?1:0,0===this._BottomLeft?1:0,0===this._BottomRight?1:0]}UnLoad(){}}_.ViewRoundCornerMask=ot;class lt{constructor(t,e,i,n,s,r){this.DragDirection=t||0,this.TriggerMovedDistance=e||0,this._EnableJsFling=i?1:0,this.SlidePile=n||new _.RectArea(0,0,1280,720),this.PageWidth=s>0?s:65535,this.EnableTabMode=s>0,this.PageEdge=r||1/4}}lt.DIRECTION_DISABLE=0,lt.DIRECTION_VERTICAL=1,lt.DIRECTION_HORIZONTAL=2,lt.DIRECTION_AUTO=lt.DIRECTION_VERTICAL|lt.DIRECTION_HORIZONTAL,_.DragSetting=lt;class ht{constructor(){this.Settings=null,this.Listener=null,this.ListenerFlags=0,this.OverListener=null,this.OverListenerFlags=0,this.Formula=null,this.SyncString=null}SetListener(t){this.Listener=t}}ht.INFLEXION=.35,ht.DECELERATION_RATE=Math.log(.78)/Math.log(.9),ht.PHYSICAL_COEF=51890.2,_.DragInfo=ht,_.DragInfo.SCROLL_FRICTION=.06,_.DragInfo.EVENT_TYPE={OnDown:0,OnTap:1,OnLongPress:2,OnDragStart:3,OnMoved:4,OnDragEnd:5,OnRelease:6,OnFling:7};let ct=0;class ut{constructor(t,e){this.TextureSetting=t,t&&console.error("LayoutViewBase constructor texture_setting not undefined!"),this._dispatchLongPress=this._dispatchLongPress.bind(this),this.Visibility="VISIBLE",this.LayoutParams=null,this.ParentView=null,this.ChildViews=[],this.zIndex=0,this._Perspective=0,this._PerspectiveAnchor=[.5,.5],this._BackfaceVisibility=1,this._DebugCount=++ct,this.childZIndexCount=0,this._IsChildOfRootView=!1,this._DetachFromSystemCallback=null,this.Element=null,this.InnerChildElement=null,"root"===e?(this.Element=window.originDocument.getElementById(e),this.Element||(this.Element=window.originDocument.getElementById("app"))):"svg"===e||"path"===e?this.Element=document.createElementNS("http://www.w3.org/2000/svg",e):"jsv-element-proxy"===e?this.Element=null:e&&(this.Element=window.originDocument.createElement(e),"div"!=e&&(this.Element.style.position="absolute")),this.TransitionStore={},this.TransformAnimationObj=null,this._TextureAnimationObj=null,this._DragInfo=null,this.DragControl=null,this._Velocity={x:new it,y:new it},this._TouchSlopSquare=64,this._InDragging=null,this._InLongPress=null,this._AlwaysInTapRegion=null,this._LastFocusX=null,this._LastFocusY=null,this._DownFocusX=null,this._DownFocusY=null,this._LastTimeStamp=null,this._ObjectFitTestCache=null,this._ProxyView=null,this.Expired=!1}Init(t){this.ResetTexture(t)}SetElementProp(t,e,i){switch(e){case"innerview":{const t=_.sViewStore.get(i);if(t){const e=t.view;null==this.LayoutParams&&this.ResetLayoutParams({x:0,y:0,width:0,height:0});let i=this.LayoutParams;this.ResetLayoutParams({x:0,y:0,width:0,height:0}),e&&(null===this._ProxyView?this._InsertProxyLayer(e,i):e!==this._ProxyView&&console.error("Error: Can not reset proxy view"))}break}case"enable-fade":case"poster-on-top":case"text-definition":break;case"id":this.Element&&this.Element.setAttribute("id",i);break;default:_.LogE(`Error: View Unknown prop name=${e}`)}}InsertView(t,e,i){this._InsertView(t,e,i)}AddView(t,e=0,i=0,n=0,s=0){this._InsertView(t,null,{x:e,y:i,width:n,height:s})}MoveChildView(t,e,i){if(null!=this._ProxyView&&t!=this._ProxyView)return void this._ProxyView.MoveChildView(t,e);let n=!1;for(var s=0;s<this.ChildViews.length;s++)if(this.ChildViews[s]==t){0!=t.zIndex&&this.childZIndexCount--,this.ChildViews.splice(s,1),t.ParentView=null,n=!0;break}n||_.LogE("MoveChildView(): view is not in child list stack="),e._InsertView(t,i,t.LayoutParams);let r=null;i&&(r=e.ChildViews[e.ChildViews.indexOf(i)+1]),r&&e.Element.contains(r.Element)?e.Element.insertBefore(t.Element,r.Element):e.Element.appendChild(t.Element)}_InsertView(t,e,i){if(i?i instanceof _.LayoutParamsBase?t.LayoutParams=i.Clone():t.LayoutParams=new _.LayoutParams(i):t.LayoutParams||(t.LayoutParams=new _.LayoutParams({x:0,y:0})),null!==t.LayoutParams&&(t.LayoutParams.MarginLeft&&(t.Element.style.left=`${t.LayoutParams.MarginLeft}px`),t.LayoutParams.MarginTop&&(t.Element.style.top=`${t.LayoutParams.MarginTop}px`),t.LayoutParams.Width&&(t.Element.style.width=`${t.LayoutParams.Width}px`),t.LayoutParams.Height?t.Element.style.height=`${t.LayoutParams.Height}px`:t.Element.style.height=""),t.ParentView=this,e){let i=this.ChildViews.indexOf(e);i<0&&(i=this.ChildViews.length),this.ChildViews.splice(i,0,t)}else this.ChildViews.push(t);this._ChildrenListDirty=!0,this._IsChildOfRootView&&t._OnAttachToSystem(),0!=t.zIndex&&this.childZIndexCount++,this.childZIndexCount>0&&this._RequestZIndexReorder()}SetZIndex(t){if(t!=this.zIndex){var e=this.zIndex;this.zIndex=t;var i=this.ParentView;i&&(0==e&&0!=t?i.childZIndexCount++:0!=e&&0==t&&i.childZIndexCount--,i.childZIndexCount<0&&_.ThrowError("ERROR: LayoutViewBase, child z-index count ERROR"),i._RequestZIndexReorder())}}_RequestZIndexReorder(){let t=[],e=[],i=0,n=this.ChildViews.length;for(var s=0;s<n;s++){let n=this.ChildViews[s].zIndex;n<0?(n<i&&(i=n),t.push(this.ChildViews[s])):n>0&&e.push(this.ChildViews[s])}i=1e3*Math.floor(-i/1e3)+1e3;let r=t.length,a=e.length;if(r>0){t.sort(((t,e)=>t.zIndex-e.zIndex));for(s=0;s<r;s++)t[s].Element.style.zIndex=t[s].zIndex+i}if(this.ChildViews.length-t.length-e.length>0)for(s=0;s<n;s++)0==this.ChildViews[s].zIndex&&(this.ChildViews[s].Element.style.zIndex=i);if(a>0){e.sort(((t,e)=>t.zIndex-e.zIndex));for(s=0;s<a;s++)e[s].Element.style.zIndex=e[s].zIndex+i}}SetPerspective(t,e){this.Element.style.perspective=`${t}px`,this.Element.style.webkitPerspective=`${t}px`,this.Element.style.perspectiveOrigin=e,this.Element.style.webkitPerspectiveOrigin=e,this._Perspective=t,this._PerspectiveOrigin=e}SetBackfaceVisibility(t){this.Element.style.backfaceVisibility=t?"visible":"hidden",this.Element.style.webkitBackfaceVisibility=t?"visible":"hidden",console.log(`back face style ${this.Element.style.backfaceVisibility}`),this._BackfaceVisibility=t?1:0}SetTransformStyle(t){this.Element.style.transformStyle=t,this.Element.style.webkitTransformStyle=t,this._TransformStyle=t}EnableDivTouch(t,e){t.eventHandlers&&t.eventHandlers.onClick&&(this.Element.onclick=e=>{t.eventHandlers.onClick(),e.preventDefault&&e.preventDefault()},this.Element.style.pointerEvents="auto")}_DoDragPause(t){this._DragInfo.Settings.EnableTabMode||this.DragControl&&this.DragControl.pause(((e,i)=>{if(null!==this.Element.style.transform){let n=this.GetLayoutParams();n=this._GetMovedLayoutParams(e-n.MarginLeft,i-n.MarginTop),this.ResetLayoutParams(n),this._DragImactSensorRecycle(),console.log(`_DoDragPause lp.MarginLeft:${n.MarginLeft}, lp.MarginTop:${n.MarginTop}`),this.DragControl=null,this.Element.style.transform=null,t.viewX=e,t.viewY=i,this._DragInfo.Listener.OnFling(t)}}))}TouchEventProcess(t){let e=!1;switch(t.type){case _.DragInfo.EVENT_TYPE.OnDown:console.log("TouchEventProcess OnDown in"),this._DoDragPause(t),this._DragInfo.Listener&&this._DragInfo.Listener.OnDown&&(e=this._DragInfo.Listener.OnDown(t));break;case _.DragInfo.EVENT_TYPE.OnTap:this._DragInfo.Listener&&this._DragInfo.Listener.OnTap&&(e=this._DragInfo.Listener.OnTap(t));break;case _.DragInfo.EVENT_TYPE.OnLongPress:this._DragInfo.Listener&&this._DragInfo.Listener.OnLongPress&&(e=this._DragInfo.Listener.OnLongPress(t));break;case _.DragInfo.EVENT_TYPE.OnDragStart:this._DragMovedDistanceX=0,this._DragMovedDistanceY=0,this._DragInfo.Listener&&this._DragInfo.Listener.OnDragStart&&(e=this._DragInfo.Listener.OnDragStart(t));break;case _.DragInfo.EVENT_TYPE.OnMoved:this._DragInfo.Listener&&this._DragInfo.Listener.OnMoved&&(e=this._DoDragMove(t,!0));break;case _.DragInfo.EVENT_TYPE.OnDragEnd:if(this._DragInfo.Listener&&this._DragInfo.Listener.OnDragEnd){e=!!this._SlideIfEnableTabMod(t,-1)||this._DoDragEnd(t)}break;case _.DragInfo.EVENT_TYPE.OnRelease:this._DragInfo.Listener&&this._DragInfo.Listener.OnRelease&&(e=this._DragInfo.Listener.OnRelease(t));break;case _.DragInfo.EVENT_TYPE.OnFling:if(this._DragInfo.Listener&&this._DragInfo.Listener.OnFling){e=!!this._SlideIfEnableTabMod(t,-1)||this._DoFling(t)}break;default:console.log(`TouchEventProcess:${t}`)}return e}DisableDrag(){this._DragInfo=null}EnableDrag(t,e,i){t instanceof _.DragSetting||_.ThrowError("EnableDrag The setting is not Forge.DragSetting"),null===e&&_.ThrowError("EnableDrag The listener is null");const n=new _.DragInfo;n.Settings=t,n.SetListener(e),n.Formula=i,this._DragInfo=n,this.DragControl=null,this._AddEventListener(),_.sRenderBridge.RequestSwap()}RemoveView(t){for(let e=0;e<this.ChildViews.length;e++)if(this.ChildViews[e]===t){t.IsChildOfRootView()&&t._OnDetachFromSystem(),this.ChildViews.splice(e,1),t.ParentView=null;break}}_OnDetachFromSystem(){this._IsChildOfRootView=!1,this._DetachFromSystemCallback?(this._DetachFromSystemCallback.some(((t,e,i)=>{t()})),this._DetachFromSystemCallback=null):this.OnDettachFromSystem();for(let t=0;t<this.ChildViews.length;t++){this.ChildViews[t]._OnDetachFromSystem()}this.ParentView.Element.removeChild(this.Element),this._releaseViewResources()}RegisterDetachCallback(t){t&&(null==this._DetachFromSystemCallback&&(this._DetachFromSystemCallback=[]),this._DetachFromSystemCallback.push(t))}UnregisterDetachCallback(t){if(t&&this._DetachFromSystemCallback){let e=!1,i=this._DetachFromSystemCallback;for(let n=0;n<i.length;n++)if(i[n]===t){i.splice(n,1),e=!0;break}e?0==i.length&&(this._DetachFromSystemCallback=null):console.error("no found")}else console.error("Unregister nothing...")}OnDettachFromSystem(){}_releaseViewResources(){this.Expired||(this.StopAnimation(),this.StopTextureAnimation(),this.Expired=!0)}ClearViews(){const t=this.ChildViews.length;if(0!==t){for(let e=0;e<t;e++){const t=this.ChildViews[e];t&&t.IsChildOfRootView()&&t._OnDetachFromSystem()}this.ChildViews=[]}}_ResetTextStyle(t){this.Element.style.overflow="hidden";let e=_.sTextStyleCache.GetDsFromId(t.Set.IDS.DS).Describe,i=_.sTextStyleCache.GetFsFromId(t.Set.IDS.FS).Describe,n=_.sTextStyleCache.GetCsFromId(t.Set.IDS.CS).Describe,s=null;"DISABLE"!==t.Set.IDS.SS&&(s=_.sTextStyleCache.GetSsFromId(t.Set.IDS.SS).Describe),this.Element.style.fontFamily=i.font,this.Element.style.fontSize=`${t.Set.FS}px`,i.italic&&(this.Element.style.fontStyle="italic"),i.bold?this.Element.style.fontWeight="bold":this.Element.style.fontWeight="normal",this.Element.style.textAlign=e.alignment,this.Element.style.verticalAlign=e.vertical_area_align,this.Element.style.direction=e.direction;let r=n.text_color;this.Element.style.color=r;let a=n.bg_color;this.Element.style.backgroundColor=a,s&&(s.shadow_blur>0&&(this.Element.style.textShadow=`${s.shadow_offset_x}px ${s.shadow_offset_y}px ${s.shadow_blur}px ${s.shadow_color}`),s.stroke_width>0&&(this.Element.style.WebkitTextStroke=`${s.stroke_width}px ${s.stroke_color}`)),this.Element.style.width=`${t.Set.W}px`,this.Element.style.height=`${t.Set.H}px`;let o=parseInt(this.Element.style.fontSize);if(t.Set.LH&&(this.Element.style.lineHeight=`${t.Set.LH}px`,o=parseInt(this.Element.style.lineHeight)),t.Set.EA){let e=t.Set.EA,i=window.originDocument.createElement("div");i.style.float=e.x>0?"right":"left",i.style.width=e.w+"px",i.style.height=e.h-1+"px",i.style.backgroundColor="rgba(0,0,0,0)",i.style.position="relative",this.Element.appendChild(i)}this.Element.style.textOverflow=e.text_overflow,this.Element.style.wordBreak="normal";let l=!1,h=e.word_wrap;if("none"===h?this.Element.style.whiteSpace="nowrap":h&&(this.Element.style.wordWrap=h.replace("_","-"),l=!0),l&&"ellipsis"==this.Element.style.textOverflow&&(this.Element.style.display="-webkit-box",this.Element.style.webkitLineClamp=""+Math.floor(parseInt(this.Element.style.height)/o),this.Element.style.webkitBoxOrient="vertical"),t.Set.LA){const e=et(t.Set.ST);!function(t,e){const i=e.text;for(const n of e.nodeList){if(n.lineFeedNode){t.appendChild(window.originDocument.createElement("br"));continue}const e=i.substring(n.indexPair[0],n.indexPair[1]),s=window.originDocument.createElement("span");let r,a=s;for(const t of n.styleList)switch(t.style){case q.BASE:break;case q.BOLD:r=window.originDocument.createElement("b"),a.appendChild(r),a=r;break;case q.ITALIC:r=window.originDocument.createElement("i"),a.appendChild(r),a=r;break;case q.COLOR:s.style.color=t.styleValue;break;case q.DECORATION:s.style.textDecoration=t.styleValue;break;case q.SUPERSCRIPT:r=window.originDocument.createElement("sup"),a.appendChild(r),a=r;break;case q.SUBSCRIPT:r=window.originDocument.createElement("sub"),a.appendChild(r),a=r}a.textContent=e,t.appendChild(s)}}(this.Element,e)}else{let e=window.originDocument.createElement("span");e.textContent=t.Set.ST,this.Element.appendChild(e)}}_SetBorderRadius(t){(this.InnerChildElement?this.InnerChildElement:this.Element).style.borderRadius=`${t._TopLeft}px ${t._TopRight}px ${t._BottomRight}px ${t._BottomLeft}px`}_InsertProxyLayer(t,e){if(t.ParentView=this,this._IsChildOfRootView){for(let t of this.ChildViews)t._AdvanceDepthForProxyLayer();t._OnAttachToSystem()}t.ChildViews=t.ChildViews.concat(this.ChildViews),t._ChildrenListDirty=!0;for(let e=0;e<t.ChildViews.length;e++)t.ChildViews[e].ParentView=t,t._RequestLayoutForAddingView(t.ChildViews[e]);null!==e?e instanceof _.LayoutParamsBase?t.LayoutParams=e.Clone():t.LayoutParams=new _.LayoutParams(e):null===t.LayoutParams&&(t.LayoutParams=new _.LayoutParams({x:0,y:0})),t.ResetLayoutParams(t.LayoutParams),this.ChildViews=[t],this._ChildrenListDirty=!0,this._RequestLayoutForAddingView(t),this._ProxyView=t,this._IsChildOfRootView&&t._OnAttachToSystem()}_RequestLayoutForAddingView(t){this._RequestLayout()}ResetTexture(t,e){let i=null;if(t&&(i=new _.ExternalTextureSetting(t,e)),this.TextureSetting=i,i){if(i.Texture.Source)"IMG"===this.Element.tagName?this.Element.src=i.Texture.Source:(this.Element.style.backgroundImage=`url(${i.Texture.Source})`,this.Element.style.backgroundSize="100% 100%");else if(i.Texture.Gradient)this.Element.style.backgroundImage=i.Texture.Gradient;else if(i.Texture.RenderTexture&&i.Texture.RenderTexture._SyncingResourceInfo){const t=i.Texture.RenderTexture._SyncingResourceInfo;if("TST"===t.Nam)this._ResetTextStyle(t);else if("CT"===t.Nam)this.Element.style.backgroundColor=t.Set.Clr;else if("VPLY"===t.Nam){const e=t.Set.Hdl;e.style.width="100%",e.style.height="100%",e.style.objectFit="fill",this.Element.appendChild(e),this.InnerChildElement=e}}i.MaskSetting&&"CORNER"===i.MaskSetting._MaskType&&this._SetBorderRadius(i.MaskSetting)}else this.Element.style.backgroundColor="",this.Element.style.backgroundImage="",this.Element.style.borderRadius=""}SetVisibility(t){if("string"==typeof t){let e=t.toLocaleLowerCase();this.Element.style.visibility="visible"==e?"inherit":e}else this.Element.style.visibility="inherit"}_OnAttachToSystem(){"svg"!==this.Element.id&&"path"!==this.Element.id||console.log("_OnAttachToSystem appendChild");let t=this.ParentView.ChildViews[this.ParentView.ChildViews.indexOf(this)+1];t&&this.ParentView.Element.contains(t.Element)?this.ParentView.Element.insertBefore(this.Element,t.Element):this.ParentView.Element.appendChild(this.Element),this._IsChildOfRootView=!0;const e=this.ChildViews;let i;for(let t=0;t<e.length;t++)i=e[t],i._OnAttachToSystem()}IsChildOfRootView(){return this._IsChildOfRootView}StartAnimation(t,e,i){void 0!==this.TransformAnimationObj&&this.TransformAnimationObj&&(this.TransformAnimationObj.Cancel(t),this.TransformAnimationObj=null,window.jsvInAndroidWebView?this.Element.style.webkitAnimation=null:this.Element.style.animation=null),null==this._ProxyView?(this.TransformAnimationObj=t,!isNaN(i)&&i>0&&t.EnableDelay(i),t.Start(this)):this._ProxyView.StartAnimation(t,e,i)}ApplyStyleTransition(t){this.TransitionStore={...this.TransitionStore,...t};let e="";Object.values(this.TransitionStore).forEach((t=>{e&&(e+=","),e+=t})),window.jsvInAndroidWebView?this.Element.style.webkitTransition=e:this.Element.style.transition=e}StopAnimation(){void 0!==this.TransformAnimationObj&&this.TransformAnimationObj&&(this.TransformAnimationObj.Cancel(),this.TransformAnimationObj=null),null==this._ProxyView||this._ProxyView.StopAnimation()}StartTextureAnimation(t){void 0!==this._TextureAnimationObj&&this._TextureAnimationObj&&(this._TextureAnimationObj.Cancel(t),this._TextureAnimationObj=null),this._TextureAnimationObj=t,t.AsTextureAnimation(),t.Start(this),this._RequestLayout()}_RequestLayout(){}StopTextureAnimation(){void 0!==this._TextureAnimationObj&&this._TextureAnimationObj&&(this._TextureAnimationObj.Cancel(),this._TextureAnimationObj=null)}StopAllAnimations(){this.StopAnimation(),this.StopTextureAnimation();for(let t=0;t<this.ChildViews.length;t++)this.ChildViews[t].StopAllAnimations()}GetAnimation(){return this.TransformAnimationObj}DetachAnimation(t){this.TransformAnimationObj===t&&(this.TransformAnimationObj=null,window.jsvInAndroidWebView?(this.Element.style.webkitAnimation=null,this.Element.style.webkitTransition=null):(this.Element.style.animation=null,this.Element.style.transition=null))}ResetCssTransform(t,e){if(t){const e=t.split("translate3d");for(let t=1;t<e.length;t++){let i=!1,n=e[t].replace(/\).*/,"");n=n.replace(/.*\(/,"");const s=n.split(",");for(let t=0;t<s.length;t++){const e=s[t].trim();e.match(/[0-9]$/)&&(s[t]=e+"px",i=!0)}i&&(n=s.join(","),e[t]=e[t].replace(/\(.*?\)/,"("+n+")"))}t=e.join("translate3d")}t===this._CssTransform&&e===this._CssTransformOrigin||(window.jsvInAndroidWebView?(this.Element.style.webkitTransform=t,this.Element.style.webkitTransformOrigin=e):(this.Element.style.transform=t,this.Element.style.transformOrigin=e),this._CssTransform=t,this._CssTransformOrigin=e)}ResetTextureCssTransform(t,e){this.ResetCssTransform(t,e)}SetId(t){this.Id=t}ResetLayoutParams(t){null==this._ProxyView?null!==t?(t instanceof _.LayoutParamsBase?this.LayoutParams=t.Clone():this.LayoutParams=new _.LayoutParams(t),this.Element.style.left=`${this.LayoutParams.MarginLeft}px`,this.Element.style.top=`${this.LayoutParams.MarginTop}px`,this.LayoutParams.Width&&(this.Element.style.width=`${this.LayoutParams.Width}px`),this.LayoutParams.Height&&(this.Element.style.height=`${this.LayoutParams.Height}px`)):_.ThrowError("ResetLayoutParams(): new params is null"):this._ProxyView.ResetLayoutParams(t)}GetRenderer(){return _.LayoutViewBase.sRenderer}GetLayoutParams(){return this.LayoutParams?this.LayoutParams.Clone():new _.LayoutParams}EnableAutoHeight(){this._AutoHeight=!0}WaitTextureToResize(t){}ApplyObjectFit(t,e,i,n,s){if(this._ProxyView)return console.warn("ProxiedView not support ApplyObjectFit"),null;null===this._ObjectFitTestCache&&(this._ObjectFitTestCache={frameWidth:NaN,frameHeight:NaN,textureWidth:NaN,textureHeight:NaN,objectFit:"fill",clipLayout:null});let r=this._ObjectFitTestCache;if(r.frameWidth===t&&r.objectFit===s&&r.frameHeight===e&&r.textureWidth===i&&r.textureHeight===n)return r.clipLayout;r.frameWidth=t,r.frameHeight=e,r.textureWidth=i,r.textureHeight=n,r.objectFit=s;let a={width:0,height:0},o=t/e;const l=i/n;if(!l)return console.warn("Warning:Texture size is 0!"),clip_layout;if(0===t||0===e){if(0===t&&0===e)return clip_layout;0===t?t=e*l:e=t/l,o=t/e}let h="";switch(s){case"fill":a.width=t,a.height=e,h="fill";break;case"none":a.width=i,a.height=n,h="none";break;case"cover":a=this._StretchSize(t,e,l,l<o),h="cover";break;case"scale-down":a=this._StretchSize(t,e,l,l>o),a.width>i&&(a.width=i,a.height=n),h="scale-down";break;case"contain":a=this._StretchSize(t,e,l,l>o),h="contain"}if(a.width=Math.floor(a.width),a.height=Math.floor(a.height),a.width!=t||a.height!=e){let i={};i.width=Math.min(a.width,t),i.height=Math.min(a.height,e),i.x=Math.floor((t-i.width)/2),i.y=Math.floor((e-i.height)/2),r.clipLayout=i;return(this.InnerChildElement?this.InnerChildElement:this.Element).style.objectFit=h,i}return null}_StretchSize(t,e,i,n){const s={width:0,height:0};return n?(s.width=t,s.height=t/i):(s.height=e,s.width=e*i),s}GetPositionOffset(t){let e=this,i=0,n=0;for(;t!==e;)i+=e.LayoutParams?e.LayoutParams.MarginLeft:0,n+=e.LayoutParams?e.LayoutParams.MarginTop:0,e=e.ParentView,e||_.ThrowError("ERROR: Target parent layoutview is not found in LayoutView tree");return new _.Coordinate(i,n)}_dispatchLongPress(){this._LongPressDelayRequestTaskId=0,this._InLongPress=!0;const t={type:_.DragInfo.EVENT_TYPE.OnLongPress,x:this._CurrentDownEvent.designX,y:this._CurrentDownEvent.designY};this.TouchEventProcess(t)}_onMouseDown(t,e,i){this._Velocity.x.reset(),this._Velocity.y.reset(),this._Velocity.x.updatePosition(t),this._Velocity.y.updatePosition(e),this._LastFocusX=t,this._DownFocusX=this._LastFocusX,this._LastFocusY=e,this._DownFocusY=this._LastFocusY,this._CurrentDownEvent={designX:t,designY:e,timeStamp:i},this._AlwaysInTapRegion=!0,this._InLongPress=!1,0!==this._LongPressDelayRequestTaskId&&(clearTimeout(this._LongPressDelayRequestTaskId),this._LongPressDelayRequestTaskId=0),this._LongPressDelayRequestTaskId=setTimeout(this._dispatchLongPress,600);return{type:_.DragInfo.EVENT_TYPE.OnDown,x:t,y:e,deltaX:0,deltaY:0}}_onMouseMove(t,e,i){if(!this._CurrentDownEvent)return null;this._Velocity.x.updatePosition(t),this._Velocity.y.updatePosition(e);const n=parseInt(t-this._LastFocusX,10),s=parseInt(e-this._LastFocusY,10),r=parseInt(t-this._DownFocusX,10),a=parseInt(e-this._DownFocusY,10);let o=null;if(this._AlwaysInTapRegion){r*r+a*a>this._TouchSlopSquare&&(o={type:_.DragInfo.EVENT_TYPE.OnDragStart,x:t,y:e},this._LastFocusX=t,this._LastFocusY=e,this._LastTimeStamp=i,this._AlwaysInTapRegion=!1,this._InLongPress=!1,this._InDragging=!0,0!==this._LongPressDelayRequestTaskId&&(clearTimeout(this._LongPressDelayRequestTaskId),this._LongPressDelayRequestTaskId=0))}else this._InDragging&&(Math.abs(n)>=1||Math.abs(s)>=1)&&(o={type:_.DragInfo.EVENT_TYPE.OnMoved,x:t,y:e,deltaX:r,deltaY:a,_deltaX:n,_deltaY:s,timeStamp:parseInt((this._LastTimeStamp-i)/1e3,10)},this._LastFocusX=t,this._LastFocusY=e,this._LastTimeStamp=i);return o}_onMouseUp(t,e,i){let n=null;if(this._CurrentDownEvent){const i=window.Forge.DesignMap(),s=Math.floor(i.displayScale*i.width),r=window.innerWidth/s,a=this._Velocity.x.getVelocity()/r,o=this._Velocity.y.getVelocity()/r;let l=t-this._CurrentDownEvent.designX,h=e-this._CurrentDownEvent.designY;const c=t-this._LastFocusX,u=e-this._LastFocusY;this._InLongPress||(this._AlwaysInTapRegion?n={type:_.DragInfo.EVENT_TYPE.OnTap,x:t,y:e,velocityX:0,velocityY:0,deltaX:l,deltaY:h,_deltaX:c,_deltaY:u}:(Math.abs(o)>70||Math.abs(a)>70?(l=this._GetSplineFlingDistance(a),h=this._GetSplineFlingDistance(o),n={type:_.DragInfo.EVENT_TYPE.OnFling,x:t,y:e,velocityX:a,velocityY:o,deltaX:a<0?-l:l,deltaY:o<0?-h:h,_deltaX:c,_deltaY:u}):n={type:_.DragInfo.EVENT_TYPE.OnDragEnd,x:t,y:e,deltaX:l,deltaY:h,_deltaX:c,_deltaY:u},this.TouchEventProcess(n),n={type:_.DragInfo.EVENT_TYPE.OnRelease,x:t,y:e,deltaX:l,deltaY:h,_deltaX:c,_deltaY:u},this._CurrentDownEvent=null)),this._InLongPress=!1,0!==this._LongPressDelayRequestTaskId&&(clearTimeout(this._LongPressDelayRequestTaskId),this._LongPressDelayRequestTaskId=0)}return n}_onTouchEvent(t){const e=window.Forge.DesignMap(),i=Math.floor(e.displayScale*e.width),n=window.innerWidth/i,s=t.clientX/n,r=t.clientY/n;let a=null;switch(t.type){case"touchstart":case"mousedown":a=this._onMouseDown(s,r,t.timeStamp);break;case"touchmove":case"mousemove":a=this._onMouseMove(s,r,t.timeStamp);break;case"touchend":case"touchcancel":case"mouseup":a=this._onMouseUp(s,r,t.timeStamp)}return!!a&&this.TouchEventProcess(a)}_AddEventListener(){this.Element.style.pointerEvents="auto",this._ValidTouch=!1;"ontouchstart"in window?(this.Element.addEventListener("touchstart",(t=>{if(console.log("touchstart",t),this._ValidTouch=!0,t.touches&&t.touches.length>0){console.log(`touchstart event.touches[0].clientX:${t.touches[0].clientX}, event.touches[0].clientY:${t.touches[0].clientY}`);this._onTouchEvent({type:t.type,clientX:t.touches[0].clientX,clientY:t.touches[0].clientY,timeStamp:t.timeStamp})&&t.stopPropagation()}}),!0),this.Element.addEventListener("touchmove",(t=>{if(this._ValidTouch&&(console.log("touchmove",t),t.touches&&t.touches.length>0)){console.log(`touchmove event.touches[0].clientX:${t.touches[0].clientX}, event.touches[0].clientY:${t.touches[0].clientY}`);this._onTouchEvent({type:t.type,clientX:t.touches[0].clientX,clientY:t.touches[0].clientY,timeStamp:t.timeStamp})&&t.stopPropagation()}}),!0),this.Element.addEventListener("touchend",(t=>{if(console.log(`touchend event.touches.length:${t.touches.length}, event.clientX:${t.clientX}, event.pageX:${t.pageX}`),this._ValidTouch=!1,t.changedTouches&&t.changedTouches.length>0){console.log(`touchend event.changedTouches[0].clientX:${t.changedTouches[0].clientX}, event.changedTouches[0].pageX:${t.changedTouches[0].pageX}`);this._onTouchEvent({type:t.type,clientX:t.changedTouches[0].clientX,clientY:t.changedTouches[0].clientY,timeStamp:t.timeStamp})&&t.stopPropagation()}}),!0),this.Element.addEventListener("touchcancel",(t=>{if(this._ValidTouch=!1,console.log("touchcancel",t),t.changedTouches&&t.changedTouches.length>0){console.log(`touchcancel event.clientX:${t.clientX}, event.clientY:${t.clientY}`);this._onTouchEvent({type:t.type,clientX:t.touches[0].clientX,clientY:t.touches[0].clientY,timeStamp:t.timeStamp})&&t.stopPropagation()}}),!0)):(this.Element.addEventListener("mousedown",(t=>{console.log("mousedown",t),this._ValidTouch=!0;this._onTouchEvent(t)&&t.stopPropagation()}),!0),this.Element.addEventListener("mousemove",(t=>{if(this._ValidTouch){this._onTouchEvent(t)&&t.stopPropagation()}}),!0),this.Element.addEventListener("mouseup",(t=>{console.log("mouseup",t),this._ValidTouch=!1;this._onTouchEvent(t)&&t.stopPropagation()}),!0))}_GetSplineDeceleration(t){return Math.log(_.DragInfo.INFLEXION*Math.abs(t)/(_.DragInfo.SCROLL_FRICTION*_.DragInfo.PHYSICAL_COEF))}_GetSplineFlingDistance(t){const e=this._GetSplineDeceleration(t),i=_.DragInfo.DECELERATION_RATE-1;return _.DragInfo.SCROLL_FRICTION*_.DragInfo.PHYSICAL_COEF*Math.exp(_.DragInfo.DECELERATION_RATE/i*e)}_DoDragMove(t,e){let i=t._deltaX,n=t._deltaY;this._DragMovedDistanceX+=i,this._DragMovedDistanceY+=n,e||(i=t.deltaX,n=t.deltaY);const s=t.timeStamp/1e3;let r=`left ${s}s, top ${s}s`;this._DragInfo.Settings.DragDirection===_.DragSetting.DIRECTION_VERTICAL?(i=0,r=`top ${s}s`):this._DragInfo.Settings.DragDirection===_.DragSetting.DIRECTION_HORIZONTAL?(n=0,r=`left ${s}s`):this._DragInfo.Settings.DragDirection===_.DragSetting.DIRECTION_DISABLE&&(i=0,n=0);let a=this.GetLayoutParams();return a=this._GetMovedLayoutParams(i,n),e&&(this.Element.style.transition=r,this.ResetLayoutParams(a)),!!((Math.abs(this._DragMovedDistanceX)>=this._DragInfo.Settings.TriggerMovedDistance||Math.abs(this._DragMovedDistanceY)>=this._DragInfo.Settings.TriggerMovedDistance)&&this._DragInfo.Listener&&this._DragInfo.Listener.OnMoved)&&(t.viewX=a.MarginLeft,t.viewY=a.MarginTop,this._DragInfo.Listener.OnMoved(t))}_GetMovedLayoutParams(t,e){const i=this.GetLayoutParams();let n=i.MarginLeft+t,s=i.MarginTop+e;return n>this._DragInfo.Settings.SlidePile.x?n=this._DragInfo.Settings.SlidePile.x:n+i.Width<this._DragInfo.Settings.SlidePile.x+this._DragInfo.Settings.SlidePile.width&&(n=this._DragInfo.Settings.SlidePile.x+this._DragInfo.Settings.SlidePile.width-i.Width),s>this._DragInfo.Settings.SlidePile.y?s=this._DragInfo.Settings.SlidePile.y:s+i.Height<this._DragInfo.Settings.SlidePile.y+this._DragInfo.Settings.SlidePile.height&&(s=this._DragInfo.Settings.SlidePile.y+this._DragInfo.Settings.SlidePile.height-i.Height),i.SetPosition(n,s),i}_SlideIfEnableTabMod(t,e){if(!this._DragInfo.Settings.EnableTabMode)return!1;const i=t._deltaX,n=t._deltaY;let s=t.deltaX,r=t.deltaY,a=this._DragInfo.Settings.PageWidth*this._DragInfo.Settings.PageEdge;const o=this.GetLayoutParams(),l=o.MarginLeft+i,h=o.MarginTop+n;switch(t.type===_.DragInfo.EVENT_TYPE.OnFling&&(a=0),this._DragInfo.Settings.DragDirection){case _.DragSetting.DIRECTION_VERTICAL:if(s=0,r>=0){const t=this._DragInfo.Settings.PageWidth-Math.abs(h)%this._DragInfo.Settings.PageWidth;r=t>=a?this._DragInfo.Settings.PageWidth-t:-t}else{const t=Math.abs(h)%this._DragInfo.Settings.PageWidth;r=t>=a?-(this._DragInfo.Settings.PageWidth-t):t}break;case _.DragSetting.DIRECTION_HORIZONTAL:if(r=0,s>=0){const t=this._DragInfo.Settings.PageWidth-Math.abs(l)%this._DragInfo.Settings.PageWidth;s=t>=a?this._DragInfo.Settings.PageWidth-t:-t,console.log(`right, left_width:${t}, distance_x:${s}`)}else{const t=Math.abs(l)%this._DragInfo.Settings.PageWidth;s=t>=a?-(this._DragInfo.Settings.PageWidth-t):t,console.log(`left, left_width:${t}, distance_x:${s}`)}break;case _.DragSetting.DIRECTION_AUTO:console.log("slideIfEnableTabMode DragDirection error DRAG_DIRECTION_AUTO")}if(0===s&&0===r)return console.log("slideIfEnableTabMode distance_x === 0 && distance_y === 0"),!1;const c=Math.sqrt(s*s+r*r)/.3;return t.deltaX=s,t.deltaY=r,this._DonFlingAnim(t,c),!0}_DoDragEnd(t){let e=t._deltaX,i=t._deltaY;this._DragInfo.Settings.DragDirection===_.DragSetting.DIRECTION_VERTICAL?e=0:this._DragInfo.Settings.DragDirection===_.DragSetting.DIRECTION_HORIZONTAL?i=0:this._DragInfo.Settings.DragDirection===_.DragSetting.DIRECTION_DISABLE&&(e=0,i=0),console.log("_DoDragEnd event:",t,this.Element.style);let n=this.GetLayoutParams();return n=this._GetMovedLayoutParams(e,i),this.ResetLayoutParams(n),t.viewX=n.MarginLeft,t.viewY=n.MarginTop,this._DragInfo.Listener.OnDragEnd(t)}_DragImactSensorRecycle(){console.log("_DragImactSensorRecycle this._DragImactSensor:",this._DragImactSensor),this._DragImactSensor&&this._DragImactSensor.Recycle()}_DonFlingAnim(t,e){const i=t.deltaX,n=t.deltaY,s=this.GetLayoutParams(),r=s.MarginLeft,a=s.MarginTop,o=s.MarginLeft+i,l=s.MarginTop+n,h=this._GetMovedLayoutParams(i,n);if(h.MarginLeft===s.MarginLeft&&h.MarginTop===s.MarginTop)return void console.log("_DonFlingAnim adjust_lp.MarginLeft === lp.MarginLeft && adjust_lp.MarginTop === lp.MarginTop");this.DragControl=new _.DragTranslateControl,this.DragControl._SetView(this),this.DragControl.speed(e),console.log(`OnFling speed:${e}`);const c=this._DragInfo.Settings;this._DragImactSensorRecycle(),this.Element.style.transform=null,this.DragControl.target(s.MarginLeft,s.MarginTop).jumpSilent(),s.SetPosition(0,0),this.ResetLayoutParams(s);let u=0;this.DragControl.target(o,l).start(((e,r)=>{this.DragControl=null,s.SetPosition(e,r),this.ResetLayoutParams(s),this.Element.style.transform=null,this._DragImactSensorRecycle(),t.viewX=e,t.viewY=r,this._DragInfo.Listener.OnFling(t),console.log(`_DonFlingAnim end view_x:${e}, view_y:${r}, distance_x:${i}, distance_y:${n}`)}),(t=>{const e=i*t,s=n*t;if(console.log(`_DonFlingAnim progress:${t}, deltaX:${e}, deltaY:${s}`),Math.abs(e)>this._DragInfo.Settings.TriggerMovedDistance||Math.abs(s)>this._DragInfo.Settings.TriggerMovedDistance){const t={deltaX:r+e,deltaY:a+s,_deltaX:e,_deltaY:s,timeStamp:parseInt((Date.now()-u)/1e3,10)};this._DoDragMove(t,!1),u=Date.now()}}));const d=this.GetPositionOffset(this.ParentView);this._DragImactSensor=new _.DragImpactSensor([{x:c.SlidePile.x+d.x,y:c.SlidePile.y+d.y},{x:c.SlidePile.x+d.x+c.SlidePile.width,y:c.SlidePile.y+d.y},{x:c.SlidePile.x+d.x,y:c.SlidePile.y+d.y+c.SlidePile.height},{x:c.SlidePile.x+d.x+c.SlidePile.width,y:c.SlidePile.y+d.y+c.SlidePile.height}],this.Element,new _.sImpactSensorManager.Callback((e=>{this._DoDragPause(t),this._DragImactSensorRecycle()}),null))}_DoFling(t){let e=t.deltaX,i=t.deltaY,n=!0,s=0;switch(this._DragInfo.Settings.DragDirection){case _.DragSetting.DIRECTION_VERTICAL:e=0,0===i&&(n=!1),s=Math.abs(t.velocityY);break;case _.DragSetting.DIRECTION_HORIZONTAL:i=0,0===e&&(n=!1),s=Math.abs(t.velocityX);break;case _.DragSetting.DIRECTION_DISABLE:n=!1;break;default:s=Math.sqrt(t.velocityX**2,t.velocityY**2)}return n&&(t.deltaX=e,t.deltaY=i,this._DonFlingAnim(t,s)),!0}GetBoundingClientRect(t){this.Element?setTimeout((()=>{let e=this,i=0;for(;e;)e.TransformAnimationObj&&e.TransformAnimationObj.repeatTimes>0&&(i++,e.TransformAnimationObj.AddAnimationListener(new _.AnimationListener(null,(e=>{if(i--,i<=0){const{left:e,top:i,width:n,height:s}=this.Element.getBoundingClientRect();t?.(JSON.stringify({status:0,data:{left:e,top:i,width:n,height:s}}))}})))),e=e.ParentView;if(0==i){const{left:e,top:i,width:n,height:s}=this.Element.getBoundingClientRect();t?.(JSON.stringify({status:0,data:{left:e,top:i,width:n,height:s}}))}}),1):t?.(JSON.stringify({status:-1,error:"BrowserError: dom element is null."}))}}ut.DivId=0,_.LayoutViewBase=ut;class dt extends ut{constructor(t,e){!t||t instanceof _.TextureSetting||_.ThrowError("ERROR:LayoutView need TextureSetting as parameter"),super(t,e=e||"div")}HtmlCanAccessElement(){return!0}HtmlGetElement(){return this.Element}}_.LayoutView=dt,window.LayoutView=_.LayoutView;class gt extends _.LayoutView{constructor(){super(void 0,"root"),this._ViewType=1,this._IsChildOfRootView=!0,window.gRootView=this,_.sRootView=this}Init(t,e,i,n,s){this.InitLayoutViewStaticValues(t),this.ResetLayoutParams({x:0,y:0,width:1280,height:720})}InitLayoutViewStaticValues(t){_.LayoutViewBase.sRenderer=t,_.LayoutViewBase.sInternalTextureManager=t.GetSharedTextureManager(),_.LayoutViewBase.sIdentityMat4=new _.Mat4,_.LayoutViewBase.sNullDirectParentMat4=new _.Mat4,_.LayoutViewBase.sBakeFlipYMat4=(new _.Mat4).rotatex(180)}}_.RootView=gt,window.RootView=_.RootView;class ft{constructor(t,e,i,n,s){this.coordX=t,this.coordY=e,this.width=i,this.height=n,this.useScissors=s,this.maskStencil=null}updateInfo(t,e,i,n,s){this.coordX=t,this.coordY=e,this.width=i,this.height=n,this.useScissors=s}setMaskStencil(t){this.maskStencil=t}}class mt extends _.LayoutView{constructor(t){super(t,"div"),this._ClipRectInfo=null,this.Id="ClipView",this.TextureSetting=null}SetId(t){this.Id=`${t}_ClipView`}SetClipRect(t,e,i,n,s){null===this._ClipRectInfo?this._ClipRectInfo=new ft(t,e,i,n,s):this._ClipRectInfo.updateInfo(t,e,i,n,s);const r=t,a=e,o=this.LayoutParams.Width-r-i,l=this.LayoutParams.Height-a-n;s?(this.Element.style.overflow="hidden",this.Element.style.clipPath=`inset(${a}px ${o}px ${l}px ${r}px)`):(this.Element.style.overflow="visible",this.Element.style.clipPath="unset")}}_.ClipView=mt,window.ClipView=_.ClipView;class pt extends _.LayoutView{constructor(t){super(t,"div"),this._HorizontalRepeats=[0,0,0,0],this._VerticalRepeats=[0,0,0,0],this._HorizontalPadding=[0,0],this._VerticalPadding=[0,0],this._ImageDspWidth=0,this._ImageDspHeight=0}ResetTexture(t,e){let i=null;t&&(i=new _.ExternalTextureSetting(t,e)),this.TextureSetting=i,this._ApplyChanges()}SetRepeat(t,e){_.Assert(t.length<=2),_.Assert(e.length<=2);for(let i=0;i<2;i++)i<t.length?(this._HorizontalRepeats[2*i]=t[i].start,this._HorizontalRepeats[2*i+1]=t[i].width):(this._HorizontalRepeats[2*i]=0,this._HorizontalRepeats[2*i+1]=0),i<e.length?(this._VerticalRepeats[2*i]=e[i].start,this._VerticalRepeats[2*i+1]=e[i].width):(this._VerticalRepeats[2*i]=0,this._VerticalRepeats[2*i+1]=0);return this._ApplyChanges(),this}SetPadding(t,e){return _.Assert(null!==t),_.Assert(null!==e),this._VerticalPadding[0]=e.start,this._VerticalPadding[1]=e.width,this._HorizontalPadding[0]=t.start,this._HorizontalPadding[1]=t.width,this._ApplyChanges(),this}SetImageDspSize(t,e){this._ImageDspWidth=t,this._ImageDspHeight=e}_ApplyChanges(){let t=this.TextureSetting;if(t){if(t.MaskSetting&&"CORNER"===t.MaskSetting._MaskType&&this._SetBorderRadius(t.MaskSetting),t.Texture.Source){const e=t.Texture.RenderTexture.Width,i=t.Texture.RenderTexture.Height,n=e/this._ImageDspWidth,s=i/this._ImageDspHeight,r=this._HorizontalRepeats[0],a=this._ImageDspWidth-this._HorizontalRepeats[1]-r,o=this._VerticalRepeats[0],l=this._ImageDspHeight-this._VerticalRepeats[1]-o;let h=Math.floor(this._HorizontalRepeats[0]*n),c=e-Math.floor(this._HorizontalRepeats[1]*n)-h,u=Math.floor(this._VerticalRepeats[0]*s),d=i-Math.floor(this._VerticalRepeats[1]*s)-u;h+c>=e&&(h-=1,c-=1),u+d>=i&&(u-=1,d-=1);const g=`${u} ${c} ${d} ${h}`;this.Element.style.borderImage=`url(${t.Texture.Source}) ${g} fill`;const f=this._HorizontalPadding[0],m=this._ImageDspWidth-this._HorizontalPadding[1]-f,p=this._VerticalPadding[0],_=this._ImageDspHeight-this._VerticalPadding[1]-p;this.Element.style.borderImageWidth=`${o}px ${a}px ${l}px ${r}px`,this.Element.style.borderImageOutset=`${p}px ${m}px ${_}px ${f}px`}}else this.Element.style.borderRadius="",this.Element.style.borderImage=""}}_.NinePatchView=pt;class _t extends _.LayoutView{constructor(t){let e;e=t.startsWith("jsve-")?t.substr(5):t.substr(3),super(void 0,e)}setAttribute(t,e){this.Element.setAttribute(t,e)}removeAttribute(t){this.Element.removeAttribute(t)}getAttribute(t){return this.Element.getAttribute(t)}hasAttribute(t){return this.Element.hasAttribute(t)}get textContent(){return this.Element.textContent}set textContent(t){this.Element.textContent=t}}_.JsvElementView=_t;_.VideoView=class extends dt{constructor(t,e){super(e),this._ViewType=8,this.Element=t,this.Id="VideoView"}SetId(t){this.Id=`${t}_VideoView`}ResetLayoutParams(t){null!==t?(t instanceof _.LayoutParamsBase?this.LayoutParams=t.Clone():this.LayoutParams=new _.LayoutParams(t),this.Element.style.left=`${this.LayoutParams.MarginLeft}px`,this.Element.style.top=`${this.LayoutParams.MarginTop}px`,this.LayoutParams.Width&&(this.Element.style.width=`${this.LayoutParams.Width}px`),this.LayoutParams.Height&&(this.Element.style.height=`${this.LayoutParams.Height}px`)):_.ThrowError("ResetLayoutParams(): new params is null")}_OnAttachToSystem(){console.log("Video attach"),super._OnAttachToSystem()}_OnDetachFromSystem(){super._OnDetachFromSystem()}};class Tt extends _.LayoutView{constructor(){super(null,"input"),this._ViewType=5,this._InputType=_.TextInputType.TEXT,this.Id="EditControlView"}_OnAttachToSystem(){super._OnAttachToSystem(),this.Element.style.left="-1920px",this.Element.style.top="-1080px",this.Element.style.width="1px",this.Element.style.height="1px",this.Element.style.pointerEvents="auto",this.Element.addEventListener("keydown",(t=>{t=t||window.event;let e=this.Element.selectionStart;console.log(`keydown cur_offset:${e}`),37===t.keyCode?(--e,e<0&&(e=0),e!==this.Element.selectionStart?(this.OnTextChanged(this.Element.value,e,!0),t.stopPropagation&&t.stopPropagation()):this.Element.blur()):39===t.keyCode?(++e,e>this.Element.value.length&&(e=this.Element.value.length),e!==this.Element.selectionStart?(this.OnTextChanged(this.Element.value,e,!0),t.stopPropagation&&t.stopPropagation()):this.Element.blur()):38===t.keyCode||40===t.keyCode?this.Element.blur():27!==t.keyCode&&1e4!==t.keyCode||this.Element.blur()})),this.Element.onfocus=t=>{console.log("onfocus in"),this.OnStatusChanged(1)},this.Element.onblur=t=>{console.log("onblur in"),this.OnStatusChanged(0)};this.Element.oninput=t=>{if(console.log("oninput:",t),t.target.value.length>0&&t.target.selectionStart>0){const i=t.target.selectionStart-1,n=t.target.selectionStart,s=t.target.value.slice(i,n);e=s,"0".charCodeAt()<=e.charCodeAt()&&e.charCodeAt()<="9".charCodeAt()||this._InputType!==_.TextInputType.NUMBER||(t.target.value=t.target.value.substr(0,i)+t.target.value.substr(n),t.target.selectionStart=i)}var e;const i=t.target.value,n=t.target.selectionStart;this.OnTextChanged(decodeURIComponent(i),n)}}SetId(t){this.Id=`${t}_EditControlView`}showIme(t,e,i){this.Element?t!==_.TextInputType.NONE?(null==i&&(i=e.length>0?e.length:0),i<0?i=0:i>e.length&&(i=e.length>0?e.length:0),this._InputType=t,this.Element.type="text",this.Element.value=e,this.Element.focus(),this.Element.selectionStart=i,this.Element.selectionEnd=i):console.log("showIme input_type error"):console.log("showIme but ele is null!")}hideIme(){this.Element?this.Element.blur():console.log("hideIme, but ele is null!")}updateCursorOffset(t,e){this.Element?(this.Element.selectionStart=e,this.Element.selectionEnd=e,this.Element.value=t):console.log("updateCursorOffset, but ele is null!")}OnTextChanged(t,e,i){console.log(`OnTextChanged value:${t}`)}OnStatusChanged(t){}OnEditAction(t){}}class yt extends _.LayoutView{constructor(t,e=1){super(t),this._ViewType=10,this._FilterType=e,this.Id="FilterView",this.Element.style.filter="grayscale(100%)"}FilterSwitch(t){this.Element&&(this.Element.style.filter=t?"grayscale(100%)":"")}SetId(t){this.Id=t+"_FilterView"}}_.FilterView=yt;let wt={NONE:0,TEXT:1,PASSWORD:2,TEXT_AREA:3,CONTENT_EDITABLE:4,SEARCH:5,URL:6,EMAIL:7,TELEPHONE:8,NUMBER:9};_.TextInputType=wt,_.EditControlView=Tt;class St{constructor(t){this._Current=new Array(t).fill(0),this._Target=new Array(t).fill(0),this._RepeatStart=new Array(t).fill(0),this._JumpTarget=null,this._Jumping=!1,this._ParameterCount=t,this._StateIndex=0,this._StateLocked=!1,this._StartSwitcher=!1,this._PausedCallback=null,this._EndCallback=null,this._NextEndCallback=null,this._Token=0,this._Repeat=!1,this._OnRepeatCallback=null,this._SpriteView=null,this._AdvanceCallback=null}setRepeat(t,e){return this._Repeat=t,this._OnRepeatCallback=t?e:null,this}start(t,e){this._NextEndCallback=t,this._EndCallback=null,this._AdvanceCallback=e,this._StartSwitcher=!0,this._Jumping=!1,this._StateMachineNext()}pause(t){this._AdvanceCallback=null,null===this._EndCallback&&null===this._NextEndCallback||(this._EndCallback=null,this._NextEndCallback=null),0===this._StateIndex?t&&this._CallbackWithCatch(this._Current,t):(t&&(this._PausedCallback=t),this._StateMachineNext())}jump(){this._JumpTarget=[...this._Target],this._Jumping=!0,this._StartSwitcher=!0,this._StateMachineNext()}jumpSilent(){this._JumpTarget=[...this._Target]}startFpsTesting(){_.sRenderBridge.SetStepFpsSwitch(!0)}stopFpsTesting(){_.sRenderBridge.SetStepFpsSwitch(!1)}_WrapBuildAnimation(t,e,i,n){console.warn("Should Override")}_WrapCallback(t,e){console.warn("Should Override")}_CallbackWithCatch(t,e){try{this._WrapCallback(t,e)}catch(t){console.error("Error:in callback"),console.error(t)}}_StateMachineNext(){this._StateLocked||(0===this._StateIndex?this._StartSwitcher&&(this._StartSwitcher=!1,this._StartAnimation()&&(this._StateIndex=1)):1===this._StateIndex&&this._StopAnimation())}_StartAnimation(){this._EndCallback=this._NextEndCallback,this._NextEndCallback=null;const t=this._JumpTarget?[...this._JumpTarget]:[...this._Current],e=this._Target,i=this._Repeat?[...this._RepeatStart]:null,n=this._WrapBuildAnimation(i,t,e,this._Jumping);if(this._JumpTarget=null,this._Jumping=!1,null===n)return;const s=[...e],r=this,a=(new _.AnimationListener).OnFinalProgress((e=>{r._OnPaused(null!==i?i:t,s,e)})).OnAdvance((t=>{this._AdvanceCallback&&this._AdvanceCallback(t)}));return this._OnRepeatCallback&&a.OnRepeat((t=>{r._OnRepeatCallback&&r._OnRepeatCallback(t)})),n.AddAnimationListener(a),n.Enable(_.AnimationEnable.KeepTransform),this._Repeat&&n.EnableInfinite(),this._SpriteView.StartAnimation(n),!0}_StopAnimation(){this._SpriteView.StopAnimation()}_OnPaused(t,e,i){for(let n=0;n<this._ParameterCount;n++)this._Current[n]=Math.floor((e[n]-t[n])*i+t[n]);this._StateLocked=!0;const n=this._PausedCallback,s=this._EndCallback;this._PausedCallback=null,n&&this._CallbackWithCatch(this._Current,n),s&&1===i&&(this._EndCallback=null,this._CallbackWithCatch(this._Current,s)),this._StateLocked=!1,this._StateIndex=0;this._StateMachineNext()}_SetView(t){this._SpriteView=t}}_.DragTranslateControl=class extends St{constructor(){super(2),this._Mode=0,this._Speed=0,this._VerlocityAcc=0,this._VerlocityInit=0,this._AccAlongX=!0,this._AnimationRef=null,this._AllowFrameStep=!1}allowFrameStepMode(t){return this._AllowFrameStep=t,this}selectMode(t){switch(t){case"UniformMotion":this._Mode=0;break;case"AcceleratedMotion":this._Mode=1,this.setRepeat(!1);break;default:console.error(`Unsupported input=${t}`)}return this}targetX(t){return this._Target[0]=t,this}targetY(t){return this._Target[1]=t,this}target(t,e){return this._Target[0]=t,this._Target[1]=e,this}enableRepeatFrom(t,e,i){if(this._ComfirmMode(0))return this.setRepeat(!0,i),this._RepeatStart[0]=t,this._RepeatStart[1]=e,this}speed(t){if(console.log(`speed, pixel_per_second:${t}`),this._ComfirmMode(0))return this._Speed=t,this}accelerateX(t,e){if(this._ComfirmMode(1))return this._Target[0]=e,this._VerlocityAcc=t,this._VerlocityInit=0,this._AccAlongX=!0,this}accelerateY(t,e){if(this._ComfirmMode(1))return this._Target[1]=e,this._VerlocityAcc=t,this._VerlocityInit=0,this._AccAlongX=!1,this}decelerateX(t,e){if(this._ComfirmMode(1))return this._VerlocityAcc=t,this._VerlocityInit=e,this._AccAlongX=!0,this}decelerateY(t,e){if(this._ComfirmMode(1))return this._VerlocityAcc=t,this._VerlocityInit=e,this._AccAlongX=!1,this}decelerate(t,e,i,n){if(1===this._Mode)return this._VerlocityAcc[0]=t,this._VerlocityAcc[1]=e,this._VerlocityInit[0]=i,this._VerlocityInit[1]=n,this;console.error("Error: mode error")}_ComfirmMode(t){return this._Mode===t||(console.error("Error: mode error"),!1)}_WrapBuildAnimation(t,e,i,n){return n?this._AnimationRef=this._UniformMove(null,e,i,n):0===this._Mode?this._AnimationRef=this._UniformMove(t,e,i,!1):1===this._Mode&&(this._AnimationRef=this._AccelerMove(e,i)),this._AnimationRef}_UniformMove(t,e,i,n){let s=0,r=0,a=0,o=1;const l=e[0],h=e[1],c=i[0],u=i[1];if(null!==t){s=t[0],r=t[1];const e=this._Distance(l,h,c,u),i=this._Distance(s,r,c,u);a=(i-e)/i,n||(o=1e3*i/this._Speed)}else s=l,r=h,a=0,n||(o=1e3*this._Distance(l,h,c,u)/this._Speed);n||0!==o||console.warn("Discard starting request for no distance");let d=null;if(s!==c&&r!==u||n||!this._AllowFrameStep||!window.JsView)d=new _.TranslateAnimation(s,c,r,u,o,null);else{console.log("Using frame translate animation");let t=0,e=0,i=!0;s!==c?(t=s,e=c,i=!0):(t=r,e=u,i=!1),d=new _.TranslateFrameAnimation(t,e,this._Speed,i)}return 0!==a&&(a<0?console.warn("Warning: start position out of repeating range"):d.SetStartPos(a)),d}_AccelerMove(t,e){const i=this._AccAlongX?t[0]:t[1],n=this._VerlocityInit,s=this._VerlocityAcc;let r,a,o,l,h=!0;if(0!==s)return 0===n?(r=this._AccAlongX?e[0]:e[1],a=Math.floor(1e3*Math.sqrt(2*Math.abs(r-i)/s)),h=!0):(a=Math.floor(1e3*Math.abs(n)/s),r=i+Math.floor(5e-4*n*a),h=!1),0===a&&console.warn("no moved..."),this._AccAlongX?(o=r,this._Target[0]=o,l=this._Target[1]):(o=this._Target[0],l=r,this._Target[1]=l),new _.TranslateAnimation(t[0],o,t[1],l,a,h?_.Easing.Circular.In:_.Easing.Circular.Out);console.error("Error: no found acceleration")}_Distance(t,e,i,n){const s=i-t,r=n-e;return Math.sqrt(s*s+r*r)}_WrapCallback(t,e){this._AnimationRef=null,e&&e(t[0],t[1])}};class xt extends _.LayoutView{constructor(){super(),this._ChildTextView=null}PutChildTextView(t){this._ChildTextView=t;const e=t.GetLayoutParams();this.AddView(t,e.MarginLeft,e.MarginTop,e.Width,e.Height)}EnableAutoHeight(){this._ChildTextView.EnableAutoHeight()}}class bt{StringWithFont(t,e,i,n,s,r,a,o,l,h,c){e||(e=bt._sDefaultFontSize),i||(i=bt._sDefaultFont);let u="";!0===a&&(u="italic");let d="";return!0===o&&(d="bold"),n||(n="left"),s||(s="middle"),r||(r=bt._sDefaultFontColor),l||(l=null),c||(c="top"),h||(h=-1),{str:`${t}`,font:i,size:e,italic:u,bold:d,stroke_width:h,alignment:n,vertical_align:s,textColour:r,backgroundColour:bt._sDefaultBackgroundColor,enableBlend:!0,shadow:l,vertical_area_align:c}}TextAttr(t,e){return t||(t="none"),e||(e="none"),{text_overflow:t,word_wrap:e}}GetTextWidth(...t){if(t.length<=1){let e=t[0];return void 0!==window.PlatformUtils?window.PlatformUtils.GetTextWidth(e):e.str.length*e.size+1}{let e=t[0];if(void 0!==window.PlatformUtils){let i={str:e,font:t[1]?t[1]:"黑体",size:t[2],bold:t[3],italic:t[4]};return window.PlatformUtils.GetTextWidth(i)}return e.length*e.size+1}}GetOneLineTextDrawWidth(t,e,i,n,s,r){if(void 0!==window.PlatformUtils){let a=window.PlatformUtils.GetOneLineTextDrawWidth(t,e??"黑体",i,n,s);r.push(...a)}else console.error("GetOneLineTextDrawWidth: window.PlatformUtils undefined.")}GetTextRect(t,e,i,n,s){return void 0!==window.PlatformUtils?window.PlatformUtils.GetTextRect(t,e,i,n,s):{width:e.width,height:e.height}}GetTextInfo(t,e,i,n,s){return void 0!==window.PlatformUtils?window.PlatformUtils.GetTextInfo(t,e,i,n,s):{start:0,end:t.length,width:e.width,height:e.height}}GetCursorOffset(t,e,i,n,s,r,a){return void 0!==window.PlatformUtils?window.PlatformUtils.GetCursorOffset(t,e,i,n,s,r,a):0}GetCursorPosition(t,e,i,n,s,r){return void 0!==window.PlatformUtils?window.PlatformUtils.GetCursorPosition(t,e,i,n,s,r):{x:0,y:0}}BuildTextView(t,e,i,n,s,r,a,o,l,h,c){s.width=isNaN(s.width)?0:s.width,s.height=isNaN(s.height)?0:s.height,r=isNaN(r)?10:r,a=isNaN(a)?0:a;let u=new _.LayoutView;const d=t.GetTextTextureFromStylePack(e,i,!!n,s,r,a,o,l,h,c);if(n&&setTimeout((()=>{n(u.Element.clientWidth,u.Element.clientHeight)})),null===d)return console.error("Error: Build text texture failed!"),null;u.ResetTexture(d),e.length<10?u.SetId("Text-"+e):u.SetId("Text-Long-"+e.length),u.ResetLayoutParams({x:0,y:0,width:s.width,height:s.height});const g=i.DS.Describe;if("middle"===g.vertical_area_align||"bottom"===g.vertical_area_align){const t=new xt;t.PutChildTextView(u),u.Element.style.display="table-cell",u.Element.style.position="static",t.Element.style.display="table",t.Element.style.position="static",u=t}return u}}bt._sDefaultFont="黑体",bt._sDefaultFontSize=30,bt._sDefaultFontColor="#FFFFFF",bt._sDefaultBackgroundColor="rgba(0, 0, 0, 0)",_.TextUtils=bt,_.sTextUtils=new _.TextUtils;class vt{constructor(){this._InnerViews={},this._ViewToken=1}add(t){const e=++this._ViewToken;return this._InnerViews[`${e}`]=t,e}remove(t){this._InnerViews[t]&&delete this._InnerViews[t]}get(t){return this._InnerViews[t]}clear(){this._InnerViews={},this._ViewToken=1}}_.ViewStore=vt;let Et=new vt;_.sViewStore=Et;class It{constructor(t,e){this.view=t,this.layout_params=e}}_.ViewInfo=It;let Ct=0;_.AnimationBase=class{constructor(){this.IdToken=Ct++,this._AttachedGroup=null,this.AnimationListenerObj=null,this._AnimationClose=!1,this._LayoutViewRef=null,this._IsTextureAnim=!1}SetAnimationListener(t){this.AnimationListenerObj=t,this.OnNewListener(t)}AddAnimationListener(t){this.AnimationListenerObj&&t.AddInherit(this.AnimationListenerObj),this.AnimationListenerObj=t,this.OnNewListener(t)}OnNewListener(t){}GetAnimationListener(){return this.AnimationListenerObj}Cancel(t){this._LayoutViewRef&&this._LayoutViewRef.DetachAnimation(this);const e=this.AnimationListenerObj;if(e&&e.OnAnimationEnd&&!this._AnimationClose&&(this._AnimationClose=!0,e.OnAnimationEnd(!1)),this._AttachedGroup){let e=!0;t&&(e=t._AttachedGroup!==this._AttachedGroup),e&&(this._AttachedGroup.CancelFromInternalAnimation(this),this._AttachedGroup=null)}}AttachToGroup(t){null!==this._AttachedGroup&&_.ThrowError("ERROR: In TransformAnimation.AttachToGroup(), animation already attached to other group"),this._AttachedGroup=t}RemoveFromGroup(){this._AttachedGroup=null}AsTextureAnimation(){this._IsTextureAnim=!0}Start(t){this._LayoutViewRef=t}SetCannotDisable(t){}OnStart(){const t=this.AnimationListenerObj;t&&t.OnAnimationStart&&t.OnAnimationStart()}OnEnd(t){this._LayoutViewRef&&!t&&(this._LayoutViewRef.DetachAnimation(this),this._LayoutViewRef=null);const e=this.AnimationListenerObj;e&&e.OnAnimationEnd&&!this._AnimationClose&&(this._AnimationClose=!0,e.OnAnimationEnd(!0))}OnRepeatEvent(){const t=this.AnimationListenerObj;t&&t.OnAnimRepeat&&t.OnAnimRepeat()}OnViewHide(){const t=this.AnimationListenerObj;t&&t.OnViewNoVisible&&t.OnViewNoVisible()}OnFinalProgress(t){const e=this.AnimationListenerObj;e&&e.OnAnimFinal&&e.OnAnimFinal(t)}OnAnimAdvance(t){const e=this.AnimationListenerObj;e&&e.OnAnimAdvance&&e.OnAnimAdvance(t)}};class At{constructor(t,e,i){this.OnAnimationStart=t,this._OnAnimationStart=t,this.OnAnimationEnd=e,this._OnAnimationEnd=e,this.OnViewNoVisible=i,this._OnViewNoVisible=i,this.OnAnimFinal=null,this._OnAnimFinal=null,this.OnAnimRepeat=null,this._OnAnimRepeat=null,this._AttachedGroup=null,this._InheritListener=[],this._OnAnimAdvance=null,this.OnAnimAdvance=null}OnStart(t){return this._OnAnimationStart=t,this.OnAnimationStart=t,this}OnEnd(t){return this._OnAnimationEnd=t,this.OnAnimationEnd=t,this}OnAdvance(t){return this._OnAnimAdvance=t,this.OnAnimAdvance=t,this}OnFinalProgress(t){return this._OnAnimFinal=t,this.OnAnimFinal=t,this}OnRepeat(t){return this._OnAnimRepeat=t,this.OnAnimRepeat=t,this}AddInherit(t){if(t){if(0===this._InheritListener.length){const t=this;this.OnAnimationStart=function(){t._OnAnimationStart&&t._OnAnimationStart();for(let e=0;e<t._InheritListener.length;e++)t._InheritListener[e].OnAnimationStart&&t._InheritListener[e].OnAnimationStart()},this.OnAnimationEnd=function(e){t._OnAnimationEnd&&t._OnAnimationEnd(e);for(let i=0;i<t._InheritListener.length;i++)t._InheritListener[i].OnAnimationEnd&&t._InheritListener[i].OnAnimationEnd(e)},this.OnViewNoVisible=function(){t._OnViewNoVisible&&t._OnViewNoVisible();for(let e=0;e<t._InheritListener.length;e++)t._InheritListener[e].OnViewNoVisible&&t._InheritListener[e].OnViewNoVisible()},this.OnAnimFinal=function(e){t._OnAnimFinal&&t._OnAnimFinal(e);for(let i=0;i<t._InheritListener.length;i++)t._InheritListener[i].OnAnimFinal&&t._InheritListener[i].OnAnimFinal(e)},this.OnAnimRepeat=function(){t._OnAnimRepeat&&t._OnAnimRepeat();for(let e=0;e<t._InheritListener.length;e++)t._InheritListener[e].OnAnimRepeat&&t._InheritListener[e].OnAnimRepeat()},this.OnAnimAdvance=function(){t._OnAnimAdvance&&t._OnAnimAdvance();for(let e=0;e<t._InheritListener.length;e++)t._InheritListener[e].OnAnimAdvance&&t._InheritListener[e].OnAnimAdvance()}}this._InheritListener.push(t)}}}_.AnimationListener=At;class Pt{constructor(t){this._SS=t}insertRule(t){window.jsvInAndroidWebView&&(t=(t=t.replace(/@keyframes/,"@-webkit-keyframes")).replace(/transform/g,"-webkit-transform"));const e=this._SS.cssRules.length;this._SS.insertRule(t,e)}removeRule(t){this.removeMultiRules([t])}hasRule(t){const e=this._SS.cssRules;for(let i=e.length-1;i>=0;i--)if(e[i].name===t)return!0;return!1}removeMultiRules(t){const e=this._SS,i=this._SS.cssRules;for(let n=i.length-1;n>=0;n--)for(const s in t)if(i[n].name===t[s]){t.splice(s,1),e.deleteRule(n);break}}}let Lt=null;function Rt(){return null===Lt&&(Lt=function(t){let e=null;const i=document.styleSheets;if(!i||0===i.length)return console.error("Error: styleSheet empty"),null;if(t){for(let n=0;n<i.length;++n){const s=i[n];if(s.cssRules[0]&&s.cssRules[0].name&&s.cssRules[0].name===t){e=s;break}}if(null===e)return console.error(`Error: no found tag=${t}`),null}else e=i[i.length-1];return new Pt(e)}()),Lt}function kt(t){let e="linear";if(t&&void 0!==t.T)switch(t.T){case _.EasingTypeIn:e="ease-in";break;case _.EasingTypeOut:e="ease-out";break;case _.EasingTypeInOut:e="ease-in-out";break;case _.EasingTypeBezier:e=`cubic-bezier(${t.St.X1},${t.St.Y1},${t.St.X2},${t.St.Y2})`;break;case _.EasingTypeSteps:e=`steps(${t.St.S},${0===t.St.T?"start":"end"})`;case _.EasingTypeBlink:case _.EasingTypeDeceleration:}return e}function Dt(t,e){const i=-1===t.repeatTimes?"infinite":t.repeatTimes;let n="linear";t.easing&&(n=kt(t.easing));return`${e} ${t.duration/1e3}s ${n} ${t.delayedTime/1e3}s ${i}`}const Vt=(t,e,i)=>{t.hasOwnProperty("__jsvHookListeners")||(t.__jsvHookListeners=new Map);const n=t.__jsvHookListeners;n.has(e)&&n.forEach((i=>{t.removeEventListener(e,i),t.__jsvHookListeners.delete(e)})),t.addEventListener(e,i),t.__jsvHookListeners.set(e,i)},Ot=t=>t>=65&&t<=90||t>=97&&t<=122,Mt=t=>t>=48&&t<=57,Ft=t=>{if(!t)return null;let e="",i="",n=[],s=0;for(let r=0;r<t.length;r++){const a=t.charCodeAt(r);if(0===s?(Ot(a)||Mt(a))&&(e+=t[r]):(Mt(a)||46===a||45===a||101===a)&&(i+=t[r]),40===a)s=1,i="",n=[];else{if(41===a)return n.push(parseFloat(i)),{name:e,params:n};44===a&&(n.push(parseFloat(i)),i="")}}return console.error("transform error",t),null};function Gt(t){const e=t.Element.children;let i=null;for(let t=0;t<e.length;t++)if("_AnimateProgressTracer"===e[t].id){i=e[t];break}return null===i&&(i=window.originDocument.createElement("div"),i.id="_AnimateProgressTracer",t.Element.appendChild(i)),i}let Nt=0;class Bt{constructor(t){this._TracerDiv=Gt(t),this._IdToken=Nt++,this._KeyFrameName=null,this._AdvanceTimer=null,this._AdvanceListener=null,this._TracerDiv.hasOwnProperty("_ForgeProgressToken")||(this._TracerDiv._ForgeProgressToken=0),this._OnEndListener=t=>{t.stopPropagation()},Vt(this._TracerDiv,"animationend",this._OnEndListener)}_ClearAdvanceTimer(){null!==this._AdvanceTimer&&(clearInterval(this._AdvanceTimer),this._AdvanceTimer=null)}_NotifyAdvance(){this._ClearAdvanceTimer(),null!==this._AdvanceListener&&(this._AdvanceTimer=setInterval((()=>{const t=this.GetProgress();this._AdvanceListener(t),1===t&&this._ClearAdvanceTimer()}),100))}Start(t,e,i){this._AdvanceListener=i,this._KeyFrameName&&console.error("Error: Asset!! should Stop before start"),this._TracerDiv._ForgeProgressToken=(this._TracerDiv._ForgeProgressToken+1)%2,this._KeyFrameName=this._BuildTraceKeyFrame(e,this._IdToken,this._TracerDiv._ForgeProgressToken),this._TracerDiv.style.animation=Dt(t,this._KeyFrameName),Vt(this._TracerDiv,"animationend",this._OnEndListener),this._NotifyAdvance()}Stop(){const t=this.GetProgress();return this._TracerDiv.style.animation=null,this._KeyFrameName&&(this._RemoveTraceKeyFrame(this._KeyFrameName),this._KeyFrameName=null),this._AdvanceListener&&(this._ClearAdvanceTimer(),this._AdvanceListener(t),this._AdvanceListener=null),t}GetProgress(){const t=window.getComputedStyle(this._TracerDiv);if(0===t.transform.length);else if(t.transform.length>0&&"none"!==t.transform){const e=Ft(t.transform);return null!==e?e.params[4]/1e3:(console.error("Error:internal error"),0)}return 1}_BuildTraceKeyFrame(t,e,i){const n=`_AnimateProgress_${e}_${i}`,s=Rt(),r=`@keyframes ${n}\n {0%{transform:translate3d(${Math.floor(1e3*t)}px,0,0)}\n 100%{transform:translate3d(1000px,0,0)}}`;return s.insertRule(r),n}_RemoveTraceKeyFrame(t){Rt().removeRule(t)}}class Wt{constructor(t,e){this._TracerDiv=Gt(t),this._IdToken=Nt++,this._KeyFrameNameArray=null,this._StepsTotal=e,this._RunAnimList=null,this._TracerDiv.hasOwnProperty("_ForgeProgressToken")||(this._TracerDiv._ForgeProgressToken=0),this._OnEndListener=t=>{t.stopPropagation()},this._TracerDiv.addEventListener("animationend",this._OnEndListener)}Start(t){this._KeyFrameName&&console.error("Error: Asset!! should Stop before start"),this._TracerDiv._ForgeProgressToken=(this._TracerDiv._ForgeProgressToken+1)%2,this._BuildTraceKeyFrameGroup(this._IdToken,this._TracerDiv._ForgeProgressToken),this._RunAnimList=this._ConvertToAnimationStyle(t),this._TracerDiv.style.animation=this._RunAnimList[0]}TriggerNextStep(t){this._TracerDiv.style.animation=this._RunAnimList[t]}Stop(){const t=this.GetProgress();return this._TracerDiv.style.animation=null,null!==this._KeyFrameNameArray&&(this._RemoveTraceKeyFrameGroup(),this._KeyFrameNameArray=null),t}GetProgress(){const t=window.getComputedStyle(this._TracerDiv);if(0===t.transform.length);else if("none"!==t.transform){const e=Ft(t.transform);if(null!==e){return e.params[4]/(100*this._StepsTotal)}return console.error("Error:internal error"),0}return 1}_BuildTraceKeyFrameGroup(t,e){this._KeyFrameNameArray=new Array(this._StepsTotal);const i=Rt();for(let n=0;n<this._KeyFrameNameArray.length;n++){const s=`_AnimateGroupProgress_${t}_${e}_Cnt_${n===this._KeyFrameNameArray.length-1?"finalStep":`${n}`}`,r=`@keyframes ${s}\n {0%{transform:translate3d(${100*n}px,0,0)}\n 100%{transform:translate3d(${100+100*n}px,0,0)}}`;i.insertRule(r),this._KeyFrameNameArray[n]=s}}_RemoveTraceKeyFrameGroup(){const t=Rt();this._KeyFrameNameArray.forEach((e=>{t.removeRule(e)}))}_ConvertToAnimationStyle(t){const e=[];for(let i=0;i<t.length;i++){let n="linear";const s=t[i];s.easing&&(n=kt(s.easing)),e.push(`${this._KeyFrameNameArray[i]} ${s.duration/1e3}s ${n}`)}return e}}let Ht=0;_.AnimationDelegate=class extends _.AnimationBase{constructor(t,e,i){super();let n=null;i&&(n=i.Package()),this.typeName=t,this.duration=e,this.easing=n,this.repeatTimes=1,this.delayedTime=0,this.enableFlags=0,this.enableStartPos=0,this._Progress=null}EnableDelay(t){return this.delayedTime=t,this}SetStartPos(t){this.enableStartPos=t}EnableInfinite(){return this.repeatTimes=-1,this}SetRepeat(t){return this.repeatTimes=t,this}Enable(t){return this._EnableFlagsInner(t),this}OnNewListener(t){let e=0;t.OnAnimFinal&&(e|=_.AnimationEnable.AckFinalProgress),t.OnAnimRepeat&&(e|=_.AnimationEnable.AckRepeat),0!==e&&this._EnableFlagsInner(e)}_EnableFlagsInner(t){-1!==this.enableFlags?this.enableFlags|=t:this.enableFlags=t}_GetCSSKeyframesRule(t){let e=null;const i=document.styleSheets;for(let n=0;n<i.length;++n)if(i[n]&&i[n].cssRules){for(const s in i[n].cssRules)if(i[n].cssRules[s].name===t){e=i[n].cssRules[s];break}if(e)break}return e}CheckCssAnimationFormat(t){const e=this._GetCSSKeyframesRule(t);if(e&&e.cssRules)for(const i in e.cssRules){if(!e.cssRules[i]||!e.cssRules[i].style)continue;if(!e.cssRules[i].style.opacity&&!e.cssRules[i].style.transform)continue;const n=e.cssRules[i].style.transform;n&&(-1!==n.indexOf("rotate(")?console.error(`@keyframe ${t}, only support rotate3d, current transform:${n}`):-1!==n.indexOf("translate(")?console.error(`@keyframe ${t}, only support translate3d, current transform:${n}`):-1!==n.indexOf("scale(")&&console.error(`@keyframe ${t}, only support scale3d, current transform:${n}`))}}},_.KeyFrameAnimation=class extends _.AnimationDelegate{constructor(t,e,i){super(t,e,i),this._KeyFrameNameToRecycle=null,this._TestRepeat=this._TestRepeat.bind(this),this._LatestProgressValue=0;const n=this;this._OnEndEvent=t=>{t.stopPropagation(),n._PerformAnimationEnd(!0)},this._CurrentEndEventFunc=null}Start(t){super.Start(t),t.ResetCssTransform(null,null),t.Element&&(t.Element.style.pointerEvents="auto"),this.enableStartPos>0?this._EnableStarterAnimation():this._EnableCssAnimation(this._BuildKeyFrame(),this._OnEndEvent,0)}Cancel(){super.Cancel(),this._PerformAnimationEnd(!1)}_EnableStarterAnimation(){let t=this._OnEndEvent;if(1!==this.repeatTimes){const e=this;t=t=>{t.stopPropagation(),null!==e._Progress&&e._Progress.Stop(),e.delayedTime=0,e.repeatTimes>0&&(e.repeatTimes-=1),this.OnRepeatEvent(),e._EnableCssAnimation(e._BuildKeyFrame(),e._OnEndEvent,0)}}const e=this.repeatTimes,i=this.duration;this.repeatTimes=1,this.duration*=1-this.enableStartPos,this._EnableCssAnimation(this._BuildStarterKeyFrame(),t,this.enableStartPos),this.repeatTimes=e,this.duration=i}_CreateAnimation(t){const e=Rt();e.removeRule(t.name),e.insertRule(t.keyFrameString)}_EnableCssAnimation(t,e,i){if(null===t)return;t.tmp?null!==t.keyFrameString&&(Rt().insertRule(t.keyFrameString),this._KeyFrameNameToRecycle=t.name):this._CreateAnimation(t);const n=t.name;this.CheckCssAnimationFormat(n);const s=this._LayoutViewRef.Element;0==(this.enableFlags&_.AnimationEnable.AckFinalProgress)&&0==(this.enableFlags&_.AnimationEnable.KeepTransform)&&0==(this.enableFlags&_.AnimationEnable.AckRepeat)||(this._Progress=new Bt(this._LayoutViewRef),this._Progress.Start(this,i,(t=>{this.OnAnimAdvance(t)})),0!=(this.enableFlags&_.AnimationEnable.AckRepeat)&&(this._LatestProgressValue=0,_.sRenderBridge.RegisterPerFrameCallback(this._TestRepeat)));const r=Dt(this,n);window.jsvInAndroidWebView?(s.style.webkitAnimation=r,s.addEventListener("webkitAnimationEnd",e)):(s.style.animation=r,s.addEventListener("animationend",e)),this._CurrentEndEventFunc=e}_PerformAnimationEnd(t){if(null!==this._CurrentEndEventFunc){const t=this._LayoutViewRef.Element,e=this._CurrentEndEventFunc;setTimeout((()=>{window.jsvInAndroidWebView?t.removeEventListener("webkitAnimationEnd",e):t.removeEventListener("animationend",e)}),0),this._CurrentEndEventFunc=null}if(null===this._Progress)return void(t&&this.OnEnd());0!=(this.enableFlags&_.AnimationEnable.AckRepeat)&&_.sRenderBridge.UnregisterPerFrameCallback(this._TestRepeat);let e=this._Progress.Stop();if(t&&(e=1),0!=(this.enableFlags&_.AnimationEnable.KeepTransform)){const t=this._GetFrozenTransform(e);this._LayoutViewRef.ResetCssTransform(t.transform,t.transformOrigin)}t&&this.OnEnd(),0!=(this.enableFlags&_.AnimationEnable.AckFinalProgress)&&window.setTimeout((()=>{this.OnFinalProgress(e)}),0),null!==this._KeyFrameNameToRecycle&&(Rt().removeRule(this._KeyFrameNameToRecycle),this._KeyFrameNameToRecycle=null)}_TestRepeat(){const t=this._Progress.GetProgress();this._LatestProgressValue>t&&this.OnRepeatEvent(),this._LatestProgressValue=t}_BuildStarterKeyFrame(){console.warn("Warning:Should override and return keyframe name")}_BuildKeyFrame(){console.warn("Warning:Should override and return keyframe name")}_GetFrozenTransform(t){console.warn("Warning:Should override and keep view transform by ResetCssTransform()")}};let Yt=class extends _.KeyFrameAnimation{constructor(t,e,i,n,s,r){super("TL",s,r),this.startX=t,this.startY=i,this.endX=e,this.endY=n}_BuildStarterKeyFrame(){if(this.enableStartPos>0){const t=(this.endX-this.startX)*this.enableStartPos+this.startX,e=(this.endY-this.startY)*this.enableStartPos+this.startY,i="_ForgeAnim_TL_"+Ht++;return{name:i,keyFrameString:`@keyframes ${i} {0%{transform:translate3d(${t}px,${e}px,0);}100%{transform:translate3d(${this.endX}px,${this.endY}px,0);}}`}}console.error("Error: no enabled starter position")}_BuildKeyFrame(){const t="_ForgeAnim_TL_"+Ht++;return{name:t,keyFrameString:`@keyframes ${t} {0%{transform:translate3d(${this.startX}px,${this.startY}px,0);}100%{transform:translate3d(${this.endX}px,${this.endY}px,0);}}`,tmp:!0}}_GetFrozenTransform(t){return{transform:`translate3d(${Math.floor((this.endX-this.startX)*t+this.startX)}px,${Math.floor((this.endY-this.startY)*t+this.startY)}px,0)`,transformOrigin:null}}};_.FuncAnimation=class extends _.AnimationDelegate{constructor(t,e,i){super("FC2",e,i),this.formula=t,console.warn("NO implemented")}},_.TranslateAnimation=Yt;let $t=class extends _.AnimationDelegate{constructor(t,e,i,n,s,r){super("RO",s,r),i instanceof _.Vec3||(i=new _.Vec3(i)),n instanceof _.Vec3||(n=new _.Vec3(n)),this.startAngle=t,this.offsetAngle=e,this.anchorVec3=i,this.axisVec3=n,console.warn("NO implemented")}};_.RotateAnimation=$t,_.BasicScaleAnimation=class extends _.AnimationDelegate{constructor(t,e,i,n,s,r,a,o,l,h){super("SC",a,o),console.warn("NO implemented")}};let Ut=class extends _.BasicScaleAnimation{constructor(t,e,i,n,s,r){const a=200;super(t*a,t*a,e*a,e*a,i,n,s,r,200,200)}};_.ScaleAnimation=Ut,_.OpacityAnimation=class extends _.AnimationDelegate{constructor(t,e,i,n){super("OP",i,n),console.warn("NO implemented")}},_.CssKeyframeAnimation=class extends _.KeyFrameAnimation{constructor(t,e,i,n,s){super("CK",e,i),this._keyFramesSet=t}_BuildKeyFrame(){let t=this._keyFramesSet.replaceAll("\n","");if(t.indexOf("@keyframes")<0&&t.indexOf("@-webkit-keyframes")<0)return console.warn("Warning:keyframes array empty"),null;let e=t.split(" ")[1];e.indexOf("{")>=0&&(e=e.substr(0,e.indexOf("{"))),t=t.replaceAll(/([left|top|width|height]:\s+\d+)/g,"$1px");const i=t.split("translate3d");for(let t=1;t<i.length;t++){let e=!1,n=i[t].replace(/\).*/,"");n=n.replace(/.*\(/,"");const s=n.split(",");for(let t=0;t<s.length;t++){const i=s[t].trim();i.match(/[0-9]$/)&&(s[t]=i+"px",e=!0)}e&&(n=s.join(","),i[t]=i[t].replace(/\(.*?\)/,"("+n+")"))}return{name:e,keyFrameString:i.join("translate3d"),tmp:!1}}_GetLastKeyframeTransform(t){let e=t.indexOf("to");if(e<0&&(e=t.indexOf("100%")),e<0)return"";{let i=t.indexOf("transform:",e);return i<0?"":t.substring(i+10,t.indexOf(";",i))}}_GetFrozenTransform(t){let e={transform:"",transformOrigin:null};return 1===t?e={transform:this._GetLastKeyframeTransform(this._keyFramesSet),transformOrigin:null}:console.warn("CssKeyframeAnimation can not get transform whill progress is not 1"),e}},_.CssTransitionAnimation=class extends _.AnimationDelegate{constructor(t){super("CT",null,null),this._transArray=t}Start(t){super.Start(t);const e=this,i=this._transArray,n={};if(0===i.length)return void console.warn("Warning:transition empty");let s="";for(let t=0;t<i.length;t++){let e="linear";const r=i[t];r.tf&&(e=kt(r.tf)),s=`${r.name} ${r.dur/1e3}s ${e} ${r.dly/1e3}s`,n[r.name]=s}t.ApplyStyleTransition(n),s&&(t.Element.addEventListener("transitionend",(t=>{t.stopPropagation(),e.OnEnd(!0)})),t.Element.addEventListener("webkitTransitionEnd",(t=>{t.stopPropagation(),e.OnEnd(!0)})))}},_.KeyFrameGroupAnimation=class extends _.AnimationDelegate{constructor(t){super(t,0,null),this._KeyFrameArray=null,this._LatestProgressValue=0,this._CurrentEndEventFunc=null,this._Progress=null,this._AnimRunList=null,this._AnimationRunIndex=0;const e=this;this._OnEndEvent=t=>{t.stopPropagation(),this._TestFinalKeyFrame(t)?e._PerformAnimationEnd(!0):(this._AnimationRunIndex++,this._LayoutViewRef.Element.style.animation=this._AnimRunList[this._AnimationRunIndex],this._Progress.TriggerNextStep(this._AnimationRunIndex),e._OnSubKeyFrameDone(t))}}Start(t){super.Start(t),t.ResetCssTransform(null,null),t.Element&&(t.Element.style.pointerEvents="auto"),this._EnableCssAnimation(this._BuildKeyFrameGroup(),this._OnEndEvent)}Cancel(){super.Cancel(),this._PerformAnimationEnd(!1)}_EnableCssAnimation(t,e){if(null===t)return;this._KeyFrameArray=new Array(t.length);const i=Rt();for(let e=0;e<t.length;e++){const n=t[e];this.CheckCssAnimationFormat(n.name),this._KeyFrameArray[e]={name:n.name,easing:n.ease.Package(),duration:n.duration,needRecycle:!1},null!==n.keyFrameString&&(i.insertRule(n.keyFrameString),this._KeyFrameArray.needRecycle=!0)}const n=this._LayoutViewRef.Element;0==(this.enableFlags&_.AnimationEnable.AckFinalProgress)&&0==(this.enableFlags&_.AnimationEnable.KeepTransform)||(this._Progress=new Wt(this._LayoutViewRef,this._KeyFrameArray.length),this._Progress.Start(this._KeyFrameArray)),this._AnimRunList=this._ConvertToAnimationStyle(this._KeyFrameArray),this._AnimationRunIndex=0,window.jsvInAndroidWebView?(n.style.webkitAnimation=this._AnimRunList[0],n.addEventListener("webkitAnimationEnd",e)):(n.style.animation=this._AnimRunList[0],n.addEventListener("animationend",e)),this._CurrentEndEventFunc=e}_PerformAnimationEnd(t){if(null!==this._CurrentEndEventFunc){const t=this._LayoutViewRef.Element,e=this._CurrentEndEventFunc;setTimeout((()=>{window.jsvInAndroidWebView?t.removeEventListener("webkitAnimationEnd",e):t.removeEventListener("animationend",e)}),0),this._CurrentEndEventFunc=null}if(null===this._Progress)return void(t&&this.OnEnd());let e=this._Progress.Stop();if(t&&(e=1),0!=(this.enableFlags&_.AnimationEnable.KeepTransform)){const t=this._GetFrozenTransform(e);this._LayoutViewRef.ResetCssTransform(t.transform,t.transformOrigin)}t&&this.OnEnd(),0!=(this.enableFlags&_.AnimationEnable.AckFinalProgress)&&window.setTimeout((()=>{this.OnFinalProgress(e)}),0);const i=Rt();for(const t of this._KeyFrameArray)t.needRecycle&&i.removeRule(t.name);this._KeyFrameArray=null}_ConvertToAnimationStyle(t){const e=[];for(let i=0;i<t.length;i++){let n="linear";const s=t[i];s.easing&&(n=kt(s.easing)),e.push(`${s.name} ${s.duration/1e3}s ${n}`)}return e}_BuildKeyFrameGroup(){console.warn("Warning:Should override and return keyframe name")}_GetFrozenTransform(t){console.warn("Warning:Should override and keep view transform by ResetCssTransform()")}_TestFinalKeyFrame(t){console.warn("Warning:Should override")}_OnSubKeyFrameDone(t){console.warn("Warning:Should override")}};let jt=class extends _.TranslateAnimation{constructor(t,e,i,n,s,r){let a=s,o=r,l=s,h=r;n?(a=t,l=e):(o=t,h=e);super(a,l,o,h,Math.abs(Math.floor((e-t)/i*1e3)),null)}};_.TranslateFrameAnimation=jt;let zt=class extends _.KeyFrameGroupAnimation{constructor(t,e,i,n,s,r,a,o){super("Thr"),this._FromX=t,this._FromY=e,this._XorY=i,this._InitV=n,this._Acc=s,this._To=r,this._HasPole=a,this._PoleCallback=null,this._PolePosition=o,this._IsPositiveMove=this._InitV>0||0===this._InitV&&this._Acc>0}SetPoleCallback(t){this._PoleCallback=t}_MakeTranslateString(t,e,i){return`@keyframes ${t} {0%{transform:translate3d(${e.x.value}px,${e.y.value}px,0);}100%{transform:translate3d(${i.x.value}px,${i.y.value}px,0);}}`}_BuildKeyFrameGroup(){const t=""+Ht++,e=[],i={x:{value:this._FromX},y:{value:this._FromY}},n={x:{value:this._FromX},y:{value:this._FromY}},s=0===this._XorY?i.x:i.y,r=0===this._XorY?n.x:n.y;if(this._HasPole){let a=`_ForgeAnim_Thr_Forw_${t}`;r.value=this._PolePosition;let o=this._MakeTranslateString(a,i,n);e.push({name:a,keyFrameString:o,ease:_.Easing.Circular.Out,duration:Math.floor(-this._InitV/this._Acc*1e3)}),a=`_ForgeAnim_Thr_Backw_${t}`,s.value=this._PolePosition,r.value=this._To,o=this._MakeTranslateString(a,i,n),e.push({name:a,keyFrameString:o,ease:_.Easing.Circular.In,duration:Math.floor(1e3*Math.sqrt(2*(this._To-this._PolePosition)/this._Acc))})}else{const a=`_ForgeAnim_Thr_Forw_${t}`;r.value=this._To;const o=this._MakeTranslateString(a,i,n),l=this._IsPositiveMove?this._InitV:-this._InitV,h=this._IsPositiveMove?this._Acc:-this._Acc,c=this._IsPositiveMove?r.value-s.value:s.value-r.value;e.push({name:a,keyFrameString:o,ease:h>0?_.Easing.Circular.In:_.Easing.Circular.Out,duration:Math.floor((Math.sqrt(l*l+2*h*c)-l)/h*1e3)})}return e}_GetFrozenTransform(t){const e={x:{value:this._FromX},y:{value:this._FromY}};let i=0===this._XorY?e.x.value:e.y.value;const n=0===this._XorY?e.x:e.y;let s=0;i=this._IsPositiveMove?i:-i;const r=this._IsPositiveMove?this._To:-this._To,a=this._IsPositiveMove?this._PolePosition:-this._PolePosition;if(this._HasPole){const e=(2*a-i-r)*t;s=e>a-i?a-(e-(a-i)):i+e}else s=i+(r-i)*t;n.value=Math.floor(this._IsPositiveMove?s:-s);return{transform:`translate3d(${e.x.value}px,${e.y.value}px,0)`,transformOrigin:null}}_TestFinalKeyFrame(t){return this._HasPole?t.animationName.indexOf("_ForgeAnim_Thr_Backw_")>=0:t.animationName.indexOf("_ForgeAnim_Thr_Forw_")>=0}_OnSubKeyFrameDone(t){this._HasPole&&this._PoleCallback&&this._PoleCallback()}};_.ThrowAnimation=zt;let Xt={ReleaseAfterEndCallback:1,KeepTransform:2,AckFinalProgress:4,AckRepeat:8};_.AnimationEnable=Xt,_.AnimFireCommand={AltSpeed:(t,e,i)=>{}};let Kt=0;class Jt extends _.AnimationDelegate{constructor(t,e){super(t,e,null),this._StepsCount=1,this._Running=!1,this._NextStepIndex=0;const i=this;this._OnStepEnd=()=>{i._NextStep()}}SetStepsCount(t){this._StepsCount=t,this._SplitSteps()}Start(t){super.Start(t),window.jsvInAndroidWebView?this._LayoutViewRef.Element.addEventListener("webkitAnimationEnd",this._OnStepEnd):this._LayoutViewRef.Element.addEventListener("animationend",this._OnStepEnd),this._Running=!0,this._NextStep()}Cancel(){this._Running=!1}_NextStep(){null!==this._KeyFrameName&&(Rt().removeRule(this._KeyFrameName),this._KeyFrameName=null);const t=this._NextStepIndex===this._StepsCount;if(!this._Running||t)return void this._PerformAnimationEnd(t);const e=this._CreateOneStepKeyFrame(this._NextStepIndex);this._KeyFrameName=e.name,Rt().insertRule(e.keyFrameString);const i=Dt({repeatTimes:this.repeatTimes,easing:this.easing,delayedTime:0,duration:this.duration/this._StepsCount},this._KeyFrameName),n=this._LayoutViewRef.Element;window.jsvInAndroidWebView?n.style.webkitAnimation=i:n.style.animation=i,this._NextStepIndex++}_PerformAnimationEnd(t){window.jsvInAndroidWebView?this._LayoutViewRef.Element.removeEventListener("webkitAnimationEnd",this._OnStepEnd):this._LayoutViewRef.Element.removeEventListener("animationend",this._OnStepEnd);const e=this._NextStepIndex/this._StepsCount;if(0!=(this.enableFlags&_.AnimationEnable.KeepTransform)){const t=this._GetFrozenTransform(this._NextStepIndex-1);this._LayoutViewRef.ResetCssTransform(t.transform,t.transformOrigin)}t&&this.OnEnd(),window.setTimeout((()=>{this.OnFinalProgress(e)}),0)}_GetFrozenTransform(t){console.warn("Warning:Should override and keep view transform by ResetCssTransform()")}_SplitSteps(){console.warn("Warning: should be override by child class")}_CreateOneStepKeyFrame(t){console.warn("Warning: should be override by child class")}}_.TranslateStepAnimation=class extends Jt{constructor(t,e,i,n,s){super("TL-S",s),this.startX=t,this.startY=i,this.endX=e,this.endY=n,this._StepsArray=null}_SplitSteps(){const t=this._StepsCount,e=(this.endX-this.startX)/t,i=(this.endY-this.startY)/t;this._StepsArray=new Array(t);let n=this.startX,s=this.startY;for(let r=0;r<t-1;r++)n+=e,s+=i,this._StepsArray[r]={targetX:Math.floor(n),targetY:Math.floor(s)};this._StepsArray[t-1]={targetX:this.endX,targetY:this.endY}}_CreateOneStepKeyFrame(t){let e=0,i=0;0===t?(e=this.startX,i=this.startY):(e=this._StepsArray[t-1].targetX,i=this._StepsArray[t-1].targetY);const n=this._StepsArray[t].targetX,s=this._StepsArray[t].targetY,r="_ForgeStepAnim_TL_"+Kt++;return{name:r,keyFrameString:`@keyframes ${r} {\n 0%{transform:translate3d(${e}px,${i}px,0);}\n 100%{transform:translate3d(${n}px,${s}px,0);}}`}}_GetFrozenTransform(t){return{transform:`translate3d(${this._StepsArray[t].targetX}px,${this._StepsArray[t].targetY}px,0)`,transformOrigin:null}}};_.RenderBridge=class{constructor(){this._ScreenInfo={width:160,height:90,x:2/160,y:2/90,perspective:2/160,scaleRatio:1,designedWidth:1280},this._FrameLoopFunc=null,this._CallbacksPerFrame=new Set,this._WillSwapCallbacks=new Map,this._DoWillSwapCallback=this._OnWillSwap.bind(this),this._AfterSwapCallbacks=new Map,this._DoAfterSwapCallback=this._OnAfterSwap.bind(this)}BeginHtmlFrameLoop(){null===this._FrameLoopFunc&&window.requestAnimationFrame&&(this._FrameLoopFunc=this._OnAnimation.bind(this),window.requestAnimationFrame(this._FrameLoopFunc))}_OnAnimation(){let t=!1;if(_.sViewSensorManager.HtmlHasActiveSensor()&&(_.sViewSensorManager.HtmlDoWorkOnFrame(),_.sViewSensorManager.HtmlHasActiveSensor()&&(t=!0)),this._CallbacksPerFrame.size>0){for(const t of this._CallbacksPerFrame)t();this._CallbacksPerFrame.size>0&&(t=!0)}t?window.requestAnimationFrame(this._FrameLoopFunc):this._FrameLoopFunc=null}GetScreenInfo(){return this._ScreenInfo}InitScreenBuffer(t,e){isNaN(t)&&(t=1),isNaN(e)&&(e=1280);const i=e*t,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=t,this._ScreenInfo.designedWidth=e}RequestSwap(){this._OnRequesting||(this._OnRequesting=!0,Promise.resolve().then((()=>{Promise.resolve().then((()=>{Promise.resolve().then((()=>{Promise.resolve().then((()=>{Promise.resolve().then(this._DoRequestSwap.bind(this))}))}))}))})))}SetGlobalConfig(t){}AddWillSwapListener(t,e){this._WillSwapCallbacks.set(t,e)}AddAfterSwapListener(t,e){this._AfterSwapCallbacks.set(t,e)}_DoRequestSwap(){this._WillSwapCallbacks.size>0&&this._WillSwapCallbacks.forEach(this._DoWillSwapCallback),this._AfterSwapCallbacks.size>0&&this._AfterSwapCallbacks.forEach(this._DoAfterSwapCallback),this._OnRequesting=!1,_.sFrameCount.update()}GetSwapCount(){return _.sFrameCount.count}InstantPerformSwap(){this._OnRequesting&&(this._OnRequesting=!1,this._DoRequestSwap(!1))}_OnWillSwap(t){t()}_OnAfterSwap(t){t()}RegisterPerFrameCallback(t){this._CallbacksPerFrame.add(t),this.BeginHtmlFrameLoop()}UnregisterPerFrameCallback(t){this._CallbacksPerFrame.delete(t)}};let qt=new _.RenderBridge;_.sRenderBridge=qt;class Zt{constructor(t,e,i){this._TextureManager=t,this._GL=e,this._Loaded=!1,this._OnLoad=i,this.TextureId=null,this._TextureSource=null}_setGLTexture(){this.TextureId=this._GL.createTexture(),this._GL.activeTexture(this._GL.TEXTURE0),this._GL.bindTexture(this._GL.TEXTURE_2D,this.TextureId),this._GL.texParameteri(this._GL.TEXTURE_2D,this._GL.TEXTURE_WRAP_S,this._GL.CLAMP_TO_EDGE),this._GL.texParameteri(this._GL.TEXTURE_2D,this._GL.TEXTURE_WRAP_T,this._GL.CLAMP_TO_EDGE),this._GL.texParameteri(this._GL.TEXTURE_2D,this._GL.TEXTURE_MIN_FILTER,this._GL.NEAREST),this._GL.texParameteri(this._GL.TEXTURE_2D,this._GL.TEXTURE_MAG_FILTER,this._GL.LINEAR),this._GL.texImage2D(this._GL.TEXTURE_2D,0,this._GL.RGBA,this._GL.RGBA,this._GL.UNSIGNED_BYTE,this._TextureSource)}loaded(){return this._Loaded}recycle(){this._TextureManager.recycle(this._TextureSource)}}Zt.IMAGE=Symbol("Texture.IMAGE"),Zt.COLOR=Symbol("Texture.COLOR");class Qt extends Zt{constructor(t,e,i,n){if(super(t,e,i),n){const t=n.trim();if(0===t.indexOf("http"))this.Url=t;else if(0===t.indexOf("url")){const e=t.indexOf("("),i=t.indexOf(")");this.Url=t.substring(e+1,i)}else this.Url=n;this._TextureSource=new Image,this._TextureSource.onload=()=>{this._setGLTexture(),this._Loaded=!0,this._OnLoad&&this._OnLoad()},this._TextureSource.src=this.Url}}}class te{constructor(){this._Canvas=window.originDocument.createElement("canvas"),this._Canvas.setAttribute("width","1px"),this._Canvas.setAttribute("height","1px"),this._Canvas.setAttribute("style","position: absolute; pointer-events: none;"),document.body.appendChild(this._Canvas),this._GL=this._Canvas.getContext("2d")}getColorImageData(t,e,i,n){const s=this._GL.createImageData(1,1);return s.data[0]=t,s.data[1]=e,s.data[2]=i,s.data[3]=n,s}}let ee=null;class ie extends Zt{constructor(t,e,i,n){super(t,e,i),null===ee&&(ee=new te),this.Color=n;const s=(t=>{if(!t)return null;if(0===(t=t.trim()).indexOf("rgba")){const e=t.indexOf("("),i=t.indexOf(")");return t.substr(e+1,i-e-1).split(",").map(((t,e)=>3===e?Math.ceil(255*parseFloat(t)):parseInt(t,10)))}if(0===t.indexOf("#")){let e=t.substr(1);const i=e.length;if(6===i||8===i){6===i&&(e+="FF");const t=parseInt(`0x${e}`,10);return[t>>24&255,t>>16&255,t>>8&255,255&t]}return null}return null})(this.Color);this._TextureSource=ee.getColorImageData(...s),this._setGLTexture(),this._Loaded=!0,this._OnLoad&&this._OnLoad()}}const ne=new class{constructor(){this._TextureMap={}}getTexture(t,e,i,n){let s;if(this._TextureMap[n])s=this._TextureMap[n].texture,this._TextureMap[n].useCount++;else{switch(t){case Zt.IMAGE:s=new Qt(this,e,i,n);break;case Zt.COLOR:s=new ie(this,e,i,n);break;default:console.log(`getTexture type is error:${t}`)}this._TextureMap[n]={texture:s,useCount:1}}return s}recycle(t){this._TextureMap[t]&&(this._TextureMap[t].useCount--,this._TextureMap[t].useCount<0&&delete this._TextureMap[t])}},se=(t,e)=>Math.random()*(e-t)+t;class re{constructor(t,e,i,n,s){this._ViewId=t,this._Type=e.type,this._ParticleNum=e.particleNum,this._DeltaAngle=e.deltaAngle/180*Math.PI,this._DeltaWidthFact=e.deltaWidth/n.width,this._DeltaHeightFact=e.deltaHeight/n.height,this._PointSizeMin=e.pointSizeMin,this._PointSizeMax=e.pointSizeMax,this._SpeedMin=e.speedMin,this._SpeedMax=e.speedMax,this._LifeMin=e.lifeMin/1e3,this._LifeMax=e.lifeMax/1e3,this._AddNumSpeed=e.addNumSpeed,this._AcceletateX=e.accelerateX,this._AcceletateY=e.accelerateY,this._EnableFade=e.enableFade,this._EnableShrink=e.enableShrink,this._AngularVelocityMin=0,this._AngularVelocityMax=0,"number"==typeof e.angularVelocityMin&&"number"==typeof e.angularVelocityMax&&(this._AngularVelocityMin=e.angularVelocityMin,this._AngularVelocityMax=e.angularVelocityMax),this._AlphaMin=1,this._AlphaMax=1,"number"==typeof e.alphaMin&&"number"==typeof e.alphaMax&&(this._AlphaMin=e.alphaMin,this._AlphaMax=e.alphaMax),this._Texture=i,this._Buffer=new Float32Array(9*this._ParticleNum),this._AddedParticleNum=0,this._DomProxyView=s,this._StartTime=-1,this._LastFrameTime=-1,this._Stopped=!1,this._getTransform=this._getTransform.bind(this)}_getTransform(){let t=this._DomProxyView.HtmlGetElement();const e=le(t.style.width),i=le(t.style.height);let n=new window.WebKitCSSMatrix;for(;t.parentNode;){const e=getComputedStyle(t);if(e.transform){const i=e.transformOrigin?e.transformOrigin:e.webkitTransformOrigin;if(i){const s=le(i),r=new window.WebKitCSSMatrix(`translate(-${s[0]}px,-${s[1]}px)`),a=new window.WebKitCSSMatrix(`translate(${s[0]}px,${s[1]}px)`),o=new window.WebKitCSSMatrix(`translate(${t.offsetLeft}px,${t.offsetTop}px)`),l=new window.WebKitCSSMatrix(e.transform);n=o.multiply(a.multiply(l.multiply(r.multiply(n))))}else n=new window.WebKitCSSMatrix(e.transform).multiply(n)}t=t.parentNode}const s=new window.WebKitCSSMatrix;s.m11=0,s.m12=0,s.m14=1,s.m21=e,s.m22=0,s.m24=1,s.m31=0,s.m32=i,s.m34=1,s.m41=e,s.m42=i,s.m44=1,n=n.multiply(s);return[n.m11,n.m12,n.m21,n.m22,n.m31,n.m32,n.m41,n.m42]}_updateParticleInfo(t,e,i,n,s,r){const a=se(0,2*this._DeltaWidthFact),o=se(0,2*this._DeltaHeightFact);this._Buffer[9*t]=a*i[0]+o*n[0]+e[0],this._Buffer[9*t+1]=a*i[1]+o*n[1]+e[1],this._Buffer[9*t+2]=s+se(-this._DeltaAngle,this._DeltaAngle),this._Buffer[9*t+3]=se(this._SpeedMin,this._SpeedMax),this._Buffer[9*t+4]=r,this._Buffer[9*t+5]=se(this._LifeMin,this._LifeMax),this._Buffer[9*t+6]=se(this._PointSizeMin,this._PointSizeMax),this._Buffer[9*t+7]=se(this._AngularVelocityMin,this._AngularVelocityMax),this._Buffer[9*t+8]=se(this._AlphaMin,this._AlphaMax)}onDrawFrame(t,e,i){if(!this._DomProxyView||!this._DomProxyView.HtmlCanAccessElement())return;if(!this._Texture.loaded()||this._Stopped)return;this._StartTime<0&&(this._StartTime=Date.now()),this._LastFrameTime<0&&(this._LastFrameTime=this._StartTime);const n=this._getTransform();for(let t=0;t<n.length;t++)n[t]=t%2==0?2*n[t]/window.innerWidth-1:1-2*n[t]/window.innerHeight;const s=(Date.now()-this._StartTime)/1e3,r=[n[0],n[1]],a=[n[2]-n[0],n[3]-n[1]],o=[n[4]-n[0],n[5]-n[1]],l=Math.sqrt(a[0]*a[0]+a[1]*a[1]),h=-a[1]/l,c=a[0]/l>0?Math.acos(h):2*Math.PI-Math.acos(h);if(0===this._Type)if(this._AddedParticleNum<this._ParticleNum){for(let t=0;t<this._ParticleNum;t++)this._updateParticleInfo(t,r,a,o,c,s);this._AddedParticleNum=this._ParticleNum}else{let t=!0;for(let e=0;e<this._ParticleNum;e++)if(this._Buffer[9*e+4]+this._Buffer[9*e+5]>s){t=!1;break}t&&(this._Stopped=!0)}else if(this._AddedParticleNum<this._ParticleNum){let t=Math.round((Date.now()-this._LastFrameTime)*this._AddNumSpeed);this._AddedParticleNum+t>this._ParticleNum&&(t=this._ParticleNum-this._AddedParticleNum);for(let e=0;e<t;e++)this._updateParticleInfo(this._AddedParticleNum+e,r,a,o,c,s);this._AddedParticleNum+=t}else for(let t=0;t<this._ParticleNum;t++)this._Buffer[9*t+4]+this._Buffer[9*t+5]<s&&this._updateParticleInfo(t,r,a,o,c,s);const u=t.getUniformLocation(e,"uTime");t.uniform1f(u,s);const d=t.getUniformLocation(e,"uAccelerate");t.uniform2f(d,this._AcceletateX,this._AcceletateY);const g=t.getUniformLocation(e,"uEnableFade");t.uniform1i(g,this._EnableFade?1:0);const f=t.getUniformLocation(e,"uEnableShrink");t.uniform1i(f,this._EnableShrink?1:0),t.bindBuffer(t.ARRAY_BUFFER,i),t.activeTexture(t.TEXTURE0),t.bindTexture(t.TEXTURE_2D,this._Texture.TextureId),t.bufferSubData(t.ARRAY_BUFFER,0,this._Buffer);const m=this._Buffer.BYTES_PER_ELEMENT,p=t.getAttribLocation(e,"aPosition");t.vertexAttribPointer(p,2,t.FLOAT,!1,9*m,0),t.enableVertexAttribArray(p);const _=t.getAttribLocation(e,"aSpeed");t.vertexAttribPointer(_,2,t.FLOAT,!1,9*m,2*m),t.enableVertexAttribArray(_);const T=t.getAttribLocation(e,"aLife");t.vertexAttribPointer(T,2,t.FLOAT,!1,9*m,4*m),t.enableVertexAttribArray(T);const y=t.getAttribLocation(e,"aPointSize");t.vertexAttribPointer(y,1,t.FLOAT,!1,9*m,6*m),t.enableVertexAttribArray(y);const w=t.getAttribLocation(e,"aAngularVelocity");t.vertexAttribPointer(w,1,t.FLOAT,!1,9*m,7*m),t.enableVertexAttribArray(w);const S=t.getAttribLocation(e,"aAlpha");t.vertexAttribPointer(S,1,t.FLOAT,!1,9*m,8*m),t.enableVertexAttribArray(S),t.drawArrays(t.POINTS,0,this._AddedParticleNum)}recycle(){this._Buffer=null,this._Texture.recycle(),this._Stopped=!0}}let ae=0;let oe=new class{constructor(){this._Inited=!1,this._Canvas=null,this._GL=null,this._GLProgram=null,this._VBO=null,this._ParticleViewMap={},this._LoopStarted=!1,this._onDrawFrame=this._onDrawFrame.bind(this)}_initCanvas(){if(this._Canvas=window.originDocument.createElement("canvas"),this._Canvas.setAttribute("width",`${window.innerWidth}px`),this._Canvas.setAttribute("height",`${window.innerHeight}px`),this._Canvas.setAttribute("style","position: absolute; pointer-events: none;"),document.body.appendChild(this._Canvas),this._GL=this._Canvas.getContext("webgl"),!this._GL)return void console.error("init webgl failed");console.log("webgl info: ",this._GL.getParameter(this._GL.VERSION),this._GL.getParameter(this._GL.SHADING_LANGUAGE_VERSION),this._GL.getParameter(this._GL.VENDOR));const t=this._GL.createShader(this._GL.VERTEX_SHADER);this._GL.shaderSource(t,"attribute vec2 aPosition;attribute vec2 aSpeed;attribute vec2 aLife;attribute float aPointSize;attribute float aAngularVelocity;attribute float aAlpha;uniform float uTime;uniform vec2 uAccelerate;uniform bool uEnableFade;uniform bool uEnableShrink;varying float vAlpha;varying mat2 vTextureRotate;void main() { float use_time = (uTime - aLife.x) / 10.0; float x = aSpeed.y * cos(aSpeed.x) * use_time + 0.5 * uAccelerate.x * use_time * use_time; float y = aSpeed.y * sin(aSpeed.x) * use_time + 0.5 * uAccelerate.y * use_time * use_time; float percent = (uTime - aLife.x) / aLife.y; percent = percent > 1.0 ? 0.0 : cos(1.57 * percent); vAlpha = aAlpha * (uEnableFade ? percent : 1.0); float angular = aAngularVelocity * use_time; vTextureRotate = mat2(cos(angular), sin(angular), -sin(angular), cos(angular)); gl_PointSize = uEnableShrink ? aPointSize * percent : aPointSize; gl_Position = vec4(x + aPosition.x, y + aPosition.y, 0.0, 1.0);}"),this._GL.compileShader(t);const e=this._GL.createShader(this._GL.FRAGMENT_SHADER);this._GL.shaderSource(e,"precision mediump float;uniform sampler2D uTexture;varying float vAlpha;varying mat2 vTextureRotate;void main(void) { vec2 center = vec2(0.5, 0.5); vec2 rotateCoord = vTextureRotate * (gl_PointCoord - center) + center; vec4 texture = texture2D(uTexture, rotateCoord) * vAlpha; gl_FragColor = texture;}"),this._GL.compileShader(e),this._GLProgram=this._GL.createProgram(),this._GL.attachShader(this._GLProgram,t),this._GL.attachShader(this._GLProgram,e),this._GL.linkProgram(this._GLProgram);const i=new Float32Array(4500),n=i.BYTES_PER_ELEMENT;this._VBO=this._GL.createBuffer(),this._GL.bindBuffer(this._GL.ARRAY_BUFFER,this._VBO),this._GL.bufferData(this._GL.ARRAY_BUFFER,i,this._GL.DYNAMIC_DRAW);const s=this._GL.getAttribLocation(this._GLProgram,"aPosition");this._GL.vertexAttribPointer(s,2,this._GL.FLOAT,!1,9*n,0),this._GL.enableVertexAttribArray(s);const r=this._GL.getAttribLocation(this._GLProgram,"aSpeed");this._GL.vertexAttribPointer(r,2,this._GL.FLOAT,!1,9*n,2*n),this._GL.enableVertexAttribArray(r);const a=this._GL.getAttribLocation(this._GLProgram,"aLife");this._GL.vertexAttribPointer(a,2,this._GL.FLOAT,!1,9*n,4*n),this._GL.enableVertexAttribArray(a);const o=this._GL.getAttribLocation(this._GLProgram,"aPointSize");this._GL.vertexAttribPointer(o,1,this._GL.FLOAT,!1,9*n,6*n),this._GL.enableVertexAttribArray(o);const l=this._GL.getAttribLocation(this._GLProgram,"aAngularVelocity");this._GL.vertexAttribPointer(l,1,this._GL.FLOAT,!1,9*n,7*n),this._GL.enableVertexAttribArray(l);const h=this._GL.getAttribLocation(this._GLProgram,"aAlpha");this._GL.vertexAttribPointer(h,1,this._GL.FLOAT,!1,9*n,8*n),this._GL.enableVertexAttribArray(h),this._GL.useProgram(this._GLProgram);const c=this._GL.getUniformLocation(this._GLProgram,"uTexture");this._GL.uniform1i(c,0),this._GL.enable(this._GL.BLEND),this._GL.enable(this._GL.SAMPLE_ALPHA_TO_COVERAGE),this._GL.blendFunc(this._GL.ONE,this._GL.ONE_MINUS_SRC_ALPHA),this._Inited=!0}_onDrawFrame(){this._GL.clear(this._GL.COLOR_BUFFER_BIT),this._GL.useProgram(this._GLProgram);for(const t in this._ParticleViewMap)this._ParticleViewMap.hasOwnProperty(t)&&this._ParticleViewMap[t].onDrawFrame(this._GL,this._GLProgram,this._VBO);window.requestAnimationFrame(this._onDrawFrame)}addParticle(t,e,i,n){this._Inited||this._initCanvas();const s=ae++;let r;return r=0===e.indexOf("rgba")||0===e.indexOf("#")?ne.getTexture(Zt.COLOR,this._GL,null,e):ne.getTexture(Zt.IMAGE,this._GL,null,e),this._ParticleViewMap[s]=new re(s,t,r,i,n),this._LoopStarted||(this._LoopStarted=!0,window.requestAnimationFrame(this._onDrawFrame)),s}recycleView(t){this._ParticleViewMap[t]&&(this._ParticleViewMap[t].recycle(),delete this._ParticleViewMap[t])}};_.sParticleManager=oe;let le=t=>{if(t.indexOf(" ")>=0){return t.split(" ").map((t=>parseInt(t.substr(0,t.length-2),10)))}return parseInt(t.substr(0,t.length-2),10)};_.ReactUtils={StyleClassMap:{}};{let t=0;class e{constructor(e,i){this._ID=i||e+t++,this.Describe={},this._RefCount=0,this._Recycled=!1}ManualSetId(t){this._ID=t}GetId(){return this._ID}DoRef(){this._RefCount++}UnRef(){this._RefCount>0?this._RefCount--:console.warn("Already 0...")}}class i extends e{constructor(t){super(null,t)}}const n=new i("DISABLE"),s={alignment:"left",vertical_align:"top",vertical_area_align:"top",text_overflow:"clip",word_wrap:"normal",direction:"ltr"},r=["alignment","vertical_align","vertical_area_align","text_overflow","word_wrap","direction"];class a extends e{constructor(t,e,i,n,s,r){super("DS",null),this.Describe.alignment=t,this.Describe.vertical_align=e,this.Describe.vertical_area_align=i,this.Describe.text_overflow=n,this.Describe.word_wrap=s,this.Describe.direction=r}GetSyncData(){return{T:0,ID:this._ID,A:this.Describe.alignment,VA:this.Describe.vertical_align,VAA:this.Describe.vertical_area_align,TO:this.Describe.text_overflow,WW:this.Describe.word_wrap,DIR:this.Describe.direction}}}const o={font:"黑体",italic:!1,bold:!1},l=["font","italic","bold"];class h extends e{constructor(t,e,i){super("FS",null),this.Describe.font=t,this.Describe.italic=e,this.Describe.bold=i}GetSyncData(){return{T:1,ID:this._ID,F:this.Describe.font,I:this.Describe.italic,B:this.Describe.bold}}}const c={text_color:"#000000",bg_color:"#FFFFFF00"},u=["text_color","bg_color"];class d extends e{constructor(t,e){super("CS",null),this.Describe.text_color=t,this.Describe.bg_color=e}GetSyncData(){return{T:2,ID:this._ID,TC:this.Describe.text_color,BC:this.Describe.bg_color}}}const g=["shadow_offset_x","shadow_offset_y","shadow_blur","shadow_color","stroke_width","stroke_color"];class f extends e{constructor(t,e,i,n,s,r){super("SS",null),this.Describe.shadow_offset_x=t,this.Describe.shadow_offset_y=e,this.Describe.shadow_blur=i,this.Describe.shadow_color=n,this.Describe.stroke_width=s,this.Describe.stroke_color=r}GetSyncData(){return{T:3,ID:this._ID,OX:this.Describe.shadow_offset_x,OY:this.Describe.shadow_offset_y,B:this.Describe.shadow_blur,C:this.Describe.shadow_color,SW:this.Describe.stroke_width,SC:this.Describe.stroke_color}}}class m{constructor(t){this.DS=_.sTextStyleCache.GetDisplayStyle(t),this.FS=_.sTextStyleCache.GetFontStyle(t),this.CS=_.sTextStyleCache.GetColorStyle(t),this.SS=_.sTextStyleCache.GetSpecialStyle(t),this._IdsCache=null}DoRef(){this.DS.DoRef(),this.FS.DoRef(),this.CS.DoRef(),this.SS.DoRef()}UnRef(){this.DS.UnRef(),this.FS.UnRef(),this.CS.UnRef(),this.SS.UnRef()}GetIdsPack(){return this._IdsCache||(this._IdsCache={DS:this.DS.GetId(),FS:this.FS.GetId(),CS:this.CS.GetId(),SS:this.SS.GetId()}),this._IdsCache}}class p{constructor(){this._DisplayStyleMap=new Map,this._DisplayStyleIds=new Map,this._FontStyleMap=new Map,this._FontStyleIds=new Map,this._ColorStyleMap=new Map,this._ColorStyleIds=new Map,this._SpecialStyleMap=new Map,this._SpecialStyleIds=new Map,this._NewStyleList=[]}StyleToPack(t){let e={alignment:void 0!==t.hAlign?t.hAlign:s.alignment,vertical_align:void 0!==t.vAlign?t.vAlign:s.vertical_align,vertical_area_align:void 0!==t.vAreaAlign?t.vAreaAlign:s.vertical_area_align,text_overflow:void 0!==t.textOverflow?t.textOverflow:s.text_overflow,word_wrap:void 0!==t.wordWrap?t.wordWrap:s.word_wrap,font:void 0!==t.font?t.font:o.font,italic:void 0!==t.italic?t.italic:o.italic,bold:void 0!==t.bold?t.bold:o.bold,text_color:void 0!==t.textColor?t.textColor:c.text_color,bg_color:void 0!==t.backgroundColor?t.backgroundColor:c.bg_color,direction:void 0!==t.direction?t.direction:"ltr",shadow_offset_x:0,shadow_offset_y:0,shadow_blur:0,shadow_color:null,stroke_width:0,stroke_color:null};if(t.shadow){const i=t.shadow;e.shadow_offset_x=i.shadowOffsetX,e.shadow_offset_y=i.shadowOffsetY,e.shadow_blur=i.shadowBlur,e.shadow_color=i.shadowColor}if(t.stroke){const i=t.stroke;e.stroke_width=i.strokeWidth,e.stroke_color=i.strokeColor}return new m(e)}PrepareSyncNewStyles(){if(this._NewStyleList.length>0){let t=[];for(let e of this._NewStyleList)t.push(e.GetSyncData());_.sRenderTextureDelegateManager.CreateTextureHeadStatus().SetResourceInfo({STA:{Nam:"TST",Sta:t}}),this._NewStyleList=[]}}GetDisplayStyle(t){return this._GetStyle(t,r,a,this._DisplayStyleMap,this._DisplayStyleIds)}GetFontStyle(t){return this._GetStyle(t,l,h,this._FontStyleMap,this._FontStyleIds)}GetColorStyle(t){return this._GetStyle(t,u,d,this._ColorStyleMap,this._ColorStyleIds)}GetSpecialStyle(t){return 0===t.shadow_blur&&0===t.stroke_width?n:this._GetStyle(t,g,f,this._SpecialStyleMap,this._SpecialStyleIds)}GetDsFromId(t){return this._DisplayStyleIds.get(t)}GetFsFromId(t){return this._FontStyleIds.get(t)}GetCsFromId(t){return this._ColorStyleIds.get(t)}GetSsFromId(t){return this._SpecialStyleIds.get(t)}_GetStyle(t,e,i,n,s){let r=[];for(let i of e)r.push(t[i]);let a=r.join(":"),o=null;return n.has(a)?o=n.get(a):(o=new i(...r),n.set(a,o),s.set(o.GetId(),o),window.JsView&&this._NewStyleList.push(o)),o}}_.TextStyleObjectBase=e,_.TextStylePack=m,_.sTextStyleCache=new p}{let t=1,e=2,i=3;class n{constructor(i,n){this.IdToken=_.sViewSensorManager.IdTokenGenerator++,this.Type=i,this.Manager=null,this._OnAnyViewLostList=null,this._AnyViewLostMark=null,this._OnWholeViewLostList=null,this._WholeViewLostMark=null,this._HtmlStatusInfo={target:null==n?t:e}}OnManaged(t){return this._HtmlStatusInfo.target!=i&&(this.Manager?(console.error("manage duplicated"),!1):(this._RegisterViewLostCallbacks(),this.Manager=t,!0))}ResetAutoRecycleViewsRef(t,e){t instanceof Array&&e instanceof Array?this._HtmlStatusInfo.target!=i&&(this._UnregisterViewCallbacks(),this._OnAnyViewLostList=t,this._OnWholdViewLostList=e,this.Manager&&this._RegisterViewLostCallbacks()):console.error("need array ",t,e)}Expired(){return this._HtmlStatusInfo.target==i}Recycle(){this._HtmlStatusInfo.target!=i&&this.Manager&&(this._HtmlStatusInfo.target=i,this.OnSelfRecycle(),this.Manager.RecycleSensor(this),this.Manager=null,this._UnregisterViewCallbacks()),this._OnAnyViewLostList=null,this._OnWholdViewLostList=null}HtmlDoWorkOnFrame(){console.log("Need be override")}HtmlNeedWorkOnFrame(){return!0}OnCallback(t){console.log("Need be override")}OnSelfRecycle(){}_RegisterViewLostCallbacks(){let t=this;if(this._OnAnyViewLostList?.length>0){let e=this._OnAnyViewLostList.length;this._AnyViewLostMark={callbacks:new Array(e).fill(null)};for(let i=0;i<e;i++){let e=this._OnAnyViewLostList[i];if(e.HtmlCanAccessElement()&&e.Expired)this._OnAnyViewLostList[i]=null;else{let n=()=>{t.Recycle()};this._AnyViewLostMark.callbacks[i]=n,e.RegisterDetachCallback(n)}}}else this._AnyViewLostMark=null;if(this._OnWholeViewLostList?.length>0){let e=this._OnWholeViewLostList.length;this._WholeViewLostMark={list:new Array(e).fill({callback:null,lost:!1}),lostCount:0};for(let i=0;i<e;i++){let e=this._OnWholeViewLostList[i];if(e.HtmlCanAccessElement()&&e.Expired)this._OnWholeViewLostList[i]=null,this._WholeViewLostMark.list[i].lost=!0,this._WholeViewLostMark.lostCount++;else{let n=()=>{t._OnViewOfWholeListLost(i)};this._WholeViewLostMark.list[i].callback=n,e.RegisterDetachCallback(n)}}}else this._WholeViewLostMark=null}_UnregisterViewCallbacks(){if(this._AnyViewLostMark){let t=this._OnAnyViewLostList.length;for(let e=0;e<t;e++){this._OnAnyViewLostList[e]&&this._OnAnyViewLostList[e].UnregisterDetachCallback(this._AnyViewLostMark.callbacks[e])}this._AnyViewLostMark=null}if(this._WholeViewLostMark){let t=this._OnWholdViewLostList.length;for(let e=0;e<t;e++){this._OnWholdViewLostList[e]&&this._OnWholdViewLostList[e].UnregisterDetachCallback(this._WholeViewLostMark.list[e].callback)}this._WholeViewLostMark=null}}_OnViewOfWholeListLost(t){this._WholeViewLostMark.list[t].lost||(this._WholeViewLostMark.lostCount++,this._WholeViewLostMark.list[t].lost=!0,this._WholeViewLostMark.list[view_idx].callback=null,this._OnWholdViewLostList[t]=null),this._WholeViewLostMark.lostCount==this._OnWholeViewLostList.length&&this.Recycle()}}n.TypeDefines={TYPE_IMPACT:1,TYPE_FROZE_SET:2,TYPE_ON_SCREEN:3,TYPE_DRAG_IMPACT:101},_.ViewSensor=n}{class t{constructor(){this._SensorMaps={},this.IdTokenGenerator=77}HtmlDoWorkOnFrame(){for(let t in this._SensorMaps){let e=this._SensorMaps[t];e.Expired()?delete this._SensorMaps[t]:e.HtmlDoWorkOnFrame()}}HtmlHasActiveSensor(){for(let t in this._SensorMaps)if(this._SensorMaps[t].HtmlNeedWorkOnFrame())return!0;return!1}AddSensor(t){if(t){t.OnManaged(this)&&(this._SensorMaps[t.IdToken]=t),this.RequestSwap()}}AddToSyncList(t){this._SensorMaps.hasOwnProperty(t.IdToken)||console.error("Error: (Add)No in map",this._SensorMaps,t)}RecycleSensor(t){this._SensorMaps.hasOwnProperty(t.IdToken)?(delete this._SensorMaps[t.IdToken],this.RequestSwap()):console.error("Error: (del)No in map",this._SensorMaps,t)}RequestSwap(){_.sRenderBridge.BeginHtmlFrameLoop()}}_.sViewSensorManager=new t}class he{constructor(t,e,i){this.element=i,this.row=t,this.column=e}toString(){return`[${this.element[0]},${this.element[1]},${this.element[2]},${this.element[3]},${this.element[4]},${this.element[5]},${this.element[6]},${this.element[7]},${this.element[8]},${this.element[9]},${this.element[10]},${this.element[11]},${this.element[12]},${this.element[13]},${this.element[14]},${this.element[15]}]`}multiply(t){if(this.column!==t.row)throw new Error("matrix multiply error");const e=[];for(let i=0;i<this.row;i++)for(let n=0;n<t.column;n++){e[i+n*t.column]=0;for(let s=0;s<this.column;s++)e[i+n*t.column]+=this.element[i+s*this.column]*t.element[s+n*t.column]}return new he(this.row,t.column,e)}static identity(){return new he(4,4,[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])}static translate(t,e,i){return new he(4,4,[1,0,0,0,0,1,0,0,0,0,1,0,t,e,i,1])}static scale(t,e,i){return new he(4,4,[t,0,0,0,0,e,0,0,0,0,i,0,0,0,0,1])}static rotate(t,e,i,n){const s=Math.cos(n/180*Math.PI),r=Math.sin(n/180*Math.PI),a=Math.sqrt(t*t+e*e+i*i);if(1!==a){const n=1/a;t*=n,e*=n,i*=n}const o=1-s,l=t*e,h=e*i,c=i*t,u=t*r,d=e*r,g=i*r,f=[];return f[0]=t*t*o+s,f[1]=l*o+g,f[2]=c*o-d,f[3]=0,f[4]=l*o-g,f[5]=e*e*o+s,f[6]=h*o+u,f[7]=0,f[8]=c*o+d,f[9]=h*o-u,f[10]=i*i*o+s,f[11]=0,f[12]=0,f[13]=0,f[14]=0,f[15]=1,new he(4,4,f)}static skew(t,e){const i=new Array(16).fill(0),n=2*Math.PI*(e/360),s=-2*Math.PI*(t/360);return i[0]=1-s*n,i[1]=-Math.tan(n),i[4]=Math.tan(s),i[5]=1,i[10]=1,i[15]=1,new he(4,4,i)}static transform2d(t,e,i,n,s,r){return new he(4,4,[t,e,0,0,i,n,0,0,0,0,1,0,s,r,0,1])}}const ce=t=>t>=65&&t<=90||t>=97&&t<=122,ue=t=>t>=48&&t<=57,de=(t,e)=>{switch(t){case"translate3d":return he.translate(e[0],e[1],e[2]);case"scale3d":return he.scale(e[0],e[1],e[2]);case"rotate3d":return he.rotate(e[0],e[1],e[2],e[3]);case"skew":return he.skew(e[0],e[1]);case"matrix":return he.transform2d(e[0],e[1],e[2],e[3],e[4],e[5]);case"matrix3d":return new he(4,4,e);default:throw new Error(`no support type ${t}`)}},ge=t=>{let e=he.identity();if(!t)return e;let i="",n="",s=[],r=0;for(let a=0;a<t.length;a++){const o=t.charCodeAt(a);0===r?(ce(o)||ue(o))&&(i+=t[a]):(ue(o)||46===o||45===o||101===o)&&(n+=t[a]),40===o?(r=1,n="",s=[]):41===o?(s.push(parseFloat(n)),e=e.multiply(de(i,s)),i="",r=0):44===o&&(s.push(parseFloat(n)),n="")}return e},fe=t=>{if(t.indexOf(" ")>=0){return t.split(" ").map((t=>parseInt(t.substr(0,t.length-2),10)))}return parseInt(t.substr(0,t.length-2),10)},me=t=>{let e=t;const i=fe(e.style.width),n=fe(e.style.height);let s=he.identity();for(;e.parentNode;){const t=getComputedStyle(e),i=t.transform?t.transform:t.webkitTransform;if(i){const n=t.transformOrigin?t.transformOrigin:t.webkitTransformOrigin,r=ge(i);if(n){const t=fe(n),i=he.translate(-t[0],-t[1],0),a=he.translate(t[0],t[1],0);s=he.translate(e.offsetLeft,e.offsetTop,0).multiply(a.multiply(r.multiply(i.multiply(s))))}else s=r.multiply(s)}e=e.parentNode}const r=new he(4,4,[0,0,0,1,i,0,0,1,0,n,0,1,i,n,0,1]);s=s.multiply(r);const a=s.element;return[a[0],a[1],a[4],a[5],a[8],a[9],a[12],a[13]]};function pe(t){let e=me(t),i=Math.min(e[0],e[2],e[4],e[6]),n=Math.max(e[0],e[2],e[4],e[6]);return[Math.min(e[1],e[3],e[5],e[7]),Math.max(e[1],e[3],e[5],e[7]),i,n]}class _e{constructor(t,e){this.set(t,e)}add(t,e){return t instanceof _e?(this.x+=t.x,this.y+=t.y):(this.x+=t||0,this.y+=e||0),this}angle(t){if(void 0!==t)return this.set(this.length(),0).rotate(t);let e=Math.atan2(this.y,this.x);return e<0&&(e+=2*Math.PI),e}angleDeg(t){return void 0!==t?this.angle(t/180*Math.PI):180*this.angle()/Math.PI}clone(){return new _e(this.x,this.y)}cross(t,e){return t instanceof _e?this.x*t.y-this.y*t.x:this.x*e-this.y*t}distance(t,e){const i=this.distanceSq(t,e);if(void 0!==i)return Math.sqrt(i)}distanceSq(t,e){let i,n;if(t instanceof _e)i=t.x-this.x,n=t.y-this.y;else{if(void 0===e)return;i=t-this.x,n=e-this.y}return i*i+n*n}dot(t,e){return t instanceof _e?this.x*t.x+this.y*t.y:this.x*t+this.y*e}equals(t,e,i){return t instanceof _e?(e=e||0,Math.abs(this.x-t.x)<=e&&Math.abs(this.y-t.y)<=e):void 0!==e&&(i=i||0,Math.abs(this.x-t)<=i&&Math.abs(this.y-e)<=i)}length(){return Math.sqrt(this.lengthSq())}lengthSq(){return this.x*this.x+this.y*this.y}negate(){return this.scale(-1)}normalize(){return this.scale(1/this.length())}rotate(t){const e=Math.cos(t),i=Math.sin(t);return this.set(this.x*e-this.y*i,this.x*i+this.y*e)}rotateDeg(t){return this.rotate(t/180*Math.PI)}scale(t,e){return this.x*=t,this.y*=e||t,this}set(t,e){return t instanceof _e?(this.x=t.x,this.y=t.y):(this.x=t||0,this.y=e||0),this}setPolar(t,e){return this.set(e,0).rotate(t)}setPolarDeg(t,e){return this.setPolar(t/180*Math.PI,e)}sub(t,e){return void 0!==e?(this.x-=t,this.y-=e):(this.x-=t.x,this.y-=t.y),this}toString(){return`(${this.x}, ${this.y})`}}function Te(t,e,i){return i=i||0,Math.abs(t-e)<Math.abs(i)}const ye={isEqual:Te,isZero:(t,e)=>Te(t,0,e),clamp:(t,e,i)=>t>e?t<i?t:i:e},we=ye.isZero,Se=ye.clamp,xe=new _e(0,0),be=1e-4;function ve(t){return"[object Array]"===Object.prototype.toString.call(t)}function Ee(t){if(!ve(t))throw new Error("Polygon must be an array of points");switch(typeof t[0]){case"number":{if(t.length%2!=0)throw new Error("Polygon that contains array of numbers must has even length ([x0, y0, x1, y1, ...., xn, yn])");const e=[];for(let i=0;i<t.length;i+=2)e.push(new _e(t[i],t[i+1]));return e}case"object":return t.map(ve(t[0])?t=>new _e(t[0],t[1]):t=>new _e(t.x,t.y));default:throw new Error("Passed polygon is not an array of 2D coordinates")}}function Ie(t){if(1===t.length)return new _e(t[0]);const e=new _e(0,0);t.forEach((t=>e.add(t))),e.scale(1/t.length);const i=new _e;let n=0;return t.forEach(((s,r)=>{const a=new _e(s),o=new _e(r+1===t.length?t[0]:t[r+1]);a.add(-e.x,-e.y),o.add(-e.x,-e.y);const l=.5*a.cross(o);n+=l,i.add(a.add(o).scale(.3333333333333333).scale(l))})),we(n,be)?i.set(t[0]):i.scale(1/n).add(e)}function Ce(t,e){let i=t[0],n=e.dot(t[0]),s=0;for(let r=1;r<t.length;r++)s=e.dot(t[r]),s>n&&(n=s,i=t[r]);return new _e(i)}function Ae(t,e,i){const n=Ce(t,i),s=Ce(e,i.negate());return new _e(n.sub(s))}function Pe(t,e){const i=new _e(0,0),n=new _e(t).negate(),s=new _e(e).sub(t),r=s.dot(s);if(we(r,be))return i.set(t);let a=n.dot(s)/r;return a=Se(a,0,1),i.set(s.scale(a).add(t))}function Le(t,e){t=Ee(t),e=Ee(e);const i=Ie(t),n=Ie(e).add(i.negate());let s,r,a;s=Ae(t,e,n),r=Ae(t,e,n.negate());for(let i=0;i<30;i++){const i=Pe(s,r);if(we(i.length(),be))return 0;n.set(i.negate().normalize()),a=Ae(t,e,n);const o=a.dot(n),l=s.dot(n);if(we(o-l,be))return o;s.distanceSq(xe)<r.distanceSq(xe)?r=a:s=a}return 0}const Re={intersect:(t,e)=>we(Le(t,e),be),distance:Le};class ke extends _.ViewSensor{constructor(t,e,i,n){super(_.ViewSensor.TypeDefines.TYPE_IMPACT),this._HtmlConfig={view1:t,view2:e,frozeSetId:n?n.IdToken:0,status:{contacted:!1}},this._Callback=i,this._FrozeViewsSet=n,n&&n.DoRef(),this.ResetAutoRecycleViewsRef([t,e],[]),_.sViewSensorManager.AddSensor(this)}HtmlDoWorkOnFrame(){if(!this.Expired()&&this._HtmlConfig.view1&&this._HtmlConfig.view2&&this._HtmlConfig.view1.HtmlCanAccessElement()&&this._HtmlConfig.view1.HtmlCanAccessElement()){(t=this._HtmlConfig.view1.HtmlGetElement(),e=this._HtmlConfig.view2.HtmlGetElement(),Re.intersect(me(t),me(e)))?this._HtmlConfig.status.contacted||(this._HtmlConfig.status.contacted=!0,this.OnCallback(1)):this._HtmlConfig.status.contacted&&(this.OnCallback(2),this._HtmlConfig.status.contacted=!1)}var t,e}OnCallback(t){this._Callback&&(1==t&&this._Callback.OnBeginContact?this._Callback.OnBeginContact():2==t&&this._Callback.OnEndContact&&this._Callback.OnEndContact())}OnSelfRecycle(){this._FrozeViewsSet&&(this._FrozeViewsSet.UnRef(),this._FrozeViewsSet=null),this._HtmlConfig=null}}_.ImpactSensor=ke;class De extends _.ViewSensor{constructor(t,e){super(_.ViewSensor.TypeDefines.TYPE_FROZE_SET),this._PreImpactViewList=null,this._OnImpactViewList=null,this._UpdateAutoRecycleRef(t,!0,e,!0),_.sViewSensorManager.AddSensor(this)}HtmlDoWorkOnFrame(){}HtmlNeedWorkOnFrame(){return!1}UpdatePreImpactList(t){this._UpdateAutoRecycleRef(t,!0,null,!1)}UpdateOnImpactList(t){this._UpdateAutoRecycleRef(null,!1,t,!0)}DoRef(){this.Expired()?console.error("Error: froze set is expired for all bind views lost"):this._RefCount++}UnRef(){this._RefCount>0&&this._RefCount--,0==this._RefCount&&this.Recycle()}OnSelfRecycle(){this._PreImpactViewList=null,this._OnImpactViewList=null}_UpdateAutoRecycleRef(t,e,i,n){e&&(this._PreImpactViewList=t instanceof Array?t:[]),n&&(this._OnImpactViewList=i instanceof Array?i:[]),this.ResetAutoRecycleViewsRef([],[...this._PreImpactViewList,...this._OnImpactViewList])}}class Ve{constructor(t,e){this.Start=t,this.End=e}Merge(t){return this.IsInterAct(t)?(this.Start>t.Start&&(this.Start=t.Start),this.End<t.End&&(this.End=t.End),!0):this.End+1==t.Start?(this.End=t.End,!0):this.Start==t.End+1&&(this.Start=t.Start,!0)}IsInterAct(t){return t.Start<this.Start?!(t.End<this.Start):t.Start<=this.End}IsInclude(t){return this.Start<=t.Start&&this.End>=t.End}Exclude(t){var e={success:!1,newSplitedRange:null};return this.IsInterAct(t)?(t.Start<=this.Start?t.End<this.End?this.Start=t.End+1:this.Clear():(t.End<this.End&&(e.newSplitedRange=new Ve(t.End+1,this.End),e.newSplitedRange=e.newSplitedRange),this.End=t.Start-1),e.success=!0,e.success=e.success,e):e}IsEmpty(){return this.Start>this.End}Clear(){this.End=this.Start-1}Clone(){return new Ve(this.Start,this.End)}}class Oe extends _.ViewSensor{constructor(t,e){super(_.ViewSensor.TypeDefines.TYPE_ON_SCREEN),this._HtmlConfig={view:t,container:null,enable:!1,testRange:null,status:{horizonVisible:!1,verticalVisible:!1}},this._Callback=e,this.ResetAutoRecycleViewsRef([t],[]),_.sViewSensorManager.AddSensor(this)}HtmlDoWorkOnFrame(){if(!this.Expired()&&this._HtmlConfig.enable&&this._HtmlConfig.testRange&&this._HtmlConfig.view&&this._HtmlConfig.view.HtmlCanAccessElement()){let t=_.sRenderBridge.GetScreenInfo().designedWidth,e=Math.floor(9*t/16),i={top:0,bottom:0,left:0,right:0},n=pe(this._HtmlConfig.view.HtmlGetElement());[i.top,i.bottom,i.left,i.right]=n;let s,r,a={top:0,bottom:e,left:0,right:t},o=!0;if(this._HtmlConfig.container&&this._HtmlConfig.container.HtmlCanAccessElement()){let i=pe(this._HtmlConfig.container.HtmlGetElement());[a.top,a.bottom,a.left,a.right]=i,s=new Ve(a.left,a.right),r=new Ve(a.top,a.bottom);let n=new Ve(0,t),l=new Ve(0,e);o=n.IsInterAct(s)&&l.IsInterAct(r)}else s=new Ve(a.left,a.right),r=new Ve(a.top,a.bottom);let l,h,c,u,d=new Ve(i.left,i.right),g=new Ve(i.top,i.bottom),f=this._HtmlConfig.testRange;{let t=Math.floor((i.right-i.left)*f.horizon);l=new Ve(i.left,i.left+t),h=new Ve(i.right-t,i.right)}{let t=Math.floor((i.bottom-i.top)*f.vertical);c=new Ve(i.top,i.top+t),u=new Ve(i.bottom-t,i.bottom)}let m=(s.IsInclude(l)||s.IsInclude(h))&&r.IsInterAct(g)&&o,p=(r.IsInclude(c)||r.IsInclude(u))&&s.IsInterAct(d)&&o;if(m!=this._HtmlConfig.status.horizonVisible||p!=this._HtmlConfig.status.verticalVisible){let t={};t.OH=this._HtmlConfig.status.horizonVisible,t.NH=m,t.OV=this._HtmlConfig.status.verticalVisible,t.NV=p,this._HtmlConfig.status.horizonVisible=m,this._HtmlConfig.status.verticalVisible=p,this.OnCallback(t)}}}HtmlNeedWorkOnFrame(){return this._HtmlConfig.enable}HtmlRequestSync(){_.sRenderBridge.BeginHtmlFrameLoop()}ResetArea(t){"number"!=typeof t.horizon&&(console.log("horizon not set, default to 1.0"),t.horizon=1),"number"!=typeof t.vertical&&(console.log("vertical not set, default to 1.0"),t.vertical=1),this._HtmlConfig.testRange=t,this.HtmlRequestSync()}Enable(t){this._HtmlConfig.enable=t,this.HtmlRequestSync()}ResetContainer(t){this._HtmlConfig.container=t,this.HtmlRequestSync()}OnCallback(t){this._Callback&&this._Callback(t.OH,t.NH,t.OV,t.NV)}OnSelfRecycle(){this._HtmlConfig=null}}function Me(t){if(!t)throw Error("assert :P")}function Fe(t,e,i){for(var n=0;4>n;n++)if(t[e+n]!=i.charCodeAt(n))return!0;return!1}function Ge(t,e,i,n,s){for(var r=0;r<s;r++)t[e+r]=i[n+r]}function Ne(t,e,i,n){for(var s=0;s<n;s++)t[e+s]=i}function Be(t){return new Int32Array(t)}function We(t,e){for(var i=[],n=0;n<t;n++)i.push(new e);return i}function He(t,e){var i=[];return function t(i,n,s){for(var r=s[n],a=0;a<r&&(i.push(s.length>n+1?[]:new e),!(s.length<n+1));a++)t(i[a],n+1,s)}(i,0,t),i}function Ye(t,e){for(var i="",n=0;n<4;n++)i+=String.fromCharCode(t[e++]);return i}function $e(t,e){return(t[e+0]<<0|t[e+1]<<8|t[e+2]<<16)>>>0}function Ue(t,e){return(t[e+0]<<0|t[e+1]<<8|t[e+2]<<16|t[e+3]<<24)>>>0}_.VisibleSensor=Oe,window.WebPDecoder=function(){function t(t,e){for(var i=1<<e-1>>>0;t&i;)i>>>=1;return i?(t&i-1)+i:t}function e(t,e,i,n,s){Me(!(n%i));do{t[e+(n-=i)]=s}while(0<n)}function i(i,s,r,a,o){if(Me(2328>=o),512>=o)var l=Be(512);else if(null==(l=Be(o)))return 0;return function(i,s,r,a,o,l){var h,c,u=s,d=1<<r,g=Be(16),f=Be(16);for(Me(0!=o),Me(null!=a),Me(null!=i),Me(0<r),c=0;c<o;++c){if(15<a[c])return 0;++g[a[c]]}if(g[0]==o)return 0;for(f[1]=0,h=1;15>h;++h){if(g[h]>1<<h)return 0;f[h+1]=f[h]+g[h]}for(c=0;c<o;++c)h=a[c],0<a[c]&&(l[f[h]++]=c);if(1==f[15])return(a=new n).g=0,a.value=l[0],e(i,u,1,d,a),d;var m,p=-1,_=d-1,T=0,y=1,w=1,S=1<<r;for(c=0,h=1,o=2;h<=r;++h,o<<=1){if(y+=w<<=1,0>(w-=g[h]))return 0;for(;0<g[h];--g[h])(a=new n).g=h,a.value=l[c++],e(i,u+T,o,S,a),T=t(T,h)}for(h=r+1,o=2;15>=h;++h,o<<=1){if(y+=w<<=1,0>(w-=g[h]))return 0;for(;0<g[h];--g[h]){if(a=new n,(T&_)!=p){for(u+=S,m=1<<(p=h)-r;15>p&&!(0>=(m-=g[p]));)++p,m<<=1;d+=S=1<<(m=p-r),i[s+(p=T&_)].g=m+r,i[s+p].value=u-s-p}a.g=h-r,a.value=l[c++],e(i,u+(T>>r),o,S,a),T=t(T,h)}}return y!=2*f[15]-1?0:d}(i,s,r,a,o,l)}function n(){this.value=this.g=0}function s(){this.value=this.g=0}function r(){this.G=We(5,n),this.H=Be(5),this.jc=this.Qb=this.qb=this.nd=0,this.pd=We(Fi,s)}function a(t,e,i,n){Me(null!=t),Me(null!=e),Me(2147483648>n),t.Ca=254,t.I=0,t.b=-8,t.Ka=0,t.oa=e,t.pa=i,t.Jd=e,t.Yc=i+n,t.Zc=4<=n?i+n-4+1:i,T(t)}function o(t,e){for(var i=0;0<e--;)i|=w(t,128)<<e;return i}function l(t,e){var i=o(t,e);return y(t)?-i:i}function h(t,e,i,n){var s,r=0;for(Me(null!=t),Me(null!=e),Me(4294967288>n),t.Sb=n,t.Ra=0,t.u=0,t.h=0,4<n&&(n=4),s=0;s<n;++s)r+=e[i+s]<<8*s;t.Ra=r,t.bb=n,t.oa=e,t.pa=i}function c(t){for(;8<=t.u&&t.bb<t.Sb;)t.Ra>>>=8,t.Ra+=t.oa[t.pa+t.bb]<<Bi-8>>>0,++t.bb,t.u-=8;m(t)&&(t.h=1,t.u=0)}function u(t,e){if(Me(0<=e),!t.h&&e<=Ni){var i=f(t)&Gi[e];return t.u+=e,c(t),i}return t.h=1,t.u=0}function d(){this.b=this.Ca=this.I=0,this.oa=[],this.pa=0,this.Jd=[],this.Yc=0,this.Zc=[],this.Ka=0}function g(){this.Ra=0,this.oa=[],this.h=this.u=this.bb=this.Sb=this.pa=0}function f(t){return t.Ra>>>(t.u&Bi-1)>>>0}function m(t){return Me(t.bb<=t.Sb),t.h||t.bb==t.Sb&&t.u>Bi}function p(t,e){t.u=e,t.h=m(t)}function _(t){t.u>=Wi&&(Me(t.u>=Wi),c(t))}function T(t){Me(null!=t&&null!=t.oa),t.pa<t.Zc?(t.I=(t.oa[t.pa++]|t.I<<8)>>>0,t.b+=8):(Me(null!=t&&null!=t.oa),t.pa<t.Yc?(t.b+=8,t.I=t.oa[t.pa++]|t.I<<8):t.Ka?t.b=0:(t.I<<=8,t.b+=8,t.Ka=1))}function y(t){return o(t,1)}function w(t,e){var i=t.Ca;0>t.b&&T(t);var n=t.b,s=i*e>>>8,r=(t.I>>>n>s)+0;for(r?(i-=s,t.I-=s+1<<n>>>0):i=s+1,n=i,s=0;256<=n;)s+=8,n>>=8;return n=7^s+Hi[n],t.b-=n,t.Ca=(i<<n)-1,r}function S(t,e,i){t[e+0]=i>>24&255,t[e+1]=i>>16&255,t[e+2]=i>>8&255,t[e+3]=i>>0&255}function x(t,e){return t[e+0]<<0|t[e+1]<<8}function b(t,e){return x(t,e)|t[e+2]<<16}function v(t,e){return x(t,e)|x(t,e+2)<<16}function E(t,e){var i=1<<e;return Me(null!=t),Me(0<e),t.X=Be(i),null==t.X?0:(t.Mb=32-e,t.Xa=e,1)}function I(t,e){Me(null!=t),Me(null!=e),Me(t.Xa==e.Xa),Ge(e.X,0,t.X,0,1<<e.Xa)}function C(){this.X=[],this.Xa=this.Mb=0}function A(t,e,i,n){Me(null!=i),Me(null!=n);var s=i[0],r=n[0];return 0==s&&(s=(t*r+e/2)/e),0==r&&(r=(e*s+t/2)/t),0>=s||0>=r?0:(i[0]=s,n[0]=r,1)}function P(t,e){return t+(1<<e)-1>>>e}function L(t,e){return((4278255360&t)+(4278255360&e)>>>0&4278255360)+((16711935&t)+(16711935&e)>>>0&16711935)>>>0}function R(t,e){self[e]=function(e,i,n,s,r,a,o){var l;for(l=0;l<r;++l){var h=self[t](a[o+l-1],n,s+l);a[o+l]=L(e[i+l],h)}}}function k(){this.ud=this.hd=this.jd=0}function D(t,e){return((4278124286&(t^e))>>>1)+(t&e)>>>0}function V(t){return 0<=t&&256>t?t:0>t?0:255<t?255:void 0}function O(t,e){return V(t+(t-e+.5>>1))}function M(t,e,i){return Math.abs(e-i)-Math.abs(t-i)}function F(t,e,i,n,s,r,a){for(n=r[a-1],i=0;i<s;++i)r[a+i]=n=L(t[e+i],n)}function G(t,e,i,n,s){var r;for(r=0;r<i;++r){var a=t[e+r],o=a>>8&255,l=16711935&(l=(l=16711935&a)+((o<<16)+o));n[s+r]=(4278255360&a)+l>>>0}}function N(t,e){e.jd=t>>0&255,e.hd=t>>8&255,e.ud=t>>16&255}function B(t,e,i,n,s,r){var a;for(a=0;a<n;++a){var o=e[i+a],l=o>>>8,h=o,c=255&(c=(c=o>>>16)+((t.jd<<24>>24)*(l<<24>>24)>>>5));h=255&(h=(h=h+((t.hd<<24>>24)*(l<<24>>24)>>>5))+((t.ud<<24>>24)*(c<<24>>24)>>>5));s[r+a]=(4278255360&o)+(c<<16)+h}}function W(t,e,i,n,s){self[e]=function(t,e,i,r,a,o,l,h,c){for(r=l;r<h;++r)for(l=0;l<c;++l)a[o++]=s(i[n(t[e++])])},self[t]=function(t,e,r,a,o,l,h){var c=8>>t.b,u=t.Ea,d=t.K[0],g=t.w;if(8>c)for(t=(1<<t.b)-1,g=(1<<c)-1;e<r;++e){var f,m=0;for(f=0;f<u;++f)f&t||(m=n(a[o++])),l[h++]=s(d[m&g]),m>>=c}else self["VP8LMapColor"+i](a,o,d,g,l,h,e,r,u)}}function H(t,e,i,n,s){for(i=e+i;e<i;){var r=t[e++];n[s++]=r>>16&255,n[s++]=r>>8&255,n[s++]=r>>0&255}}function Y(t,e,i,n,s){for(i=e+i;e<i;){var r=t[e++];n[s++]=r>>16&255,n[s++]=r>>8&255,n[s++]=r>>0&255,n[s++]=r>>24&255}}function $(t,e,i,n,s){for(i=e+i;e<i;){var r=(a=t[e++])>>16&240|a>>12&15,a=a>>0&240|a>>28&15;n[s++]=r,n[s++]=a}}function U(t,e,i,n,s){for(i=e+i;e<i;){var r=(a=t[e++])>>16&248|a>>13&7,a=a>>5&224|a>>3&31;n[s++]=r,n[s++]=a}}function j(t,e,i,n,s){for(i=e+i;e<i;){var r=t[e++];n[s++]=r>>0&255,n[s++]=r>>8&255,n[s++]=r>>16&255}}function z(t,e,i,n,s,r){if(0==r)for(i=e+i;e<i;)S(n,((r=t[e++])[0]>>24|r[1]>>8&65280|r[2]<<8&16711680|r[3]<<24)>>>0),s+=32;else Ge(n,s,t,e,i)}function X(t,e){self[e][0]=self[t+"0"],self[e][1]=self[t+"1"],self[e][2]=self[t+"2"],self[e][3]=self[t+"3"],self[e][4]=self[t+"4"],self[e][5]=self[t+"5"],self[e][6]=self[t+"6"],self[e][7]=self[t+"7"],self[e][8]=self[t+"8"],self[e][9]=self[t+"9"],self[e][10]=self[t+"10"],self[e][11]=self[t+"11"],self[e][12]=self[t+"12"],self[e][13]=self[t+"13"],self[e][14]=self[t+"0"],self[e][15]=self[t+"0"]}function K(t){return t==Hn||t==Yn||t==$n||t==Un}function J(){this.eb=[],this.size=this.A=this.fb=0}function q(){this.y=[],this.f=[],this.ea=[],this.F=[],this.Tc=this.Ed=this.Cd=this.Fd=this.lb=this.Db=this.Ab=this.fa=this.J=this.W=this.N=this.O=0}function Z(){this.Rd=this.height=this.width=this.S=0,this.f={},this.f.RGBA=new J,this.f.kb=new q,this.sd=null}function Q(){this.width=[0],this.height=[0],this.Pd=[0],this.Qd=[0],this.format=[0]}function tt(){this.Id=this.fd=this.Md=this.hb=this.ib=this.da=this.bd=this.cd=this.j=this.v=this.Da=this.Sd=this.ob=0}function et(t){return alert("todo:WebPSamplerProcessPlane"),t.T}function it(t,e){var i=t.T,n=e.ba.f.RGBA,s=n.eb,r=n.fb+t.ka*n.A,a=ps[e.ba.S],o=t.y,l=t.O,h=t.f,c=t.N,u=t.ea,d=t.W,g=e.cc,f=e.dc,m=e.Mc,p=e.Nc,_=t.ka,T=t.ka+t.T,y=t.U,w=y+1>>1;for(0==_?a(o,l,null,null,h,c,u,d,h,c,u,d,s,r,null,null,y):(a(e.ec,e.fc,o,l,g,f,m,p,h,c,u,d,s,r-n.A,s,r,y),++i);_+2<T;_+=2)g=h,f=c,m=u,p=d,c+=t.Rc,d+=t.Rc,r+=2*n.A,a(o,(l+=2*t.fa)-t.fa,o,l,g,f,m,p,h,c,u,d,s,r-n.A,s,r,y);return l+=t.fa,t.j+T<t.o?(Ge(e.ec,e.fc,o,l,y),Ge(e.cc,e.dc,h,c,w),Ge(e.Mc,e.Nc,u,d,w),i--):1&T||a(o,l,null,null,h,c,u,d,h,c,u,d,s,r+n.A,null,null,y),i}function nt(t,e,i){var n=t.F,s=[t.J];if(null!=n){var r=t.U,a=e.ba.S,o=a==Nn||a==$n;e=e.ba.f.RGBA;var l=[0],h=t.ka;l[0]=t.T,t.Kb&&(0==h?--l[0]:(--h,s[0]-=t.width),t.j+t.ka+t.T==t.o&&(l[0]=t.o-t.j-h));var c=e.eb;h=e.fb+h*e.A;t=vn(n,s[0],t.width,r,l,c,h+(o?0:3),e.A),Me(i==l),t&&K(a)&&xn(c,h,o,r,l,e.A)}return 0}function st(t){var e=t.ma,i=e.ba.S,n=11>i,s=i==Mn||i==Gn||i==Nn||i==Bn||12==i||K(i);if(e.memory=null,e.Ib=null,e.Jb=null,e.Nd=null,!Vi(e.Oa,t,s?11:12))return 0;if(s&&K(i)&&_i(),t.da)alert("todo:use_scaling");else{if(n){if(e.Ib=et,t.Kb){if(i=t.U+1>>1,e.memory=Be(t.U+2*i),null==e.memory)return 0;e.ec=e.memory,e.fc=0,e.cc=e.ec,e.dc=e.fc+t.U,e.Mc=e.cc,e.Nc=e.dc+i,e.Ib=it,_i()}}else alert("todo:EmitYUV");s&&(e.Jb=nt,n&&mi())}if(n&&!Ls){for(t=0;256>t;++t)Rs[t]=89858*(t-128)+Es>>vs,Vs[t]=-22014*(t-128)+Es,Ds[t]=-45773*(t-128),ks[t]=113618*(t-128)+Es>>vs;for(t=Is;t<Cs;++t)e=76283*(t-16)+Es>>vs,Os[t-Is]=Ft(e,255),Ms[t-Is]=Ft(e+8>>4,15);Ls=1}return 1}function rt(t){var e=t.ma,i=t.U,n=t.T;return Me(!(1&t.ka)),0>=i||0>=n?0:(i=e.Ib(t,e),null!=e.Jb&&e.Jb(t,e,i),e.Dc+=i,1)}function at(t){t.ma.memory=null}function ot(t,e,i,n){return 47!=u(t,8)?0:(e[0]=u(t,14)+1,i[0]=u(t,14)+1,n[0]=u(t,1),0!=u(t,3)?0:!t.h)}function lt(t,e){if(4>t)return t+1;var i=t-2>>1;return(2+(1&t)<<i)+u(e,i)+1}function ht(t,e){return 120<e?e-120:1<=(i=((i=qn[e-1])>>4)*t+(8-(15&i)))?i:1;var i}function ct(t,e,i){var n=f(i),s=t[e+=255&n].g-8;return 0<s&&(p(i,i.u+8),n=f(i),e+=t[e].value,e+=n&(1<<s)-1),p(i,i.u+t[e].g),t[e].value}function ut(t,e,i){return i.g+=t.g,i.value+=t.value<<e>>>0,Me(8>=i.g),t.g}function dt(t,e,i){var n=t.xc;return Me((e=0==n?0:t.vc[t.md*(i>>n)+(e>>n)])<t.Wb),t.Ya[e]}function gt(t,e,i,n){var s=t.ab,r=t.c*e,a=t.C;e=a+e;var o=i,l=n;for(n=t.Ta,i=t.Ua;0<s--;){var h=t.gc[s],c=a,u=e,d=o,g=l,f=(l=n,o=i,h.Ea);switch(Me(c<u),Me(u<=h.nc),h.hc){case 2:Ui(d,g,(u-c)*f,l,o);break;case 0:var m=c,p=u,_=l,T=o,y=(v=h).Ea;0==m&&(Yi(d,g,null,null,1,_,T),F(d,g+1,0,0,y-1,_,T+1),g+=y,T+=y,++m);for(var w=1<<v.b,S=w-1,x=P(y,v.b),b=v.K,v=v.w+(m>>v.b)*x;m<p;){var E=b,I=v,C=1;for($i(d,g,_,T-y,1,_,T);C<y;){var A=(C&~S)+w;A>y&&(A=y),(0,Ji[E[I++]>>8&15])(d,g+ +C,_,T+C-y,A-C,_,T+C),C=A}g+=y,T+=y,++m&S||(v+=x)}u!=h.nc&&Ge(l,o-f,l,o+(u-c-1)*f,f);break;case 1:for(f=d,p=g,y=(d=h.Ea)-(T=d&~(_=(g=1<<h.b)-1)),m=P(d,h.b),w=h.K,h=h.w+(c>>h.b)*m;c<u;){for(S=w,x=h,b=new k,v=p+T,E=p+d;p<v;)N(S[x++],b),qi(b,f,p,g,l,o),p+=g,o+=g;p<E&&(N(S[x++],b),qi(b,f,p,y,l,o),p+=y,o+=y),++c&_||(h+=m)}break;case 3:if(d==l&&g==o&&0<h.b){for(p=l,d=f=o+(u-c)*f-(T=(u-c)*P(h.Ea,h.b)),g=l,_=o,m=[],T=(y=T)-1;0<=T;--T)m[T]=g[_+T];for(T=y-1;0<=T;--T)p[d+T]=m[T];ji(h,c,u,l,f,l,o)}else ji(h,c,u,d,g,l,o)}o=n,l=i}l!=i&&Ge(n,i,o,l,r)}function ft(t,e){var i=t.V,n=t.Ba+t.c*t.C,s=e-t.C;if(Me(e<=t.l.o),Me(16>=s),0<s){var r=t.l,a=t.Ta,o=t.Ua,l=r.width;if(gt(t,s,i,n),s=o=[o],Me((i=t.C)<(n=e)),Me(r.v<r.va),n>r.o&&(n=r.o),i<r.j){var h=r.j-i;i=r.j;s[0]+=h*l}if(i>=n?i=0:(s[0]+=4*r.v,r.ka=i-r.j,r.U=r.va-r.v,r.T=n-i,i=1),i){if(o=o[0],11>(i=t.ca).S){var c=i.f.RGBA,u=(n=i.S,s=r.U,r=r.T,h=c.eb,c.A),d=r;for(c=c.fb+t.Ma*c.A;0<d--;){var g=a,f=o,m=s,p=h,_=c;switch(n){case On:Zi(g,f,m,p,_);break;case Mn:Qi(g,f,m,p,_);break;case Hn:Qi(g,f,m,p,_),xn(p,_,0,m,1,0);break;case Fn:nn(g,f,m,p,_);break;case Gn:z(g,f,m,p,_,1);break;case Yn:z(g,f,m,p,_,1),xn(p,_,0,m,1,0);break;case Nn:z(g,f,m,p,_,0);break;case $n:z(g,f,m,p,_,0),xn(p,_,1,m,1,0);break;case Bn:tn(g,f,m,p,_);break;case Un:tn(g,f,m,p,_),bn(p,_,m,1,0);break;case Wn:en(g,f,m,p,_);break;default:Me(0)}o+=l,c+=u}t.Ma+=r}else alert("todo:EmitRescaledRowsYUVA");Me(t.Ma<=i.height)}}t.C=e,Me(t.C<=t.i)}function mt(t){var e;if(0<t.ua)return 0;for(e=0;e<t.Wb;++e){var i=t.Ya[e].G,n=t.Ya[e].H;if(0<i[1][n[1]+0].g||0<i[2][n[2]+0].g||0<i[3][n[3]+0].g)return 0}return 1}function pt(t,e,i,n,s,r){if(0!=t.Z){var a=t.qd,o=t.rd;for(Me(null!=ms[t.Z]);e<i;++e)ms[t.Z](a,o,n,s,n,s,r),a=n,o=s,s+=r;t.qd=a,t.rd=o}}function _t(t,e){var i=t.l.ma,n=0==i.Z||1==i.Z?t.l.j:t.C;n=t.C<n?n:t.C;if(Me(e<=t.l.o),e>n){var s=t.l.width,r=i.ca,a=i.tb+s*n,o=t.V,l=t.Ba+t.c*n,h=t.gc;Me(1==t.ab),Me(3==h[0].hc),Xi(h[0],n,e,o,l,r,a),pt(i,n,e,r,a,s)}t.C=t.Ma=e}function Tt(t,e,i,n,s,r,a){var o=t.$/n,l=t.$%n,h=t.m,c=t.s,u=i+t.$,d=u;s=i+n*s;var g=i+n*r,T=280+c.ua,y=t.Pb?o:16777216,w=0<c.ua?c.Wa:null,S=c.wc,x=u<g?dt(c,l,o):null;Me(t.C<r),Me(g<=s);var b=!1;t:for(;;){for(;b||u<g;){var v=0;if(o>=y){var E=u-i;Me((y=t).Pb),y.wd=y.m,y.xd=E,0<y.s.ua&&I(y.s.Wa,y.s.vb),y=o+Qn}if(l&S||(x=dt(c,l,o)),Me(null!=x),x.Qb&&(e[u]=x.qb,b=!0),!b)if(_(h),x.jc){v=h,E=e;var C=u,A=x.pd[f(v)&Fi-1];Me(x.jc),256>A.g?(p(v,v.u+A.g),E[C]=A.value,v=0):(p(v,v.u+A.g-256),Me(256<=A.value),v=A.value),0==v&&(b=!0)}else v=ct(x.G[0],x.H[0],h);if(h.h)break;if(b||256>v){if(!b)if(x.nd)e[u]=(x.qb|v<<8)>>>0;else{if(_(h),b=ct(x.G[1],x.H[1],h),_(h),E=ct(x.G[2],x.H[2],h),C=ct(x.G[3],x.H[3],h),h.h)break;e[u]=(C<<24|b<<16|v<<8|E)>>>0}if(b=!1,++u,++l>=n&&(l=0,++o,null!=a&&o<=r&&!(o%16)&&a(t,o),null!=w))for(;d<u;)v=e[d++],w.X[(506832829*v&4294967295)>>>w.Mb]=v}else if(280>v){if(v=lt(v-256,h),E=ct(x.G[4],x.H[4],h),_(h),E=ht(n,E=lt(E,h)),h.h)break;if(u-i<E||s-u<v)break t;for(C=0;C<v;++C)e[u+C]=e[u+C-E];for(u+=v,l+=v;l>=n;)l-=n,++o,null!=a&&o<=r&&!(o%16)&&a(t,o);if(Me(u<=s),l&S&&(x=dt(c,l,o)),null!=w)for(;d<u;)v=e[d++],w.X[(506832829*v&4294967295)>>>w.Mb]=v}else{if(!(v<T))break t;for(b=v-280,Me(null!=w);d<u;)v=e[d++],w.X[(506832829*v&4294967295)>>>w.Mb]=v;v=u,Me(!(b>>>(E=w).Xa)),e[v]=E.X[b],b=!0}b||Me(h.h==m(h))}if(t.Pb&&h.h&&u<s)Me(t.m.h),t.a=5,t.m=t.wd,t.$=t.xd,0<t.s.ua&&I(t.s.vb,t.s.Wa);else{if(h.h)break t;null!=a&&a(t,o>r?r:o),t.a=0,t.$=u-i}return 1}return t.a=3,0}function yt(t){Me(null!=t),t.vc=null,t.yc=null,t.Ya=null;var e=t.Wa;null!=e&&(e.X=null),t.vb=null,Me(null!=t)}function wt(){var t=new ri;return null==t?null:(t.a=0,t.xb=fs,X("Predictor","VP8LPredictors"),X("Predictor","VP8LPredictors_C"),X("PredictorAdd","VP8LPredictorsAdd"),X("PredictorAdd","VP8LPredictorsAdd_C"),Ui=G,qi=B,Zi=H,Qi=Y,tn=$,en=U,nn=j,self.VP8LMapColor32b=zi,self.VP8LMapColor8b=Ki,t)}function St(t,e,s,a,o){var l=1,h=[t],c=[e],d=a.m,g=a.s,m=null,T=0;t:for(;;){if(s)for(;l&&u(d,1);){var y=h,w=c,S=a,x=1,b=S.m,v=S.gc[S.ab],I=u(b,2);if(S.Oc&1<<I)l=0;else{switch(S.Oc|=1<<I,v.hc=I,v.Ea=y[0],v.nc=w[0],v.K=[null],++S.ab,Me(4>=S.ab),I){case 0:case 1:v.b=u(b,3)+2,x=St(P(v.Ea,v.b),P(v.nc,v.b),0,S,v.K),v.K=v.K[0];break;case 3:var C,A=u(b,8)+1,R=16<A?0:4<A?1:2<A?2:3;if(y[0]=P(v.Ea,R),v.b=R,C=x=St(A,1,0,S,v.K)){var k,D=A,V=v,O=1<<(8>>V.b),M=Be(O);if(null==M)C=0;else{var F=V.K[0],G=V.w;for(M[0]=V.K[0][0],k=1;k<1*D;++k)M[k]=L(F[G+k],M[k-1]);for(;k<4*O;++k)M[k]=0;V.K[0]=null,V.K[0]=M,C=1}}x=C;break;case 2:break;default:Me(0)}l=x}}if(h=h[0],c=c[0],l&&u(d,1)&&!(l=1<=(T=u(d,4))&&11>=T)){a.a=3;break t}var N;if(N=l)e:{var B,W,H,Y=a,$=h,U=c,j=T,z=s,X=Y.m,K=Y.s,J=[null],q=1,Z=0,Q=Zn[j];i:for(;;){if(z&&u(X,1)){var tt=u(X,3)+2,et=P($,tt),it=P(U,tt),nt=et*it;if(!St(et,it,0,Y,J))break i;for(J=J[0],K.xc=tt,B=0;B<nt;++B){var st=J[B]>>8&65535;J[B]=st,st>=q&&(q=st+1)}}if(X.h)break i;for(W=0;5>W;++W){var rt=Xn[W];!W&&0<j&&(rt+=1<<j),Z<rt&&(Z=rt)}var at=We(q*Q,n),ot=q,lt=We(ot,r);if(null==lt)var ht=null;else Me(65536>=ot),ht=lt;var ct=Be(Z);if(null==ht||null==ct||null==at){Y.a=1;break i}var dt=at;for(B=H=0;B<q;++B){var gt=ht[B],ft=gt.G,mt=gt.H,pt=0,_t=1,wt=0;for(W=0;5>W;++W){rt=Xn[W],ft[W]=dt,mt[W]=H,!W&&0<j&&(rt+=1<<j);n:{var xt,bt=rt,vt=Y,Et=ct,It=dt,Ct=H,At=0,Pt=vt.m,Lt=u(Pt,1);if(Ne(Et,0,0,bt),Lt){var Rt=u(Pt,1)+1,kt=u(Pt,1),Dt=u(Pt,0==kt?1:8);Et[Dt]=1,2==Rt&&(Et[Dt=u(Pt,8)]=1);var Vt=1}else{var Ot=Be(19),Mt=u(Pt,4)+4;if(19<Mt){vt.a=3;var Ft=0;break n}for(xt=0;xt<Mt;++xt)Ot[Jn[xt]]=u(Pt,3);var Gt=void 0,Nt=void 0,Bt=vt,Wt=Ot,Ht=bt,Yt=Et,$t=0,Ut=Bt.m,jt=8,zt=We(128,n);s:for(;i(zt,0,7,Wt,19);){if(u(Ut,1)){var Xt=2+2*u(Ut,3);if((Gt=2+u(Ut,Xt))>Ht)break s}else Gt=Ht;for(Nt=0;Nt<Ht&&Gt--;){_(Ut);var Kt=zt[0+(127&f(Ut))];p(Ut,Ut.u+Kt.g);var Jt=Kt.value;if(16>Jt)Yt[Nt++]=Jt,0!=Jt&&(jt=Jt);else{var qt=16==Jt,Zt=Jt-16,Qt=zn[Zt],te=u(Ut,jn[Zt])+Qt;if(Nt+te>Ht)break s;for(var ee=qt?jt:0;0<te--;)Yt[Nt++]=ee}}$t=1;break s}$t||(Bt.a=3),Vt=$t}(Vt=Vt&&!Pt.h)&&(At=i(It,Ct,8,Et,bt)),Vt&&0!=At?Ft=At:(vt.a=3,Ft=0)}if(0==Ft)break i;if(_t&&1==Kn[W]&&(_t=0==dt[H].g),pt+=dt[H].g,H+=Ft,3>=W){var ie,ne=ct[0];for(ie=1;ie<rt;++ie)ct[ie]>ne&&(ne=ct[ie]);wt+=ne}}if(gt.nd=_t,gt.Qb=0,_t&&(gt.qb=(ft[3][mt[3]+0].value<<24|ft[1][mt[1]+0].value<<16|ft[2][mt[2]+0].value)>>>0,0==pt&&256>ft[0][mt[0]+0].value&&(gt.Qb=1,gt.qb+=ft[0][mt[0]+0].value<<8)),gt.jc=!gt.Qb&&6>wt,gt.jc){var se,re=gt;for(se=0;se<Fi;++se){var ae=se,oe=re.pd[ae],le=re.G[0][re.H[0]+ae];256<=le.value?(oe.g=le.g+256,oe.value=le.value):(oe.g=0,oe.value=0,ae>>=ut(le,8,oe),ae>>=ut(re.G[1][re.H[1]+ae],16,oe),ae>>=ut(re.G[2][re.H[2]+ae],0,oe),ut(re.G[3][re.H[3]+ae],24,oe))}}}K.vc=J,K.Wb=q,K.Ya=ht,K.yc=at,N=1;break e}N=0}if(!(l=N)){a.a=3;break t}if(0<T){if(g.ua=1<<T,!E(g.Wa,T)){a.a=1,l=0;break t}}else g.ua=0;var he=a,ce=h,ue=c,de=he.s,ge=de.xc;if(he.c=ce,he.i=ue,de.md=P(ce,ge),de.wc=0==ge?-1:(1<<ge)-1,s){a.xb=gs;break t}if(null==(m=Be(h*c))){a.a=1,l=0;break t}l=(l=Tt(a,m,0,h,c,c,null))&&!d.h;break t}return l?(null!=o?o[0]=m:(Me(null==m),Me(s)),a.$=0,s||yt(g)):yt(g),l}function xt(t,e){var i=t.c*t.i,n=i+e+16*e;return Me(t.c<=e),t.V=Be(n),null==t.V?(t.Ta=null,t.Ua=0,t.a=1,0):(t.Ta=t.V,t.Ua=t.Ba+i+e,1)}function bt(t,e){var i=t.C,n=e-i,s=t.V,r=t.Ba+t.c*i;for(Me(e<=t.l.o);0<n;){var a=16<n?16:n,o=t.l.ma,l=t.l.width,h=l*a,c=o.ca,u=o.tb+l*i,d=t.Ta,g=t.Ua;gt(t,a,s,r),En(d,g,c,u,h),pt(o,i,i+a,c,u,l),n-=a,s+=a*t.c,i+=a}Me(i==e),t.C=t.Ma=e}function vt(){this.ub=this.yd=this.td=this.Rb=0}function Et(){this.Kd=this.Ld=this.Ud=this.Td=this.i=this.c=0}function It(){this.Fb=this.Bb=this.Cb=0,this.Zb=Be(4),this.Lb=Be(4)}function Ct(){this.Yb=function(){var t=[];return function t(e,i,n){for(var s=n[i],r=0;r<s&&(e.push(n.length>i+1?[]:0),!(n.length<i+1));r++)t(e[r],i+1,n)}(t,0,[3,11]),t}()}function At(){this.jb=Be(3),this.Wc=He([4,8],Ct),this.Xc=He([4,17],Ct)}function Pt(){this.Pc=this.wb=this.Tb=this.zd=0,this.vd=new Be(4),this.od=new Be(4)}function Lt(){this.ld=this.La=this.dd=this.tc=0}function Rt(){this.Na=this.la=0}function kt(){this.Sc=[0,0],this.Eb=[0,0],this.Qc=[0,0],this.ia=this.lc=0}function Dt(){this.ad=Be(384),this.Za=0,this.Ob=Be(16),this.$b=this.Ad=this.ia=this.Gc=this.Hc=this.Dd=0}function Vt(){this.uc=this.M=this.Nb=0,this.wa=Array(new Lt),this.Y=0,this.ya=Array(new Dt),this.aa=0,this.l=new Gt}function Ot(){this.y=Be(16),this.f=Be(8),this.ea=Be(8)}function Mt(){this.cb=this.a=0,this.sc="",this.m=new d,this.Od=new vt,this.Kc=new Et,this.ed=new Pt,this.Qa=new It,this.Ic=this.$c=this.Aa=0,this.D=new Vt,this.Xb=this.Va=this.Hb=this.zb=this.yb=this.Ub=this.za=0,this.Jc=We(8,d),this.ia=0,this.pb=We(4,kt),this.Pa=new At,this.Bd=this.kc=0,this.Ac=[],this.Bc=0,this.zc=[0,0,0,0],this.Gd=Array(new Ot),this.Hd=0,this.rb=Array(new Rt),this.sb=0,this.wa=Array(new Lt),this.Y=0,this.oc=[],this.pc=0,this.sa=[],this.ta=0,this.qa=[],this.ra=0,this.Ha=[],this.B=this.R=this.Ia=0,this.Ec=[],this.M=this.ja=this.Vb=this.Fc=0,this.ya=Array(new Dt),this.L=this.aa=0,this.gd=He([4,2],Lt),this.ga=null,this.Fa=[],this.Cc=this.qc=this.P=0,this.Gb=[],this.Uc=0,this.mb=[],this.nb=0,this.rc=[],this.Ga=this.Vc=0}function Ft(t,e){return 0>t?0:t>e?e:t}function Gt(){this.T=this.U=this.ka=this.height=this.width=0,this.y=[],this.f=[],this.ea=[],this.Rc=this.fa=this.W=this.N=this.O=0,this.ma="void",this.put="VP8IoPutHook",this.ac="VP8IoSetupHook",this.bc="VP8IoTeardownHook",this.ha=this.Kb=0,this.data=[],this.hb=this.ib=this.da=this.o=this.j=this.va=this.v=this.Da=this.ob=this.w=0,this.F=[],this.J=0}function Nt(){var t=new Mt;return null!=t&&(t.a=0,t.sc="OK",t.cb=0,t.Xb=0,is||(is=Yt)),t}function Bt(t,e,i){return 0==t.a&&(t.a=e,t.sc=i,t.cb=0),0}function Wt(t,e,i){return 3<=i&&157==t[e+0]&&1==t[e+1]&&42==t[e+2]}function Ht(t,e){if(null==t)return 0;if(t.a=0,t.sc="OK",null==e)return Bt(t,2,"null VP8Io passed to VP8GetHeaders()");var i=e.data,n=e.w,s=e.ha;if(4>s)return Bt(t,7,"Truncated header.");var r=i[n+0]|i[n+1]<<8|i[n+2]<<16,h=t.Od;if(h.Rb=!(1&r),h.td=r>>1&7,h.yd=r>>4&1,h.ub=r>>5,3<h.td)return Bt(t,3,"Incorrect keyframe parameters.");if(!h.yd)return Bt(t,4,"Frame not displayable.");n+=3,s-=3;var c=t.Kc;if(h.Rb){if(7>s)return Bt(t,7,"cannot parse picture header");if(!Wt(i,n,s))return Bt(t,3,"Bad code word");c.c=16383&(i[n+4]<<8|i[n+3]),c.Td=i[n+4]>>6,c.i=16383&(i[n+6]<<8|i[n+5]),c.Ud=i[n+6]>>6,n+=7,s-=7,t.za=c.c+15>>4,t.Ub=c.i+15>>4,e.width=c.c,e.height=c.i,e.Da=0,e.j=0,e.v=0,e.va=e.width,e.o=e.height,e.da=0,e.ib=e.width,e.hb=e.height,e.U=e.width,e.T=e.height,Ne((r=t.Pa).jb,0,255,r.jb.length),Me(null!=(r=t.Qa)),r.Cb=0,r.Bb=0,r.Fb=1,Ne(r.Zb,0,0,r.Zb.length),Ne(r.Lb,0,0,r.Lb)}if(h.ub>s)return Bt(t,7,"bad partition length");a(r=t.m,i,n,h.ub),n+=h.ub,s-=h.ub,h.Rb&&(c.Ld=y(r),c.Kd=y(r)),c=t.Qa;var u,d=t.Pa;if(Me(null!=r),Me(null!=c),c.Cb=y(r),c.Cb){if(c.Bb=y(r),y(r)){for(c.Fb=y(r),u=0;4>u;++u)c.Zb[u]=y(r)?l(r,7):0;for(u=0;4>u;++u)c.Lb[u]=y(r)?l(r,6):0}if(c.Bb)for(u=0;3>u;++u)d.jb[u]=y(r)?o(r,8):255}else c.Bb=0;if(r.Ka)return Bt(t,3,"cannot parse segment header");if((c=t.ed).zd=y(r),c.Tb=o(r,6),c.wb=o(r,3),c.Pc=y(r),c.Pc&&y(r)){for(d=0;4>d;++d)y(r)&&(c.vd[d]=l(r,6));for(d=0;4>d;++d)y(r)&&(c.od[d]=l(r,6))}if(t.L=0==c.Tb?0:c.zd?1:2,r.Ka)return Bt(t,3,"cannot parse filter header");var g=s;if(s=u=n,n=u+g,c=g,t.Xb=(1<<o(t.m,2))-1,g<3*(d=t.Xb))i=7;else{for(u+=3*d,c-=3*d,g=0;g<d;++g){var f=i[s+0]|i[s+1]<<8|i[s+2]<<16;f>c&&(f=c),a(t.Jc[+g],i,u,f),u+=f,c-=f,s+=3}a(t.Jc[+d],i,u,c),i=u<n?0:5}if(0!=i)return Bt(t,i,"cannot parse partitions");for(i=o(u=t.m,7),s=y(u)?l(u,4):0,n=y(u)?l(u,4):0,c=y(u)?l(u,4):0,d=y(u)?l(u,4):0,u=y(u)?l(u,4):0,g=t.Qa,f=0;4>f;++f){if(g.Cb){var m=g.Zb[f];g.Fb||(m+=i)}else{if(0<f){t.pb[f]=t.pb[0];continue}m=i}var p=t.pb[f];p.Sc[0]=ts[Ft(m+s,127)],p.Sc[1]=es[Ft(m+0,127)],p.Eb[0]=2*ts[Ft(m+n,127)],p.Eb[1]=101581*es[Ft(m+c,127)]>>16,8>p.Eb[1]&&(p.Eb[1]=8),p.Qc[0]=ts[Ft(m+d,117)],p.Qc[1]=es[Ft(m+u,127)],p.lc=m+u}if(!h.Rb)return Bt(t,4,"Not a key frame.");for(y(r),h=t.Pa,i=0;4>i;++i){for(s=0;8>s;++s)for(n=0;3>n;++n)for(c=0;11>c;++c)d=w(r,ls[i][s][n][c])?o(r,8):as[i][s][n][c],h.Wc[i][s].Yb[n][c]=d;for(s=0;17>s;++s)h.Xc[i][s]=h.Wc[i][hs[s]]}return t.kc=y(r),t.kc&&(t.Bd=o(r,8)),t.cb=1}function Yt(t,e,i,n,s,r,a){var o=e[s].Yb[i];for(i=0;16>s;++s){if(!w(t,o[i+0]))return s;for(;!w(t,o[i+1]);)if(o=e[++s].Yb[0],i=0,16==s)return 16;var l=e[s+1].Yb;if(w(t,o[i+2])){var h=t,c=0;if(w(h,(d=o)[(u=i)+3]))if(w(h,d[u+6])){for(o=0,u=2*(c=w(h,d[u+8]))+(d=w(h,d[u+9+c])),c=0,d=ns[u];d[o];++o)c+=c+w(h,d[o]);c+=3+(8<<u)}else w(h,d[u+7])?(c=7+2*w(h,165),c+=w(h,145)):c=5+w(h,159);else c=w(h,d[u+4])?3+w(h,d[u+5]):2;o=l[2]}else c=1,o=l[1];l=a+ss[s],0>(h=t).b&&T(h);var u,d=h.b,g=(u=h.Ca>>1)-(h.I>>d)>>31;--h.b,h.Ca+=g,h.Ca|=1,h.I-=(u+1&g)<<d,r[l]=((c^g)-g)*n[(0<s)+0]}return 16}function $t(t){var e=t.rb[t.sb-1];e.la=0,e.Na=0,Ne(t.zc,0,0,t.zc.length),t.ja=0}function Ut(t,e){if(null==t)return 0;if(null==e)return Bt(t,2,"NULL VP8Io parameter in VP8Decode().");if(!t.cb&&!Ht(t,e))return 0;if(Me(t.cb),null==e.ac||e.ac(e)){e.ob&&(t.L=0);var i=Gs[t.L];if(2==t.L?(t.yb=0,t.zb=0):(t.yb=e.v-i>>4,t.zb=e.j-i>>4,0>t.yb&&(t.yb=0),0>t.zb&&(t.zb=0)),t.Va=e.o+15+i>>4,t.Hb=e.va+15+i>>4,t.Hb>t.za&&(t.Hb=t.za),t.Va>t.Ub&&(t.Va=t.Ub),0<t.L){var n=t.ed;for(i=0;4>i;++i){var s;if(t.Qa.Cb){var r=t.Qa.Lb[i];t.Qa.Fb||(r+=n.Tb)}else r=n.Tb;for(s=0;1>=s;++s){var a=t.gd[i][s],o=r;if(n.Pc&&(o+=n.vd[0],s&&(o+=n.od[0])),0<(o=0>o?0:63<o?63:o)){var l=o;0<n.wb&&((l=4<n.wb?l>>2:l>>1)>9-n.wb&&(l=9-n.wb)),1>l&&(l=1),a.dd=l,a.tc=2*o+l,a.ld=40<=o?2:15<=o?1:0}else a.tc=0;a.La=s}}}i=0}else Bt(t,6,"Frame setup failed"),i=t.a;if(i=0==i){if(i){t.$c=0,0<t.Aa||(t.Ic=Bs);t:{i=t.Ic;n=4*(l=t.za);var h=32*l,c=l+1,u=0<t.L?l*(0<t.Aa?2:1):0,d=(2==t.Aa?2:1)*l;if((a=n+832+(s=3*(16*i+Gs[t.L])/2*h)+(r=null!=t.Fa&&0<t.Fa.length?t.Kc.c*t.Kc.i:0))!=a)i=0;else{if(a>t.Vb){if(t.Vb=0,t.Ec=Be(a),t.Fc=0,null==t.Ec){i=Bt(t,1,"no memory during frame initialization.");break t}t.Vb=a}a=t.Ec,o=t.Fc,t.Ac=a,t.Bc=o,o+=n,t.Gd=We(h,Ot),t.Hd=0,t.rb=We(c+1,Rt),t.sb=1,t.wa=u?We(u,Lt):null,t.Y=0,t.D.Nb=0,t.D.wa=t.wa,t.D.Y=t.Y,0<t.Aa&&(t.D.Y+=l),Me(!0),t.oc=a,t.pc=o,o+=832,t.ya=We(d,Dt),t.aa=0,t.D.ya=t.ya,t.D.aa=t.aa,2==t.Aa&&(t.D.aa+=l),t.R=16*l,t.B=8*l,l=(h=Gs[t.L])*t.R,h=h/2*t.B,t.sa=a,t.ta=o+l,t.qa=t.sa,t.ra=t.ta+16*i*t.R+h,t.Ha=t.qa,t.Ia=t.ra+8*i*t.B+h,t.$c=0,o+=s,t.mb=r?a:null,t.nb=r?o:null,Me(o+r<=t.Fc+t.Vb),$t(t),Ne(t.Ac,t.Bc,0,n),i=1}}if(i){if(e.ka=0,e.y=t.sa,e.O=t.ta,e.f=t.qa,e.N=t.ra,e.ea=t.Ha,e.Vd=t.Ia,e.fa=t.R,e.Rc=t.B,e.F=null,e.J=0,!Ln){for(i=-255;255>=i;++i)In[255+i]=0>i?-i:i;for(i=-1020;1020>=i;++i)Cn[1020+i]=-128>i?-128:127<i?127:i;for(i=-112;112>=i;++i)An[112+i]=-16>i?-16:15<i?15:i;for(i=-255;510>=i;++i)Pn[255+i]=0>i?0:255<i?255:i;Ln=1}sn=ee,rn=qt,on=Zt,ln=Qt,hn=te,an=Jt,cn=ze,un=Xe,dn=qe,gn=Ze,fn=Ke,mn=Je,pn=Qe,_n=ti,Tn=Ve,yn=Oe,wn=Ye,Sn=$e,us[0]=pe,us[1]=ne,us[2]=fe,us[3]=me,us[4]=_e,us[5]=ye,us[6]=Te,us[7]=we,us[8]=xe,us[9]=Se,cs[0]=he,cs[1]=re,cs[2]=ae,cs[3]=oe,cs[4]=ce,cs[5]=ue,cs[6]=de,ds[0]=Ie,ds[1]=se,ds[2]=be,ds[3]=ve,ds[4]=Ae,ds[5]=Ce,ds[6]=Pe,i=1}else i=0}i&&(i=function(t,e){for(t.M=0;t.M<t.Va;++t.M){var i,n=t.Jc[t.M&t.Xb],s=t.m,r=t;for(i=0;i<r.za;++i){var a=s,o=r,l=o.Ac,h=o.Bc+4*i,c=o.zc,u=o.ya[o.aa+i];if(o.Qa.Bb?u.$b=w(a,o.Pa.jb[0])?2+w(a,o.Pa.jb[2]):w(a,o.Pa.jb[1]):u.$b=0,o.kc&&(u.Ad=w(a,o.Bd)),u.Za=!w(a,145)+0,u.Za){var d=u.Ob,g=0;for(o=0;4>o;++o){var f,m=c[0+o];for(f=0;4>f;++f){m=os[l[h+f]][m];for(var p=rs[w(a,m[0])];0<p;)p=rs[2*p+w(a,m[p])];m=-p,l[h+f]=m}Ge(d,g,l,h,4),g+=4,c[0+o]=m}}else m=w(a,156)?w(a,128)?1:3:w(a,163)?2:0,u.Ob[0]=m,Ne(l,h,m,4),Ne(c,0,m,4);u.Dd=w(a,142)?w(a,114)?w(a,183)?1:3:2:0}if(r.m.Ka)return Bt(t,7,"Premature end-of-partition0 encountered.");for(;t.ja<t.za;++t.ja){if(r=n,a=(s=t).rb[s.sb-1],l=s.rb[s.sb+s.ja],i=s.ya[s.aa+s.ja],h=s.kc?i.Ad:0)a.la=l.la=0,i.Za||(a.Na=l.Na=0),i.Hc=0,i.Gc=0,i.ia=0;else{var _,T;if(a=l,l=r,h=s.Pa.Xc,c=s.ya[s.aa+s.ja],u=s.pb[c.$b],o=c.ad,d=0,g=s.rb[s.sb-1],m=f=0,Ne(o,d,0,384),c.Za)var y=0,S=h[3];else{p=Be(16);var x=a.Na+g.Na;if(x=is(l,h[1],x,u.Eb,0,p,0),a.Na=g.Na=(0<x)+0,1<x)sn(p,0,o,d);else{var b=p[0]+3>>3;for(p=0;256>p;p+=16)o[d+p]=b}y=1,S=h[0]}var v=15&a.la,E=15&g.la;for(p=0;4>p;++p){var I=1&E;for(b=T=0;4>b;++b)v=v>>1|(I=(x=is(l,S,x=I+(1&v),u.Sc,y,o,d))>y)<<7,T=T<<2|(3<x?3:1<x?2:0!=o[d+0]),d+=16;v>>=4,E=E>>1|I<<7,f=(f<<8|T)>>>0}for(S=v,y=E>>4,_=0;4>_;_+=2){for(T=0,v=a.la>>4+_,E=g.la>>4+_,p=0;2>p;++p){for(I=1&E,b=0;2>b;++b)x=I+(1&v),v=v>>1|(I=0<(x=is(l,h[2],x,u.Qc,0,o,d)))<<3,T=T<<2|(3<x?3:1<x?2:0!=o[d+0]),d+=16;v>>=2,E=E>>1|I<<5}m|=T<<4*_,S|=v<<4<<_,y|=(240&E)<<_}a.la=S,g.la=y,c.Hc=f,c.Gc=m,c.ia=43690&m?0:u.ia,h=!(f|m)}if(0<s.L&&(s.wa[s.Y+s.ja]=s.gd[i.$b][i.Za],s.wa[s.Y+s.ja].La|=!h),r.Ka)return Bt(t,7,"Premature end-of-file encountered.")}if($t(t),s=e,r=1,i=(n=t).D,a=0<n.L&&n.M>=n.zb&&n.M<=n.Va,0==n.Aa)t:{if(i.M=n.M,i.uc=a,ki(n,i),r=1,i=(T=n.D).Nb,a=(m=Gs[n.L])*n.R,l=m/2*n.B,p=16*i*n.R,b=8*i*n.B,h=n.sa,c=n.ta-a+p,u=n.qa,o=n.ra-l+b,d=n.Ha,g=n.Ia-l+b,E=0==(v=T.M),f=v>=n.Va-1,2==n.Aa&&ki(n,T),T.uc)for(I=(x=n).D.M,Me(x.D.uc),T=x.yb;T<x.Hb;++T){y=T,S=I;var C=(A=(F=x).D).Nb;_=F.R;var A=A.wa[A.Y+y],P=F.sa,L=F.ta+16*C*_+16*y,R=A.dd,k=A.tc;if(0!=k)if(Me(3<=k),1==F.L)0<y&&yn(P,L,_,k+4),A.La&&Sn(P,L,_,k),0<S&&Tn(P,L,_,k+4),A.La&&wn(P,L,_,k);else{var D=F.B,V=F.qa,O=F.ra+8*C*D+8*y,M=F.Ha,F=F.Ia+8*C*D+8*y;C=A.ld,0<y&&(un(P,L,_,k+4,R,C),gn(V,O,M,F,D,k+4,R,C)),A.La&&(mn(P,L,_,k,R,C),_n(V,O,M,F,D,k,R,C)),0<S&&(cn(P,L,_,k+4,R,C),dn(V,O,M,F,D,k+4,R,C)),A.La&&(fn(P,L,_,k,R,C),pn(V,O,M,F,D,k,R,C))}}if(n.ia&&alert("todo:DitherRow"),null!=s.put){if(T=16*v,v=16*(v+1),E?(s.y=n.sa,s.O=n.ta+p,s.f=n.qa,s.N=n.ra+b,s.ea=n.Ha,s.W=n.Ia+b):(T-=m,s.y=h,s.O=c,s.f=u,s.N=o,s.ea=d,s.W=g),f||(v-=m),v>s.o&&(v=s.o),s.F=null,s.J=null,null!=n.Fa&&0<n.Fa.length&&T<v&&(s.J=ci(n,s,T,v-T),s.F=n.mb,null==s.F&&0==s.F.length)){r=Bt(n,3,"Could not decode alpha data.");break t}T<s.j&&(m=s.j-T,T=s.j,Me(!(1&m)),s.O+=n.R*m,s.N+=n.B*(m>>1),s.W+=n.B*(m>>1),null!=s.F&&(s.J+=s.width*m)),T<v&&(s.O+=s.v,s.N+=s.v>>1,s.W+=s.v>>1,null!=s.F&&(s.J+=s.v),s.ka=T-s.j,s.U=s.va-s.v,s.T=v-T,r=s.put(s))}i+1!=n.Ic||f||(Ge(n.sa,n.ta-a,h,c+16*n.R,a),Ge(n.qa,n.ra-l,u,o+8*n.B,l),Ge(n.Ha,n.Ia-l,d,g+8*n.B,l))}if(!r)return Bt(t,6,"Output aborted.")}return 1}(t,e)),null!=e.bc&&e.bc(e),i&=1}return i?(t.cb=0,i):0}function jt(t,e,i,n,s){s=t[e+i+32*n]+(s>>3),t[e+i+32*n]=-256&s?0>s?0:255:s}function zt(t,e,i,n,s,r){jt(t,e,0,i,n+s),jt(t,e,1,i,n+r),jt(t,e,2,i,n-r),jt(t,e,3,i,n-s)}function Xt(t){return(20091*t>>16)+t}function Kt(t,e,i,n){var s,r=0,a=Be(16);for(s=0;4>s;++s){var o=t[e+0]+t[e+8],l=t[e+0]-t[e+8],h=(35468*t[e+4]>>16)-Xt(t[e+12]),c=Xt(t[e+4])+(35468*t[e+12]>>16);a[r+0]=o+c,a[r+1]=l+h,a[r+2]=l-h,a[r+3]=o-c,r+=4,e++}for(s=r=0;4>s;++s)o=(t=a[r+0]+4)+a[r+8],l=t-a[r+8],h=(35468*a[r+4]>>16)-Xt(a[r+12]),jt(i,n,0,0,o+(c=Xt(a[r+4])+(35468*a[r+12]>>16))),jt(i,n,1,0,l+h),jt(i,n,2,0,l-h),jt(i,n,3,0,o-c),r++,n+=32}function Jt(t,e,i,n){var s=t[e+0]+4,r=35468*t[e+4]>>16,a=Xt(t[e+4]),o=35468*t[e+1]>>16;zt(i,n,0,s+a,t=Xt(t[e+1]),o),zt(i,n,1,s+r,t,o),zt(i,n,2,s-r,t,o),zt(i,n,3,s-a,t,o)}function qt(t,e,i,n,s){Kt(t,e,i,n),s&&Kt(t,e+16,i,n+4)}function Zt(t,e,i,n){rn(t,e+0,i,n,1),rn(t,e+32,i,n+128,1)}function Qt(t,e,i,n){var s;for(t=t[e+0]+4,s=0;4>s;++s)for(e=0;4>e;++e)jt(i,n,e,s,t)}function te(t,e,i,n){t[e+0]&&ln(t,e+0,i,n),t[e+16]&&ln(t,e+16,i,n+4),t[e+32]&&ln(t,e+32,i,n+128),t[e+48]&&ln(t,e+48,i,n+128+4)}function ee(t,e,i,n){var s,r=Be(16);for(s=0;4>s;++s){var a=t[e+0+s]+t[e+12+s],o=t[e+4+s]+t[e+8+s],l=t[e+4+s]-t[e+8+s],h=t[e+0+s]-t[e+12+s];r[0+s]=a+o,r[8+s]=a-o,r[4+s]=h+l,r[12+s]=h-l}for(s=0;4>s;++s)a=(t=r[0+4*s]+3)+r[3+4*s],o=r[1+4*s]+r[2+4*s],l=r[1+4*s]-r[2+4*s],h=t-r[3+4*s],i[n+0]=a+o>>3,i[n+16]=h+l>>3,i[n+32]=a-o>>3,i[n+48]=h-l>>3,n+=64}function ie(t,e,i){var n,s=e-32,r=Dn,a=255-t[s-1];for(n=0;n<i;++n){var o,l=r,h=a+t[e-1];for(o=0;o<i;++o)t[e+o]=l[h+t[s+o]];e+=32}}function ne(t,e){ie(t,e,4)}function se(t,e){ie(t,e,8)}function re(t,e){ie(t,e,16)}function ae(t,e){var i;for(i=0;16>i;++i)Ge(t,e+32*i,t,e-32,16)}function oe(t,e){var i;for(i=16;0<i;--i)Ne(t,e,t[e-1],16),e+=32}function le(t,e,i){var n;for(n=0;16>n;++n)Ne(e,i+32*n,t,16)}function he(t,e){var i,n=16;for(i=0;16>i;++i)n+=t[e-1+32*i]+t[e+i-32];le(n>>5,t,e)}function ce(t,e){var i,n=8;for(i=0;16>i;++i)n+=t[e-1+32*i];le(n>>4,t,e)}function ue(t,e){var i,n=8;for(i=0;16>i;++i)n+=t[e+i-32];le(n>>4,t,e)}function de(t,e){le(128,t,e)}function ge(t,e,i){return t+2*e+i+2>>2}function fe(t,e){var i,n=e-32;n=new Uint8Array([ge(t[n-1],t[n+0],t[n+1]),ge(t[n+0],t[n+1],t[n+2]),ge(t[n+1],t[n+2],t[n+3]),ge(t[n+2],t[n+3],t[n+4])]);for(i=0;4>i;++i)Ge(t,e+32*i,n,0,n.length)}function me(t,e){var i=t[e-1],n=t[e-1+32],s=t[e-1+64],r=t[e-1+96];S(t,e+0,16843009*ge(t[e-1-32],i,n)),S(t,e+32,16843009*ge(i,n,s)),S(t,e+64,16843009*ge(n,s,r)),S(t,e+96,16843009*ge(s,r,r))}function pe(t,e){var i,n=4;for(i=0;4>i;++i)n+=t[e+i-32]+t[e-1+32*i];for(n>>=3,i=0;4>i;++i)Ne(t,e+32*i,n,4)}function _e(t,e){var i=t[e-1+0],n=t[e-1+32],s=t[e-1+64],r=t[e-1-32],a=t[e+0-32],o=t[e+1-32],l=t[e+2-32],h=t[e+3-32];t[e+0+96]=ge(n,s,t[e-1+96]),t[e+1+96]=t[e+0+64]=ge(i,n,s),t[e+2+96]=t[e+1+64]=t[e+0+32]=ge(r,i,n),t[e+3+96]=t[e+2+64]=t[e+1+32]=t[e+0+0]=ge(a,r,i),t[e+3+64]=t[e+2+32]=t[e+1+0]=ge(o,a,r),t[e+3+32]=t[e+2+0]=ge(l,o,a),t[e+3+0]=ge(h,l,o)}function Te(t,e){var i=t[e+1-32],n=t[e+2-32],s=t[e+3-32],r=t[e+4-32],a=t[e+5-32],o=t[e+6-32],l=t[e+7-32];t[e+0+0]=ge(t[e+0-32],i,n),t[e+1+0]=t[e+0+32]=ge(i,n,s),t[e+2+0]=t[e+1+32]=t[e+0+64]=ge(n,s,r),t[e+3+0]=t[e+2+32]=t[e+1+64]=t[e+0+96]=ge(s,r,a),t[e+3+32]=t[e+2+64]=t[e+1+96]=ge(r,a,o),t[e+3+64]=t[e+2+96]=ge(a,o,l),t[e+3+96]=ge(o,l,l)}function ye(t,e){var i=t[e-1+0],n=t[e-1+32],s=t[e-1+64],r=t[e-1-32],a=t[e+0-32],o=t[e+1-32],l=t[e+2-32],h=t[e+3-32];t[e+0+0]=t[e+1+64]=r+a+1>>1,t[e+1+0]=t[e+2+64]=a+o+1>>1,t[e+2+0]=t[e+3+64]=o+l+1>>1,t[e+3+0]=l+h+1>>1,t[e+0+96]=ge(s,n,i),t[e+0+64]=ge(n,i,r),t[e+0+32]=t[e+1+96]=ge(i,r,a),t[e+1+32]=t[e+2+96]=ge(r,a,o),t[e+2+32]=t[e+3+96]=ge(a,o,l),t[e+3+32]=ge(o,l,h)}function we(t,e){var i=t[e+0-32],n=t[e+1-32],s=t[e+2-32],r=t[e+3-32],a=t[e+4-32],o=t[e+5-32],l=t[e+6-32],h=t[e+7-32];t[e+0+0]=i+n+1>>1,t[e+1+0]=t[e+0+64]=n+s+1>>1,t[e+2+0]=t[e+1+64]=s+r+1>>1,t[e+3+0]=t[e+2+64]=r+a+1>>1,t[e+0+32]=ge(i,n,s),t[e+1+32]=t[e+0+96]=ge(n,s,r),t[e+2+32]=t[e+1+96]=ge(s,r,a),t[e+3+32]=t[e+2+96]=ge(r,a,o),t[e+3+64]=ge(a,o,l),t[e+3+96]=ge(o,l,h)}function Se(t,e){var i=t[e-1+0],n=t[e-1+32],s=t[e-1+64],r=t[e-1+96];t[e+0+0]=i+n+1>>1,t[e+2+0]=t[e+0+32]=n+s+1>>1,t[e+2+32]=t[e+0+64]=s+r+1>>1,t[e+1+0]=ge(i,n,s),t[e+3+0]=t[e+1+32]=ge(n,s,r),t[e+3+32]=t[e+1+64]=ge(s,r,r),t[e+3+64]=t[e+2+64]=t[e+0+96]=t[e+1+96]=t[e+2+96]=t[e+3+96]=r}function xe(t,e){var i=t[e-1+0],n=t[e-1+32],s=t[e-1+64],r=t[e-1+96],a=t[e-1-32],o=t[e+0-32],l=t[e+1-32],h=t[e+2-32];t[e+0+0]=t[e+2+32]=i+a+1>>1,t[e+0+32]=t[e+2+64]=n+i+1>>1,t[e+0+64]=t[e+2+96]=s+n+1>>1,t[e+0+96]=r+s+1>>1,t[e+3+0]=ge(o,l,h),t[e+2+0]=ge(a,o,l),t[e+1+0]=t[e+3+32]=ge(i,a,o),t[e+1+32]=t[e+3+64]=ge(n,i,a),t[e+1+64]=t[e+3+96]=ge(s,n,i),t[e+1+96]=ge(r,s,n)}function be(t,e){var i;for(i=0;8>i;++i)Ge(t,e+32*i,t,e-32,8)}function ve(t,e){var i;for(i=0;8>i;++i)Ne(t,e,t[e-1],8),e+=32}function Ee(t,e,i){var n;for(n=0;8>n;++n)Ne(e,i+32*n,t,8)}function Ie(t,e){var i,n=8;for(i=0;8>i;++i)n+=t[e+i-32]+t[e-1+32*i];Ee(n>>4,t,e)}function Ce(t,e){var i,n=4;for(i=0;8>i;++i)n+=t[e+i-32];Ee(n>>3,t,e)}function Ae(t,e){var i,n=4;for(i=0;8>i;++i)n+=t[e-1+32*i];Ee(n>>3,t,e)}function Pe(t,e){Ee(128,t,e)}function Le(t,e,i){var n=t[e-i],s=t[e+0],r=3*(s-n)+Rn[1020+t[e-2*i]-t[e+i]],a=kn[112+(r+4>>3)];t[e-i]=Dn[255+n+kn[112+(r+3>>3)]],t[e+0]=Dn[255+s-a]}function Re(t,e,i,n){var s=t[e+0],r=t[e+i];return Vn[255+t[e-2*i]-t[e-i]]>n||Vn[255+r-s]>n}function ke(t,e,i,n){return 4*Vn[255+t[e-i]-t[e+0]]+Vn[255+t[e-2*i]-t[e+i]]<=n}function De(t,e,i,n,s){var r=t[e-3*i],a=t[e-2*i],o=t[e-i],l=t[e+0],h=t[e+i],c=t[e+2*i],u=t[e+3*i];return 4*Vn[255+o-l]+Vn[255+a-h]>n?0:Vn[255+t[e-4*i]-r]<=s&&Vn[255+r-a]<=s&&Vn[255+a-o]<=s&&Vn[255+u-c]<=s&&Vn[255+c-h]<=s&&Vn[255+h-l]<=s}function Ve(t,e,i,n){var s=2*n+1;for(n=0;16>n;++n)ke(t,e+n,i,s)&&Le(t,e+n,i)}function Oe(t,e,i,n){var s=2*n+1;for(n=0;16>n;++n)ke(t,e+n*i,1,s)&&Le(t,e+n*i,1)}function Ye(t,e,i,n){var s;for(s=3;0<s;--s)Ve(t,e+=4*i,i,n)}function $e(t,e,i,n){var s;for(s=3;0<s;--s)Oe(t,e+=4,i,n)}function Ue(t,e,i,n,s,r,a,o){for(r=2*r+1;0<s--;){if(De(t,e,i,r,a))if(Re(t,e,i,o))Le(t,e,i);else{var l=t,h=e,c=i,u=l[h-2*c],d=l[h-c],g=l[h+0],f=l[h+c],m=l[h+2*c],p=27*(T=Rn[1020+3*(g-d)+Rn[1020+u-f]])+63>>7,_=18*T+63>>7,T=9*T+63>>7;l[h-3*c]=Dn[255+l[h-3*c]+T],l[h-2*c]=Dn[255+u+_],l[h-c]=Dn[255+d+p],l[h+0]=Dn[255+g-p],l[h+c]=Dn[255+f-_],l[h+2*c]=Dn[255+m-T]}e+=n}}function je(t,e,i,n,s,r,a,o){for(r=2*r+1;0<s--;){if(De(t,e,i,r,a))if(Re(t,e,i,o))Le(t,e,i);else{var l=t,h=e,c=i,u=l[h-c],d=l[h+0],g=l[h+c],f=kn[112+((m=3*(d-u))+4>>3)],m=kn[112+(m+3>>3)],p=f+1>>1;l[h-2*c]=Dn[255+l[h-2*c]+p],l[h-c]=Dn[255+u+m],l[h+0]=Dn[255+d-f],l[h+c]=Dn[255+g-p]}e+=n}}function ze(t,e,i,n,s,r){Ue(t,e,i,1,16,n,s,r)}function Xe(t,e,i,n,s,r){Ue(t,e,1,i,16,n,s,r)}function Ke(t,e,i,n,s,r){var a;for(a=3;0<a;--a)je(t,e+=4*i,i,1,16,n,s,r)}function Je(t,e,i,n,s,r){var a;for(a=3;0<a;--a)je(t,e+=4,1,i,16,n,s,r)}function qe(t,e,i,n,s,r,a,o){Ue(t,e,s,1,8,r,a,o),Ue(i,n,s,1,8,r,a,o)}function Ze(t,e,i,n,s,r,a,o){Ue(t,e,1,s,8,r,a,o),Ue(i,n,1,s,8,r,a,o)}function Qe(t,e,i,n,s,r,a,o){je(t,e+4*s,s,1,8,r,a,o),je(i,n+4*s,s,1,8,r,a,o)}function ti(t,e,i,n,s,r,a,o){je(t,e+4,1,s,8,r,a,o),je(i,n+4,1,s,8,r,a,o)}function ei(){this.ba=new Z,this.ec=[],this.cc=[],this.Mc=[],this.Dc=this.Nc=this.dc=this.fc=0,this.Oa=new tt,this.memory=0,this.Ib="OutputFunc",this.Jb="OutputAlphaFunc",this.Nd="OutputRowFunc"}function ii(){this.data=[],this.offset=this.kd=this.ha=this.w=0,this.na=[],this.xa=this.gb=this.Ja=this.Sa=this.P=0}function ni(){this.nc=this.Ea=this.b=this.hc=0,this.K=[],this.w=0}function si(){this.ua=0,this.Wa=new C,this.vb=new C,this.md=this.xc=this.wc=0,this.vc=[],this.Wb=0,this.Ya=new r,this.yc=new n}function ri(){this.xb=this.a=0,this.l=new Gt,this.ca=new Z,this.V=[],this.Ba=0,this.Ta=[],this.Ua=0,this.m=new g,this.Pb=0,this.wd=new g,this.Ma=this.$=this.C=this.i=this.c=this.xd=0,this.s=new si,this.ab=0,this.gc=We(4,ni),this.Oc=0}function ai(){this.Lc=this.Z=this.$a=this.i=this.c=0,this.l=new Gt,this.ic=0,this.ca=[],this.tb=0,this.qd=null,this.rd=0}function oi(t,e,i,n,s,r,a){for(t=null==t?0:t[e+0],e=0;e<a;++e)s[r+e]=t+i[n+e]&255,t=s[r+e]}function li(t,e,i,n,s,r,a){var o;if(null==t)oi(null,null,i,n,s,r,a);else for(o=0;o<a;++o)s[r+o]=t[e+o]+i[n+o]&255}function hi(t,e,i,n,s,r,a){if(null==t)oi(null,null,i,n,s,r,a);else{var o,l=t[e+0],h=l,c=l;for(o=0;o<a;++o)h=c+(l=t[e+o])-h,c=i[n+o]+(-256&h?0>h?0:255:h)&255,h=l,s[r+o]=c}}function ci(t,e,i,n){var s=e.width,r=e.o;if(Me(null!=t&&null!=e),0>i||0>=n||i+n>r)return null;if(!t.Cc){if(null==t.ga){var a;if(t.ga=new ai,(a=null==t.ga)||(a=e.width*e.o,Me(0==t.Gb.length),t.Gb=Be(a),t.Uc=0,null==t.Gb?a=0:(t.mb=t.Gb,t.nb=t.Uc,t.rc=null,a=1),a=!a),!a){a=t.ga;var o=t.Fa,l=t.P,c=t.qc,u=t.mb,d=t.nb,g=l+1,f=c-1,p=a.l;if(Me(null!=o&&null!=u&&null!=e),ms[0]=null,ms[1]=oi,ms[2]=li,ms[3]=hi,a.ca=u,a.tb=d,a.c=e.width,a.i=e.height,Me(0<a.c&&0<a.i),1>=c)e=0;else if(a.$a=o[l+0]>>0&3,a.Z=o[l+0]>>2&3,a.Lc=o[l+0]>>4&3,l=o[l+0]>>6&3,0>a.$a||1<a.$a||4<=a.Z||1<a.Lc||l)e=0;else if(p.put=rt,p.ac=st,p.bc=at,p.ma=a,p.width=e.width,p.height=e.height,p.Da=e.Da,p.v=e.v,p.va=e.va,p.j=e.j,p.o=e.o,a.$a)t:{Me(1==a.$a),e=wt();e:for(;;){if(null==e){e=0;break t}if(Me(null!=a),a.mc=e,e.c=a.c,e.i=a.i,e.l=a.l,e.l.ma=a,e.l.width=a.c,e.l.height=a.i,e.a=0,h(e.m,o,g,f),!St(a.c,a.i,1,e,null))break e;if(1==e.ab&&3==e.gc[0].hc&&mt(e.s)?(a.ic=1,o=e.c*e.i,e.Ta=null,e.Ua=0,e.V=Be(o),e.Ba=0,null==e.V?(e.a=1,e=0):e=1):(a.ic=0,e=xt(e,a.c)),!e)break e;e=1;break t}a.mc=null,e=0}else e=f>=a.c*a.i;a=!e}if(a)return null;1!=t.ga.Lc?t.Ga=0:n=r-i}Me(null!=t.ga),Me(i+n<=r);t:{if(e=(o=t.ga).c,r=o.l.o,0==o.$a){if(g=t.rc,f=t.Vc,p=t.Fa,l=t.P+1+i*e,c=t.mb,u=t.nb+i*e,Me(l<=t.P+t.qc),0!=o.Z)for(Me(null!=ms[o.Z]),a=0;a<n;++a)ms[o.Z](g,f,p,l,c,u,e),g=c,f=u,u+=e,l+=e;else for(a=0;a<n;++a)Ge(c,u,p,l,e),g=c,f=u,u+=e,l+=e;t.rc=g,t.Vc=f}else{if(Me(null!=o.mc),e=i+n,Me(null!=(a=o.mc)),Me(e<=a.i),a.C>=e)e=1;else if(o.ic||mi(),o.ic){o=a.V,g=a.Ba,f=a.c;var T=a.i,y=(p=1,l=a.$/f,c=a.$%f,u=a.m,d=a.s,a.$),w=f*T,S=f*e,x=d.wc,b=y<S?dt(d,c,l):null;Me(y<=w),Me(e<=T),Me(mt(d));e:for(;;){for(;!u.h&&y<S;){if(c&x||(b=dt(d,c,l)),Me(null!=b),_(u),256>(T=ct(b.G[0],b.H[0],u)))o[g+y]=T,++y,++c>=f&&(c=0,++l<=e&&!(l%16)&&_t(a,l));else{if(!(280>T)){p=0;break e}T=lt(T-256,u);var v,E=ct(b.G[4],b.H[4],u);if(_(u),!(y>=(E=ht(f,E=lt(E,u)))&&w-y>=T)){p=0;break e}for(v=0;v<T;++v)o[g+y+v]=o[g+y+v-E];for(y+=T,c+=T;c>=f;)c-=f,++l<=e&&!(l%16)&&_t(a,l);y<S&&c&x&&(b=dt(d,c,l))}Me(u.h==m(u))}_t(a,l>e?e:l);break e}!p||u.h&&y<w?(p=0,a.a=u.h?5:3):a.$=y,e=p}else e=Tt(a,a.V,a.Ba,a.c,a.i,e,bt);if(!e){n=0;break t}}i+n>=r&&(t.Cc=1),n=1}if(!n)return null;if(t.Cc&&(null!=(n=t.ga)&&(n.mc=null),t.ga=null,0<t.Ga))return alert("todo:WebPDequantizeLevels"),null}return t.nb+i*s}function ui(t,e,i,n,s,r){for(;0<s--;){var a,o=t,l=e+(i?1:0),h=t,c=e+(i?0:3);for(a=0;a<n;++a){var u=h[c+4*a];255!=u&&(u*=32897,o[l+4*a+0]=o[l+4*a+0]*u>>23,o[l+4*a+1]=o[l+4*a+1]*u>>23,o[l+4*a+2]=o[l+4*a+2]*u>>23)}e+=r}}function di(t,e,i,n,s){for(;0<n--;){var r;for(r=0;r<i;++r){var a=t[e+2*r+0],o=15&(h=t[e+2*r+1]),l=4369*o,h=(240&h|h>>4)*l>>16;t[e+2*r+0]=(240&a|a>>4)*l>>16&240|(15&a|a<<4)*l>>16>>4&15,t[e+2*r+1]=240&h|o}e+=s}}function gi(t,e,i,n,s,r,a,o){var l,h,c=255;for(h=0;h<s;++h){for(l=0;l<n;++l){var u=t[e+l];r[a+4*l]=u,c&=u}e+=i,a+=o}return 255!=c}function fi(t,e,i,n,s){var r;for(r=0;r<s;++r)i[n+r]=t[e+r]>>8}function mi(){xn=ui,bn=di,vn=gi,En=fi}function pi(t,e,i){self[t]=function(t,n,s,r,a,o,l,h,c,u,d,g,f,m,p,_,T){var y,w=T-1>>1,S=a[o+0]|l[h+0]<<16,x=c[u+0]|d[g+0]<<16;Me(null!=t);var b=3*S+x+131074>>2;for(e(t[n+0],255&b,b>>16,f,m),null!=s&&(b=3*x+S+131074>>2,e(s[r+0],255&b,b>>16,p,_)),y=1;y<=w;++y){var v=a[o+y]|l[h+y]<<16,E=c[u+y]|d[g+y]<<16,I=S+v+x+E+524296,C=I+2*(v+x)>>3;b=C+S>>1,S=(I=I+2*(S+E)>>3)+v>>1,e(t[n+2*y-1],255&b,b>>16,f,m+(2*y-1)*i),e(t[n+2*y-0],255&S,S>>16,f,m+(2*y-0)*i),null!=s&&(b=I+x>>1,S=C+E>>1,e(s[r+2*y-1],255&b,b>>16,p,_+(2*y-1)*i),e(s[r+2*y+0],255&S,S>>16,p,_+(2*y+0)*i)),S=v,x=E}1&T||(b=3*S+x+131074>>2,e(t[n+T-1],255&b,b>>16,f,m+(T-1)*i),null!=s&&(b=3*x+S+131074>>2,e(s[r+T-1],255&b,b>>16,p,_+(T-1)*i)))}}function _i(){ps[On]=_s,ps[Mn]=ys,ps[Fn]=Ts,ps[Gn]=ws,ps[Nn]=Ss,ps[Bn]=xs,ps[Wn]=bs,ps[Hn]=ys,ps[Yn]=ws,ps[$n]=Ss,ps[Un]=xs}function Ti(t){return t&~Ps?0>t?0:255:t>>As}function yi(t,e){return Ti((19077*t>>8)+(26149*e>>8)-14234)}function wi(t,e,i){return Ti((19077*t>>8)-(6419*e>>8)-(13320*i>>8)+8708)}function Si(t,e){return Ti((19077*t>>8)+(33050*e>>8)-17685)}function xi(t,e,i,n,s){n[s+0]=yi(t,i),n[s+1]=wi(t,e,i),n[s+2]=Si(t,e)}function bi(t,e,i,n,s){n[s+0]=Si(t,e),n[s+1]=wi(t,e,i),n[s+2]=yi(t,i)}function vi(t,e,i,n,s){var r=wi(t,e,i);e=r<<3&224|Si(t,e)>>3,n[s+0]=248&yi(t,i)|r>>5,n[s+1]=e}function Ei(t,e,i,n,s){var r=240&Si(t,e)|15;n[s+0]=240&yi(t,i)|wi(t,e,i)>>4,n[s+1]=r}function Ii(t,e,i,n,s){n[s+0]=255,xi(t,e,i,n,s+1)}function Ci(t,e,i,n,s){bi(t,e,i,n,s),n[s+3]=255}function Ai(t,e,i,n,s){xi(t,e,i,n,s),n[s+3]=255}function Ft(t,e){return 0>t?0:t>e?e:t}function Pi(t,e,i){self[t]=function(t,n,s,r,a,o,l,h,c){for(var u=h+(-2&c)*i;h!=u;)e(t[n+0],s[r+0],a[o+0],l,h),e(t[n+1],s[r+0],a[o+0],l,h+i),n+=2,++r,++o,h+=2*i;1&c&&e(t[n+0],s[r+0],a[o+0],l,h)}}function Li(t,e,i){return 0==i?0==t?0==e?6:5:0==e?4:0:i}function Ri(t,e,i,n,s){switch(t>>>30){case 3:rn(e,i,n,s,0);break;case 2:an(e,i,n,s);break;case 1:ln(e,i,n,s)}}function ki(t,e){var i,n,s=e.M,r=e.Nb,a=t.oc,o=t.pc+40,l=t.oc,h=t.pc+584,c=t.oc,u=t.pc+600;for(i=0;16>i;++i)a[o+32*i-1]=129;for(i=0;8>i;++i)l[h+32*i-1]=129,c[u+32*i-1]=129;for(0<s?a[o-1-32]=l[h-1-32]=c[u-1-32]=129:(Ne(a,o-32-1,127,21),Ne(l,h-32-1,127,9),Ne(c,u-32-1,127,9)),n=0;n<t.za;++n){var d=e.ya[e.aa+n];if(0<n){for(i=-1;16>i;++i)Ge(a,o+32*i-4,a,o+32*i+12,4);for(i=-1;8>i;++i)Ge(l,h+32*i-4,l,h+32*i+4,4),Ge(c,u+32*i-4,c,u+32*i+4,4)}var g=t.Gd,f=t.Hd+n,m=d.ad,p=d.Hc;if(0<s&&(Ge(a,o-32,g[f].y,0,16),Ge(l,h-32,g[f].f,0,8),Ge(c,u-32,g[f].ea,0,8)),d.Za){var _=a,T=o-32+16;for(0<s&&(n>=t.za-1?Ne(_,T,g[f].y[15],4):Ge(_,T,g[f+1].y,0,4)),i=0;4>i;i++)_[T+128+i]=_[T+256+i]=_[T+384+i]=_[T+0+i];for(i=0;16>i;++i,p<<=2)_=a,T=o+Fs[i],us[d.Ob[i]](_,T),Ri(p,m,16*+i,_,T)}else if(_=Li(n,s,d.Ob[0]),cs[_](a,o),0!=p)for(i=0;16>i;++i,p<<=2)Ri(p,m,16*+i,a,o+Fs[i]);for(i=d.Gc,_=Li(n,s,d.Dd),ds[_](l,h),ds[_](c,u),p=m,_=l,T=h,255&(d=i>>0)&&(170&d?on(p,256,_,T):hn(p,256,_,T)),d=c,p=u,255&(i>>=8)&&(170&i?on(m,320,d,p):hn(m,320,d,p)),s<t.Ub-1&&(Ge(g[f].y,0,a,o+480,16),Ge(g[f].f,0,l,h+224,8),Ge(g[f].ea,0,c,u+224,8)),i=8*r*t.B,g=t.sa,f=t.ta+16*n+16*r*t.R,m=t.qa,d=t.ra+8*n+i,p=t.Ha,_=t.Ia+8*n+i,i=0;16>i;++i)Ge(g,f+i*t.R,a,o+32*i,16);for(i=0;8>i;++i)Ge(m,d+i*t.B,l,h+32*i,8),Ge(p,_+i*t.B,c,u+32*i,8)}}function Di(t,e,i,n,s,r,a,o,l){var c=[0],u=[0],d=0,f=null!=l?l.kd:0,m=null!=l?l:new ii;if(null==t||12>i)return 7;m.data=t,m.w=e,m.ha=i,e=[e],i=[i],m.gb=[m.gb];t:{var p=e,_=i,T=m.gb;if(Me(null!=t),Me(null!=_),Me(null!=T),T[0]=0,12<=_[0]&&!Fe(t,p[0],"RIFF")){if(Fe(t,p[0]+8,"WEBP")){T=3;break t}var y=v(t,p[0]+4);if(12>y||4294967286<y){T=3;break t}if(f&&y>_[0]-8){T=7;break t}T[0]=y,p[0]+=12,_[0]-=12}T=0}if(0!=T)return T;for(y=0<m.gb[0],i=i[0];;){t:{var w=t;_=e,T=i;var S=c,x=u,E=p=[0];if((A=d=[d])[0]=0,8>T[0])T=7;else{if(!Fe(w,_[0],"VP8X")){if(10!=v(w,_[0]+4)){T=3;break t}if(18>T[0]){T=7;break t}var I=v(w,_[0]+8),C=1+b(w,_[0]+12);if(2147483648<=C*(w=1+b(w,_[0]+15))){T=3;break t}null!=E&&(E[0]=I),null!=S&&(S[0]=C),null!=x&&(x[0]=w),_[0]+=18,T[0]-=18,A[0]=1}T=0}}if(d=d[0],p=p[0],0!=T)return T;if(_=!!(2&p),!y&&d)return 3;if(null!=r&&(r[0]=!!(16&p)),null!=a&&(a[0]=_),null!=o&&(o[0]=0),a=c[0],p=u[0],d&&_&&null==l){T=0;break}if(4>i){T=7;break}if(y&&d||!y&&!d&&!Fe(t,e[0],"ALPH")){i=[i],m.na=[m.na],m.P=[m.P],m.Sa=[m.Sa];t:{I=t,T=e,y=i;var A=m.gb;S=m.na,x=m.P,E=m.Sa;C=22,Me(null!=I),Me(null!=y),w=T[0];var P=y[0];for(Me(null!=S),Me(null!=E),S[0]=null,x[0]=null,E[0]=0;;){if(T[0]=w,y[0]=P,8>P){T=7;break t}var L=v(I,w+4);if(4294967286<L){T=3;break t}var R=8+L+1&-2;if(C+=R,0<A&&C>A){T=3;break t}if(!Fe(I,w,"VP8 ")||!Fe(I,w,"VP8L")){T=0;break t}if(P[0]<R){T=7;break t}Fe(I,w,"ALPH")||(S[0]=I,x[0]=w+8,E[0]=L),w+=R,P-=R}}if(i=i[0],m.na=m.na[0],m.P=m.P[0],m.Sa=m.Sa[0],0!=T)break}i=[i],m.Ja=[m.Ja],m.xa=[m.xa];t:if(A=t,T=e,y=i,S=m.gb[0],x=m.Ja,E=m.xa,I=T[0],w=!Fe(A,I,"VP8 "),C=!Fe(A,I,"VP8L"),Me(null!=A),Me(null!=y),Me(null!=x),Me(null!=E),8>y[0])T=7;else{if(w||C){if(A=v(A,I+4),12<=S&&A>S-12){T=3;break t}if(f&&A>y[0]-8){T=7;break t}x[0]=A,T[0]+=8,y[0]-=8,E[0]=C}else E[0]=5<=y[0]&&47==A[I+0]&&!(A[I+4]>>5),x[0]=y[0];T=0}if(i=i[0],m.Ja=m.Ja[0],m.xa=m.xa[0],e=e[0],0!=T)break;if(4294967286<m.Ja)return 3;if(null==o||_||(o[0]=m.xa?2:1),a=[a],p=[p],m.xa){if(5>i){T=7;break}o=a,f=p,_=r,null==t||5>i?t=0:5<=i&&47==t[e+0]&&!(t[e+4]>>5)?(y=[0],A=[0],S=[0],h(x=new g,t,e,i),ot(x,y,A,S)?(null!=o&&(o[0]=y[0]),null!=f&&(f[0]=A[0]),null!=_&&(_[0]=S[0]),t=1):t=0):t=0}else{if(10>i){T=7;break}o=p,null==t||10>i||!Wt(t,e+3,i-3)?t=0:(f=t[e+0]|t[e+1]<<8|t[e+2]<<16,_=16383&(t[e+7]<<8|t[e+6]),t=16383&(t[e+9]<<8|t[e+8]),1&f||3<(f>>1&7)||!(f>>4&1)||f>>5>=m.Ja||!_||!t?t=0:(a&&(a[0]=_),o&&(o[0]=t),t=1))}if(!t)return 3;if(a=a[0],p=p[0],d&&(c[0]!=a||u[0]!=p))return 3;null!=l&&(l[0]=m,l.offset=e-l.w,Me(4294967286>e-l.w),Me(l.offset==l.ha-i));break}return 0==T||7==T&&d&&null==l?(null!=r&&(r[0]|=null!=m.na&&0<m.na.length),null!=n&&(n[0]=a),null!=s&&(s[0]=p),0):T}function Vi(t,e,i){var n=e.width,s=e.height,r=0,a=0,o=n,l=s;if(e.Da=null!=t&&0<t.Da,e.Da&&(o=t.cd,l=t.bd,r=t.v,a=t.j,11>i||(r&=-2,a&=-2),0>r||0>a||0>=o||0>=l||r+o>n||a+l>s))return 0;if(e.v=r,e.j=a,e.va=r+o,e.o=a+l,e.U=o,e.T=l,e.da=null!=t&&0<t.da,e.da){if(!A(o,l,i=[t.ib],r=[t.hb]))return 0;e.ib=i[0],e.hb=r[0]}return e.ob=null!=t&&t.ob,e.Kb=null==t||!t.Sd,e.da&&(e.ob=e.ib<3*n/4&&e.hb<3*s/4,e.Kb=0),1}function Oi(t){if(null==t)return 2;if(11>t.S){var e=t.f.RGBA;e.fb+=(t.height-1)*e.A,e.A=-e.A}else e=t.f.kb,t=t.height,e.O+=(t-1)*e.fa,e.fa=-e.fa,e.N+=(t-1>>1)*e.Ab,e.Ab=-e.Ab,e.W+=(t-1>>1)*e.Db,e.Db=-e.Db,null!=e.F&&(e.J+=(t-1)*e.lb,e.lb=-e.lb);return 0}function Mi(t,e,i,n){if(null==n||0>=t||0>=e)return 2;if(null!=i){if(i.Da){var s=i.cd,r=i.bd,a=-2&i.v,o=-2&i.j;if(0>a||0>o||0>=s||0>=r||a+s>t||o+r>e)return 2;t=s,e=r}if(i.da){if(!A(t,e,s=[i.ib],r=[i.hb]))return 2;t=s[0],e=r[0]}}n.width=t,n.height=e;t:{var l=n.width,h=n.height;if(t=n.S,0>=l||0>=h||!(t>=On&&13>t))t=2;else{if(0>=n.Rd&&null==n.sd){a=r=s=e=0;var c=(o=l*Ws[t])*h;if(11>t||(r=(h+1)/2*(e=(l+1)/2),12==t&&(a=(s=l)*h)),null==(h=Be(c+2*r+a))){t=1;break t}n.sd=h,11>t?((l=n.f.RGBA).eb=h,l.fb=0,l.A=o,l.size=c):((l=n.f.kb).y=h,l.O=0,l.fa=o,l.Fd=c,l.f=h,l.N=0+c,l.Ab=e,l.Cd=r,l.ea=h,l.W=0+c+r,l.Db=e,l.Ed=r,12==t&&(l.F=h,l.J=0+c+2*r),l.Tc=a,l.lb=s)}if(e=1,s=n.S,r=n.width,a=n.height,s>=On&&13>s)if(11>s)t=n.f.RGBA,e&=(o=Math.abs(t.A))*(a-1)+r<=t.size,e&=o>=r*Ws[s],e&=null!=t.eb;else{t=n.f.kb,o=(r+1)/2,c=(a+1)/2,l=Math.abs(t.fa);h=Math.abs(t.Ab);var u=Math.abs(t.Db),d=Math.abs(t.lb),g=d*(a-1)+r;e&=l*(a-1)+r<=t.Fd,e&=h*(c-1)+o<=t.Cd,e=(e&=u*(c-1)+o<=t.Ed)&l>=r&h>=o&u>=o,e&=null!=t.y,e&=null!=t.f,e&=null!=t.ea,12==s&&(e&=d>=r,e&=g<=t.Tc,e&=null!=t.F)}else e=0;t=e?0:2}}return 0!=t||null!=i&&i.fd&&(t=Oi(n)),t}var Fi=64,Gi=[0,1,3,7,15,31,63,127,255,511,1023,2047,4095,8191,16383,32767,65535,131071,262143,524287,1048575,2097151,4194303,8388607,16777215],Ni=24,Bi=32,Wi=8,Hi=[0,0,1,1,2,2,2,2,3,3,3,3,3,3,3,3,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7];R("Predictor0","PredictorAdd0"),self.Predictor0=function(){return 4278190080},self.Predictor1=function(t){return t},self.Predictor2=function(t,e,i){return e[i+0]},self.Predictor3=function(t,e,i){return e[i+1]},self.Predictor4=function(t,e,i){return e[i-1]},self.Predictor5=function(t,e,i){return D(D(t,e[i+1]),e[i+0])},self.Predictor6=function(t,e,i){return D(t,e[i-1])},self.Predictor7=function(t,e,i){return D(t,e[i+0])},self.Predictor8=function(t,e,i){return D(e[i-1],e[i+0])},self.Predictor9=function(t,e,i){return D(e[i+0],e[i+1])},self.Predictor10=function(t,e,i){return D(D(t,e[i-1]),D(e[i+0],e[i+1]))},self.Predictor11=function(t,e,i){var n=e[i+0];return 0>=M(n>>24&255,t>>24&255,(e=e[i-1])>>24&255)+M(n>>16&255,t>>16&255,e>>16&255)+M(n>>8&255,t>>8&255,e>>8&255)+M(255&n,255&t,255&e)?n:t},self.Predictor12=function(t,e,i){var n=e[i+0];return(V((t>>24&255)+(n>>24&255)-((e=e[i-1])>>24&255))<<24|V((t>>16&255)+(n>>16&255)-(e>>16&255))<<16|V((t>>8&255)+(n>>8&255)-(e>>8&255))<<8|V((255&t)+(255&n)-(255&e)))>>>0},self.Predictor13=function(t,e,i){var n=e[i-1];return(O((t=D(t,e[i+0]))>>24&255,n>>24&255)<<24|O(t>>16&255,n>>16&255)<<16|O(t>>8&255,n>>8&255)<<8|O(t>>0&255,n>>0&255))>>>0};var Yi=self.PredictorAdd0;self.PredictorAdd1=F,R("Predictor2","PredictorAdd2"),R("Predictor3","PredictorAdd3"),R("Predictor4","PredictorAdd4"),R("Predictor5","PredictorAdd5"),R("Predictor6","PredictorAdd6"),R("Predictor7","PredictorAdd7"),R("Predictor8","PredictorAdd8"),R("Predictor9","PredictorAdd9"),R("Predictor10","PredictorAdd10"),R("Predictor11","PredictorAdd11"),R("Predictor12","PredictorAdd12"),R("Predictor13","PredictorAdd13");var $i=self.PredictorAdd2;W("ColorIndexInverseTransform","MapARGB","32b",(function(t){return t>>8&255}),(function(t){return t})),W("VP8LColorIndexInverseTransformAlpha","MapAlpha","8b",(function(t){return t}),(function(t){return t>>8&255}));var Ui,ji=self.ColorIndexInverseTransform,zi=self.MapARGB,Xi=self.VP8LColorIndexInverseTransformAlpha,Ki=self.MapAlpha,Ji=self.VP8LPredictorsAdd=[];Ji.length=16,(self.VP8LPredictors=[]).length=16,(self.VP8LPredictorsAdd_C=[]).length=16,(self.VP8LPredictors_C=[]).length=16;var qi,Zi,Qi,tn,en,nn,sn,rn,an,on,ln,hn,cn,un,dn,gn,fn,mn,pn,_n,Tn,yn,wn,Sn,xn,bn,vn,En,In=Be(511),Cn=Be(2041),An=Be(225),Pn=Be(767),Ln=0,Rn=Cn,kn=An,Dn=Pn,Vn=In,On=0,Mn=1,Fn=2,Gn=3,Nn=4,Bn=5,Wn=6,Hn=7,Yn=8,$n=9,Un=10,jn=[2,3,7],zn=[3,3,11],Xn=[280,256,256,256,40],Kn=[0,1,1,1,0],Jn=[17,18,0,1,2,3,4,5,16,6,7,8,9,10,11,12,13,14,15],qn=[24,7,23,25,40,6,39,41,22,26,38,42,56,5,55,57,21,27,54,58,37,43,72,4,71,73,20,28,53,59,70,74,36,44,88,69,75,52,60,3,87,89,19,29,86,90,35,45,68,76,85,91,51,61,104,2,103,105,18,30,102,106,34,46,84,92,67,77,101,107,50,62,120,1,119,121,83,93,17,31,100,108,66,78,118,122,33,47,117,123,49,63,99,109,82,94,0,116,124,65,79,16,32,98,110,48,115,125,81,95,64,114,126,97,111,80,113,127,96,112],Zn=[2954,2956,2958,2962,2970,2986,3018,3082,3212,3468,3980,5004],Qn=8,ts=[4,5,6,7,8,9,10,10,11,12,13,14,15,16,17,17,18,19,20,20,21,21,22,22,23,23,24,25,25,26,27,28,29,30,31,32,33,34,35,36,37,37,38,39,40,41,42,43,44,45,46,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,76,77,78,79,80,81,82,83,84,85,86,87,88,89,91,93,95,96,98,100,101,102,104,106,108,110,112,114,116,118,122,124,126,128,130,132,134,136,138,140,143,145,148,151,154,157],es=[4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,60,62,64,66,68,70,72,74,76,78,80,82,84,86,88,90,92,94,96,98,100,102,104,106,108,110,112,114,116,119,122,125,128,131,134,137,140,143,146,149,152,155,158,161,164,167,170,173,177,181,185,189,193,197,201,205,209,213,217,221,225,229,234,239,245,249,254,259,264,269,274,279,284],is=null,ns=[[173,148,140,0],[176,155,140,135,0],[180,157,141,134,130,0],[254,254,243,230,196,177,153,140,133,130,129,0]],ss=[0,1,4,8,5,2,3,6,9,12,13,10,7,11,14,15],rs=[-0,1,-1,2,-2,3,4,6,-3,5,-4,-5,-6,7,-7,8,-8,-9],as=[[[[128,128,128,128,128,128,128,128,128,128,128],[128,128,128,128,128,128,128,128,128,128,128],[128,128,128,128,128,128,128,128,128,128,128]],[[253,136,254,255,228,219,128,128,128,128,128],[189,129,242,255,227,213,255,219,128,128,128],[106,126,227,252,214,209,255,255,128,128,128]],[[1,98,248,255,236,226,255,255,128,128,128],[181,133,238,254,221,234,255,154,128,128,128],[78,134,202,247,198,180,255,219,128,128,128]],[[1,185,249,255,243,255,128,128,128,128,128],[184,150,247,255,236,224,128,128,128,128,128],[77,110,216,255,236,230,128,128,128,128,128]],[[1,101,251,255,241,255,128,128,128,128,128],[170,139,241,252,236,209,255,255,128,128,128],[37,116,196,243,228,255,255,255,128,128,128]],[[1,204,254,255,245,255,128,128,128,128,128],[207,160,250,255,238,128,128,128,128,128,128],[102,103,231,255,211,171,128,128,128,128,128]],[[1,152,252,255,240,255,128,128,128,128,128],[177,135,243,255,234,225,128,128,128,128,128],[80,129,211,255,194,224,128,128,128,128,128]],[[1,1,255,128,128,128,128,128,128,128,128],[246,1,255,128,128,128,128,128,128,128,128],[255,128,128,128,128,128,128,128,128,128,128]]],[[[198,35,237,223,193,187,162,160,145,155,62],[131,45,198,221,172,176,220,157,252,221,1],[68,47,146,208,149,167,221,162,255,223,128]],[[1,149,241,255,221,224,255,255,128,128,128],[184,141,234,253,222,220,255,199,128,128,128],[81,99,181,242,176,190,249,202,255,255,128]],[[1,129,232,253,214,197,242,196,255,255,128],[99,121,210,250,201,198,255,202,128,128,128],[23,91,163,242,170,187,247,210,255,255,128]],[[1,200,246,255,234,255,128,128,128,128,128],[109,178,241,255,231,245,255,255,128,128,128],[44,130,201,253,205,192,255,255,128,128,128]],[[1,132,239,251,219,209,255,165,128,128,128],[94,136,225,251,218,190,255,255,128,128,128],[22,100,174,245,186,161,255,199,128,128,128]],[[1,182,249,255,232,235,128,128,128,128,128],[124,143,241,255,227,234,128,128,128,128,128],[35,77,181,251,193,211,255,205,128,128,128]],[[1,157,247,255,236,231,255,255,128,128,128],[121,141,235,255,225,227,255,255,128,128,128],[45,99,188,251,195,217,255,224,128,128,128]],[[1,1,251,255,213,255,128,128,128,128,128],[203,1,248,255,255,128,128,128,128,128,128],[137,1,177,255,224,255,128,128,128,128,128]]],[[[253,9,248,251,207,208,255,192,128,128,128],[175,13,224,243,193,185,249,198,255,255,128],[73,17,171,221,161,179,236,167,255,234,128]],[[1,95,247,253,212,183,255,255,128,128,128],[239,90,244,250,211,209,255,255,128,128,128],[155,77,195,248,188,195,255,255,128,128,128]],[[1,24,239,251,218,219,255,205,128,128,128],[201,51,219,255,196,186,128,128,128,128,128],[69,46,190,239,201,218,255,228,128,128,128]],[[1,191,251,255,255,128,128,128,128,128,128],[223,165,249,255,213,255,128,128,128,128,128],[141,124,248,255,255,128,128,128,128,128,128]],[[1,16,248,255,255,128,128,128,128,128,128],[190,36,230,255,236,255,128,128,128,128,128],[149,1,255,128,128,128,128,128,128,128,128]],[[1,226,255,128,128,128,128,128,128,128,128],[247,192,255,128,128,128,128,128,128,128,128],[240,128,255,128,128,128,128,128,128,128,128]],[[1,134,252,255,255,128,128,128,128,128,128],[213,62,250,255,255,128,128,128,128,128,128],[55,93,255,128,128,128,128,128,128,128,128]],[[128,128,128,128,128,128,128,128,128,128,128],[128,128,128,128,128,128,128,128,128,128,128],[128,128,128,128,128,128,128,128,128,128,128]]],[[[202,24,213,235,186,191,220,160,240,175,255],[126,38,182,232,169,184,228,174,255,187,128],[61,46,138,219,151,178,240,170,255,216,128]],[[1,112,230,250,199,191,247,159,255,255,128],[166,109,228,252,211,215,255,174,128,128,128],[39,77,162,232,172,180,245,178,255,255,128]],[[1,52,220,246,198,199,249,220,255,255,128],[124,74,191,243,183,193,250,221,255,255,128],[24,71,130,219,154,170,243,182,255,255,128]],[[1,182,225,249,219,240,255,224,128,128,128],[149,150,226,252,216,205,255,171,128,128,128],[28,108,170,242,183,194,254,223,255,255,128]],[[1,81,230,252,204,203,255,192,128,128,128],[123,102,209,247,188,196,255,233,128,128,128],[20,95,153,243,164,173,255,203,128,128,128]],[[1,222,248,255,216,213,128,128,128,128,128],[168,175,246,252,235,205,255,255,128,128,128],[47,116,215,255,211,212,255,255,128,128,128]],[[1,121,236,253,212,214,255,255,128,128,128],[141,84,213,252,201,202,255,219,128,128,128],[42,80,160,240,162,185,255,205,128,128,128]],[[1,1,255,128,128,128,128,128,128,128,128],[244,1,255,128,128,128,128,128,128,128,128],[238,1,255,128,128,128,128,128,128,128,128]]]],os=[[[231,120,48,89,115,113,120,152,112],[152,179,64,126,170,118,46,70,95],[175,69,143,80,85,82,72,155,103],[56,58,10,171,218,189,17,13,152],[114,26,17,163,44,195,21,10,173],[121,24,80,195,26,62,44,64,85],[144,71,10,38,171,213,144,34,26],[170,46,55,19,136,160,33,206,71],[63,20,8,114,114,208,12,9,226],[81,40,11,96,182,84,29,16,36]],[[134,183,89,137,98,101,106,165,148],[72,187,100,130,157,111,32,75,80],[66,102,167,99,74,62,40,234,128],[41,53,9,178,241,141,26,8,107],[74,43,26,146,73,166,49,23,157],[65,38,105,160,51,52,31,115,128],[104,79,12,27,217,255,87,17,7],[87,68,71,44,114,51,15,186,23],[47,41,14,110,182,183,21,17,194],[66,45,25,102,197,189,23,18,22]],[[88,88,147,150,42,46,45,196,205],[43,97,183,117,85,38,35,179,61],[39,53,200,87,26,21,43,232,171],[56,34,51,104,114,102,29,93,77],[39,28,85,171,58,165,90,98,64],[34,22,116,206,23,34,43,166,73],[107,54,32,26,51,1,81,43,31],[68,25,106,22,64,171,36,225,114],[34,19,21,102,132,188,16,76,124],[62,18,78,95,85,57,50,48,51]],[[193,101,35,159,215,111,89,46,111],[60,148,31,172,219,228,21,18,111],[112,113,77,85,179,255,38,120,114],[40,42,1,196,245,209,10,25,109],[88,43,29,140,166,213,37,43,154],[61,63,30,155,67,45,68,1,209],[100,80,8,43,154,1,51,26,71],[142,78,78,16,255,128,34,197,171],[41,40,5,102,211,183,4,1,221],[51,50,17,168,209,192,23,25,82]],[[138,31,36,171,27,166,38,44,229],[67,87,58,169,82,115,26,59,179],[63,59,90,180,59,166,93,73,154],[40,40,21,116,143,209,34,39,175],[47,15,16,183,34,223,49,45,183],[46,17,33,183,6,98,15,32,183],[57,46,22,24,128,1,54,17,37],[65,32,73,115,28,128,23,128,205],[40,3,9,115,51,192,18,6,223],[87,37,9,115,59,77,64,21,47]],[[104,55,44,218,9,54,53,130,226],[64,90,70,205,40,41,23,26,57],[54,57,112,184,5,41,38,166,213],[30,34,26,133,152,116,10,32,134],[39,19,53,221,26,114,32,73,255],[31,9,65,234,2,15,1,118,73],[75,32,12,51,192,255,160,43,51],[88,31,35,67,102,85,55,186,85],[56,21,23,111,59,205,45,37,192],[55,38,70,124,73,102,1,34,98]],[[125,98,42,88,104,85,117,175,82],[95,84,53,89,128,100,113,101,45],[75,79,123,47,51,128,81,171,1],[57,17,5,71,102,57,53,41,49],[38,33,13,121,57,73,26,1,85],[41,10,67,138,77,110,90,47,114],[115,21,2,10,102,255,166,23,6],[101,29,16,10,85,128,101,196,26],[57,18,10,102,102,213,34,20,43],[117,20,15,36,163,128,68,1,26]],[[102,61,71,37,34,53,31,243,192],[69,60,71,38,73,119,28,222,37],[68,45,128,34,1,47,11,245,171],[62,17,19,70,146,85,55,62,70],[37,43,37,154,100,163,85,160,1],[63,9,92,136,28,64,32,201,85],[75,15,9,9,64,255,184,119,16],[86,6,28,5,64,255,25,248,1],[56,8,17,132,137,255,55,116,128],[58,15,20,82,135,57,26,121,40]],[[164,50,31,137,154,133,25,35,218],[51,103,44,131,131,123,31,6,158],[86,40,64,135,148,224,45,183,128],[22,26,17,131,240,154,14,1,209],[45,16,21,91,64,222,7,1,197],[56,21,39,155,60,138,23,102,213],[83,12,13,54,192,255,68,47,28],[85,26,85,85,128,128,32,146,171],[18,11,7,63,144,171,4,4,246],[35,27,10,146,174,171,12,26,128]],[[190,80,35,99,180,80,126,54,45],[85,126,47,87,176,51,41,20,32],[101,75,128,139,118,146,116,128,85],[56,41,15,176,236,85,37,9,62],[71,30,17,119,118,255,17,18,138],[101,38,60,138,55,70,43,26,142],[146,36,19,30,171,255,97,27,20],[138,45,61,62,219,1,81,188,64],[32,41,20,117,151,142,20,21,163],[112,19,12,61,195,128,48,4,24]]],ls=[[[[255,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]],[[176,246,255,255,255,255,255,255,255,255,255],[223,241,252,255,255,255,255,255,255,255,255],[249,253,253,255,255,255,255,255,255,255,255]],[[255,244,252,255,255,255,255,255,255,255,255],[234,254,254,255,255,255,255,255,255,255,255],[253,255,255,255,255,255,255,255,255,255,255]],[[255,246,254,255,255,255,255,255,255,255,255],[239,253,254,255,255,255,255,255,255,255,255],[254,255,254,255,255,255,255,255,255,255,255]],[[255,248,254,255,255,255,255,255,255,255,255],[251,255,254,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]],[[255,253,254,255,255,255,255,255,255,255,255],[251,254,254,255,255,255,255,255,255,255,255],[254,255,254,255,255,255,255,255,255,255,255]],[[255,254,253,255,254,255,255,255,255,255,255],[250,255,254,255,254,255,255,255,255,255,255],[254,255,255,255,255,255,255,255,255,255,255]],[[255,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]]],[[[217,255,255,255,255,255,255,255,255,255,255],[225,252,241,253,255,255,254,255,255,255,255],[234,250,241,250,253,255,253,254,255,255,255]],[[255,254,255,255,255,255,255,255,255,255,255],[223,254,254,255,255,255,255,255,255,255,255],[238,253,254,254,255,255,255,255,255,255,255]],[[255,248,254,255,255,255,255,255,255,255,255],[249,254,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]],[[255,253,255,255,255,255,255,255,255,255,255],[247,254,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]],[[255,253,254,255,255,255,255,255,255,255,255],[252,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]],[[255,254,254,255,255,255,255,255,255,255,255],[253,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]],[[255,254,253,255,255,255,255,255,255,255,255],[250,255,255,255,255,255,255,255,255,255,255],[254,255,255,255,255,255,255,255,255,255,255]],[[255,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]]],[[[186,251,250,255,255,255,255,255,255,255,255],[234,251,244,254,255,255,255,255,255,255,255],[251,251,243,253,254,255,254,255,255,255,255]],[[255,253,254,255,255,255,255,255,255,255,255],[236,253,254,255,255,255,255,255,255,255,255],[251,253,253,254,254,255,255,255,255,255,255]],[[255,254,254,255,255,255,255,255,255,255,255],[254,254,254,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]],[[255,254,255,255,255,255,255,255,255,255,255],[254,254,255,255,255,255,255,255,255,255,255],[254,255,255,255,255,255,255,255,255,255,255]],[[255,255,255,255,255,255,255,255,255,255,255],[254,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]],[[255,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]],[[255,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]],[[255,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]]],[[[248,255,255,255,255,255,255,255,255,255,255],[250,254,252,254,255,255,255,255,255,255,255],[248,254,249,253,255,255,255,255,255,255,255]],[[255,253,253,255,255,255,255,255,255,255,255],[246,253,253,255,255,255,255,255,255,255,255],[252,254,251,254,254,255,255,255,255,255,255]],[[255,254,252,255,255,255,255,255,255,255,255],[248,254,253,255,255,255,255,255,255,255,255],[253,255,254,254,255,255,255,255,255,255,255]],[[255,251,254,255,255,255,255,255,255,255,255],[245,251,254,255,255,255,255,255,255,255,255],[253,253,254,255,255,255,255,255,255,255,255]],[[255,251,253,255,255,255,255,255,255,255,255],[252,253,254,255,255,255,255,255,255,255,255],[255,254,255,255,255,255,255,255,255,255,255]],[[255,252,255,255,255,255,255,255,255,255,255],[249,255,254,255,255,255,255,255,255,255,255],[255,255,254,255,255,255,255,255,255,255,255]],[[255,255,253,255,255,255,255,255,255,255,255],[250,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]],[[255,255,255,255,255,255,255,255,255,255,255],[254,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]]]],hs=[0,1,2,3,6,4,5,6,6,6,6,6,6,6,6,7,0],cs=[],us=[],ds=[],gs=1,fs=2,ms=[],ps=[];pi("UpsampleRgbLinePair",xi,3),pi("UpsampleBgrLinePair",bi,3),pi("UpsampleRgbaLinePair",Ai,4),pi("UpsampleBgraLinePair",Ci,4),pi("UpsampleArgbLinePair",Ii,4),pi("UpsampleRgba4444LinePair",Ei,2),pi("UpsampleRgb565LinePair",vi,2);var _s=window.UpsampleRgbLinePair,Ts=window.UpsampleBgrLinePair,ys=window.UpsampleRgbaLinePair,ws=window.UpsampleBgraLinePair,Ss=window.UpsampleArgbLinePair,xs=window.UpsampleRgba4444LinePair,bs=window.UpsampleRgb565LinePair,vs=16,Es=1<<vs-1,Is=-227,Cs=482,As=6,Ps=(256<<As)-1,Ls=0,Rs=Be(256),ks=Be(256),Ds=Be(256),Vs=Be(256),Os=Be(Cs-Is),Ms=Be(Cs-Is);Pi("YuvToRgbRow",xi,3),Pi("YuvToBgrRow",bi,3),Pi("YuvToRgbaRow",Ai,4),Pi("YuvToBgraRow",Ci,4),Pi("YuvToArgbRow",Ii,4),Pi("YuvToRgba4444Row",Ei,2),Pi("YuvToRgb565Row",vi,2);var Fs=[0,4,8,12,128,132,136,140,256,260,264,268,384,388,392,396],Gs=[0,2,8],Ns=[8,7,6,4,4,2,2,2,1,1,1,1],Bs=1;this.WebPDecodeRGBA=function(t,e,i,n,s){var r=Mn,a=new ei,o=new Z;a.ba=o,o.S=r,o.width=[o.width],o.height=[o.height];var l=o.width,c=o.height,u=new Q;if(null==u||null==t)var d=2;else Me(null!=u),d=Di(t,e,i,u.width,u.height,u.Pd,u.Qd,u.format,null);if(0!=d?l=0:(null!=l&&(l[0]=u.width[0]),null!=c&&(c[0]=u.height[0]),l=1),l){o.width=o.width[0],o.height=o.height[0],null!=n&&(n[0]=o.width),null!=s&&(s[0]=o.height);t:{if(n=new Gt,(s=new ii).data=t,s.w=e,s.ha=i,s.kd=1,e=[0],Me(null!=s),(0==(t=Di(s.data,s.w,s.ha,null,null,null,e,null,s))||7==t)&&e[0]&&(t=4),0==(e=t)){if(Me(null!=a),n.data=s.data,n.w=s.w+s.offset,n.ha=s.ha-s.offset,n.put=rt,n.ac=st,n.bc=at,n.ma=a,s.xa){if(null==(t=wt())){a=1;break t}if(function(t,e){var i=[0],n=[0],s=[0];e:for(;;){if(null==t)return 0;if(null==e)return t.a=2,0;if(t.l=e,t.a=0,h(t.m,e.data,e.w,e.ha),!ot(t.m,i,n,s)){t.a=3;break e}if(t.xb=fs,e.width=i[0],e.height=n[0],!St(i[0],n[0],1,t,null))break e;return 1}return Me(0!=t.a),0}(t,n)){if(n=0==(e=Mi(n.width,n.height,a.Oa,a.ba))){e:{n=t;i:for(;;){if(null==n){n=0;break e}if(Me(null!=n.s.yc),Me(null!=n.s.Ya),Me(0<n.s.Wb),Me(null!=(i=n.l)),Me(null!=(s=i.ma)),0!=n.xb){if(n.ca=s.ba,n.tb=s.tb,Me(null!=n.ca),!Vi(s.Oa,i,Gn)){n.a=2;break i}if(!xt(n,i.width))break i;if(i.da)break i;if((i.da||K(n.ca.S))&&mi(),11>n.ca.S||(alert("todo:WebPInitConvertARGBToYUV"),null!=n.ca.f.kb.F&&mi()),n.Pb&&0<n.s.ua&&null==n.s.vb.X&&!E(n.s.vb,n.s.Wa.Xa)){n.a=1;break i}n.xb=0}if(!Tt(n,n.V,n.Ba,n.c,n.i,i.o,ft))break i;s.Dc=n.Ma,n=1;break e}Me(0!=n.a),n=0}n=!n}n&&(e=t.a)}else e=t.a}else{if(null==(t=new Nt)){a=1;break t}if(t.Fa=s.na,t.P=s.P,t.qc=s.Sa,Ht(t,n)){if(0==(e=Mi(n.width,n.height,a.Oa,a.ba))){if(t.Aa=0,i=a.Oa,Me(null!=(s=t)),null!=i){if(0<(l=0>(l=i.Md)?0:100<l?255:255*l/100)){for(c=u=0;4>c;++c)12>(d=s.pb[c]).lc&&(d.ia=l*Ns[0>d.lc?0:d.lc]>>3),u|=d.ia;u&&(alert("todo:VP8InitRandom"),s.ia=1)}s.Ga=i.Id,100<s.Ga?s.Ga=100:0>s.Ga&&(s.Ga=0)}Ut(t,n)||(e=t.a)}}else e=t.a}0==e&&null!=a.Oa&&a.Oa.fd&&(e=Oi(a.ba))}a=e}r=0!=a?null:11>r?o.f.RGBA.eb:o.f.kb.y}else r=null;return r};var Ws=[3,4,3,4,4,2,2,4,4,4,2,1,1]},new window.WebPDecoder,window.WebPRiffParser=function(t,e){var i={},n=0,s=!1,r=0,a=0;if(i.frames=[],!function(t,e,i,n){for(var s=0;s<n;s++)if(t[e+s]!=i.charCodeAt(s))return!0;return!1}(t,e,"RIFF",4)){for(Ue(t,e+=4),e+=8;e<t.length;){var o=Ye(t,e),l=Ue(t,e+=4);e+=4;var h=l+(1&l);switch(o){case"VP8 ":case"VP8L":void 0===i.frames[n]&&(i.frames[n]={}),(d=i.frames[n]).src_off=s?a:e-8,d.src_size=r+l+8,n++,s&&(s=!1,r=0,a=0);break;case"VP8X":(d=i.header={}).feature_flags=t[e];var c=e+4;d.canvas_width=1+$e(t,c),c+=3,d.canvas_height=1+$e(t,c),c+=3;break;case"ALPH":s=!0,r=h+8,a=e-8;break;case"ANIM":(d=i.header).bgcolor=Ue(t,e),c=e+4,d.loop_count=(g=t)[(f=c)+0]<<0|g[f+1]<<8,c+=2;break;case"ANMF":var u,d;(d=i.frames[n]={}).offset_x=2*$e(t,e),e+=3,d.offset_y=2*$e(t,e),e+=3,d.width=1+$e(t,e),e+=3,d.height=1+$e(t,e),e+=3,d.duration=$e(t,e),e+=3,u=t[e++],d.dispose=1&u,d.blend=u>>1&1}"ANMF"!=o&&(e+=h)}var g,f;return i}},window.ApicTools={parseGIF:t,decompressFrames:e},console.log("Using JsView HTML Forge");let je=_;class ze{static StringToInt32(t){let e=g.InvalidInt32,i=parseInt(t);return 0==isNaN(i)&&(e=i),e}static StringTrim(t){return t.trim()}static StringStartsWith(t,e){return t.startsWith(e)}static StringEndsWith(t,e){return t.endsWith(e)}static StringSplit(t,e=" ",i=0,n=0,s=!1){t||(t=""),0==n&&(n=t.length-1);let r=(t=t.substring(i,n+1)).trim().split(e),a=[];for(let t of r)t&&(s&&(t=t.trim(),0==t.length)||a.push(t));return a}static MergeBrackets(t,e=null){let i=[],n="",s=null,r=null,a=0,o=!1;for(let l of t){let t=0;for(;t<l.length;)if(a>0){let e=l.indexOf(")",t),i=l.indexOf("(",t);if(-1!=i&&(-1==e||i<e))a++,t=i+1;else{if(!(e>=0))break;a--,t=e+1}}else{let e=l.indexOf("(",t);if(-1==e)break;a++,t=e+1}o?(e&&(n+=e),n+=l):null!=s?(n+=s,e&&(n+=e),n+=l,s=null,o=!0):s=l,0==a&&(o?(r=n,n=""):r=l,i.push(r),s=null,o=!1)}return i}static ConvertToInt32(t,e){if(e.is(g.DataType.Null))return 0;if(e.is(g.DataType.String)){const t=e.get();if(""===t)return 0;if(ze.StringTrim(t),ze.StringEndsWith(t,"px")){const e='JsView Warning: Using px will make style performance lower, you can directly use numbers instead of "'+t+'".';console.warn(e)}return ze.StringToInt32(t)}return e.is(g.DataType.Int32)||e.is(g.DataType.Float)?e.get():(l(n.InvalidArgument,g.InvalidInt32,["Failed to convert style ",t,"=",e.toString(),", value type is supported."]),g.InvalidInt32)}static ConvertToFloat(t,e){return e.is(g.DataType.Null)?g.InvalidFloat:e.is(g.DataType.String)&&""===e.get()?0:e.is(g.DataType.Int32)||e.is(g.DataType.Float)?e.get():(l(n.InvalidArgument,g.InvalidFloat,["Failed to convert style ",t,"=",e.toString(),", value type is supported."]),g.InvalidFloat)}static ConvertToString(t,e,i=!1){if(e.is(g.DataType.Null))return g.InvalidPointer;0==e.is(g.DataType.String)&&l(n.InvalidArgument,g.InvalidPointer,["Failed to convert style ",t,"=",e.toString(),", type is not string."]);let s=e.get();return null==s||s.length<=0?g.InvalidPointer:(i&&(s=s.toUpperCase()),s)}static ConvertToCorner(t,e){if(e.is(g.DataType.Null))return g.InvalidPointer;let i=null;if(e.is(g.DataType.Int32)){const t=e.get();i=new g.CornerImpl(String(t)),i.topLeft=t,i.topRight=t,i.bottomRight=t,i.bottomLeft=t}else if(e.is(g.DataType.String)){const t=e.get();if(null==t||t.length<=0)return g.InvalidPointer;const n=ze.StringSplit(t),s=n.length;i=new g.CornerImpl(t),i.topLeft=s>0?parseInt(n[0]):0,i.topRight=s>1?parseInt(n[1]):i.topLeft,i.bottomRight=s>2?parseInt(n[2]):i.topLeft,i.bottomLeft=s>3?parseInt(n[3]):i.bottomRight}else l(n.InvalidArgument,g.InvalidPointer,["Failed to convert style ",t,"=",e.toString(),", type is not number or string."]);return i}static ConvertToRect(t,e){if(e.is(g.DataType.Null))return g.InvalidPointer;0==e.is(g.DataType.String)&&l(n.InvalidArgument,g.InvalidPointer,["Failed to convert style "+t+"="+e+", value type is not string."]);const i=e.get();if(null==i||i.length<=0)return g.InvalidPointer;const s=new g.RectImpl(i),r=ze.StringSplit(i),a=r.length;return s.top=a>0?parseInt(r[0]):0,s.right=a>1?parseInt(r[1]):s.top,s.bottom=a>2?parseInt(r[2]):s.top,s.left=a>3?parseInt(r[3]):s.right,s}static ConvertToAnimation(t,e,i=null){if(e.is(g.DataType.Null))return g.InvalidPointer;0==e.is(g.DataType.String)&&l(n.InvalidArgument,g.InvalidPointer,["Failed to convert style ",t,"=",e.toString(),", type is not string."]);const s=e.get();if(null==s||s.length<=0)return g.InvalidPointer;if(null!=i&&null!=i.rawValue&&i.rawValue==s)return i;return ze.ParseToAnimation(s)}static ConvertToTransition(t,e,i=null){if(e.is(g.DataType.Null))return g.InvalidPointer;0==e.is(g.DataType.String)&&l(n.InvalidArgument,g.InvalidPointer,["Failed to convert style ",t,"=",e.toString(),", type is not string."]);const s=e.get();if(null==s||s.length<=0)return g.InvalidPointer;if(null!=i&&null!=i.rawValue&&i.rawValue==s)return i;let r=[];const a=ze.StringSplit(s,",");for(let t=0;t<a.length;t++)if(a[t].indexOf("(")>=0){let e=t;for(;e<a.length&&a[e].indexOf(")")<0;)e++;let i="";for(let n=t;n<=e;n++)n!=t&&(i+=","),i+=a[n];t=e,r.push(i)}else r.push(a[t]);const o=new g.TransitionImpl(s);for(const e of r){const i=ze.ConvertToAnimation(t,new g(e));if(null!=i&&(o.animationMap.set(i.name,i),"all"==i?.name)){const t=["opacity","left","top","width","height","transform"];for(const e of t)o.animationMap.set(e,i)}}return o}static ConvertToTextShadow(t,e){if(e.is(g.DataType.Null))return g.InvalidPointer;0==e.is(g.DataType.String)&&l(n.InvalidArgument,g.InvalidPointer,["Failed to convert style ",t,"=",e.toString(),", type is not string."]);const i=e.get();if(null==i||i.length<=0)return g.InvalidPointer;const s=new g.TextShadowImpl(i),r=ze.StringSplit(i);r.length>0&&(s.hShadow=parseInt(r[0])),r.length>1&&(s.vShadow=parseInt(r[1])),r.length>2&&(s.blur=parseInt(r[2]));let a=-1;return 3==r.length?a=2:r.length>3&&(a=3),a>0&&(s.color=r[a]),s}static ConvertToWebkitTextStroke(t,e){if(e.is(g.DataType.Null))return g.InvalidPointer;0==e.is(g.DataType.String)&&l(n.InvalidArgument,g.InvalidPointer,["Failed to convert style ",t,"=",e.toString(),", type is not string."]);const i=e.get();if(null==i||i.length<=0)return g.InvalidPointer;const s=new g.WebkitTextStrokeImpl(i),r=ze.StringSplit(i);return r.length>0&&(s.length=parseInt(r[0])),r.length>1&&(s.color=r[1]),s}static ConvertToBorderImage(t,e){if(e.is(g.DataType.Null))return g.InvalidPointer;0==e.is(g.DataType.String)&&l(n.InvalidArgument,g.InvalidPointer,["Failed to convert style ",t,"=",e.toString(),", type is not string."]);const i=e.get();if(null==i||i.length<=0)return g.InvalidPointer;const s=new g.BorderImageImpl(i),r=ze.StringSplit(i),a=r.length;return a>0&&(s.source=r[0]),a>1&&(s.slice=ze.ConvertToRect(t,new g(r[1]))),s}static ConvertToBackgroundImage(t,e){if(e.is(g.DataType.Null))return g.InvalidPointer;0==e.is(g.DataType.String)&&l(n.InvalidArgument,g.InvalidPointer,["Failed to convert style ",t,"=",e.toString(),", type is not string."]);let i=e.get();if(null==i||i.length<=0)return g.InvalidPointer;const s=new g.BackgroundImageImpl(i),r="linear-gradient(";if(0==i.indexOf(r)){i=ze.StringTrim(i),s.type=g.BackgroundImageImpl.eType.LINEAR_GRADIENT,s.linearGradient=new g.BackgroundImageImpl.LinearGradient,s.urlPath=i;let t=ze.StringSplit(i,",",r.length,i.length-2);t=ze.MergeBrackets(t,",");let n=t.length;if(n>0){let e=t[0];if(-1!=e.indexOf("to ")){t.splice(0,1);let i=t.length;-1!=e.indexOf("left")?(s.linearGradient.fromX=i+1,s.linearGradient.toX=0):-1!=e.indexOf("right")?(s.linearGradient.fromX=0,s.linearGradient.toX=i+1):(s.linearGradient.fromX=0,s.linearGradient.toX=0),-1!=e.indexOf("top")?(s.linearGradient.fromY=i+1,s.linearGradient.toY=0):-1!=e.indexOf("bottom")?(s.linearGradient.fromY=0,s.linearGradient.toY=i+1):(s.linearGradient.fromY=0,s.linearGradient.toY=0)}else s.linearGradient.fromX=0,s.linearGradient.toX=0,s.linearGradient.fromY=0,s.linearGradient.toY=2}if(n<2)return console.error(`linear gradient format error: str=${e}`),null;let a=1/t.length,o=t.length;for(let e=0;e<o;e++){let i=t[e];i=ze.StringTrim(i);let n=new je.LinearGradientTexture.StopPoint;n.color=i,n.stopPosition=e!=o-1?e*a:1,s.linearGradient.stops.push(n)}}else s.type=g.BackgroundImageImpl.eType.URL_PATH,s.urlPath=i;return s}static ParseToAnimation(t){const e=ze.StringTrim(t);let i=[];const n=e.indexOf("cubic-bezier");if(n>=0){const t=e.indexOf(")"),s=e.substring(n,t-1),r=ze.StringSplit(e,s);for(const t of r){const e=ze.StringSplit(t);i=[...i,...e]}i.push(s)}else i=ze.StringSplit(e);let s="",r=0,a=1,o=e.indexOf("alternate")>=0;for(var l=2;l<i.length;l++){if("infinite"==i[l]){a=-1;continue}let t=ze.ParseToTimeMs(i[l]);0==isNaN(t)?r=t:(t=ze.ParseToFloat(i[l]),0==isNaN(t)?a=t:s=i[l])}const h=i.length>1?ze.ParseToTimeMs(i[1]):0,c=new g.AnimationImpl(e);return c.name=i.length>0?i[0]:"",c.duration=h,c.timingFunction=ze.ParseToEasing(s,h),c.delay=r,c.iterationCount=a,c.direction=o,c}static ParseToTimeMs(t){if(0==ze.StringEndsWith(t,"s"))return NaN;let e=ze.ParseToFloat(t);return ze.StringEndsWith(t,"ms")?e*=1:ze.StringEndsWith(t,"s")&&(e*=1e3),e}static ParseToFloat(t){const e=ze.StringTrim(t);return parseFloat(e)}static ParseToEasing(t,e){let i=null;return t.indexOf("ease")>=0?i=t.indexOf("-in-out")>=0?_.Easing.Circular.InOut:t.indexOf("-out")>=0?_.Easing.Circular.Out:t.indexOf("-in")>=0?_.Easing.Circular.In:_.Easing.Circular.InOut:t.indexOf("linear")>=0?i=null:t.indexOf("cubic-bezier")>=0?i=ze.ParseToEasingBezier(t,e):t.indexOf("steps")>=0&&(i=ze.ParseToEasingSteps(t)),i}static ParseToEasingBezier(t,e){let i=t.indexOf("(");i>=0&&(t=t.substring(i+1));let n=ze.StringSplit(t,","),s={x1:n.length>0?parseFloat(n[0]):0,y1:n.length>1?parseFloat(n[1]):0,x2:n.length>2?parseFloat(n[2]):0,y2:n.length>3?parseFloat(n[3]):0};return new _.BezierEasing(s.x1,s.y1,s.x2,s.y2,e)}static ParseToEasingSteps(t){let e=t.indexOf("(");e>=0&&(t=t.substring(e+1));let i=ze.StringSplit(t,","),n={steps:i.length>0?parseInt(i[0]):1,type:i.length>1?i[1].includes("start")?0:1:0};return new _.StepsEasing(n.steps,n.type)}constructor(){throw new Error("new StyleGroup() is forbidden.")}}class Xe{static IsInheritedProp(t){return t==d.Text.Color||t==d.Text.FontFamily||t==d.Text.FontSize||t==d.Text.FontStyle||t==d.Text.FontWeight||t==d.Text.LineHeight||t==d.Text.TextAlign||t==d.Text.TextOverflow||t==d.Text.TextShadow||t==d.Text.WebkitTextStroke||t==d.Text.WhiteSpace||t==d.Text.WordWrap||t==d.Text.Direction||t==d.Text.JsvTextEmoji||t==d.Text.JsvTextLatex||t==d.Text.JsvTextAlignMinWidth||t==d.Text.JsvTextVerticalAlign||t==d.Text.JsvTextLineAlign||t==d.Text.JsvTextInnerDirection}constructor(){}setPropValue(t,e,i){if(0==i&&1==this.isPropNameLocked(t))return n.CssStyleNotChanged;const s=this.setValue(t,e);return null==s?n.CssStyleNotChanged:(this.changedStyleGroups.add(s),this.needUpdateTransition(t)&&this.changedStyleGroups.add(p.Motion.Name),i&&this.lockedPropNames.add(t),0)}getPropValue(t){return this.getValue(t)}hasPropValue(t){return this.hasValue(t)}hasPropGroup(t){return t==p.Layout.Name?null!=this.layout:t==p.Background.Name?null!=this.background:t==p.Effect.Name?null!=this.effect:t==p.Text.Name?null!=this.text:t==p.Motion.Name&&null!=this.motion}isPropNameLocked(t){return 1==this.lockedPropNames.has(t)}addChangedStyleGroup(t){return t!=p.Layout.Name&&t!=p.Background.Name&&t!=p.Effect.Name&&t!=p.Text.Name&&t!=p.Motion.Name&&o(n.InvalidArgument),this.changedStyleGroups.add(t),0}getChangedStyleGroups(){return this.changedStyleGroups}clearChangedStyleGroups(){this.changedStyleGroups.clear()}setValue(t,e){let i=null;return t==d.Layout.Left||t==d.Layout.Top||t==d.Layout.Width||t==d.Layout.Height?i=this.setLayoutValue(t,e):t==d.Background.BackgroundColor||t==d.Background.BackgroundImage||t==d.Background.BorderRadius?i=this.setBackgroundValue(t,e):t==d.Effect.BackfaceVisibility||t==d.Effect.BorderImage||t==d.Effect.BorderImageWidth||t==d.Effect.BorderImageOutset||t==d.Effect.Display||t==d.Effect.ObjectFit||t==d.Effect.Overflow||t==d.Effect.Perspective||t==d.Effect.PerspectiveOrigin||t==d.Effect.Transform||t==d.Effect.TransformOrigin||t==d.Effect.TransformStyle||t==d.Effect.Visibility||t==d.Effect.ZIndex?i=this.setEffectValue(t,e):t==d.Text.Color||t==d.Text.FontFamily||t==d.Text.FontSize||t==d.Text.FontStyle||t==d.Text.FontWeight||t==d.Text.TextAlign||t==d.Text.TextOverflow||t==d.Text.TextShadow||t==d.Text.LineHeight||t==d.Text.WebkitTextStroke||t==d.Text.WhiteSpace||t==d.Text.WordWrap||t==d.Text.Direction||t==d.Text.JsvTextEmoji||t==d.Text.JsvTextLatex||t==d.Text.JsvTextAlignMinWidth||t==d.Text.JsvTextVerticalAlign||t==d.Text.JsvTextLineAlign||t==d.Text.JsvTextInnerDirection?i=this.setTextValue(t,e):t==d.Motion.Animation||t==d.Motion.Transition?i=this.setMotionValue(t,e):l(n.UnimplementedError,null),null!=i&&this.changedStyleGroups.add(i),i}getValue(t){let e;return t==d.Layout.Left||t==d.Layout.Top||t==d.Layout.Width||t==d.Layout.Height?e=this.getLayoutValue(t):t==d.Background.BackgroundColor||t==d.Background.BackgroundImage||t==d.Background.BorderRadius?e=this.getBackgroundValue(t):t==d.Effect.BackfaceVisibility||t==d.Effect.BorderImage||t==d.Effect.BorderImageWidth||t==d.Effect.BorderImageOutset||t==d.Effect.Display||t==d.Effect.ObjectFit||t==d.Effect.Overflow||t==d.Effect.Perspective||t==d.Effect.PerspectiveOrigin||t==d.Effect.Transform||t==d.Effect.TransformOrigin||t==d.Effect.TransformStyle||t==d.Effect.Visibility||t==d.Effect.ZIndex?e=this.getEffectValue(t):t==d.Text.Color||t==d.Text.FontFamily||t==d.Text.FontSize||t==d.Text.FontStyle||t==d.Text.FontWeight||t==d.Text.TextAlign||t==d.Text.TextOverflow||t==d.Text.TextShadow||t==d.Text.LineHeight||t==d.Text.WebkitTextStroke||t==d.Text.WhiteSpace||t==d.Text.WordWrap||t==d.Text.Direction||t==d.Text.JsvTextEmoji||t==d.Text.JsvTextLatex||t==d.Text.JsvTextAlignMinWidth||t==d.Text.JsvTextVerticalAlign||t==d.Text.JsvTextLineAlign||t==d.Text.JsvTextInnerDirection?e=this.getTextValue(t):t==d.Motion.Animation||t==d.Motion.Transition?e=this.getMotionValue(t):(l(n.UnimplementedError,null),e=new g),e}hasValue(t){let e=!1;return t==d.Layout.Left||t==d.Layout.Top||t==d.Layout.Width||t==d.Layout.Height?e=this.hasLayoutValue(t):t==d.Background.BackgroundColor||t==d.Background.BackgroundImage||t==d.Background.BorderRadius?e=this.hasBackgroundValue(t):t==d.Effect.BackfaceVisibility||t==d.Effect.BorderImage||t==d.Effect.BorderImageWidth||t==d.Effect.BorderImageOutset||t==d.Effect.Display||t==d.Effect.ObjectFit||t==d.Effect.Overflow||t==d.Effect.Perspective||t==d.Effect.PerspectiveOrigin||t==d.Effect.Transform||t==d.Effect.TransformOrigin||t==d.Effect.TransformStyle||t==d.Effect.Visibility||t==d.Effect.ZIndex?e=this.hasEffectValue(t):t==d.Text.Color||t==d.Text.FontFamily||t==d.Text.FontSize||t==d.Text.FontStyle||t==d.Text.FontWeight||t==d.Text.TextAlign||t==d.Text.TextOverflow||t==d.Text.TextShadow||t==d.Text.LineHeight||t==d.Text.WebkitTextStroke||t==d.Text.WhiteSpace||t==d.Text.WordWrap||t==d.Text.Direction||t==d.Text.JsvTextEmoji||t==d.Text.JsvTextLatex||t==d.Text.JsvTextAlignMinWidth||t==d.Text.JsvTextVerticalAlign||t==d.Text.JsvTextLineAlign||t==d.Text.JsvTextInnerDirection?e=this.hasTextValue(t):t!=d.Motion.Animation&&t!=d.Motion.Transition||(e=this.hasMotionValue(t)),e}setLayoutValue(t,e){const i=(t,e)=>{const i=e;return this.layout[t]==i==0&&(this.layout[t]=i,!0)};this.ensureGroupExist(p.Layout.Name);let n=!1;if(t==d.Layout.Height)n=i("height",ze.ConvertToInt32(t,e));else if(t==d.Layout.Left)n=i("left",ze.ConvertToInt32(t,e));else if(t==d.Layout.Top)n=i("top",ze.ConvertToInt32(t,e));else{if(t!=d.Layout.Width)throw new Error;n=i("width",ze.ConvertToInt32(t,e))}return n?p.Layout.Name:null}getLayoutValue(t){const e=t=>this.layout?new g(this.layout[t]):new g;if(t==d.Layout.Height)return e("height");if(t==d.Layout.Left)return e("left");if(t==d.Layout.Top)return e("top");if(t==d.Layout.Width)return e("width");throw new Error}hasLayoutValue(t){const e=t=>!(!this.layout||this.layout[t]==g.InvalidInt32);if(t==d.Layout.Height)return e("height");if(t==d.Layout.Left)return e("left");if(t==d.Layout.Top)return e("top");if(t==d.Layout.Width)return e("width");throw new Error}setBackgroundValue(t,e){const i=(t,e)=>{const i=e;return this.background[t]==i==0&&(this.background[t]=i,!0)};this.ensureGroupExist(p.Background.Name);let n=!1;if(t==d.Background.BackgroundColor)n=i("backgroundColor",ze.ConvertToString(t,e));else if(t==d.Background.BackgroundImage)n=i("backgroundImage",ze.ConvertToBackgroundImage(t,e));else{if(t!=d.Background.BorderRadius)throw new Error;n=i("borderRadius",ze.ConvertToCorner(t,e))}return n?p.Background.Name:null}getBackgroundValue(t){const e=t=>this.background?new g(this.background[t]):new g;if(t==d.Background.BackgroundColor)return e("backgroundColor");if(t==d.Background.BackgroundImage)return e("backgroundImage");if(t==d.Background.BorderRadius)return e("borderRadius");throw new Error}hasBackgroundValue(t){const e=t=>!(!this.background||this.background[t]==g.InvalidPointer);if(t==d.Background.BackgroundColor)return e("backgroundColor");if(t==d.Background.BackgroundImage)return e("backgroundImage");if(t==d.Background.BorderRadius)return e("borderRadius");throw new Error}setEffectValue(t,e){const i=(t,e)=>{const i=e;return this.effect[t]==i==0&&(this.effect[t]=i,!0)};this.ensureGroupExist(p.Effect.Name);let n=!1;if(t==d.Effect.BackfaceVisibility)n=i("backfaceVisibility",ze.ConvertToString(t,e));else if(t==d.Effect.BorderImage)n=i("borderImage",ze.ConvertToBorderImage(t,e));else if(t==d.Effect.BorderImageWidth)n=i("borderImageWidth",ze.ConvertToRect(t,e));else if(t==d.Effect.BorderImageOutset)n=i("borderImageOutset",ze.ConvertToRect(t,e));else if(t==d.Effect.Display)n=i("display",ze.ConvertToString(t,e));else if(t==d.Effect.ObjectFit)n=i("objectFit",ze.ConvertToString(t,e));else if(t==d.Effect.Opacity)n=i("opacity",ze.ConvertToFloat(t,e));else if(t==d.Effect.Overflow)n=i("overflow",ze.ConvertToString(t,e));else if(t==d.Effect.Perspective)n=i("perspective",ze.ConvertToInt32(t,e));else if(t==d.Effect.PerspectiveOrigin)n=i("perspectiveOrigin",ze.ConvertToInt32(t,e));else if(t==d.Effect.Transform)n=i("transform",ze.ConvertToString(t,e));else if(t==d.Effect.TransformOrigin)n=i("transformOrigin",ze.ConvertToString(t,e));else if(t==d.Effect.TransformStyle)n=i("transformStyle",ze.ConvertToString(t,e));else if(t==d.Effect.Visibility)n=i("visibility",ze.ConvertToString(t,e));else{if(t!=d.Effect.ZIndex)throw new Error;n=i("zIndex",ze.ConvertToInt32(t,e))}return n?p.Effect.Name:null}getEffectValue(t){const e=t=>this.effect?new g(this.effect[t]):new g;if(t==d.Effect.BackfaceVisibility)return e("backfaceVisibility");if(t==d.Effect.BorderImage)return e("borderImage");if(t==d.Effect.BorderImageWidth)return e("borderImageWidth");if(t==d.Effect.BorderImageOutset)return e("borderImageOutset");if(t==d.Effect.Display)return e("display");if(t==d.Effect.ObjectFit)return e("objectFit");if(t==d.Effect.Opacity)return e("opacity");if(t==d.Effect.Overflow)return e("overflow");if(t==d.Effect.Perspective)return e("perspective");if(t==d.Effect.PerspectiveOrigin)return e("perspectiveOrigin");if(t==d.Effect.Transform)return e("transform");if(t==d.Effect.TransformOrigin)return e("transformOrigin");if(t==d.Effect.TransformStyle)return e("transformStyle");if(t==d.Effect.Visibility)return e("visibility");if(t==d.Effect.ZIndex)return e("zIndex");throw new Error}hasEffectValue(t){const e=(t,e)=>!(!this.effect||this.effect[t]==e);if(t==d.Effect.BackfaceVisibility)return e("backfaceVisibility",g.InvalidInt32);if(t==d.Effect.BorderImage)return e("borderImage",g.InvalidPointer);if(t==d.Effect.BorderImageWidth)return e("borderImageWidth",g.InvalidPointer);if(t==d.Effect.BorderImageOutset)return e("borderImageOutset",g.InvalidPointer);if(t==d.Effect.Display)return e("display",g.InvalidPointer);if(t==d.Effect.ObjectFit)return e("objectFit",g.InvalidPointer);if(t==d.Effect.Opacity)return e("opacity",g.InvalidFloat);if(t==d.Effect.Overflow)return e("overflow",g.InvalidPointer);if(t==d.Effect.Perspective)return e("perspective",g.InvalidInt32);if(t==d.Effect.PerspectiveOrigin)return e("perspectiveOrigin",g.InvalidInt32);if(t==d.Effect.Transform)return e("transform",g.InvalidPointer);if(t==d.Effect.TransformOrigin)return e("transformOrigin",g.InvalidPointer);if(t==d.Effect.TransformStyle)return e("transformStyle",g.InvalidPointer);if(t==d.Effect.Visibility)return e("visibility",g.InvalidPointer);if(t==d.Effect.ZIndex)return e("zIndex",g.InvalidInt32);throw new Error}setTextValue(t,e){const i=(t,e)=>{const i=e;return this.text[t]==i==0&&(this.text[t]=i,!0)};this.ensureGroupExist(p.Text.Name);let n=!1;if(t==d.Text.Color)n=i("color",ze.ConvertToString(t,e));else if(t==d.Text.FontFamily)n=i("fontFamily",ze.ConvertToString(t,e));else if(t==d.Text.FontSize)n=i("fontSize",ze.ConvertToInt32(t,e));else if(t==d.Text.FontStyle)n=i("fontStyle",ze.ConvertToString(t,e));else if(t==d.Text.FontWeight)n=i("fontWeight",ze.ConvertToString(t,e));else if(t==d.Text.LineHeight)n=i("lineHeight",ze.ConvertToInt32(t,e));else if(t==d.Text.TextAlign)n=i("textAlign",ze.ConvertToString(t,e));else if(t==d.Text.TextOverflow)n=i("textOverflow",ze.ConvertToString(t,e));else if(t==d.Text.TextShadow)n=i("textShadow",ze.ConvertToTextShadow(t,e));else if(t==d.Text.WebkitTextStroke)n=i("webkitTextStroke",ze.ConvertToWebkitTextStroke(t,e));else if(t==d.Text.WhiteSpace)n=i("whiteSpace",ze.ConvertToString(t,e));else if(t==d.Text.WordWrap)n=i("wordWrap",ze.ConvertToString(t,e));else if(t==d.Text.Direction)n=i("direction",ze.ConvertToString(t,e));else if(t==d.Text.JsvTextEmoji)n=i("jsvTextEmoji",ze.ConvertToInt32(t,e));else if(t==d.Text.JsvTextLatex)n=i("jsvTextLatex",ze.ConvertToInt32(t,e));else if(t==d.Text.JsvTextAlignMinWidth)n=i("jsvTextAlignMinWidth",ze.ConvertToInt32(t,e));else if(t==d.Text.JsvTextVerticalAlign)n=i("jsvTextVerticalAlign",ze.ConvertToString(t,e));else if(t==d.Text.JsvTextLineAlign)n=i("jsvTextLineAlign",ze.ConvertToString(t,e));else{if(t!=d.Text.JsvTextInnerDirection)throw new Error;n=i("jsvTextInnerDirection",ze.ConvertToString(t,e))}return n?p.Text.Name:null}getTextValue(t){const e=t=>this.text?new g(this.text[t]):new g;if(t==d.Text.Color)return e("color");if(t==d.Text.FontFamily)return e("fontFamily");if(t==d.Text.FontSize)return e("fontSize");if(t==d.Text.FontStyle)return e("fontStyle");if(t==d.Text.FontWeight)return e("fontWeight");if(t==d.Text.LineHeight)return e("lineHeight");if(t==d.Text.TextAlign)return e("textAlign");if(t==d.Text.TextOverflow)return e("textOverflow");if(t==d.Text.TextShadow)return e("textShadow");if(t==d.Text.WebkitTextStroke)return e("webkitTextStroke");if(t==d.Text.WhiteSpace)return e("whiteSpace");if(t==d.Text.WordWrap)return e("wordWrap");if(t==d.Text.Direction)return e("direction");if(t==d.Text.JsvTextEmoji)return e("jsvTextEmoji");if(t==d.Text.JsvTextLatex)return e("jsvTextLatex");if(t==d.Text.JsvTextAlignMinWidth)return e("jsvTextAlignMinWidth");if(t==d.Text.JsvTextVerticalAlign)return e("jsvTextVerticalAlign");if(t==d.Text.JsvTextLineAlign)return e("jsvTextLineAlign");if(t==d.Text.JsvTextInnerDirection)return e("jsvTextInnerDirection");throw new Error}hasTextValue(t){const e=(t,e)=>!(!this.text||this.text[t]==e);if(t==d.Text.Color)return e("color",g.InvalidPointer);if(t==d.Text.FontFamily)return e("fontFamily",g.InvalidPointer);if(t==d.Text.FontSize)return e("fontSize",g.InvalidInt32);if(t==d.Text.FontStyle)return e("fontStyle",g.InvalidPointer);if(t==d.Text.FontWeight)return e("fontWeight",g.InvalidPointer);if(t==d.Text.LineHeight)return e("lineHeight",g.InvalidInt32);if(t==d.Text.TextAlign)return e("textAlign",g.InvalidPointer);if(t==d.Text.TextOverflow)return e("textOverflow",g.InvalidPointer);if(t==d.Text.TextShadow)return e("textShadow",g.InvalidPointer);if(t==d.Text.WebkitTextStroke)return e("webkitTextStroke",g.InvalidPointer);if(t==d.Text.WhiteSpace)return e("whiteSpace",g.InvalidPointer);if(t==d.Text.WordWrap)return e("wordWrap",g.InvalidPointer);if(t==d.Text.Direction)return e("direction",g.InvalidPointer);if(t==d.Text.JsvTextEmoji)return e("jsvTextEmoji",g.InvalidInt32);if(t==d.Text.JsvTextLatex)return e("jsvTextLatex",g.InvalidInt32);if(t==d.Text.JsvTextAlignMinWidth)return e("jsvTextAlignMinWidth",g.InvalidInt32);if(t==d.Text.JsvTextVerticalAlign)return e("jsvTextVerticalAlign",g.InvalidPointer);if(t==d.Text.JsvTextLineAlign)return e("jsvTextLineAlign",g.InvalidPointer);if(t==d.Text.JsvTextInnerDirection)return e("jsvTextInnerDirection",g.InvalidPointer);throw new Error}setMotionValue(t,e){const i=(t,e)=>{const i=e;return this.motion[t]==i==0&&(this.motion[t]=i,!0)};this.ensureGroupExist(p.Motion.Name);let n=!1;if(t==d.Motion.Animation)n=i("animation",ze.ConvertToAnimation(t,e,this.motion.animation));else{if(t!=d.Motion.Transition)throw new Error;n=i("transition",ze.ConvertToTransition(t,e,this.motion.transition))}return n?p.Motion.Name:null}getMotionValue(t){const e=t=>this.motion?new g(this.motion[t]):new g;if(t==d.Motion.Animation)return e("animation");if(t==d.Motion.Transition)return e("transition");throw new Error}hasMotionValue(t){const e=t=>!(!this.motion||this.motion[t]==g.InvalidPointer);if(t==d.Motion.Animation)return e("animation");if(t==d.Motion.Transition)return e("transition");throw new Error}needUpdateTransition(t){return null!=this.motion&&null==this.motion.animation&&null!=this.motion.transition&&(t==d.Layout.Height||t==d.Layout.Left||t==d.Layout.Top||t==d.Layout.Width||t==d.Effect.Opacity||t==d.Effect.Transform)}ensureGroupExist(t){t==p.Layout.Name&&null==this.layout?this.layout=new p.Layout:t==p.Background.Name&&null==this.background?this.background=new p.Background:t==p.Effect.Name&&null==this.effect?this.effect=new p.Effect:t==p.Text.Name&&null==this.text?this.text=new p.Text:t==p.Motion.Name&&null==this.motion&&(this.motion=new p.Motion)}changedStyleGroups=new Set;lockedPropNames=new Set;layout=void 0;background=void 0;effect=void 0;text=void 0;motion=void 0}class Ke{static Manager=class{static StyleSheetKeyGlobal=0;declareStyleSheets(t){for(const[e,i]of Object.entries(t)){let t=0;t=parseInt(e,16),0==this.styleSheetMap.has(t)&&this.styleSheetMap.set(t,new Map);const n=this.styleSheetMap.get(t);for(const[t,e]of Object.entries(i))n.set(t,e)}return 0}getStyleSheets(){return this.styleSheetMap}appendStyleClassCache(t,e){0==this.parsedStyleClassCache.has(t)&&(e=null),this.parsedStyleClassCache.set(t,e)}findStyleClassCache(t){const e=this.parsedStyleClassCache.get(t);return null==e?null:e}clearStyleClassCache(){this.parsedStyleClassCache.clear()}static VariableInfo=class{static WatchListener=class{propName;listener};value=new g;watchListenerMap=new Map};watchVariable(t,e,i,r,a){let l=d.ToConst(e);s(null!=l,n.InvalidArgument);let h=this.getVariableInfo(r);if(s(null!=h,n.InvalidArgument),0==h.watchListenerMap.has(t)){const e=new Set;h.watchListenerMap.set(t,e)}const c=h.watchListenerMap.get(t),u=new Ke.Manager.VariableInfo.WatchListener;if(u.propName=l,u.listener=i,c.add(u),0==h.value.is(g.DataType.Null)){const t=i(l,h.value,a);if(t==n.CssStyleNotChanged)return t;o(t)}return 0}watchKeyframeVariables(t,e,i,n,s){const r=this.getRawKeyframes(t.classAttributes,n);if(0==r.length)return 0;const a=new Set;let l=this.getKeyframesVarNames(r,a);o(l);for(const n of a)l=this.watchVariable(t,e,i,n,s),o(l);return 0}unwatchVariable(t,e){for(const[i,n]of this.propVariableMap){if(0==n.watchListenerMap.has(t))continue;let i=n.watchListenerMap.get(t);for(const t of i)if(t.propName!=e){i.delete(t);break}}return 0}unwatchAllVariables(t){for(const[e,i]of this.propVariableMap)i.watchListenerMap.delete(t)}setVariable(t,e,i){let r=this.getVariableInfo(t);s(null!=r,n.InvalidArgument),r.value=e;for(const[t,s]of r.watchListenerMap)for(const t of s){let s=new Set;const r=t.listener(t.propName,e,s);if(r==n.CssStyleNotChanged)return r;o(r);for(const t of s)i.add(t)}return 0}insertKeyFrame(t,e){const i=this.styleSheetMap.get(Ke.Manager.StyleSheetKeyGlobal);r(i,null),i?.set(t,e)}removeKeyFrame(t){const e=this.styleSheetMap.get(Ke.Manager.StyleSheetKeyGlobal);if(r(e,null),e?.has(t)){e.delete(t);const i=document.styleSheets[0],n=i.cssRules;for(let e=n.length-1;e>=0;e--)if(n[e].name===t){i.deleteRule(e);break}}}getKeyframes(t,e){if(0==e.length)return"";const i=this.getRawKeyframes(t,e);if(0==i.length)return"";const n=new Set;if(l(this.getKeyframesVarNames(i,n),""),0==n.size)return i;let s=i;for(const t of n){const e=this.getVariableInfo(t);r(null!=e,""),a=t,o=e.value.toString(),s=s.replaceAll(a,o)}var a,o;return s}getRawKeyframes(t,e){if(0==e.length)return Ke.Manager.ConstEmptyString;if(0==this.styleSheetMap.has(Ke.Manager.StyleSheetKeyGlobal))return Ke.Manager.ConstEmptyString;const i=this.styleSheetMap.get(Ke.Manager.StyleSheetKeyGlobal);for(const n of t){const t=e+"-"+n.toString(16).padStart(8,"0");if(0==i.has(t))continue;return i.get(t)}if(i.has(e)){return i.get(e)}return Ke.Manager.ConstEmptyString}getKeyframesVarNames(t,e){e.clear();let i=t;const n=/var\([\s\S]+?\)/;let s;for(;null!==(s=n.exec(i));)e.add(s[0]),i=i.substring(s.index+s[0].length);return 0}getVariableInfo(t){let e=m.FormatVariableName(t);if(s(null!=e,null),0==this.propVariableMap.has(e)){const t=new Ke.Manager.VariableInfo;this.propVariableMap.set(e,t)}let i=this.propVariableMap.get(e);return i}static ConstEmptyString="";styleSheetMap=new Map;parsedStyleClassCache=new Map;propVariableMap=new Map};constructor(t){this.classStyleManager=t}getManager(){return this.classStyleManager}setClassNames(t){return null==t&&(t=""),this.classNames==t?n.CssClassNotChanged:(this.classNames=t,0)}getClassNames(){return this.classNames}appendClassAttribute(t){return this.classAttributes.has(t)?n.CssClassNotChanged:(this.classAttributes.add(t),0)}mergeClassAttributes(t){for(let e of t.classAttributes)this.classAttributes.add(e);return 0}hasClassAttribute(t){return this.classAttributes.has(t)}getClassAttributes(){return this.classAttributes}getClassDeclarations(t){if(0==this.classNames.length)return null;let e="";for(const i of t)e+=i+"{";e+=this.classNames;for(const i of t)e+="}";e+=" @ ";for(const t of this.classAttributes)e+=t+" ";const i=e;let n=this.classStyleManager.findStyleClassCache(i);return null==n&&(n=this.makeClassDeclarations(t),this.classStyleManager.appendStyleClassCache(i,n)),n}getKeyframes(t){if(0==t.length)return"";const e=this.classStyleManager.getKeyframes(this.classAttributes,t);return 0==e.length?"":e}static CastToStyleValue(t){let e;return null==t||Number(t)===t||"string"==typeof t?e=new g(t):"boolean"==typeof t?e=new g(Number(t)):(l(n.UnimplementedError,null),e=new g),e}static ParseDeclarations(t,e,i){let n=new Map;for(let s of e){if(0==t.has(i))continue;const e=t.get(i);if(0==e.has(s))continue;const r=e.get(s),a=JSON.parse(r);for(const[t,e]of Object.entries(a)){const i=d.ToConst(t);if(null==i){console.error("Unsupported style name: "+t);continue}const s=Ke.CastToStyleValue(e);n.set(i,s)}}return n}makeClassDeclarations(t){let e=new Map;const i=this.classStyleManager.getStyleSheets(),n=this.getNestedClassCombine(t),s=Ke.ParseDeclarations(i,n,Ke.Manager.StyleSheetKeyGlobal);for(const[t,i]of s)e.set(t,i);for(const t of this.classAttributes){const s=Ke.ParseDeclarations(i,n,t);for(const[t,i]of s)e.set(t,i)}return e}getNestedClassCombine(t){const e=ze.StringSplit(this.classNames),i=[];for(const t of e)i.push("."+t);for(let e=t.length-1;e>=0;e--){const n=t[e],s=i.length,r=ze.StringSplit(n);for(const t of r)for(let e=0;e<s;e++){const n=i[e];i.push("."+t+" "+n)}}return i}classStyleManager;classNames="";classAttributes=new Set}class Je{static STYLE_PROPERTY_GETTER(t,e,i){let n=new g;return t.getProperty(e,n)>=0?n.get():i}constructor(t,e){this.elementDelegate=t,this.style=new Xe,this.styleClass=new Ke(e)}finalize(){this.styleClass.getManager().unwatchAllVariables(this.styleClass)}hasPropGroup(t){return this.style.hasPropGroup(t)}setProperty(t,e,i){let r=t;0==m.IsVariable(t)&&(r=d.ToConst(t)),s(r,n.UnsupportedError),i.clear();return this.setStyleInheritedProperty(r,e,!0,i)}getProperty(t,e){const i=d.ToConst(t);s(i,n.UnsupportedError);return this.getStyleInheritedProperty(i,e)}setClassNames(t){const e=this.styleClass.setClassNames(t);return s(e>=0||e==n.CssClassNotChanged,e),0}getClassNames(){return this.styleClass.getClassNames()}appendClassAttribute(t){const e=this.styleClass.appendClassAttribute(t);return e==n.CssClassNotChanged||o(e),0}mergeClassAttributes(t){return o(this.styleClass.mergeClassAttributes(t.styleClass)),0}getKeyframes(t){const e=this.styleClass.getKeyframes(t);return r(null!=e,null,["Failed to get keyframes:"+t]),e}getNestedClassNames(t){const e=this.elementDelegate;s(null!=e,n.InvalidElement);const i=e.parentNode;s(null!=i,n.InvalidElement);const r=i.styleDelegate,a=this.styleClass.getClassAttributes();let l=[];for(const t of a){const e=[];o(r.getNestedClassNamesRecursive(t,e)),(l.length<=0||l.length>e.length)&&(l=e)}for(const e of l)t.push(e);if(t.length>5){let t="JsView: Low performance warning: ";t+="It is recommended that the nesting of style classes in a single vue file should less than 6.",t+="You can avoid this risk by splitting the vue file.",console.warn(t)}return 0}updateClassDeclarations(t,e){e.clear();const i=this.lastCssClassKeySet,s=new Set,r=this.styleClass.getClassDeclarations(t);if(null!=r)for(const[t,a]of r){let r=this.setStyleInheritedProperty(t,a,!1,e);r==n.CssStyleNotChanged&&(r=0),h(r),s.add(t),i.delete(t)}let a=new g;for(const t of i){let i=this.setStyleInheritedProperty(t,a,!1,e);i==n.CssStyleNotChanged&&(i=0),h(i)}this.lastCssClassKeySet=s}addChangedStyleGroup(t){return this.style.addChangedStyleGroup(t)}getChangedStyleGroups(){return this.style.getChangedStyleGroups()}clearChangedStyleGroups(){this.style.clearChangedStyleGroups()}jsvValidHeight(){return Je.STYLE_PROPERTY_GETTER(this,d.Layout.Height,0)}height(){return Je.STYLE_PROPERTY_GETTER(this,d.Layout.Height,g.InvalidInt32)}left(){return Je.STYLE_PROPERTY_GETTER(this,d.Layout.Left,0)}top(){return Je.STYLE_PROPERTY_GETTER(this,d.Layout.Top,0)}jsvValidWidth(){return Je.STYLE_PROPERTY_GETTER(this,d.Layout.Width,0)}width(){return Je.STYLE_PROPERTY_GETTER(this,d.Layout.Width,g.InvalidInt32)}backgroundColor(){return Je.STYLE_PROPERTY_GETTER(this,d.Background.BackgroundColor,null)}backgroundImage(){return Je.STYLE_PROPERTY_GETTER(this,d.Background.BackgroundImage,null)}borderRadius(){return Je.STYLE_PROPERTY_GETTER(this,d.Background.BorderRadius,null)}backfaceVisibility(){return Je.STYLE_PROPERTY_GETTER(this,d.Effect.BackfaceVisibility,null)}borderImage(){return Je.STYLE_PROPERTY_GETTER(this,d.Effect.BorderImage,null)}borderImageWidth(){return Je.STYLE_PROPERTY_GETTER(this,d.Effect.BorderImageWidth,null)}borderImageOutset(){return Je.STYLE_PROPERTY_GETTER(this,d.Effect.BorderImageOutset,null)}display(){return Je.STYLE_PROPERTY_GETTER(this,d.Effect.Display,null)}objectFit(){return Je.STYLE_PROPERTY_GETTER(this,d.Effect.ObjectFit,null)}opacity(){return Je.STYLE_PROPERTY_GETTER(this,d.Effect.ObjectFit,0)}overflow(){return Je.STYLE_PROPERTY_GETTER(this,d.Effect.Overflow,null)}perspective(){return Je.STYLE_PROPERTY_GETTER(this,d.Effect.Perspective,0)}perspectiveOrigin(){return Je.STYLE_PROPERTY_GETTER(this,d.Effect.PerspectiveOrigin,null)}transform(){return Je.STYLE_PROPERTY_GETTER(this,d.Effect.Transform,null)}transformOrigin(){return Je.STYLE_PROPERTY_GETTER(this,d.Effect.TransformOrigin,null)}transformStyle(){return Je.STYLE_PROPERTY_GETTER(this,d.Effect.TransformStyle,null)}visibility(){return Je.STYLE_PROPERTY_GETTER(this,d.Effect.Visibility,null)}zIndex(){return Je.STYLE_PROPERTY_GETTER(this,d.Effect.ZIndex,0)}color(){return Je.STYLE_PROPERTY_GETTER(this,d.Text.Color,f.Text.Color)}fontFamily(){return Je.STYLE_PROPERTY_GETTER(this,d.Text.FontFamily,f.Text.FontFamily)}fontSize(){return Je.STYLE_PROPERTY_GETTER(this,d.Text.FontSize,f.Text.FontSize)}fontStyle(){return Je.STYLE_PROPERTY_GETTER(this,d.Text.FontStyle,f.Text.FontStyle)}fontWeight(){return Je.STYLE_PROPERTY_GETTER(this,d.Text.FontWeight,f.Text.FontWeight)}lineHeight(){return Je.STYLE_PROPERTY_GETTER(this,d.Text.LineHeight,f.Text.LineHeight)}textAlign(){return Je.STYLE_PROPERTY_GETTER(this,d.Text.TextAlign,f.Text.TextAlign)}textOverflow(){return Je.STYLE_PROPERTY_GETTER(this,d.Text.TextOverflow,f.Text.TextOverflow)}textShadow(){return Je.STYLE_PROPERTY_GETTER(this,d.Text.TextShadow,f.Text.TextShadow)}webkitTextStroke(){return Je.STYLE_PROPERTY_GETTER(this,d.Text.WebkitTextStroke,f.Text.WebkitTextStroke)}whiteSpace(){return Je.STYLE_PROPERTY_GETTER(this,d.Text.WhiteSpace,f.Text.WhiteSpace)}wordWrap(){return Je.STYLE_PROPERTY_GETTER(this,d.Text.WordWrap,f.Text.WordWrap)}direction(){return Je.STYLE_PROPERTY_GETTER(this,d.Text.Direction,f.Text.Direction)}jsvTextEmoji(){return Je.STYLE_PROPERTY_GETTER(this,d.Text.JsvTextEmoji,f.Text.JsvTextEmoji)}jsvTextLatex(){return Je.STYLE_PROPERTY_GETTER(this,d.Text.JsvTextLatex,f.Text.JsvTextLatex)}jsvTextAlignMinWidth(){return Je.STYLE_PROPERTY_GETTER(this,d.Text.JsvTextAlignMinWidth,f.Text.JsvTextAlignMinWidth)}jsvTextVerticalAlign(){return Je.STYLE_PROPERTY_GETTER(this,d.Text.JsvTextVerticalAlign,f.Text.JsvTextVerticalAlign)}jsvTextLineAlign(){return Je.STYLE_PROPERTY_GETTER(this,d.Text.JsvTextLineAlign,f.Text.JsvTextLineAlign)}jsvTextInnerDirection(){return Je.STYLE_PROPERTY_GETTER(this,d.Text.JsvTextInnerDirection,f.Text.JsvTextInnerDirection)}animation(){return Je.STYLE_PROPERTY_GETTER(this,d.Motion.Animation,null)}transition(){return Je.STYLE_PROPERTY_GETTER(this,d.Motion.Transition,null)}static OnVariableChanged(t,e,i,r){const a=t;if(e==d.Motion.Animation){const t=a.elementDelegate;s(null!=t,n.InvalidElement),a.addChangedStyleGroup(p.Motion.Name),r.add(t.nativeId)}else{const t=a.setStyleInheritedProperty(e,i,!1,r);if(t==n.CssStyleNotChanged)return t;o(t)}return 0}setStyleInheritedProperty(t,e,i,r){const a=this.styleClass.getManager();let l=n.UnknownError;if(m.IsVariable(t))l=a.setVariable(t,e,r);else if(m.IsVariable(e))l=a.watchVariable(this.styleClass,t,Je.OnVariableChanged.bind(null,this),e.get(),r);else{if(l=this.style.setPropValue(t,e,i),l==n.CssStyleNotChanged)return l;if(o(l),t==d.Motion.Animation){i&&(l=a.unwatchVariable(this.styleClass,t),o(l));const e=this.style.getPropValue(t);e.is(g.DataType.Animation)&&(l=a.watchKeyframeVariables(this.styleClass,t,Je.OnVariableChanged.bind(null,this),e.get().name,r),o(l))}}if(l==n.CssStyleNotChanged)return l;o(l);const h=this.elementDelegate;s(null!=h,n.InvalidElement),r.add(h.nativeId);const c=(t,e,i)=>{for(const n of e.childNodes)n.styleDelegate.style.hasPropValue(t)||c(t,n,i);const n=e instanceof si?e:null;null!=n&&0!=n.getTextContent().length&&(e.styleDelegate.addChangedStyleGroup(p.Text.Name),i.add(e.nativeId))};return Xe.IsInheritedProp(t)&&c(t,h,r),0}getStyleInheritedProperty(t,e){if(e.reset(this.style.getPropValue(t)),0==e.is(g.DataType.Null))return 0;if(0==Xe.IsInheritedProp(t))return n.CssStyleNotExists;const i=this.elementDelegate;s(null!=i,n.InvalidElement);const r=i.parentNode;if(null==r)return n.CssStyleNotExists;const a=r.styleDelegate.getStyleInheritedProperty(t,e);return a<0?a:0}getNestedClassNamesRecursive(t,e){const i=this.elementDelegate;if(s(null!=i,n.InvalidElement),0==this.styleClass.hasClassAttribute(t))return 0;const r=i.parentNode;s(null!=r,n.InvalidElement);o(r.styleDelegate.getNestedClassNamesRecursive(t,e));const a=this.styleClass.getClassNames();return a.length<=0||e.push(a),0}elementDelegate;style;styleClass;lastCssClassKeySet=new Set}class qe{static DataType=class{static Null=0;static Int32=1;static Float=2;static String=3};static InvalidInt32=Number.MIN_VALUE;static InvalidFloat=Number.NaN;static InvalidPointer=null;constructor(t){let e=-1;null==t?e=qe.DataType.Null:Number(t)===t&&t%1==0?e=qe.DataType.Int32:Number(t)===t&&t%1!=0?e=qe.DataType.Float:"string"==typeof t&&(e=qe.DataType.String),this.data=new qe.DataInfo,t!=qe.InvalidInt32&&t!=qe.InvalidFloat&&t!=qe.InvalidPointer?this.data.value=t:this.data.value=null,this.data.index=e}is(t){return this.data.index==t}get(){return this.data.value}reset(t){this.data.value=t.data.value,this.data.index=t.data.index}equals(t){return this.data.value===t.data.value&&this.data.index===t.data.index}static DataInfo=class{value=null;index=-1};data}class Ze{constructor(){this._PersistMap=new Map,this._PersistMax=300,this._PersistIdx=0,this._PersistTrackList=new Array(this._PersistMax),this._TempMap=new Map,this._TempMax=50,this._TempIdx=0,this._TempTrackList=new Array(this._TempMax)}getPersistPack(t){return this._PersistMap.get(t)}putPersistPack(t,e){Ze._putPack(this._PersistMap,this._PersistTrackList,this._PersistIdx,t,e),this._PersistIdx=(this._PersistIdx+1)%this._PersistMax}getTempPack(t){return this._TempMap.get(t)}putTempPack(t,e){Ze._putPack(this._TempMap,this._TempTrackList,this._TempIdx,t,e),this._TempIdx=(this._TempIdx+1)%this._TempMax}static _putPack(t,e,i,n,s){let r=e[i];r&&(t.delete(r),e[i]=n),t.set(n,s)}}let Qe=new Ze;class ti{static ClipView=_.ClipView;static LayoutView=_.LayoutView;static NinePatchView=_.NinePatchView;static ViewRoundCornerMask=_.ViewRoundCornerMask;static AnimationListener=_.AnimationListener;static sRenderBridge=_.sRenderBridge;static Animation=class{constructor(){}Cancel(){this.animation.Cancel()}Enable(t){this.animation.Enable(t)}EnableDelay(t){this.animation.EnableDelay(t)}SetAnimationListener(t){this.animation.SetAnimationListener(t)}SetRepeat(t){this.animation.SetRepeat(t)}Start(t){this.animation.Start(t)}animation};static AnimationCssKeyframes=class extends _.CssKeyframeAnimation{constructor(t,e){super(e.keyframes,e.duration,e.easing,e.width,e.height)}};static AnimationCssTransition=class extends _.CssTransitionAnimation{static Value=class{constructor(t){this.data=t}data};constructor(t,e){let i=[];for(const t of e){let e={name:t.name,dur:t.duration,tf:null,dly:t.delay,from:t.from.data,to:t.to.data};i.push(e)}super(i)}};static AnimationEnable=_.AnimationEnable;GetAnimationManager(){}static TextUtils=class{static GetTextWidth(t,e,i,n,s,r){return _.sTextUtils.GetTextWidth(e,i,n,s,r)}static GetOneLineTextDrawWidth(t,e,i,n,s,r,a){_.sTextUtils.GetOneLineTextDrawWidth(e,i,n,s,r,a)}static BuildTextView(t,e,i,n,s,r,a,o,l,h,c){return _.sTextUtils.BuildTextView(t,e,i.GetStylePack(),n,{width:s,height:r},0!=a?a:null,o,l,0!=h,0!=c)}};static TextStyleCache=class{UpdateShadow(t,e,i,n){this.stylePackData.shadow={shadowOffsetX:t,shadowOffsetY:e,shadowBlur:i,shadowColor:n}}UpdateStroke(t,e){this.stylePackData.stroke={strokeWidth:t,strokeColor:e}}CommitChanges(){this.stylePackData.textColor=this.textColor,this.stylePackData.font=this.font,this.stylePackData.italic=this.italic,this.stylePackData.bold=this.bold,this.stylePackData.hAlign=this.hAlign,this.stylePackData.vAlign=this.vAlign,this.stylePackData.vAreaAlign=this.vAreaAlign,this.stylePackData.textOverflow=this.textOverflow,this.stylePackData.wordWrap=this.wordWrap,this.stylePackData.direction=this.direction,this.stylePackData.textInnerDirection=this.textInnerDirection,this.stylePackData.whiteSpace=this.whiteSpace;let t=JSON.stringify(this.stylePackData);this.stylePackData.textColor=null==this.stylePackData.textColor?void 0:this.stylePackData.textColor,this.stylePackData.font=null==this.stylePackData.font?void 0:this.stylePackData.font,this.stylePackData.italic=null==this.stylePackData.italic?void 0:this.stylePackData.italic,this.stylePackData.bold=null==this.stylePackData.bold?void 0:this.stylePackData.bold,this.stylePackData.hAlign=null==this.stylePackData.hAlign?void 0:this.stylePackData.hAlign,this.stylePackData.vAlign=null==this.stylePackData.vAlign?void 0:this.stylePackData.vAlign,this.stylePackData.vAreaAlign=null==this.stylePackData.vAreaAlign?void 0:this.stylePackData.vAreaAlign,this.stylePackData.textOverflow=null==this.stylePackData.textOverflow?void 0:this.stylePackData.textOverflow,this.stylePackData.wordWrap=null==this.stylePackData.wordWrap?void 0:this.stylePackData.wordWrap,this.stylePackData.direction=null==this.stylePackData.direction?void 0:this.stylePackData.direction,this.stylePackData.textInnerDirection=null==this.stylePackData.textInnerDirection?void 0:this.stylePackData.textInnerDirection,this.stylePackData.whiteSpace=null==this.stylePackData.whiteSpace?void 0:this.stylePackData.whiteSpace,"nowrap"===this.stylePackData.whiteSpace&&(this.stylePackData.wordWrap="none");let e=Qe.getTempPack(t);e||(e=_.sTextStyleCache.StyleToPack(this.stylePackData),Qe.putTempPack(t,e)),this.textStylePack=e}GetStylePack(){return this.textStylePack}stylePackData={};textStylePack};GetRootView(){return new _.RootView}GetTextureManager(){return window.JsvCode.ForgeHandles.TextureManager}GetTextureSetting(t,e){return new _.ExternalTextureSetting(t,e)}GetRenderBridge(){return ti.sRenderBridge}}ti.LayoutView.eVisibility={VIEW_HIDDEN:"hidden",VIEW_VISIBLE:"visible"};class ei{name;value;viewType;constructor(t,e,i){this.name=t,this.value=e,this.viewType=i}}class ii{static TAG="ElementDelegate";static MakeShared(t,e,i,n){const s=new n(t,e);return s.styleDelegate=new Je(s,i),s}static State={NeedRefreshCssClass:1,NeedRefreshCssClassAttribute:2,NeedCallPostProcess:3};bindToForgeRootView(t){this.forgeMainView=t.GetRootView(),this.forgeMaskView=this.forgeMainView}insertForgeView(t,e,i){e.ensureForgeMaskView(t);const n=this.forgeMainView.InsertView(e.forgeMaskView,i?i.forgeMaskView:null);a(n||void 0===n),this.linkChild(t,e,i)}removeForgeView(t,e){this.forgeMainView.RemoveView(e.forgeMaskView),this.unlinkChild(t,e)}linkChild(t,e,i){this.childNodes.push(e),e.parentNode=this,(e.attrStore.extendClassAttributeDepth>0||e.hasExtendClassAttributeChildren)&&(this.hasExtendClassAttributeChildren=!0)}unlinkChild(t,e){const i=this.childNodes.indexOf(e);this.childNodes.splice(i,1),e.parentNode=void 0}moveForgeView(t,e,i,n){e.unlinkChild(t,i),this.linkChild(t,i,n),(e.forgeMaskView?e.forgeMaskView:e.forgeMainView).MoveChildView(i.forgeMaskView,this.forgeMaskView?this.forgeMaskView:this.forgeMainView,n?n.forgeMaskView:null),console.log("moving child")}addEventListener(t,e,i){if(null==this.eventInfoMap&&(this.eventInfoMap=new Map),0==this.eventInfoMap.has(t)){const i=new ii.EventInfo;i.listener=e,this.eventInfoMap.set(t,i)}this.eventInfoMap.get(t).count++;const n=this.tryDealWithCustomEvent(t,i);return o(n),n}removeEventListener(t,e){if(null==this.eventInfoMap)return;if(0==this.eventInfoMap.has(t))return;const i=this.eventInfoMap.get(t);i.count--,i.count<=0&&this.eventInfoMap.delete(t)}setAttribute(t,e,i){let r=n.UnsupportedError;if(ze.StringStartsWith(e,"data-v-"))r=this.appendStyleClassAttribute(e),o(r),r=ii.State.NeedRefreshCssClassAttribute;else if(ze.StringStartsWith(e,"class"))r=this.styleDelegate.setClassNames(i),o(r),r=ii.State.NeedRefreshCssClass;else if(ze.StringStartsWith(e,"data-jsv-extend-class-attr")){const t=ze.StringToInt32(i);s(t!=g.InvalidInt32,n.InvalidArgument),r=this.setExtendClassAttributeDepth(t),o(r),r=ii.State.NeedRefreshCssClass}return o(r),r}getExtendClassAttributeChildren(t,e=0){if(this.attrStore.extendClassAttributeDepth==e)return t.add(this),0;if(0==this.hasExtendClassAttributeChildren)return 0;for(let i of this.childNodes){if(i.attrStore.extendClassAttributeDepth<=0&&0==i.hasExtendClassAttributeChildren)continue;o(i.getExtendClassAttributeChildren(t,e+1))}return 0}onCssStyleChanged(t){const e=this.styleDelegate.getChangedStyleGroups();return e.has(p.Layout.Name)&&this.onFlushViewLayout(t),e.has(p.Background.Name)&&this.onFlushViewBackground(t),e.has(p.Effect.Name)&&this.onFlushViewEffect(t),e.has(p.Motion.Name)&&this.onFlushViewMotion(t),this.styleDelegate.clearChangedStyleGroups(),0}onAllChangeFinished(t){if(null==this.onAllChangeFinishTasks)return 0;for(const t of this.onAllChangeFinishTasks)t();return this.onAllChangeFinishTasks=void 0,0}handleAfterAllChangeFinish(t){null==this.onAllChangeFinishTasks&&(this.onAllChangeFinishTasks=[]),this.onAllChangeFinishTasks.push(t)}setForgeViewInnerProps(t,e,i,n){return 1==i?this.forgeMaskView?this.forgeMaskView.SetElementProp(t,e,n):this.forgeInnerPropsCacheList.push(new ei(e,n,i)):this.forgeMainView.SetElementProp(t,e,n),0}getElementView(t){return t?this.forgeMaskView:this.forgeMainView}setClientWidth(t,e){this.clientWidth=e}getClientWidth(t){return this.clientWidth<0?this.styleDelegate.width():this.clientWidth}setClientHeight(t,e){this.clientHeight=e}getClientHeight(t){return this.clientHeight>0?this.clientHeight:this.styleDelegate.jsvValidHeight()}nativeId;styleDelegate;childNodes=[];parentNode=void 0;constructor(t,e){this.nativeId=e,this.forgeMainView=new ti.LayoutView,this.forgeMaskView=null}sendEvent(t,e){if(null==this.eventInfoMap||0==this.eventInfoMap.has(t))return;console.log("ElementDelegate.sendEvent(). event="+t);const i=this.eventInfoMap.get(t);let n=[];n.push(new qe(this.nativeId)),n.push(new qe(t));for(const t of e)n.push(t);i.listener(n)}getObjectFitClipStatus(t){}flushMaskViewClip(t){if(null==this.forgeMaskView)return;const e=this.forgeMaskView instanceof ti.ClipView?this.forgeMaskView:null;if(null==e)return;let i={left:0,top:0,width:0,height:0,useScissors:!1};if(this.getObjectFitClipStatus(i),!i.useScissors){const t=this.styleDelegate.overflow();null!=t&&"hidden"==t&&(i.width=this.styleDelegate.jsvValidWidth(),i.height=this.styleDelegate.jsvValidHeight(),i.useScissors=!0)}e.SetClipRect(i.left,i.top,i.width,i.height,i.useScissors)}onFlushViewLayout(t){if(0==this.styleDelegate.hasPropGroup(p.Layout.Name))return;const e=this.styleDelegate.left(),i=this.styleDelegate.top(),n=this.styleDelegate.jsvValidWidth(),s=this.styleDelegate.jsvValidHeight();this.forgeMaskView.ResetLayoutParams({x:e,y:i,width:n,height:s}),this.forgeMaskView!=this.forgeMainView&&this.forgeMainView.ResetLayoutParams({x:0,y:0,width:n,height:s})}onFlushViewBackground(t){if(0==this.styleDelegate.hasPropGroup(p.Background.Name))return;const e=t.GetTextureManager(),i=this.styleDelegate.backgroundColor(),n=this.styleDelegate.backgroundImage(),s=this.styleDelegate.borderRadius();let r,a;i&&(r=e.GetColorTexture(i)),n&&(n.type==g.BackgroundImageImpl.eType.LINEAR_GRADIENT?(r=e.GetNamedCachedTexture(n.urlPath),null==r&&(r=e.CreateCssGradientColorTexture(n.urlPath,n.linearGradient.fromX,n.linearGradient.fromY,n.linearGradient.toX,n.linearGradient.toY,n.linearGradient.stops))):r=e.GetImage(n.urlPath,null)),s&&(a=new ti.ViewRoundCornerMask(s.topLeft,s.topRight,s.bottomLeft,s.bottomRight)),this.forgeMainView.ResetTexture(r,a)}onFlushViewEffect(t){if(0==this.styleDelegate.hasPropGroup(p.Effect.Name))return;const e=this.styleDelegate.visibility();let i=e&&"hidden"==e?ti.LayoutView.eVisibility.VIEW_HIDDEN:ti.LayoutView.eVisibility.VIEW_VISIBLE;"none"==this.styleDelegate.display()&&(i=ti.LayoutView.eVisibility.VIEW_HIDDEN),this.forgeMaskView.SetVisibility(i),this.flushMaskViewClip(t);const n=this.styleDelegate.perspective();if(n>0){const t=this.styleDelegate.perspectiveOrigin();this.forgeMainView.SetPerspective(n,t)}const s=this.styleDelegate.backfaceVisibility();s&&this.forgeMainView.SetBackfaceVisibility("visible"==s),this.styleDelegate.transformStyle()&&this.forgeMainView.SetTransformStyle(this.styleDelegate.transformStyle()),this.forgeMaskView.ResetCssTransform(this.styleDelegate.transform(),this.styleDelegate.transformOrigin()),this.forgeMaskView.SetZIndex(this.styleDelegate.zIndex())}onFlushViewMotion(t){if(null!=this.forgeAnimation&&(this.forgeAnimation.Cancel(),this.forgeAnimation=null),0==this.styleDelegate.hasPropGroup(p.Motion.Name))return;let e="",i="";const n=this.styleDelegate.animation(),s=this.styleDelegate.transition();if(null!=n&&null!=s&&console.warn("ElementDelegate","Cannot set both animation and transition on a single element at the same time."),null!=n){e="animation",i=n.name;const s=this.styleDelegate.getKeyframes(n.name);this.forgeAnimation=this.makeAnimation(t,n,s)}if(null!=s&&null==this.forgeAnimation){const i=t.GetRenderBridge().GetSwapCount();if(this.transitionSetInfo.alreadySet&&this.transitionSetInfo.swapCount!=i)e="transition",this.forgeAnimation=this.makeTransition(t,s);else{for(const[t,e]of s.animationMap){let e=new g;const i=d.ToConst(t);null!=i&&(this.styleDelegate.getProperty(i,e),this.attrStore.transitionStyleMap.set(t,e))}this.transitionSetInfo.alreadySet||(this.transitionSetInfo.alreadySet=!0,this.transitionSetInfo.swapCount=i)}}else this.attrStore.transitionStyleMap.clear(),this.transitionSetInfo.swapCount=0,this.transitionSetInfo.alreadySet=!1;if(null!=this.forgeAnimation){const t=this.makeForgeAnimationListener(e,i);null!=t&&this.forgeAnimation.SetAnimationListener(t),this.forgeMaskView.StartAnimation(this.forgeAnimation)}}tryDealWithCustomEvent(t,e){if("jsvgetbound"===t){s(e.has("jsvtoken"),n.InvalidArgument);const i=e.get("jsvtoken"),r=()=>{const e=this;null!=e?e.getBoundingClientRect(t,i,e.forgeMainView):console.error("ElementDelegate.tryDealWithCustomEvent(), Element has been released.")};return this.handleAfterAllChangeFinish(r),ii.State.NeedCallPostProcess}return 0}makeAnimation(t,e,i){if(null==e||null==i)return null;const n=this.styleDelegate.jsvValidWidth(),s=this.styleDelegate.jsvValidHeight();let r={keyframes:i,duration:e.duration,easing:e.timingFunction,width:n,height:s,left:this.styleDelegate.left(),top:this.styleDelegate.top()};const a=new ti.AnimationCssKeyframes(t.GetAnimationManager(),r);return a.EnableDelay(e.delay),a.SetRepeat(e.iterationCount),a.Enable(ti.AnimationEnable.ReleaseAfterEndCallback),a}makeTransition(t,e){if(null==e)return this.attrStore.transitionStyleMap.clear(),null;let i=[];for(const[t,n]of e.animationMap){if(null==n)continue;const e=this.attrStore.transitionStyleMap.get(t)??new g;let r=new g;const a=d.ToConst(t);if(s(a,null,["Failed makeTransition no support:"+t]),this.styleDelegate.getProperty(a,r),e==r)continue;const o={name:t,duration:n.duration,easing:n.timingFunction,delay:n.delay,from:new ti.AnimationCssTransition.Value,to:new ti.AnimationCssTransition.Value,origin:""};if(e.is(g.DataType.Int32)){const t=e.get();o.from=new ti.AnimationCssTransition.Value(t)}else if(e.is(g.DataType.Float)){const t=e.get();o.from=new ti.AnimationCssTransition.Value(t)}else if(e.is(g.DataType.String)){const t=e.get();o.from=new ti.AnimationCssTransition.Value(t)}if(r.is(g.DataType.Int32)){const t=r.get();o.to=new ti.AnimationCssTransition.Value(t)}else if(r.is(g.DataType.Float)){const t=r.get();o.to=new ti.AnimationCssTransition.Value(t)}else if(r.is(g.DataType.String)){const t=r.get();o.to=new ti.AnimationCssTransition.Value(t)}t==d.Effect.Transform&&(o.origin=null!=this.styleDelegate.transformOrigin()?this.styleDelegate.transformOrigin():"center center"),i.push(o),this.attrStore.transitionStyleMap.set(t,r)}return new ti.AnimationCssTransition(t.GetAnimationManager(),i)}makeForgeAnimationListener(t,e){const i=new ti.AnimationListener(null,null,null);return i.OnStart((()=>{const i=t+"start";this.sendEvent(i,[new qe(e)])})),i.OnRepeat((i=>{const n=t+"iteration";this.sendEvent(n,[new qe(e)])})),i.OnEnd((i=>{let n;n=i?t+"end":t+"cancel",this.sendEvent(n,[new qe(e)])})),i}ensureForgeMaskView(t){if(this.forgeMainView.mParentView)return void console.log("ElementDelegate.ensureForgeMaskView(), Failed to ensure forge mask view, main view's parent is not null.");const e=this.styleDelegate.objectFit(),i=this.styleDelegate.overflow();if(null!=e||null!=i?(null!=this.forgeMaskView&&console.error(ii.TAG,"Jsview: jsvMaskView is conflicting."),this.forgeMaskView=new ti.ClipView):null==this.forgeMaskView&&(this.forgeMaskView=this.forgeMainView),this.forgeMaskView!==this.forgeMainView&&this.forgeMaskView.AddView(this.forgeMainView,0,0),this.forgeInnerPropsCacheList.length>0){for(let e of this.forgeInnerPropsCacheList)this.forgeMaskView.SetElementProp(t,e.name,e.value);this.forgeInnerPropsCacheList=[]}}appendStyleClassAttribute(t){const e=t.replace("data-v-","");let i=0;i=parseInt(e,16);let n=this.styleDelegate.appendClassAttribute(i);o(n);const s=new Set;n=this.getExtendClassAttributeChildren(s),o(n);for(let t of s)n=t.styleDelegate.appendClassAttribute(i),o(n);return 0}setExtendClassAttributeDepth(t){if(t<=0)return 0;this.attrStore.extendClassAttributeDepth=t;let e=this;for(let i=0;i<t&&(e=e.parentNode,null!=e);i++);if(e){o(this.styleDelegate.mergeClassAttributes(e.styleDelegate))}return 0}convertObjectFit(t){return t?"fill"==t?"fill":"none"==t?"none":"cover"==t?"cover":"contain"==t?"contain":"scale-down"==t?"scale-down":"fill":"fill"}getBoundingClientRect(t,e,i){if(i){const n=i=>{this.sendEvent(t,[new qe(i),new qe(e)])};i.GetBoundingClientRect(n)}else{const i='{"status": -100, "error": target LayoutView is null})';this.sendEvent(t,[new qe(i),new qe(e)])}}static EventInfo=class{listener=void 0;count=0};static AttrStore=class{transitionStyleMap=new Map;extendClassAttributeDepth=-1};static TransitionSetInfo=class{swapCount=0;alreadySet=!1};forgeAnimation=null;eventInfoMap=void 0;onAllChangeFinishTasks=void 0;attrStore=new ii.AttrStore;hasExtendClassAttributeChildren=!1;transitionSetInfo=new ii.TransitionSetInfo;forgeMaskView;forgeMainView;clientWidth=-1;clientHeight=-1;forgeInnerPropsCacheList=[]}class ni{static isRtl(t){for(let e=0;e<t.length;++e){let i=t.charCodeAt(e);if(32!==i)return i>=1536&&i<=1791}return!1}}class si extends ii{static TAG="DivDelegate";setTextContent(t){this.textContent=t}getTextContent(){return this.textContent}onCssStyleChanged(t){const e=this.styleDelegate.getChangedStyleGroups();return(e.has(p.Text.Name)||e.has(p.Layout.Name)&&this.clientWidth!=this.styleDelegate.jsvValidHeight())&&this.onFlushViewText(t),e.has(p.Effect.Name)&&null!=this.styleDelegate.borderImage()&&this.onFlushViewBorder(t),super.onCssStyleChanged(t)}constructor(t,e){super(t,e)}onFlushViewText(t){if(!this.textContent)return void(this.forgeContentView&&(this.forgeMainView.RemoveView(this.forgeContentView),this.forgeContentView=null));null==this.forgeContentView&&(this.forgeContentView=new ti.LayoutView,this.forgeMainView.InsertView(this.forgeContentView)),this.forgeContentView.ClearViews(),this.clientWidth=0,this.clientHeight=0;let e=t.GetTextureManager(),i=new ti.TextStyleCache;const n=this.styleDelegate.fontSize();let s=this.styleDelegate.lineHeight();s<=0&&(s=n>0?Math.ceil(1.3*n):14);const r=this.styleDelegate.jsvTextEmoji(),a=this.styleDelegate.jsvTextLatex(),o=this.styleDelegate.fontStyle(),l=this.styleDelegate.fontWeight(),h=this.styleDelegate.textShadow(),c=this.styleDelegate.webkitTextStroke();s>=0&&(i.vAlign="middle"),i.textColor=this.styleDelegate.color(),i.font=this.styleDelegate.fontFamily(),i.italic=o&&"italic"==o,i.bold=l&&"bold"==l,i.hAlign=this.styleDelegate.textAlign(),i.vAlign=this.styleDelegate.jsvTextLineAlign(),i.vAreaAlign=this.styleDelegate.jsvTextVerticalAlign(),i.textOverflow=this.styleDelegate.textOverflow(),h&&i.UpdateShadow(h.hShadow,h.vShadow,h.blur,h.color),c&&i.UpdateStroke(c.length,c.color),i.whiteSpace=this.styleDelegate.whiteSpace(),i.wordWrap=this.styleDelegate.wordWrap(),i.direction=this.styleDelegate.direction(),i.textInnerDirection=this.styleDelegate.jsvTextInnerDirection(),i.CommitChanges(e);const u=this.styleDelegate.height();let d=this.styleDelegate.width(),f=u!=g.InvalidInt32?u:0,m=d==g.InvalidInt32;if(m&&(d=ti.TextUtils.GetTextWidth(e,this.textContent,i.font,n,i.bold,i.italic)),d<=0)return void console.error(si.TAG,"Failed to render text: %s, text width is invalid.");let p=d,_=this.styleDelegate.jsvTextAlignMinWidth();_>0&&p<_&&(p=_);const T=u==g.InvalidInt32||0==u,y=T?(t,e,i)=>{this.clientWidth=t,this.clientHeight=e}:null;let w=Math.floor(d*ti.sRenderBridge.GetScreenInfo().scaleRatio);if(w>3e3){if(!m)return void console.error(`long text only support style.width=undefine. str=${this.textContent}`);console.log(`text too long, start to break down. width(${w})`),this.forgeTextView=new ti.LayoutView;const t=[];ti.TextUtils.GetOneLineTextDrawWidth(e,this.textContent,i.font,n,i.bold,i.italic,t);const o=t[0];let l=0;const h="unset"===i.textInnerDirection?ni.isRtl(this.textContent):"rtl"===i.textInnerDirection;for(let c=1;c<t.length;c+=3){const u=t[c],d=t[c+1],g=t[c+2],m=this.textContent.slice(u,d);let p=ti.TextUtils.BuildTextView(e,m,i,0==u?y:null,g,f,n,s,!0,a,r);const _=h?o-l-g:l;this.forgeTextView.AddView(p,_,0,g,f),l+=g}this.clientWidth=o}else this.forgeTextView=ti.TextUtils.BuildTextView(e,this.textContent,i,y,p,f,n,s,!0,a,r),this.clientWidth=d;T&&this.forgeTextView.EnableAutoHeight(),this.forgeContentView.InsertView(this.forgeTextView)}ensureForgeMaskView(t){null!=this.styleDelegate.borderImage()&&(this.forgeMaskView=new ti.NinePatchView),super.ensureForgeMaskView(t)}onFlushViewBorder(t){if(null==this.forgeMaskView)return;const e=this.styleDelegate.borderImage();if(null!=e)if(0==e.source.length)this.forgeMaskView.ResetTexture(null,null);else{const i=t.GetTextureManager(),n=e.source,s=i.GetImage(n,null);this.forgeMaskView.ResetTexture(s,null),this.forgeMaskView.WaitTextureToResize(!0);const r=(t,i,n)=>{const s=this.styleDelegate.borderImageWidth(),r=this.styleDelegate.borderImageOutset();if(null==this.forgeMaskView||null==e.slice||null==s||null==r)return void console.log(si.TAG,"Nine patch settings are not complete.");const a=this.forgeMaskView,o=Math.floor(t*s.top/e.slice.top),l=Math.floor(i*s.left/e.slice.left);a.SetImageDspSize(o,l);const h={start:r.left,width:Math.max(0,o-r.left-r.right)},c={start:r.top,width:Math.max(0,l-r.top-r.bottom)};a.SetPadding(h,c);const u=[{start:s?.left,width:Math.max(0,o-2*s.left)}],d=[{start:s.top,width:Math.max(0,l-2*s.top)}];a.SetRepeat(u,d),a.WaitTextureToResize(!1)};s.RegisterLoadImageCallback(r)}}getBoundingClientRect(t,e,i){this.styleDelegate.height()!=g.InvalidInt32&&this.styleDelegate.width()!=g.InvalidInt32||null==this.forgeTextView||(i=this.forgeTextView),super.getBoundingClientRect(t,e,i)}forgeContentView;forgeTextView;textContent=""}class ri extends ii{constructor(t,e){super(t,e)}}class ai extends ri{constructor(t,e){super(t,e)}}class oi extends ii{setAttribute(t,e,i){const n=()=>{const e=this;null!=e?e.loadImage(t,e.imgAttrStore.src):console.error("ElementDelegate.tryDealWithCustomEvent(), Element has been released.")};if("src"==e)return this.imgAttrStore.src=i,this.handleAfterAllChangeFinish(n),oi.State.NeedCallPostProcess;return 0==this.setTextureAttribute(t,e,i)?(this.handleAfterAllChangeFinish(n),oi.State.NeedCallPostProcess):super.setAttribute(t,e,i)}onCssStyleChanged(t){const e=this.styleDelegate.getChangedStyleGroups();return(e.has(p.Layout.Name)||e.has(p.Effect.Name))&&this.onFlushViewImage(t),super.onCssStyleChanged(t)}constructor(t,e){super(t,e),this.forgeImageView=new ti.LayoutView(null,"img"),this.forgeMainView.InsertView(this.forgeImageView)}setForgeViewInnerProps(t,e,i,n){return 1==i?super.setForgeViewInnerProps(t,e,i,n):(this.forgeImageView.SetElementProp(t,e,n),0)}getObjectFitClipStatus(t){if(0!=this.imgAttrStore.imageWidth&&0!=this.imgAttrStore.imageHeight){let e=this.convertObjectFit(this.styleDelegate.objectFit());if("fill"!=e){let i=this.forgeImageView.ApplyObjectFit(this.styleDelegate.jsvValidWidth(),this.styleDelegate.jsvValidHeight(),this.imgAttrStore.imageWidth,this.imgAttrStore.imageHeight,e);i&&(t.left=i.x,t.top=i.y,t.width=i.width,t.height=i.height,t.useScissors=!0)}}}onFlushViewImage(t){if(0!=this.imgAttrStore.imageWidth&&0!=this.imgAttrStore.imageHeight&&!this.imgAttrStore.sizeApplied){this.flushMaskViewClip(t),this.imgAttrStore.sizeApplied=!0;let e=this.styleDelegate.jsvValidWidth(),i=this.styleDelegate.jsvValidHeight();0==e&&0!=i?e=this.imgAttrStore.imageWidth*i/this.imgAttrStore.imageHeight:0!=e&&0==i&&(i=this.imgAttrStore.imageHeight*e/this.imgAttrStore.imageWidth),this.clientWidth=e,this.clientHeight=i,this.imgAttrStore.sizeApplied=!0}const e={x:0,y:0,width:this.getClientWidth(t),height:this.getClientHeight(t)};this.forgeImageView.ResetLayoutParams({x:e.x,y:e.y,width:e.width,height:e.height})}setTextureAttribute(t,e,i){let s=n.UnsupportedError;return"dataJsvImgColorSpace"==e||"data-jsv-img-color-space"==e?(this.imageInLoading&&console.log("Failed to set attribute "+e+", this attribute must be set before src"),this.imgAttrStore.dataJsvColorSpace=i,s=0):"dataJsvImgScaledownTex"!=e&&"data-jsv-img-scaledown-tex"!=e||(this.imageInLoading&&console.log("Failed to set attribute "+e+", this attribute must be set before src"),this.imgAttrStore.dataJsvScaleDownTex=""==i||"true"==i,s=0),s}loadImage(t,e){if(null==e)return;this.imgAttrStore.imageWidth=0,this.imgAttrStore.imageHeight=0;let i=0;1==this.imgAttrStore.dataJsvScaleDownTex&&(i=this.styleDelegate.width(),0==i&&console.error("set dataJsvScaleDownTex while style.width is not set"));let n=t.GetTextureManager();this.forgeImageTexture=n.GetImage2(this.imgAttrStore.src,i,0,this.imgAttrStore.dataJsvColorSpace,null),this.imageInLoading=!0;let s,r=++this.loadCallbackSeq;this.imageOperatorKey=this.forgeImageTexture.RegisterLoadImageCallback(((e,i,n)=>{r==this.loadCallbackSeq&&(this.imgAttrStore.imageWidth=e,this.imgAttrStore.imageHeight=i,this.imageInLoading=!1,this.onFlushViewImage(t),this.sendEvent("load",[new qe(e),new qe(i)]))}));let a=this.styleDelegate.borderRadius();a&&(s=new ti.ViewRoundCornerMask(a.topLeft,a.topRight,a.bottomLeft,a.bottomRight)),this.forgeImageView.ResetTexture(this.forgeImageTexture,s)}getClientWidth(t){const e=super.getClientWidth(t);return e<=0&&this.imgAttrStore.imageWidth>0?this.imgAttrStore.imageWidth:e}getClientHeight(t){const e=super.getClientHeight(t);return e<=0&&this.imgAttrStore.imageHeight>0?this.imgAttrStore.imageHeight:e}forgeImageView;imageInLoading=!1;forgeImageTexture=null;imageOperatorKey=null;loadCallbackSeq=0;static ImgAttrStore=class{src=void 0;imageWidth=0;imageHeight=0;sizeApplied=!1;dataJsvColorSpace="RGBA_8888";dataJsvScaleDownTex=!1};imgAttrStore=new oi.ImgAttrStore}class li extends ri{onCssStyleChanged(t){return this.styleDelegate.getChangedStyleGroups().has(p.Layout.Name)&&this.onFlushViewHole(t),super.onCssStyleChanged(t)}constructor(t,e){super(t,e)}onFlushViewHole(t){this.forgeMainView.Element.style.backgroundColor="#222222"}}class hi{static SetForgeFrontToContext(t,e){t.forgeFront=e}static GetForgeFrontFromContext(t){return t.forgeFront}}class ci{static TaskType={CreateElement:10,BindElementToRootView:11,InsertElementChild:12,RemoveElementChild:13,AddElementEventListener:14,RemoveElementEventListener:15,SetElementText:16,SetElementAttribute:17,GetElementBoundingClientStyles:18,GetElementAttribute:19,MoveElementChild:20,GetRelativePosition:21,DeclareStyleSheets:30,SetStyleProperty:31,GetStyleProperties:32,SetForgeViewInnerProps:40,InsertKeyFrameDefine:41,RemoveKeyFrameDefine:42};static TaskStash=class{removedIdSet=new Set;cssClassChangedIdSet=new Set;cssStyleChangedIdSet=new Set;postprocessingIdSet=new Set};static EventListener=class{jseContext=null;jseFunction};static GetInstance(t){const e=ci.PlatformBridgeInstanceMap.get(t);if(e)return e;const i=new class extends ci{};return i.jsviewId=t,ci.PlatformBridgeInstanceMap.set(t,i),hi.SetForgeFrontToContext(i,new ti),window.JsvCode.Debug||(window.JsvCode.Debug={}),window.JsvCode.Debug.PlatformBridge=[],window.JsvCode.Debug.PlatformBridge.push(i),i}static JsViewId=1;static SetOnEventListener(...t){r(t.length>=2,null);const e=t[0],i=t[1],n=ci.GetInstance(e);return n.onEventListener=new ci.EventListener,n.onEventListener.jseFunction=i,null}static RunSyncTask(...t){s(t.length>=3,n.BadArgumentSize);const e=t[0],i=t[1],r=t[2],a=t,o=ci.GetInstance(e),l=hi.GetForgeFrontFromContext(o);let h=new qe,c=o.runGetterTaskByType(l,i,r,a,h);if(c<0)throw new Error("Failed to run synctask, error: "+c);return ci.CastFromUnionValue(h)}static RunLazyTaskList(...t){r(t.length>=2,null);const e=t[0],i=t[1],s=JSON.parse(i),a=ci.GetInstance(e),o=hi.GetForgeFrontFromContext(a),l=s,h=new ci.TaskStash;for(const t of l){const e=t[0],i=t[1],s=t;if(h.removedIdSet.has(i))continue;let r=a.runSetterTaskByType(o,e,i,s,h);if(r==n.CssStyleNotChanged&&(r=0),r<0)throw new Error("Failed to run lazytask, error: "+r)}for(const t of h.removedIdSet)h.cssClassChangedIdSet.delete(t),h.cssStyleChangedIdSet.delete(t),h.postprocessingIdSet.delete(t);const u=a.syncCssClasses(h.cssClassChangedIdSet,h.cssStyleChangedIdSet);h.cssClassChangedIdSet.clear(),function(t,e,i=[]){c(t,n.GetErrorMessage(i),e)}(u,null);for(const t of h.cssStyleChangedIdSet){a.getElementById(t).onCssStyleChanged(o)}h.cssStyleChangedIdSet.clear();for(const t of h.postprocessingIdSet){a.getElementById(t).onAllChangeFinished(o)}return h.postprocessingIdSet.clear(),null}static CastFromUnionValue(t){let e;return t.is(qe.DataType.String)||t.is(qe.DataType.Int32)||t.is(qe.DataType.Float)?e=t.get():t.is(qe.DataType.Null)?e=null:r(!1,null),e}static AppendToJsonObject(t,e,i){let s,r;if(s=e,i.is(g.DataType.String)){const t=i.get();t&&(r=t)}else if(i.is(g.DataType.Int32)){r=i.get()}else if(i.is(g.DataType.Float)){r=i.get()}else i.is(g.DataType.Null)||o(n.CssStyleBadType);return t[s]=r,0}getElementById(t){let e=null;const i=this.elementDelegateMap.get(t);return null!=i&&(e=i),r(e,null),e}forgeElementGetter(t){let e=null;const i=this.elementDelegateMap.get(t);return null!=i&&(e=i),e}static PlatformBridgeInstanceMap=new Map;syncCssClasses(t,e){for(const i of t){const n=this.getElementById(i),s=[];o(n.styleDelegate.getNestedClassNames(s)),this.syncCssClassesRecursive(n,s,t,e)}return this.styleClassMgr.clearStyleClassCache(),0}syncCssClassesRecursive(t,e,i,n){let s=new Set;t.styleDelegate.updateClassDeclarations(e,s);for(const t of s)n.add(t);const r=t.styleDelegate.getClassNames(),a=[...e];r.length>0&&a.push(r);for(const e of t.childNodes){if(i.has(e.nativeId))return;this.syncCssClassesRecursive(e,a,i,n)}}runSetterTaskByType(t,e,i,s,r){let a=n.BadTaskType;switch(e){case ci.TaskType.CreateElement:a=this.createElement(t,i,s);break;case ci.TaskType.BindElementToRootView:a=this.bindElementToRootView(t,i,s);break;case ci.TaskType.InsertElementChild:a=this.insertElementChild(t,i,s);break;case ci.TaskType.RemoveElementChild:a=this.removeElementChild(t,i,s,r);break;case ci.TaskType.MoveElementChild:a=this.moveElementChild(t,i,s);break;case ci.TaskType.AddElementEventListener:a=this.addElementEventListener(t,i,s,r);break;case ci.TaskType.RemoveElementEventListener:a=this.removeElementEventListener(t,i,s);break;case ci.TaskType.SetElementText:a=this.setElementText(t,i,s,r);break;case ci.TaskType.SetElementAttribute:a=this.setElementAttribute(t,i,s,r);break;case ci.TaskType.SetForgeViewInnerProps:a=this.setForgeViewInnerProps(t,i,s);break;case ci.TaskType.InsertKeyFrameDefine:a=this.insertKeyFrame(t,i,s);break;case ci.TaskType.RemoveKeyFrameDefine:a=this.removeKeyFrame(t,i,s);break;case ci.TaskType.DeclareStyleSheets:a=this.declareStyleSheets(t,i,s);break;case ci.TaskType.SetStyleProperty:a=this.setStyleProperty(t,i,s,r)}return o(a),0}runGetterTaskByType(t,e,i,s,r){let a=n.BadTaskType;switch(e){case ci.TaskType.GetElementBoundingClientStyles:a=this.getElementBoundingClientStyles(t,i,s,r);case ci.TaskType.GetStyleProperties:a=this.getStyleProperties(t,i,s,r);break;case ci.TaskType.GetElementAttribute:a=this.getElementAttributes(t,i,s,r);break;case ci.TaskType.GetRelativePosition:a=this.getRelativePosition(t,i,s,r)}return o(a),0}createElement(t,e,i){const r=i;s(r.length>=3,n.BadArgumentSize);const a=r[2];let o;return o="AUDIO"==a?ii.MakeShared(t,e,this.styleClassMgr,ai):"DIV"==a?ii.MakeShared(t,e,this.styleClassMgr,si):"IMG"==a?ii.MakeShared(t,e,this.styleClassMgr,oi):"VIDEO"==a?ii.MakeShared(t,e,this.styleClassMgr,li):ii.MakeShared(t,e,this.styleClassMgr,ii),this.elementDelegateMap.set(e,o),0}bindElementToRootView(t,e,i){s(i.length>=2,n.BadArgumentSize);return this.getElementById(e).bindToForgeRootView(t),0}insertElementChild(t,e,i){const r=i;s(r.length>=3,n.BadArgumentSize);const a=r[2],o=r.length>=4&&r[3]?r[3]:-1,l=this.getElementById(e),h=this.getElementById(a),c=o>0?this.getElementById(o):void 0;return l.insertForgeView(t,h,c),0}removeElementChild(t,e,i,r){const a=i;s(a.length>=3,n.BadArgumentSize);const o=a[2],l=this.getElementById(e),h=this.getElementById(o),c=(t,e,i)=>{for(const n of t.childNodes)c(n,e,i);t.styleDelegate.finalize(),e.add(t.nativeId),i.delete(t.nativeId)};return c(h,r.removedIdSet,this.elementDelegateMap),l.removeForgeView(t,h),0}moveElementChild(t,e,i){const r=i;s(r.length>=4,n.BadArgumentSize);const a=r[2],o=r[3],l=r.length>=5&&r[4]?r[4]:-1,h=this.getElementById(e),c=this.getElementById(a),u=this.getElementById(o),d=l>0?this.getElementById(l):void 0;return h.moveForgeView(t,c,u,d),0}addElementEventListener(t,e,i,r){const l=i;s(l.length>=4,n.BadArgumentSize);const h=l[2],c=new Map;if("object"==typeof l[3]&&null!==l[3]){const t=l[3];for(const[e,i]of Object.entries(t))s("number"==typeof i,n.InvalidArgument),c.set(e,i)}const u=this.getElementById(e).addEventListener(h,((t,e,i)=>{a(ci.GetInstance(t).onEventListener),setTimeout(e.bind(this,t,i),0)}).bind(this,this.jsviewId,((t,e)=>{const i=ci.GetInstance(t);if(null==i.onEventListener)return;const n=i.onEventListener.jseFunction;let s=[];for(const t of e){const e=ci.CastFromUnionValue(t);s.push(e)}n(...s)})),c);return o(u),u==ii.State.NeedCallPostProcess&&r.postprocessingIdSet.add(e),0}removeElementEventListener(t,e,i){const r=i;s(r.length>=4,n.BadArgumentSize);const a=r[2],o=new Map;if("object"==typeof r[3]&&null!==r[3]){const t=r[3];for(const[e,i]of Object.entries(t))s("number"==typeof i,n.InvalidArgument),o.set(e,i)}return this.getElementById(e).removeEventListener(a,o),0}setElementText(t,e,i,r){const a=i;s(a.length>=3,n.BadArgumentSize);const o=a[2],l=this.getElementById(e),h=l instanceof si?l:null;return s(h,n.BadElementType),h.setTextContent(o),h.styleDelegate.addChangedStyleGroup(p.Text.Name),r.cssStyleChangedIdSet.add(h.nativeId),0}setElementAttribute(t,e,i,r){const a=i;s(a.length>=4,n.BadArgumentSize);const l=a[2],h=a[3],c=this.getElementById(e);let u=c.setAttribute(t,l,h);if(o(u),u==ii.State.NeedRefreshCssClass)r.cssClassChangedIdSet.add(e);else if(u==ii.State.NeedRefreshCssClassAttribute){r.cssClassChangedIdSet.add(e);const t=new Set;u=c.getExtendClassAttributeChildren(t),o(u);for(const e of t)r.cssClassChangedIdSet.add(e.nativeId)}else u==ii.State.NeedCallPostProcess&&r.postprocessingIdSet.add(e);return 0}getElementBoundingClientStyles(t,e,i,r){const a=i;s(a.length>=4,n.BadArgumentSize);const l=a[3];s(l,n.InvalidElement);const h=JSON.parse(l),c=this.getElementById(e),u=c.styleDelegate,f={},m=h;for(const t of m){const e=t,i=d.ToConst(e);s(i,n.CssStyleBadName);let r=new g;if(i==d.Layout.Left){let t=u.left(),e=c.parentNode;for(;null!=e;){t+=e.styleDelegate.left(),e=e.parentNode}r=new g(t)}else if(i==d.Layout.Top){let t=u.top(),e=c.parentNode;for(;null!=e;){t+=e.styleDelegate.top(),e=e.parentNode}r=new g(t)}else{let t=u.getProperty(i,r);s(t>=0||n.CssStyleNotExists,t,["Failed to get style ",i])}o(ci.AppendToJsonObject(f,i,r))}const p=JSON.stringify(f),_=new qe(p);return r.reset(_),0}declareStyleSheets(t,e,i){const r=i;s(r.length>=2,n.BadArgumentSize);const a=r[2];return o(this.styleClassMgr.declareStyleSheets(a)),0}setStyleProperty(t,e,i,r){const a=i;s(a.length>=3,n.BadArgumentSize);const l=a[2],h=a.length>=4?a[3]:null,c=this.getElementById(e).styleDelegate,u=Ke.CastToStyleValue(h);let d=new Set;const g=c.setProperty(l,u,d);if(g==n.CssStyleNotChanged)return 0;o(g,["Failed to set style ",l]);for(const t of d)r.cssStyleChangedIdSet.add(t);return 0}getStyleProperties(t,e,i,r){const a=i;s(a.length>=4,n.BadArgumentSize);const l=a[3];s(l,n.InvalidElement);const h=JSON.parse(l),c=this.getElementById(e).styleDelegate,u={},f=h;for(const t of f){const e=t,i=d.ToConst(e);s(i,n.CssStyleBadName);const r=new g;let a=c.getProperty(i,r);s(a>=0||n.CssStyleNotExists,a,["Failed to get style ",i]),a=ci.AppendToJsonObject(u,i,r),o(a)}const m=JSON.stringify(u),p=new qe(m);return r.reset(p),0}getElementAttributes(t,e,i,r){const a=i;s(a.length>=3,n.BadArgumentSize);const o=a[3],l=this.getElementById(e);if("clientWidth"==o){const e=new qe(l.getClientWidth(t));r.reset(e)}else if("clientHeight"==o){const e=new qe(l.getClientHeight(t));r.reset(e)}return 0}getRelativePosition(t,e,i,r){const a=i;s(a.length>=3,n.BadArgumentSize);const o=a[3],l=this.getElementById(e),h=this.getElementById(o);let c=0,u=0,d=l.getClientWidth(t),g=l.getClientHeight(t),f=l;for(;null!=f&&f!=h;)c+=f.styleDelegate.left(),u+=f.styleDelegate.top(),f=f.parentNode;const m=new qe(JSON.stringify({left:c,top:u,width:d,height:g}));return r.reset(m),0}setForgeViewInnerProps(t,e,i){const r=i;s(r.length>=5,n.BadArgumentSize);const a=r[2],o=r[3],l=r[4];return this.getElementById(e).setForgeViewInnerProps(t,a,o,l)}insertKeyFrame(t,e,i){const r=i;s(r.length>=4,n.BadArgumentSize);const a=r[2],o=r[3];return this.styleClassMgr.insertKeyFrame(a,o),0}removeKeyFrame(t,e,i){const r=i;s(r.length>=3,n.BadArgumentSize);const a=r[2];return this.styleClassMgr.removeKeyFrame(a),0}jsviewId;elementDelegateMap=new Map;onEventListener=void 0;styleClassMgr=new Ke.Manager}ci.RegisterOriginDocument=function(t){let e=t.createElement("style");e.type="text/css",e.innerHTML="\n * {\n margin: 0px;\n }\n div {\n position: absolute;\n background-size: 100% 100%;\n white-space: pre-wrap;\n pointer-events: none;\n z-index: 0; /* 所有元素都设置zindex以触发DOM为每个view创建单独的zIndex stack context,使和Forge native动作一致 */\n }\n video {\n position: absolute;\n background-size: 100% 100%;\n }\n img {\n position: absolute;\n pointer-events: none;\n }\n ";t.getElementsByTagName("Head")[0].appendChild(e),window.originDocument=t},window.JsvCode.BrowserPlatformDomBridge=ci,i.LogF=function(t){},i.LogE=function(t){},i.LogW=function(t){},i.LogI=function(t){},i.LogD=function(t){},i.LogM=function(t){},i.ThrowError=function(t){throw new Error(t)},i.Assert=function(t){if(!t)throw new Error("ASSERT!!!!!")},i.EnableLog=function(t){i.LogM=console.log.bind(console),t>0&&(i.LogF=console.error.bind(console)),t>1&&(i.LogE=console.error.bind(console)),t>2&&(i.LogW=console.warn.bind(console)),t>3&&(i.LogI=console.log.bind(console)),t>4&&(i.LogD=console.debug.bind(console))},i.EnableLog(4),i.BaseActivity=class{},console.log("Log debug replace Forge.BaseActivity");{class t{constructor(t,e,i){this.PageName=t,this._FocusChild=null,this._LatestFocusChild=null,this.SubPages=[],this._ParentPage=null,this._ConsumeKeycodeUntilUp=-1,this.TouchDispatcher=null,this._Acc=.001,this._KeyLock=!1,this._CVSet=null,this._AutoShow=!1,this._IsShowing=!1,this._HostActivity=i,e&&this.SetContentView(e)}OnRenderFrame(){i.LogE("OnRenderFrame() MUST override")}OnKeyDown(t){return!1}OnKeyUp(t){return!1}DispatchKeyDown(e){if(this._KeyLock)return!0;var i=!1;return t.sLastFocusPage=this,this._FocusChild&&(i=this._FocusChild.DispatchKeyDown(e)),i||(i=this.OnKeyDown(e)),i}OnCustomerEvent(t){return!1}BubbleCustomerEvent(t){this.OnCustomerEvent(t)||this._ParentPage&&this._ParentPage.BubbleCustomerEvent(t)}DispatchKeyUp(t){if(this._KeyLock)return!0;var e=!1;return this._FocusChild&&(e=this._FocusChild.DispatchKeyUp(t)),e||(e=this.OnKeyUp(t)),e}PrintLastFocusPage(){var t="------"+this.PageName+"\n",e=this._ParentPage;return e&&(t+=e.PrintLastFocusPage()),t}OnMouseDown(t){return!1}EnableTouchDispatcher(){this.TouchDispatcher=new i.TouchDispatcher(this)}DisableTouchDispatcher(){this.TouchDispatcher=null}GetTouchView(){return null}GetSwipeParams(t,e,i){var n=void 0===i||0==i?this._Acc:i,s=t*t/2/n;t<0&&(s=-s);var r=e*e/2/n;return e<0&&(r=-r),{durationX:Math.floor(Math.abs(t/n)),durationY:Math.floor(Math.abs(e/n)),distanceX:s,distanceY:r}}OnTouch(t){return!1}DispatchTouch(t){var e=!1;return this.TouchDispatcher&&(e=this.TouchDispatcher.OnTouch(t)),e}LostTouchFocus(t){}OnJavaKey(t,e){return!0}OnPlatformKey(t,e){return!0}PassPlatformKey(t,e){if(this._KeyLock)return!1;var i=this.OnPlatformKey(t,e);return i&&(i=this.OnJavaKey(t,e)),i}DispatchJavaKey(t,e){if(t==this._ConsumeKeycodeUntilUp)return 1==e&&(this._ConsumeKeycodeUntilUp=-1),i.LogM("Consume Javakey until up keycode="+t+" keyaction="+e),!1;if(this._KeyLock)return!1;-1!=this._ConsumeKeycodeUntilUp&&(i.LogE("ERROR: Other key pressed before locked key release"),this._ConsumeKeycodeUntilUp=-1);var n=this._FocusChild,s=!0;return n&&(s=n.DispatchJavaKey(t,e)),s&&(s=this.PassPlatformKey(t,e)),n!=this._FocusChild&&0==e&&this.CosumeAllKeyUnitlUpForFocusChange(t),s}CosumeAllKeyUnitlUpForFocusChange(t){this._ParentPage?this._ParentPage.CosumeAllKeyUnitlUpForFocusChange(t):this._ConsumeKeycodeUntilUp=t}OnHostActivityGetFocus(){this._ConsumeKeycodeUntilUp=-1}IsFocus(){return!this._ParentPage||this._ParentPage._FocusChild==this}_IsLeafInChain(){return this.IsFocus()&&!this._FocusChild}SetParent(t,e){null!=t?(null!=e&&this.SetContentView(e),t instanceof i.BaseActivity&&(t=t.GetRootPageBase()),this._ParentPage=t,t.SubPages.push(this),this._HostActivity=t._HostActivity,t._IsShowing&&this._AutoShow&&this._OnShowInternal()):i.ThrowError("ERROR: parent is null")}SetParentPage(t){this.SetParent(t)}RemoveSubPage(t){t==this._FocusChild&&(this._FocusChild=null),t==this._LatestFocusChild&&(this._LatestFocusChild=null);for(var e=0;e<this.SubPages.length;e++)if(t==this.SubPages[e]){t._OnHideInternal(),this.SubPages.splice(e,1);break}}ClearSubPages(){this.SubPages=[],this._FocusChild=null,this._LatestFocusChild=null}GetParentPage(){return this._ParentPage}Focus(e){if(this.IsFocus()){if(!e)return void i.LogI("Already focused page_name="+this.PageName);if(this._IsLeafInChain())return void i.LogI("Already focused page_name="+this.PageName)}if(t.sChangingFocusLock)return void t.sDelayedFocusChanges.push(this);if(t.sChangingFocusLock=!0,this._ParentPage){for(var n,s=[],r=this;r._ParentPage&&!r.IsFocus();)s.push(r),r=r._ParentPage;n=e&&0==s.length?this._FocusChild:s[s.length-1]._ParentPage._FocusChild;for(var a=[];n;)a.push(n),n=n._FocusChild;for(var o=a.length-1;o>=0;o--)a[o]._BlurInternal();for(o=s.length-1;o>=0;o--)s[o]._FocusInternal();if(!e)for(var l=s[0];l._LatestFocusChild&&null==l._FocusChild;)l._LatestFocusChild._FocusInternal(),(l=l._FocusChild)||i.ThrowError("ERROR: focus chain is broken")}t.sChangingFocusLock=!1;let h=t.sDelayedFocusChanges.length;if(h>0){let e=t.sDelayedFocusChanges;t.sDelayedFocusChanges=[];for(let t=0;t<h;t++)e[t].Focus()}}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()):i.LogE("No dispatcher")}_BlurInternal(){this._ParentPage||i.LogE("No dispacher"),this._ParentPage._FocusChild==this?(this._ParentPage._FocusChild=null,this.OnBlur()):i.LogW("Not focus yet, page name="+this.PageName)}GetFocusChild(){return this._FocusChild}Hide(){this._AutoShow=!1,this._OnHideInternal()}Show(t){this._OnShowInternal(),t&&this.Focus()}OnFocus(){i.LogW("No overrided Page OnFocus event, page name="+this.PageName)}OnBlur(){i.LogW("No overrided Page OnBlur event, page name="+this.PageName)}OnShow(){i.LogW("No overrided Page OnShow event, page name="+this.PageName)}OnHide(){i.LogW("No overrided Page OnHide event, page name="+this.PageName)}_OnShowInternal(){for(var t,e=0;e<this.SubPages.length;e++)(t=this.SubPages[e])._AutoShow&&t._OnShowInternal();this._IsShowing||(this._IsShowing=!0,this.OnShow())}_OnHideInternal(){for(var t,e=0;e<this.SubPages.length;e++)(t=this.SubPages[e])._IsShowing&&t._OnHideInternal();this._IsShowing&&(this._IsShowing=!1,this.OnHide())}GetMainView(){return null==this._CVSet&&(this._CVSet=new i.MainViewSetting(null,null)),this._CVSet}GetContentView(){return null==this._CVSet?null:this._CVSet.View}SetContentView(t){null!=t&&(null!=this._CVSet&&this._CVSet.View.BindedPageBase(null),this._CVSet=new i.MainViewSetting(t,null),t.BindedPageBase(this))}OnContentViewLostInternal(){this.OnContentViewLost()}OnContentViewLost(){}GetHostActivity(){return this._HostActivity}SetHostActivity(t){this._HostActivity=t}GetTextureManager(){return null!=this._HostActivity?this._HostActivity.GetTextureManager():null}SetAutoShow(t){this._AutoShow=t}KeyLock(){this._KeyLock=!0}UnKeyLock(){this._KeyLock=!1}}t.sLastFocusPage=null,t.sChangingFocusLock=!1,t.sDelayedFocusChanges=[],i.PageBase=t}i.RectArea=C,i.sParticleManager=oe,i.AnimationListener=At,i.TranslateAnimation=Yt,i.RotateAnimation=$t,i.ScaleAnimation=Ut,i.TranslateFrameAnimation=jt,i.ThrowAnimation=zt,i.AnimationEnable=Xt,i.TextureSetting=nt,i.ExternalTextureSetting=st,i.DragInfo=ht,i.DragSetting=lt;let ui=qt;i.sRenderBridge=ui;{let t=[];ui.AddAfterSwapListener("NewDomView",(()=>{!function(){if(t.length>0){for(let e of t)e.DoAttachToElement();t=[]}}()}));class e extends dt{constructor(e,i){super(null,"jsv-element-proxy"),this.ProxiedView=null,this._DomNativeId=e,this._UseMaskView=i,this.DelayedCalls=[],this._OnReadyCallbacks=[],t.push(this)}DoAttachToElement(){let t=i.DomElementGetter?.(this._DomNativeId);if(t){this.ProxiedView=t?.getElementView(this._UseMaskView),this.InvokeDelayCalls();for(const t of this._OnReadyCallbacks)t();this._OnReadyCallbacks=null}else console.warn("expired domProxyView id="+this._DomNativeId)}RegisterOnProxyReady(t){this.ProxiedView?t():"function"==typeof t&&this._OnReadyCallbacks.push(t)}PushDelayCalls(t,e){this.DelayedCalls.push({name:t,args:e})}InvokeDelayCalls(){if(this.DelayedCalls.length>0)for(let t of this.DelayedCalls)this.ProxiedView[t.name].apply(this.ProxiedView,t.args)}HtmlCanAccessElement(){return null!=this.ProxiedView}}i.NewDomProxyView=function(t,n){let s=new e(t,n);return new Proxy(s,{get(t,e){if("string"!=typeof e||e.startsWith("_"))return t[e];if(null!=t.ProxiedView)return void 0!==t.ProxiedView[e]?"function"==typeof t.ProxiedView[e]?t.ProxiedView[e].bind(t.ProxiedView):t.ProxiedView[e]:Reflect.get(t,e);if("function"==typeof t[e]){if("RegisterOnProxyReady"===e)return t[e].bind(t);{let n=t;return(...t)=>{n.PushDelayCalls(e,t),i.sRenderBridge.RequestSwap()}}}console.warn(`proxy not ready to get prop(${e})`)},set(t,e){console.warn("no support set prop")}})}}i.LayoutView=class extends dt{ResetTexture(t){t?super.ResetTexture(t.Texture,t.MaskSetting?.ImageTexture):super.ResetTexture(null)}AddView(t,e){let n=0,s=0,r=0,a=0;e&&(e instanceof i.LayoutParams?(n=e.MarginLeft,s=e.MarginTop,r=e.Width,a=e.Height):(n=isNaN(e.x)?0:e.x,s=isNaN(e.y)?0:e.y,r=isNaN(e.width)?0:e.width,a=isNaN(e.height)?0:e.height)),super.AddView(t,n,s,r,a)}},i.FilterView=yt,i.EditControlView=Tt,i.DragSetting=lt,i.DragInfo=ht;i.TextureManager=class extends j{RegisterLoadImageCallback(t,e,i){return super.RegisterLoadImageCallback(((t,n)=>{e({width:t,height:n},i)}))}},i.sViewStore=Et,i.ViewInfo=It,i.ViewMask=rt,i.ViewTextureMask=at,i.ViewRoundCornerMask=ot;{class t{constructor(t,e){this.OnBeginContact=t,this.OnEndContact=e}UpdateImpactCallback(t){this.OnBeginContact=t}UpdateLeaveCallback(t){this.OnEndContact=t}}i.sImpactSensorManager={StartTrace:(t,e,i,n)=>new ke(t,e,i,n),Callback:t,AutoFroze:De}}i.ImpactAutoFroze=De,i.ImpactSensor=ke,i.VisibleSensor=Oe,i.TextInputType=wt;const di=window.ForgeFront,gi=Object.keys(di);for(let t of gi)Object.hasOwn(i,t)||(i[t]=di[t]);export{i as default};
|
|
1
|
+
/* eslint-disable */ import{parseGIF as t,decompressFrames as e}from"gifuct-js";void 0===window.Forge?(window.Forge={},console.log("Define forge browser")):console.log("Define using JsView forge engine-js");var i=window.Forge;class n{static ToString(t){switch(t){case n.UnknownError:return"UnknownError("+t+")";case n.UnimplementedError:return"UnimplementedError("+t+")";case n.UnsupportedError:return"UnsupportedError("+t+")";case n.NotFoundError:return"NotFoundError("+t+")";case n.InvalidArgument:return"InvalidArgument("+t+")";case n.BadArgumentSize:return"BadArgumentSize("+t+")";case n.InvalidElement:return"InvalidElement("+t+")";case n.BadElementType:return"BadElementType("+t+")";case n.CssStyleNotExists:return"CssStyleNotExists("+t+")";case n.CssStyleNotChanged:return"CssStyleNotChanged("+t+")";case n.CssStyleBadType:return"CssStyleBadType("+t+")";case n.CssClassNotChanged:return"CssClassNotChanged("+t+")";case n.ForgeInsertView:return"ForgeInsertView("+t+")";default:return"UnknownError("+t+")"}}static GetFormattedMethod(t){var e,i;e=t.indexOf(" ")+1,i=t.indexOf("(")-e;return t.substr(e,i)+"()"}static GetErrorMessage(t=[]){var e="";for(const i of t)e+=i;return e}static PrintErrorMessage(t,e,i=[]){const s=n.GetErrorMessage(i);console.error("ForgeDom","Error@ "+t+":"+e+", "+s)}static UnknownError=-1;static UnimplementedError=-2;static UnsupportedError=-3;static NotFoundError=-4;static InvalidArgument=-5;static BadArgumentSize=-6;static InvalidElement=-100;static BadElementType=-101;static BadTaskType=-102;static CssStyleNotExists=-120;static CssStyleNotChanged=-121;static CssStyleBadName=-122;static CssStyleBadType=-123;static CssClassNotChanged=-124;static ForgeInsertView=-200;constructor(){throw new Error("new ErrCode() is forbidden.")}}function s(t,e,i=[]){u(t,n.GetErrorMessage(i),e)}function r(t,e,i=[]){u(t,n.GetErrorMessage(i),e)}function a(t,e=[]){u(t,n.GetErrorMessage(e))}function o(t,e=[]){c(t,n.GetErrorMessage(e),t)}function l(t,e,i=[]){c(t,n.GetErrorMessage(i),e)}function h(t,e=[]){c(t,n.GetErrorMessage(e))}function c(t,e,i){if(t<0)throw n.PrintErrorMessage("__FILE_NAME__","__LINE__",[n.ToString(t),". ",e]),new Error(i)}function u(t,e,i){if(!t)throw n.PrintErrorMessage("__FILE_NAME__","__LINE__",["ASSERT("+t+")",". ",e]),new Error(i)}class d{static Layout=class{static Height="height";static Left="left";static Top="top";static Width="width";constructor(){throw new Error("new StyleName.Layout() is forbidden.")}};static Background=class{static BackgroundColor="backgroundColor";static BackgroundImage="backgroundImage";static BorderRadius="borderRadius";constructor(){throw new Error("new StyleName.Background() is forbidden.")}};static Effect=class{static BackfaceVisibility="backfaceVisibility";static BorderImage="borderImage";static BorderImageWidth="borderImageWidth";static BorderImageOutset="borderImageOutset";static Display="display";static ObjectFit="objectFit";static Opacity="opacity";static Overflow="overflow";static Perspective="perspective";static PerspectiveOrigin="perspectiveOrigin";static Transform="transform";static TransformOrigin="transformOrigin";static TransformStyle="transformStyle";static Visibility="visibility";static ZIndex="zIndex";constructor(){throw new Error("new StyleName.Effect() is forbidden.")}};static Text=class{static Color="color";static FontFamily="fontFamily";static FontSize="fontSize";static FontStyle="fontStyle";static FontWeight="fontWeight";static LineHeight="lineHeight";static TextAlign="textAlign";static TextOverflow="textOverflow";static TextShadow="textShadow";static WebkitTextStroke="WebkitTextStroke";static WhiteSpace="whiteSpace";static WordWrap="wordWrap";static Direction="direction";static JsvTextEmoji="JsvTextEmoji";static JsvTextLatex="JsvTextLatex";static JsvTextAlignMinWidth="JsvTextAlignMinWidth";static JsvTextVerticalAlign="JsvTextVerticalAlign";static JsvTextLineAlign="JsvTextLineAlign";static JsvTextInnerDirection="JsvTextInnerDirection";constructor(){throw new Error("new StyleName.Text() is forbidden.")}};static Motion=class{static Animation="animation";static Transition="transition";constructor(){throw new Error("new StyleName.Motion() is forbidden.")}};static HasGetterMethod(t){switch(t){case d.Layout.Height:case d.Layout.Left:case d.Layout.Top:case d.Layout.Width:case d.Effect.ObjectFit:return!0;default:return!1}}static ToConst(t){return t==d.Layout.Height?d.Layout.Height:t==d.Layout.Left?d.Layout.Left:t==d.Layout.Top?d.Layout.Top:t==d.Layout.Width?d.Layout.Width:t==d.Background.BackgroundColor?d.Background.BackgroundColor:t==d.Background.BackgroundImage?d.Background.BackgroundImage:t==d.Background.BorderRadius?d.Background.BorderRadius:t==d.Effect.BackfaceVisibility?d.Effect.BackfaceVisibility:t==d.Effect.BorderImage?d.Effect.BorderImage:t==d.Effect.BorderImageWidth?d.Effect.BorderImageWidth:t==d.Effect.BorderImageOutset?d.Effect.BorderImageOutset:t==d.Effect.Display?d.Effect.Display:t==d.Effect.ObjectFit?d.Effect.ObjectFit:t==d.Effect.Opacity?d.Effect.Opacity:t==d.Effect.Overflow?d.Effect.Overflow:t==d.Effect.Perspective?d.Effect.Perspective:t==d.Effect.PerspectiveOrigin?d.Effect.PerspectiveOrigin:t==d.Effect.Transform?d.Effect.Transform:t==d.Effect.TransformOrigin?d.Effect.TransformOrigin:t==d.Effect.TransformStyle?d.Effect.TransformStyle:t==d.Effect.Visibility?d.Effect.Visibility:t==d.Effect.ZIndex?d.Effect.ZIndex:t==d.Text.Color?d.Text.Color:t==d.Text.FontFamily?d.Text.FontFamily:t==d.Text.FontSize?d.Text.FontSize:t==d.Text.FontStyle?d.Text.FontStyle:t==d.Text.FontWeight?d.Text.FontWeight:t==d.Text.LineHeight?d.Text.LineHeight:t==d.Text.TextAlign?d.Text.TextAlign:t==d.Text.TextOverflow?d.Text.TextOverflow:t==d.Text.TextShadow?d.Text.TextShadow:t==d.Text.WebkitTextStroke?d.Text.WebkitTextStroke:t==d.Text.WhiteSpace?d.Text.WhiteSpace:t==d.Text.WordWrap?d.Text.WordWrap:t==d.Text.Direction?d.Text.Direction:t==d.Text.JsvTextEmoji?d.Text.JsvTextEmoji:t==d.Text.JsvTextLatex?d.Text.JsvTextLatex:t==d.Text.JsvTextAlignMinWidth?d.Text.JsvTextAlignMinWidth:t==d.Text.JsvTextVerticalAlign?d.Text.JsvTextVerticalAlign:t==d.Text.JsvTextLineAlign?d.Text.JsvTextLineAlign:t==d.Text.JsvTextInnerDirection?d.Text.JsvTextInnerDirection:t==d.Motion.Animation?d.Motion.Animation:t==d.Motion.Transition?d.Motion.Transition:null}constructor(){throw new Error("new StyleName() is forbidden.")}}class g{static Base=class{constructor(t){this.rawValue=t}rawValue};static AnimationImpl=class extends g.Base{constructor(t){super(t)}name="";duration=0;timingFunction=null;delay=0;iterationCount=0;direction=!1};static CornerImpl=class extends g.Base{constructor(t){super(t)}topLeft=0;topRight=0;bottomRight=0;bottomLeft=0};static RectImpl=class extends g.Base{constructor(t){super(t)}top=0;right=0;left=0;bottom=0};static TextShadowImpl=class extends g.Base{constructor(t){super(t)}hShadow=0;vShadow=0;blur=0;color=void 0};static WebkitTextStrokeImpl=class extends g.Base{constructor(t){super(t)}length=0;color=void 0};static TransitionImpl=class extends g.Base{constructor(t){super(t)}animationMap=new Map};static BorderImageImpl=class extends g.Base{constructor(t){super(t)}source="";slice=null};static BackgroundImageImpl=class extends g.Base{constructor(t){super(t)}type=0;static eType={UNKNOWN:0,LINEAR_GRADIENT:1,URL_PATH:2};static LinearGradient=class{fromX=0;fromY=0;toX=0;toY=0;stops=[]};linearGradient;urlPath=""};static DataType=class{static Null=0;static Int32=1;static Float=2;static String=3;static Animation=4;static Corner=5;static Rect=6;static TextShadow=7;static WebkitTextStroke=8;static Transition=9;static BorderImage=10;static BackgroundImage=11};static InvalidInt32=Number.MIN_VALUE;static InvalidFloat=Number.NaN;static InvalidPointer=null;constructor(t){let e=-1,i=null;null==t?e=g.DataType.Null:Number(t)===t&&t%1==0?e=g.DataType.Int32:Number(t)===t&&t%1!=0?e=g.DataType.Float:"string"==typeof t||t instanceof String?e=g.DataType.String:t instanceof g.AnimationImpl?e=g.DataType.Animation:t instanceof g.CornerImpl?e=g.DataType.Corner:t instanceof g.RectImpl?e=g.DataType.Rect:t instanceof g.TextShadowImpl?e=g.DataType.TextShadow:t instanceof g.WebkitTextStrokeImpl?e=g.DataType.WebkitTextStroke:t instanceof g.TransitionImpl?e=g.DataType.Transition:t instanceof g.BorderImageImpl&&(e=g.DataType.BorderImage),t!=g.InvalidInt32&&t!=g.InvalidFloat&&t!=g.InvalidPointer?i=t:(e=g.DataType.Null,i=null),this.data=new g.DataInfo,this.data.index=e,this.data.value=i}toString(){let t=null;switch(this.data.index){case g.DataType.Null:return"";case g.DataType.Int32:case g.DataType.Float:return String(this.get());case g.DataType.String:t=this.get();break;case g.DataType.Animation:case g.DataType.Corner:case g.DataType.Rect:case g.DataType.TextShadow:case g.DataType.WebkitTextStroke:case g.DataType.Transition:case g.DataType.BorderImage:case g.DataType.BackgroundImage:t=this.get().rawValue;break;default:console.error("Failed to do StyleValue.toString()")}return t??""}is(t){return this.data.index==t}get(){return this.data.value}reset(t){this.data.value=t.data.value,this.data.index=t.data.index}equals(t){return this.data.value===t.data.value&&this.data.index===t.data.index}static DataInfo=class{value=null;index=-1};data}class f{static Text=class{static Color="#000000";static FontFamily="黑体";static FontSize=10;static FontStyle="normal";static FontWeight="normal";static LineHeight=0;static TextAlign="start";static TextOverflow="clip";static TextShadow=null;static WebkitTextStroke=null;static WhiteSpace="normal";static WordWrap="normal";static Direction="ltr";static JsvTextEmoji=0;static JsvTextLatex=0;static JsvTextAlignMinWidth=0;static JsvTextVerticalAlign="top";static JsvTextLineAlign="middle";static JsvTextInnerDirection="unset"}}class m{static FormatVariableName(t){return t.startsWith("--")?"var("+t+")":t.startsWith("var(--")?t:(r(!1,null),null)}static IsVariable(t){let e;if(t instanceof g){if(0==t.is(g.DataType.String))return!1;e=t.get()}else{if("string"!=typeof t)return!1;e=t}return e.startsWith("--")||e.startsWith("var(--")}constructor(){throw new Error("new StyleVariable() is forbidden.")}}class p{static Layout=class{height=g.InvalidInt32;left=g.InvalidInt32;top=g.InvalidInt32;width=g.InvalidInt32;static Name="layout"};static Background=class{backgroundColor=g.InvalidPointer;backgroundImage=g.InvalidPointer;borderRadius=g.InvalidPointer;static Name="background"};static Effect=class{backfaceVisibility=g.InvalidPointer;borderImage=g.InvalidPointer;borderImageWidth=g.InvalidPointer;borderImageOutset=g.InvalidPointer;display=g.InvalidPointer;objectFit=g.InvalidPointer;opacity=g.InvalidFloat;overflow=g.InvalidPointer;perspective=g.InvalidInt32;perspectiveOrigin=g.InvalidPointer;transform=g.InvalidPointer;transformOrigin=g.InvalidPointer;transformStyle=g.InvalidPointer;visibility=g.InvalidPointer;zIndex=g.InvalidInt32;static Name="effect"};static Text=class{color=g.InvalidPointer;fontFamily=g.InvalidPointer;fontSize=g.InvalidInt32;fontStyle=g.InvalidPointer;fontWeight=g.InvalidPointer;lineHeight=g.InvalidInt32;textAlign=g.InvalidPointer;textOverflow=g.InvalidPointer;textShadow=g.InvalidPointer;webkitTextStroke=g.InvalidPointer;whiteSpace=g.InvalidPointer;wordWrap=g.InvalidPointer;direction=g.InvalidPointer;jsvTextEmoji=g.InvalidInt32;jsvTextLatex=g.InvalidInt32;jsvTextAlignMinWidth=g.InvalidInt32;jsvTextVerticalAlign=g.InvalidPointer;jsvTextLineAlign=g.InvalidPointer;jsvTextInnerDirection=g.InvalidPointer;static Name="text"};static Motion=class{animation=g.InvalidPointer;transition=g.InvalidPointer;static Name="motion"};constructor(){throw new Error("new StyleGroup() is forbidden.")}}void 0===window.ForgeFront&&(window.ForgeFront={},console.log("Define global ForgeFront browser"));let _=window.ForgeFront;const T=new class{constructor(){this._count=1}get count(){return this._count}update(){this._count<Number.MAX_SAFE_INTEGER?++this._count:this._count=1}};_.sFrameCount=T;class y{static getTextPixelWith(t,e){null===y.sCanvas&&(y.sCanvas=window.originDocument.createElement("canvas"));const i=y.sCanvas.getContext("2d");i.font=e;const n=i.measureText(t);return Math.ceil(n.width)}static GetOneLineTextDrawWidth(t,e,i,n,s){const r=[];r.push(0);const a=n?"bold":"",o=s?"italic":"",l=Math.floor(2048/i);let h=0,c=0;for(;h<t.length;){const n=h+l;let s;if(h+l>=t.length)s=t.length-h;else{let e=t.lastIndexOf(" ",n);s=e>h?e-h+1:l}const u=t.slice(h,h+s),d=y.getTextPixelWith(u,`${a} ${o} ${i}px ${e}`);r.push(h),r.push(h+s),r.push(d),c+=d,h+=s}return r[0]=c,r}static GetTextWidth(t){let e="";t.bold&&(e="bold");let i="";return t.italic&&(i="italic"),this.getTextPixelWith(t.str,`${e} ${i} ${t.size}px ${t.font}`)}static GetTextRect(t,e,i,n,s){let r=Math.ceil(i.size*t.length/e.width)*s;r>e.height&&(r=e.height);return{width:e.width,height:r}}static GetCursorOffset(t,e,i,n,s,r,a){let o="";i.bold&&(o="bold");let l="";i.italic&&(l="italic");let h=0;if("right"===i.alignment){const n=this.getTextPixelWith(t,`${o} ${l} ${i.size}px ${i.font}`);(r-=e.width-n)<0&&(r=0)}let c=0;for(;r>=c&&h!==t.length;)c=this.getTextPixelWith(t.substr(0,h+1),`${o} ${l} ${i.size}px ${i.font}`),r>=c&&h++;return h}static GetCursorPosition(t,e,i,n,s,r){let a="";i.bold&&(a="bold");let o="";i.italic&&(o="italic");let l=0,h=t;if(r<t.length&&(h=h.substr(0,r)),l=this.getTextPixelWith(h,`${a} ${o} ${i.size}px ${i.font}`),"right"===i.alignment){const n=this.getTextPixelWith(t,`${a} ${o} ${i.size}px ${i.font}`);l=e.width-n+l}return{x:l,y:0}}}y.sCanvas=null,window.PlatformUtils=y;class w{constructor(t){this.state={},this.type=t,this._AutoPlay=!1}buildPlatformInstance(){this.Ele=window.originDocument.createElement(this.type),this.Ele.addEventListener("loadedmetadata",(()=>{this.hasOwnProperty("onload")&&this.onload(),this.hasOwnProperty("onloadedmetadata")&&this.onloadedmetadata()}))}set autoplay(t){void 0!==t&&(this._AutoPlay=!0,this.Ele.paused&&setTimeout((()=>{this.play()}),0))}get currentTime(){return this.Ele.currentTime}set currentTime(t){this.Ele.currentTime=t,this.setState("seek",t,"number")}get duration(){return this.Ele.duration}set loop(t){this.Ele.loop="boolean"==typeof t||void 0!==t}get muted(){return this.getState("muted")}set muted(t){this.setState("muted",t,"boolean")}get paused(){return this.Ele.paused}get playbackRate(){return this.getState("playbackRate")}set playbackRate(t){this.setState("playbackRate",t,"number")}set src(t){this.setState("src",t,"string"),t&&this._AutoPlay&&setTimeout((()=>{this.play()}),0)}get style(){const t=this;return{set bottom(e){t.setState("style",`{"bottom":"${e}"}`,"string")},set left(e){t.setState("style",`{"left":"${e}"}`,"string")},set right(e){t.setState("style",`{"right":"${e}"}`,"string")},set top(e){t.setState("style",`{"top":"${e}"}`,"string")},set height(e){t.setState("style",`{"height":"${e}"}`,"string")},set width(e){t.setState("style",`{"width":"${e}"}`,"string")}}}get volume(){return this.getState("volume")}set volume(t){this.setState("volume",t,"number")}get playableDuration(){return this.Ele.playableDuration}addEventListener(t,e){this[`on${t}`]=e,this.Ele.addEventListener(t,(e=>{this[`on${t}`](e)}))}load(){this.Ele.load()}pause(){this.Ele.pause(),this.setState("paused",!0,"boolean"),this.hasOwnProperty("onpause")&&this.onpause()}play(){this.setState("paused",!1,"boolean"),this.Ele.play(),this.hasOwnProperty("onplay")&&this.onplay()}unload(){this.setState("paused",!0,"boolean"),this.Ele.pause(),this.Ele.removeAttribute("src"),this.Ele.load()}setState(t,e,i){typeof e===i?("playbackRate"==t?this.Ele.playbackRate=e:"muted"==t?this.Ele.muted=e:this.Ele.setAttribute(t,e),this.state[t]=e,console.log(`set ${t} = ${e}`)):console.warn(`invalid paramter type to set ${t}. value is not ${i}`)}getState(t){let e=this.state[t];return console.log(`get ${t} = ${e}`),void 0===e&&(e=this.Ele.getAttribute(t),this.state[t]=e),e}onEnd(t){this.setState("paused",!0,"boolean"),this.hasOwnProperty("onended")&&this.onended()}onError(t){this.hasOwnProperty("onerror")&&this.onerror(t.currentTarget.error.code)}mediaHandler(){return this.Ele}static setDesignMapWidth(t){"number"==typeof t?w.prototype.designMapWidth=t:console.warn(`Invalid paramter type to set ${t}. It is not number.`)}}w.prototype.designMapWidth=0;class S extends w{constructor(t){super(t),super.buildPlatformInstance(t)}}class x extends S{constructor(){super("audio")}}window._ExtAudio=x;class b extends S{constructor(){super("video"),this.state.height=0,this.state.width=0,this.state.aspectRatiow="origin"}get height(){return this.getState("height")}set height(t){this.style.height=t,this.state.height=t}get poster(){return console.log("Video.poster() TODO"),null}set poster(t){console.log("Video.poster() TODO")}get videoAspectRatio(){return this.getState("aspectRatio")}set videoAspectRatio(t){this.setState("aspectRatio",t,"string")}get videoHeight(){return this.Ele.videoHeight}get videoWidth(){return this.Ele.videoWidth}get width(){return this.getState("width")}set width(t){this.style.width=t,this.state.width=t}onLoad(t){super.onLoad(t)}setRotation(t,e,i,n){let s=function(){let s=`rotate3d(0, 0, 1, ${t}deg)`;if(90==t||-90==t){let t,r;if(n?(t=i/e,r=e/i):(t=this.videoHeight/this.videoWidth,r=this.videoWidth/this.videoHeight),isNaN(t)||isNaN(r))return!1;s+=` scale3d(${t}, ${r}, 1)`}return this.Ele.style.transform=s,this.Ele.parentNode&&(this.Ele.parentNode.style.overflow="hidden"),!0};s=s.bind(this);s()||this.Ele.addEventListener("loadedmetadata",(()=>{s()}))}}window._ExtVideo=b;class v extends w{constructor(){super("video"),this._ReleaseCallbacks=[],this._ResourceTerminater=null,super.buildPlatformInstance()}setResourceTerminator(t){this._ResourceTerminater=t}hasTerminator(){return null!==this._ResourceTerminater}listenToRelease(t){this._ReleaseCallbacks.push(t)}unload(){super.unload(),null!==this._ResourceTerminater&&this._ResourceTerminater(),this._ResourceTerminater=null}releaseResource(){for(let t=0;t<this._ReleaseCallbacks.length;t++)this._ReleaseCallbacks[t]();null!==this._ResourceTerminater&&this._ResourceTerminater(),this._ResourceTerminater=null}confirmInitSetup(){}setRotation(){console.log("media.setRotation no implemented")}onPlatformDestroy(){}get videoHeight(){return this.Ele.videoHeight}get videoWidth(){return this.Ele.videoWidth}}window._ExtOVP=v,window.Audio=x,window.Video=b,window.OffscreenVideoPlayer=v;class E{constructor(t,e){if(this.href="",this.origin="",this.protocol="",this.host="",this.hostname="",this.port="",this.pathname="",this.search="",this.hash="",!t)return;if(!0===t.startsWith("url")){const e=t.indexOf("(")+1,i=t.lastIndexOf(")");t=t.substring(e,i).trim()}if(!0===t.startsWith("data:"))return void(this.href=t);if(!0===t.startsWith("/")&&(t=document.location.origin+t),!0===t.startsWith("./")){const e=document.location.pathname.lastIndexOf("/");let i="";e>0&&(i=document.location.pathname.substring(0,e)),t=document.location.origin+i+t.substring(1)}if(this.href=t,!e)return;let i=this.href.indexOf("?");const n=i>0?this.href.substring(0,i):this.href;this.search=i>1?this.href.substring(i):"",i=n.indexOf("://"),this.protocol=i>0?n.substring(0,i+1):"";const s=i>1?n.substring(i+3):"";i=s.indexOf("/"),this.host=i>0?s.substring(0,i):"",this.pathname=i>1?s.substring(i):"",this.origin=i>0?`${this.protocol}//${this.host}`:"",i=this.host.indexOf(":"),this.hostname=i>0?this.host.substring(0,i):this.host,this.port=i>1?this.host.substring(i+1):"",console.log("create total parse URL, this=",this)}replace(t){this.href=t}}const I=window.AudioContext||window.webkitAudioContext;if(I){const t=new I;let e=0,i=0;class n{constructor(t,e,i){this._Context=t,this._BufferSource=e,this._Gain=i,this._BufferSource.connect(this._Gain),this._Gain.connect(this._Context.destination)}start(t,e,i){this._BufferSource.start(t,e,i)}setVolume(t){this._Gain.gain.setValueAtTime(t,this._Context.currentTime)}stop(t){this._BufferSource.stop(t)}}class s{constructor(){this._SoundBufferMap={},this._StreamMap={}}load(i,n,s,r){const a=new E(i).href,o=e++;return this._requestBuffer(a,((e,i)=>{0===e?t.decodeAudioData(i,(t=>{this._SoundBufferMap[o]=t,r(o,0)})):r(-1,-1)})),o}unload(t){delete this._SoundBufferMap[t]}autoPause(){}autoResume(){}play(e,s,r,a,o,l){if(this._SoundBufferMap[e]){const r=i++,a=t.createBufferSource();a.buffer=this._SoundBufferMap[e],a.playbackRate.value=l,a.onended=t=>{this.stop(r)},o>0&&(a.loop=!0);const h=t.createGain();h.gain.setValueAtTime(s,t.currentTime);const c=new n(t,a,h);return this._StreamMap[r]=c,console.log("loop test",(o+1)*this._SoundBufferMap[e].duration),c.start(0,0,(o+1)*this._SoundBufferMap[e].duration),r}return-1}pause(t){}resume(t){}stop(t){this._StreamMap[t]&&(this._StreamMap[t].stop(),delete this._StreamMap[t])}release(){this._SoundBufferMap={},this._StreamMap={}}setVolume(t,e,i){this._StreamMap[t]&&this._StreamMap[t].setVolume(e)}setPriority(t,e){}setRate(t,e){}setLoop(t,e){}_requestBuffer(t,e){const i=new XMLHttpRequest;i.open("GET",t,!0),i.responseType="arraybuffer",i.onload=()=>{200===i.status?(console.log("http request succeed"),e(0,i.response)):(console.error(`download audio ${t} failed.`,i.status),e(-1,null))},i.send()}}window.SoundPool=s}else window.SoundPool=null;_.LogF=function(t){},_.LogE=function(t){},_.LogW=function(t){},_.LogI=function(t){},_.LogD=function(t){},_.LogM=function(t){},_.ThrowError=function(t){throw new Error(t)},_.Assert=function(t){if(!t)throw new Error("ASSERT!!!!!")},_.EnableLog=function(t){_.LogM=console.log.bind(console),t>0&&(_.LogF=console.error.bind(console)),t>1&&(_.LogE=console.error.bind(console)),t>2&&(_.LogW=console.warn.bind(console)),t>3&&(_.LogI=console.log.bind(console)),t>4&&(_.LogD=console.debug.bind(console))};class C{constructor(t,e,i,n){this.x="number"==typeof t?t:0,this.y="number"==typeof e?e:0,("number"!=typeof i||i<0)&&(i=0),this.width=i,("number"!=typeof n||n<0)&&(n=0),this.height=n}Equals(t){return null!==t&&(t.x===this.x&&t.y===this.y&&t.width===this.width&&t.height===this.height)}}_.RectArea=C;_.Coordinate=class{constructor(t,e){this.x=t,this.y=e}};_.Size=class{constructor(t,e){this.width=t,this.height=e}};_.RectUtils=class{FormatRectArea(t){let e=null;if(t instanceof _.RectArea)e=t;else if("object"==typeof t&&null!==t){if(isNaN(t.width)||isNaN(t.height))throw new Error("ERROR: target_size format should be {width:XXXX, height:XXXX}");e=new _.RectArea(0,0,t.width,t.height)}return e}},_.sRectUitls=new _.RectUtils,_.TextShaderType={LinearGradient:0,Image:1};_.TextShader=class{constructor(t,e){this.Type=t,this.Params=e}};class A{constructor(){const t=(new _.LayoutView).GetRenderer();this._Renderer=t,this.StringWithFont=_.sTextUtils.StringWithFont("",0,void 0,"center","middle",void 0,!1,!1,void 0,void 0,"top"),this.RectArea=new _.RectArea(0,0,0,0),this.TextAttr=_.sTextUtils.TextAttr("ellipsis","none"),this.Marquee=null,this.Shader=null,this.IsInstantLoad=!0,this.LineHeight=0,this.LatexMode=!1}SetInstantLoad(t){return this.IsInstantLoad=t,this}SetStringWithFont(t){return this.StringWithFont=t,this}SetLatexMode(t){return this.LatexMode=t,this}SetFontStyle(t,e,i,n,s,r,a,o,l,h){return this.StringWithFont="object"==typeof t?_.sTextUtils.StringWithFont("",void 0!==t.size?t.size:10,void 0!==t.font?t.font:"宋体",void 0!==t.hAlign?t.hAlign:"center",void 0!==t.vAlign?t.vAlign:"middle",void 0!==t.textColor?t.textColor:"#000000",void 0!==t.italic&&t.italic,void 0!==t.bold&&t.bold,void 0!==t.shadow?t.shadow:null,void 0!==t.strokeWidth?t.strokeWidth:null,void 0!==t.vAreaAlign?t.vAreaAlign:"top"):_.sTextUtils.StringWithFont("",t,e,i,n,s,r,a,o,l,h),this}SetRectArea(t){return t instanceof _.RectArea?this.RectArea=t:this.RectArea=new _.RectArea(t.x,t.y,t.width,t.height),this}SetViewSize(t){return t instanceof _.RectArea||(t=new _.RectArea(t.x,t.y,t.width,t.height)),this.SetRectArea(t),0===this.LineHeight&&0!==t.height&&(this.LineHeight=t.height),this}SetTextAttr(t){let e,i;return e=t.hasOwnProperty("textOverflow")?t.textOverflow:t.hasOwnProperty("text_overflow")?t.text_overflow:"clip",i=t.hasOwnProperty("wordWrap")?t.wordWrap:t.hasOwnProperty("word_wrap")?t.word_wrap:"none",this.TextAttr={word_wrap:i,text_overflow:e},this}SetMarquee(t){return t&&(this.Marquee={repetition:"infinite",direction:"left",speed:"normal"},t.repetition&&(this.Marquee.repetition=t.repetition),t.direction&&(this.Marquee.direction=t.direction),t.speed&&(this.Marquee.speed=t.speed)),this}SetShader(t){return this.Shader=t,this}SetLineHeight(t){return this.LineHeight=t,this}EnableDuplicateBuilder(){this.BuildCopyBag=!0}Clone(){const t=new A(null);return t.StringWithFont=this.StringWithFont,t.RectArea=this.RectArea,t.TextAttr=this.TextAttr,t.LineHeight=this.LineHeight,t}}_.TextViewParams=A,window.TextViewParams=_.TextViewParams;class P{constructor(t,e,i,n,s){this._layoutView=null,this._textWidth=0,this._textViewReahHeight=0,this._marqueeRunning=!0,this._marqueePause=!1,this._marqueeCurrentNum=2,this._textView=null,this._TextViewParams=e,this._NeedQuick=void 0!==n&&n,this._marquee=e.Marquee,this._rectArea=e.RectArea,this._DrawCount=0,this._ShowInterval=0,this._TextureManager=t,this._LatexMode=e.LatexMode,this._Shader=e.Shader,this._IsInstantLoad=e.IsInstantLoad?1:0,this._AutoHeight=!1,this._EnableTextureOnloadCallback=!!s,this._DuplicateBag=e.BuildCopyBag?{Set:null,Swf:null,Siz:null}:null;const r=this;let a=null;const o=e.RectArea.width,l=e.RectArea.height;let h=null,c=null;null!==this._marquee?(c=new _.ClipView,c.Init(),c.SetClipRect(0,0,o,l,!0),c.SetId("matrixClipLayoutview"),c.OnDettachFromSystem=function(){r._marqueeRunning=!1,_.ClipView.prototype.OnDettachFromSystem.call(this)}):(c=new _.LayoutView,c.OnDettachFromSystem=function(){this._TextureOnloadCallbacksTimer&&(clearTimeout(this._TextureOnloadCallbacksTimer),this._TextureOnloadCallbacksTimer=null)}),a=c.GetRenderer(),this._Renderer=a;let u=i;u||(u=e.StringWithFont.str),u=this._ConvertEscToString(u);let d=!1;e.StringWithFont.italic.length>0&&(d=!0);let g=!1;e.StringWithFont.bold.length>0&&(g=!0),h=_.sTextUtils.StringWithFont(u,e.StringWithFont.size,e.StringWithFont.font,e.StringWithFont.alignment,e.StringWithFont.vertical_align,e.StringWithFont.textColour,d,g,e.StringWithFont.shadow,e.StringWithFont.stroke_width,e.StringWithFont.vertical_area_align),void 0!==e.Marquee&&null!==e.Marquee?this._textWidth=_.sTextUtils.GetTextWidth(h):this._NeedQuick?this._textWidth=e.RectArea.width-2*e.RectArea.x:this._textWidth=_.sTextUtils.GetTextWidth(h),this.addTextView(c,h,e.TextAttr,e.RectArea,e.Marquee,e.LineHeight),this._TextureOnloadCallbacksTimer&&(clearTimeout(this._TextureOnloadCallbacksTimer),this._TextureOnloadCallbacksTimer=null),this._TextureOnloadCallbacksTimer=setTimeout((()=>{s&&s({width:this._textView.Element.clientWidth,height:this._textView.Element.clientHeight})}),0),this._layoutView=c,this._TextTexture=null,this._MarqueeTimer=null}_ConvertEscToString(t){let e=`${t}`;return-1!==e.indexOf(""")&&(e=e.replace(/"/gi,'"')),-1!==e.indexOf("&")&&(e=e.replace(/&/gi,"&")),-1!==e.indexOf("<")&&(e=e.replace(/</gi,">")),-1!==e.indexOf(">")&&(e=e.replace(/>/gi,"<")),-1!==e.indexOf(" ")&&(e=e.replace(/ /gi," ")),e}EnableAutoHeight(){this._AutoHeight=!0,this._textView.EnableAutoHeight()}addTextView(t,e,i,n,s,r){const a=n.height;let o;const l=_.Clone(n);let h=null;0!==e.str.length?(o=this._TextureManager.GetTextTextureByMultiRows(e,i,l,r,this._NeedQuick,this._Shader,this._IsInstantLoad,this._LatexMode,this._DuplicateBag),this._TextTexture=o.texture,this._textViewReahHeight=o.real_height,h=new _.LayoutView,h.Init(new _.TextureSetting(o.texture,null,null,!0)),h.SetId(`Text-${e.str}`),"middle"!==e.vertical_area_align&&"bottom"!==e.vertical_area_align||(h.Element.style.display="table-cell",h.Element.style.position="static",t.Element.style.display="table",t.Element.style.position="static"),t.AddView(h,0,0,l.width,a),this._textView=h):(this._textViewReahHeight=0,_.LogI("t_StringWithFont.str.length is 0"))}GetDuplicateBuilder(){return this._DuplicateBag}GetLayoutView(){return this._layoutView}GetTextWidth(){return this._textView?this._textView.Element.clientWidth:Math.floor(this._textWidth+.5)}StartAnimation(t){t&&null!==this._textView&&this._textView.StartAnimation(t)}}_.TextViewEx=P,_.TextViewControl=P;_.CopiedTextViewEx=class{constructor(t,e,i,n,s){const r={x:0,y:0,width:i.width,height:i.height};this._ContainerView=new _.LayoutView,this._TextView=this._AddTextView(t,e,r,this._ContainerView,n,s)}_AddTextView(t,e,i,n,s,r){let a=null;if(e&&0!==e.length){const o=t.GetCopiedTextTexture(e,i,s,r);a=new _.LayoutView,a.Init(new _.TextureSetting(o,null,null,!0)),e.length<15?a.SetId(`Text-${e}`):a.SetId(`Text-Long${e.length}`),n.AddView(a,0,0,i.width,i.height),r&&o.RegisterLoadImageCallback(null,r,null)}return a}EnableAutoHeight(){this._TextView&&this._TextView.EnableAutoHeight()}GetLayoutView(){return this._ContainerView}},_.Clone=function(t){return JSON.parse(JSON.stringify(t))},window.Clone=_.Clone;_.PersistTimer=new class{constructor(){this._AlreadyExited=!1,window.PersistTimer&&(this._AlreadyExited=!0)}setTimeout(t,e){return this._AlreadyExited&&window.PersistTimer.setTimeout?window.PersistTimer.setTimeout(t,e):window.setTimeout(t,e)}clearTimeout(t){this._AlreadyExited&&window.PersistTimer.clearTimeout?window.PersistTimer.clearTimeout(t):window.clearTimeout(t)}setInterval(t,e){if(!this._AlreadyExited||!window.PersistTimer.setInterval)return window.setInterval(t,e);window.PersistTimer.setInterval(t,e)}clearInterval(t){this._AlreadyExited&&window.PersistTimer.clearInterval?window.PersistTimer.clearInterval(t):window.clearInterval(t)}};_.ForegroundTimer=new class{setTimeout(t,e){return window.setTimeout(t,e)}clearTimeout(t){window.clearTimeout(t)}setInterval(t,e){return window.setInterval(t,e)}clearInterval(t){window.clearInterval(t)}},_.EasingTypeIn=0,_.EasingTypeOut=1,_.EasingTypeInOut=2,_.EasingTypeBezier=3,_.EasingTypeBlink=4,_.EasingTypeDeceleration=5,_.EasingTypeSteps=6;_.EasingBase=class{constructor(){this.Pacakge=this.Package}Package(){}_GetBasePackage(t){return{T:t,St:null}}};class L extends _.EasingBase{Package(){return this._GetBasePackage(_.EasingTypeIn)}}_.EasingIn=L;class R extends _.EasingBase{Package(){return this._GetBasePackage(_.EasingTypeOut)}}_.EasingOut=R;class k extends _.EasingBase{Package(){return this._GetBasePackage(_.EasingTypeInOut)}}_.EasingInOut=k;class D extends _.EasingBase{Package(){return this._GetBasePackage(_.EasingTypeDeceleration)}}_.EasingDeceleration=D;class V extends _.EasingBase{Package(){return this._GetBasePackage(_.EasingTypeBlink)}}_.EasingBlink=V;class O extends _.EasingBase{constructor(t,e,i,n,s){super(),this._Inited=!1,this._X1=t,this._X2=i,this._Y1=e,this._Y2=n,this._Duration=s}Package(){const t=this._GetBasePackage(_.EasingTypeBezier);return t.St={X1:this._X1,X2:this._X2,Y1:this._Y1,Y2:this._Y2,Dur:this._Duration},t}}_.BezierEasing=O;class M extends _.EasingBase{constructor(t,e){super(),this._Steps=t,this._Type=e}Package(){const t=this._GetBasePackage(_.EasingTypeSteps);return t.St={S:this._Steps,T:this._Type},t}}_.StepsEasing=M,_.Easing={Circular:{In:new _.EasingIn,Out:new _.EasingOut,InOut:new _.EasingInOut,Deceleration:new _.EasingDeceleration}},window.Easing=_.Easing,_.ColorSpace={RGBA_8888:"RGBA_8888",RGBA_4444:"RGBA_4444",RGBA_5551:"RGBA_5551",RGB_565:"RGB_565",RGB_ETC1:"RGB_ETC1",RGBA_ETC1:"RGBA_ETC1"},_.QRCodeLevel={L:1,M:0,Q:3,H:2};class F{constructor(t,e,i){if(this._Manager=t,i){_.sRenderTextureDelegateManager.CreateTextureStatus().SetResourceInfo(i)}this.RenderTexture=_.sRenderTextureDelegateManager.CreateTexture(),this.RenderTexture.SetResourceInfo(e),this._CallbackIdToken=0,this._OnLoadCallback=[],_.ForgeDebug.EnableTextureTracer&&(t._ImageTextureTracer.push(this),this._TracerDescript="")}get Unloaded(){return null===this.RenderTexture||this.RenderTexture.Unloaded}set Unloaded(t){}get LoadTime(){return null!==this.RenderTexture?this.RenderTexture.LoadTime:0}set LoadTime(t){}get Width(){return null!==this.RenderTexture?this.RenderTexture.Width:0}set Width(t){}get Height(){return null!==this.RenderTexture?this.RenderTexture.Height:0}set Height(t){}UnloadTex(){this._OnLoadCallback=[],null!==this.RenderTexture&&(this._CallbackIdToken>0&&(this.RenderTexture.UnregisterOnloadCallback(this._CallbackIdToken),this._CallbackIdToken=0),this.RenderTexture.UndoRef(),this.RenderTexture=null),this._TracerDescript=""}RegisterLoadImageCallback(t){if(this.IsLoaded()&&null!=t)return this.RenderTexture&&t(this.RenderTexture.Width,this.RenderTexture.Height),null;let e=null;return null!=t&&(e={callback:t},this._OnLoadCallback.push(e),0===this._CallbackIdToken&&(_.Assert(null!==this.RenderTexture),this._CallbackIdToken=this.RenderTexture.RegisterOnloadCallback(F.prototype._InvokeOnLoadCallbacks.bind(this)))),e}UnregisterLoadImageCallback(t){t&&this._OnLoadCallback.some(((e,i,n)=>{if(e===t)return n.splice(i,1),!0}))}EnableBackgroundLoad(t){}DisableBackgroundLoad(t){}_InvokeOnLoadCallbacks(t,e){const i=this._OnLoadCallback;this._OnLoadCallback=[];for(let n=0;n<i.length;n++){i[n].callback(t,e)}this.RenderTexture&&this.RenderTexture.UnregisterOnloadCallback(this._CallbackIdToken)}IsLoaded(){return 0!==this.LoadTime&&!this.Unloaded}SetTextureTracerDescript(t){this._TracerDescript=t}ReallocRenderTexture(){}}_.ImageTexture=F;class G extends _.ImageTexture{constructor(t,e,i,n,s,r){const a=_.sRenderTextureDelegateManager.CreateResourceInfo(t.GetId(),"IMG");a.Set={URL:e,Siz:n,Clr:s||"",IsF:i?1:0,NtS:r,ILd:0},super(t,a),this.Name="IMG",this.Source=e,this.IsForever=i?1:0,this.TargetSize=n,this.ColorSpace=s||"",this.NetSetting=r||null,this._InstantLoad=0,this._ImageElement=new Image,this._ImageElement.onload=function(){this._Loaded()}.bind(this),this._ImageElement.onerror=function(){this._Loaded()}.bind(this),this._ImageElement.src=e,this.RenderTexture.NeedCheckExpired=!0}_Loaded(){this.RenderTexture.Unloaded=!1,this.RenderTexture.LoadTime=Date.now(),this.RenderTexture.Width=this._ImageElement.width,this.RenderTexture.Height=this._ImageElement.height,this.RenderTexture.InvokeOnloadCallbacks(this._ImageElement.width,this._ImageElement.height)}InstantLoad(t){if(this._InstantLoad=t?1:0,this.RenderTexture){const t=this.RenderTexture.GetResourceInfo();null!==t&&(t.Set.ILd=this._InstantLoad,this.RenderTexture.SetResourceInfo(t))}return this}ReallocRenderTexture(){if(this.IsForever)return void _.LogE("ReallocRenderTexture(): NOT need for forever texture");const t=this.Source,e=this.TargetSize,i=this.ColorSpace,n=this.IsForever,s=_.sRenderTextureDelegateManager.CreateResourceInfo(this._Manager.GetId(),this.Name);s.Set={URL:t,Siz:e,Clr:i,IsF:n,ILd:this._InstantLoad},this.RenderTexture=_.sRenderTextureDelegateManager.CreateTexture(),this.RenderTexture.SetResourceInfo(s),this._Manager.CachedTextureManager.CacheTheTexture(this)}}_.UrlImageTexture=G;class N extends _.ImageTexture{constructor(t,e,i,n,s){const r=_.sRenderTextureDelegateManager.CreateResourceInfo(t.GetId(),"GRAD");r.Set={URL:s},super(t,r),this.Gradient=s}}_.GradientTexture=N;class B extends _.ImageTexture{constructor(t,e,i,n){const s=_.sRenderTextureDelegateManager.CreateResourceInfo(t.GetId(),"LGT");s.Set={L:e,S:i},super(t,s),this.Gradient=n}static StopPoint=class{constructor(){this.stopPosition=0,this.color=""}}}_.LinearGradientTexture=B;class W extends _.ImageTexture{constructor(t,e,i,n,s,r,a,o,l,h,c){const u=_.sRenderTextureDelegateManager.CreateResourceInfo(t.GetId(),"TST");let d=null;c&&(d={x:0,y:0,w:0,h:0},Object.assign(d,c)),u.Set={ST:e,IDS:i.GetIdsPack(),W:Math.floor(s.width+.5),H:Math.floor(s.height+.5),FS:r,LA:l,EM:h,LH:Math.floor(a+.5),ILD:o?1:0,TLC:n?1:0,EA:d},super(t,u),this.Name="TST",this._TextStylePack=i,i.DoRef()}UnloadTex(){this._TextStylePack.UnRef(),super.UnloadTex()}}_.TextStyleTexture=W;_.CachedTextureManager=class{constructor(t){this._TextureManager=t,this._Renderer=t.GetRenderer(),this._CachedTextureStack=[],this._LockedTextureStack=[],this._MemoryLimited=10485760,this._VisibleMark=1}SetMemoryLimited(t){this._MemoryLimited=1024*t*1024}_FindTexture(t,e,i){for(let n=this._CachedTextureStack.length-1;n>=0;n--){const s=this._CachedTextureStack[n];if(s.Source===t&&(e===s.TargetSize||null!==e&&e.Equals(s.TargetSize))&&i===s.ColorSpace){if(null===s.RenderTexture)continue;return s}}return null}CacheTheTexture(t){for(let e=this._CachedTextureStack.length-1;e>=0;e--)if(t===this._CachedTextureStack[e])return;this._CachedTextureStack.push(t)}_MarkVisibleViewTextures(t,e){t.TextureSetting&&t.TextureSetting.Texture&&(t.TextureSetting.Texture.VisibleMark=e);const i=t.ChildViews.length;for(let n=0;n<i;n++){const i=t.ChildViews[n];i&&"VISIBLE"!==i.Visibility||this._MarkVisibleViewTextures(i,e)}}ReduceInvisibleTexture(t){this._MarkVisibleViewTextures(t,++this._VisibleMark);for(let t=0;t<this._CachedTextureStack.length;t++){const e=this._CachedTextureStack[t];e.VisibleMark!==this._VisibleMark&&(e.UnloadTex(),this._CachedTextureStack.splice(t,1),t--)}}GetCacheSize(){return this._CachedTextureStack.length}};const H=new Map;let Y=0;const $=new Map;let U=0;class j{constructor(){this.CachedTextureManager=new _.CachedTextureManager(this),this._ForeverCachedTextureManager=new _.CachedTextureManager(this),this._AtlasDataInfo={atlas_data:[],buffer_data_offset:0,textures:[]},this._ClearTimer=-1,this._ImageTextureTracer=[],this._Id=j.sTextureManagerToken++,this._CacheMaxSize=100,this.StartScavengerCachedTimer()}StartScavengerCachedTimer(){-1===this._ClearTimer&&(this._ClearTimer=_.ForegroundTimer.setInterval(this.ScavengerCached.bind(this),3e4))}GetId(){return this._Id}GetRenderer(){return _.sDeprecatedRenderer}GetGifImage(t,e,i){return this.GetImage(t,e,i)}GetImage(t,e,i){if(!t)return _.LogI("GetImage, url is null!"),null;return this._GetImageInternal(t,null,_.ColorSpace.RGBA_8888,e,!1,i)}GetImage2(t,e,i,n,s){if(!t)return _.LogI("GetImage2, url is null!"),null;const r=_.sRectUitls.FormatRectArea(i);"string"!=typeof n&&(n=t.indexOf(".pkm")>=0?t.indexOf(".pkma")>=0?_.ColorSpace.RGBA_ETC1:_.ColorSpace.RGB_ETC1:_.ColorSpace.RGB_565);return this._GetImageInternal(t,r,n,e,!1,s)}CreateMiniGradientTexture(t,e,i,n){return new _.GradientTexture(this,t,e,i,n)}_GetImageInternal(t,e,i,n,s,r){if(n){const n=this._ForeverCachedTextureManager._FindTexture(t,e,i);if(n)return n}else{const n=this.CachedTextureManager._FindTexture(t,e,i);if(n)return n}const a=new _.UrlImageTexture(this,t,n,e,i,r);return a.IsForever?this._ForeverCachedTextureManager.CacheTheTexture(a):this.CachedTextureManager.CacheTheTexture(a),a}GetRoundCornerMask(t,e){return this.GetCustomCornerMask(t,e,e,e,e)}GetCustomCornerMask(t,e,i,n,s){const r=_.sRectUitls.FormatRectArea(t),a=Math.max(e,i,n,s);if(a>r.width/2||a>r.height/2)return _.LogE(`TextureManager.GetRoundCornerMask(): radius is too large, radius=${a} w=${r.width} h=${r.height}`),null;const o=_.sRenderTextureDelegateManager.CreateResourceInfo(this._Id,"CCM");o.Set={W:r.width,H:r.height,LT:e,RT:i,LB:n,RB:s};const l=new _.ImageTexture(this,o);return _.ForgeDebug.EnableTextureTracer&&l.SetTextureTracerDescript("CornerMask"),l}GetOneCornerMask(t){const e=_.sRenderTextureDelegateManager.CreateResourceInfo(this._Id,"OCM");e.Set={Rad:t};const i=new _.ImageTexture(this,e);return _.ForgeDebug.EnableTextureTracer&&i.SetTextureTracerDescript("OneCornerMask"),i}GetTextTextureFromStylePack(t,e,i,n,s,r,a,o,l,h){return t&&0!==t.length?new _.TextStyleTexture(this,t,e,i,n,s,r,a,o,l,h):null}_getParamsId(t,e,i){const n=t.font,s=t.size,r=t.italic,a=t.bold,o=t.alignment,l=t.vertical_align,h=t.vertical_area_align,c=t.textColour,u=t.backgroundColour,d=t.shadow;let g="";t.stroke_width&&(g=t.stroke_width);const f=e.text_overflow,m=e.word_wrap,p=[n,r,a,d,g].join(":"),_=[s,o,l,h,f,m].join(":");let T="",y="";return H.has(p)?T=H.get(p):(T=`TS${Y}`,H.set(p,T),Y++),$.has(_)?y=$.get(_):(y=`DS${U}`,$.set(_,y),U++),[T,y,c,u]}GetTextTextureByMultiRows(t,e,i,n,s,r,a,o,l){const h=t.str;if(null===h||0===h.length)return null;const c=_.sRenderBridge.GetScreenInfo().scaleRatio,u=Object.assign(i);u.x*=c,u.y*=c,u.width*=c,u.height*=c;const d=Object.assign(t);d.size=Math.ceil(d.size*c),n*=c;const g={ST:t.str,AT:JSON.stringify({TO:e.text_overflow,WW:e.word_wrap}),RA:JSON.stringify({X:parseInt(u.x+.5,10),Y:parseInt(u.y+.5,10),W:parseInt(u.width+.5,10),H:parseInt(u.height+.5,10)}),LA:o,LH:parseInt(n+.5,10),ILD:void 0!==a?a:1};if(r&&(g.SH=JSON.stringify({T:r.Type,P:r.Params})),void 0!==window.JsView&&void 0!==window.JsView.ForgeNativeRevision&&window.JsView.ForgeNativeRevision>0){const t=this._getParamsId(d,e,r);g.PI={FS:t[0],DS:t[1],TC:t[2],BC:t[3]}}const f=this._BuildTextTextureAndSerialStatus(g,d);if(null!==l){const t=Object.assign({},g);t.ST=null,t.TLC=0,l.Set=t,l.Swf=Object.assign({},d)}let m=u.height;if(void 0!==window.PlatformUtils&&!1===s){m=window.PlatformUtils.GetTextRect(h,u,d,e,n).height}if(m=Math.floor(m/c+.5),_.ForgeDebug.EnableTextureTracer){let e=t.str;e.length>8&&(e=`${t.str.substr(0,8)}...`),f.SetTextureTracerDescript(`[${e}]`)}return{texture:f,real_height:m}}GetCopiedTextTexture(t,e,i,n){const s=Object.assign({},i.Set);s.ST=t,s.TLC=void 0!==n&&n?1:0;const r=i.Swf,a=_.sRenderBridge.GetScreenInfo().scaleRatio;s.RA=JSON.stringify({X:parseInt(e.x*a+.5,10),Y:parseInt(e.y*a+.5,10),W:parseInt(e.width*a+.5,10),H:parseInt(e.height*a+.5,10)});const o=this._BuildTextTextureAndSerialStatus(s,r);if(_.ForgeDebug.EnableTextureTracer&&t){let e=t;e.length>8&&(e=`${t.substr(0,8)}...`),o.SetTextureTracerDescript(`[${e}]`)}return o}_BuildTextTextureAndSerialStatus(t,e){_.sRenderTextureDelegateManager.AppendFontStatusIfNeed(t,e);let i=null;t.FO&&(i={STA:{Nam:"T",Sta:t.FO}});const n=_.sRenderTextureDelegateManager.CreateResourceInfo(this._Id,"T");return n.Set=t,new _.ImageTexture(this,n,i)}GetColorTexture(t){const e=_.sRenderTextureDelegateManager.CreateResourceInfo(this._Id,"CT");e.Set={Clr:t};const i=new _.ImageTexture(this,e);return _.ForgeDebug.EnableTextureTracer&&i.SetTextureTracerDescript(`Color[${t}]`),i}GetColorTextureCached(t){return this.GetColorTexture(t)}GetNamedCachedTexture(t){return null}CreateCssGradientColorTexture(t,e,i,n,s,r){let a=[];for(let t of r){let e={stop:t.stopPosition,color:t.color};a.push(e)}return new _.LinearGradientTexture(this,JSON.stringify({x0:e,y0:i,x1:n,y1:s}),JSON.stringify(a),t)}ScavengerCached(){this.CachedTextureManager.GetCacheSize()>=this._CacheMaxSize&&this.CachedTextureManager.ReduceInvisibleTexture(_.sRootView)}GetOffScreenMediaTexture(t){if(void 0===window.OffscreenVideoPlayer||!(t instanceof window.OffscreenVideoPlayer))return null;if(!t.hasTerminator()){const e=this._BuildVideoTexture(t);t.setResourceTerminator((()=>{e.UnloadTex()}))}return this._BuildVideoTexture(t)}_BuildVideoTexture(t){const e=_.sRenderTextureDelegateManager.CreateResourceInfo(this._Id,"VPLY");e.Set={Hdl:t.mediaHandler()};const i=new _.ImageTexture(this,e);return _.ForgeDebug.EnableTextureTracer&&i.SetTextureTracerDescript(`Video[${t.mediaHandler()}]`),i}}j.sTextureManagerToken=100,_.TextureManager=j,window.TextureManager=_.TextureManager;_.LayoutViewDebugClass=class{SetTextureTracer(t){}GetTextureTracer(){return null}},_.ForgeDebug=new _.LayoutViewDebugClass,window.ForgeDebug=_.ForgeDebug;class z{constructor(){this.Width=0,this.Height=0,this.MarginTop=0,this.MarginLeft=0,this.MarginRight=0,this.MarginBottom=0,this.Z=0,this.SizeAdjust=!1}SetPosition(t,e,i){this.MarginTop=e,this.MarginLeft=t,i&&(this.Z=i)}SetSize(t,e){this.Width=t,this.Height=e}Clone(){const t=new z(null);return t.Width=this.Width,t.Height=this.Height,t.MarginTop=this.MarginTop,t.MarginLeft=this.MarginLeft,t.MarginRight=this.MarginRight,t.MarginBottom=this.MarginBottom,t.Z=this.Z,t.SizeAdjust=this.SizeAdjust,t}Equals(t){return t.Width===this.Width&&t.Height===this.Height&&t.MarginTop===this.MarginTop&&t.MarginLeft===this.MarginLeft&&t.MarginRight===this.MarginRight&&t.MarginBottom===this.MarginBottom&&t.Z===this.Z}}_.LayoutParamsBase=z;class X extends _.LayoutParamsBase{constructor(t){super(),t instanceof _.RectArea&&(t={x:t.x,y:t.y,width:t.width,height:t.height}),t&&(t.x?this.MarginLeft=t.x:t.marginLeft&&(this.MarginLeft=t.marginLeft),t.y?this.MarginTop=t.y:t.marginTop&&(this.MarginTop=t.marginTop),t.z&&(this.Z=t.z),t.width&&(this.Width=t.width),t.height&&(this.Height=t.height),isNaN(this.MarginTop)&&(_.LogE("isNaN(this.MarginTop)!"),this.MarginTop=0),isNaN(this.MarginLeft)&&(_.LogE("isNaN(this.MarginLeft)!"),this.MarginLeft=0),"MatchParent"!==this.Width?isNaN(this.Width)&&_.LogE("isNaN(this.Width)!"):this.SizeAdjust=!0,"MatchParent"!==this.Height?isNaN(this.Height)&&_.LogE("isNaN(this.Height)!"):this.SizeAdjust=!0)}}_.LayoutParams=X,window.LayoutParams=_.LayoutParams;_.RenderTextureDelegateManager=class{constructor(){this._IdTokenGenerator=66,_.sRenderTextureDelegateManager=this,this._CheckExpiredTime=0}CreateTextureHeadStatus(){const t=new _.RenderTextureDelegate(this,0);return t.DoRef(),t}CreateTextureStatus(){const t=new _.RenderTextureDelegate(this,0);return t.DoRef(),t}CreateTexture(){const t=new _.RenderTextureDelegate(this,this._IdTokenGenerator++);return t.DoRef(),t}RecycleTexture(t){}CreateResourceInfo(t,e){return{Id:0,Nam:e,Set:null,TmId:t,NdLd:0}}AppendFontStatusIfNeed(t,e){const i={};i.Fo=e.font,i.Si=e.size,i.It=e.italic,i.Bo=e.bold,i.Al=e.alignment,i.Ve=e.vertical_align,i.Vaa=e.vertical_area_align,i.Tx=e.textColour,i.Ba=e.backgroundColour,i.En=e.enableBlend,i.Sh=e.shadow,e.stroke_width?i.Stk=e.stroke_width:i.Stk=-1,t.FO=JSON.stringify(i)}},_.sRenderTextureDelegateManager=new _.RenderTextureDelegateManager;_.RenderTextureDelegate=class{constructor(t,e){this.IdToken=e,this._Manager=t,this._Reference=0,this._SyncingResourceInfo=null,this._OnloadCallbacks={},this._OnloadCallbacksSize=0,this._OnloadCallbackIdGenerator=1,this.Unloaded=!0,this.LoadTime=0,this.RequireTime=0,this.ForceExpire=!1,this.NeedCheckExpired=!1;if(_.ForgeDebug.GetTextureTracer()){const t=new Error;this.Stack=t.stack}}DoRef(){this._Reference++}UndoRef(){this._Reference--,0===this._Reference&&(this._OnloadCallbacksSize>0&&(this._OnloadCallbacks={}),this._Manager.RecycleTexture(this))}SetResourceInfo(t){t.Id=this.IdToken,this._SyncingResourceInfo=t}GetResourceInfo(){return this._SyncingResourceInfo}ReadSyncInfo(){const t=this._SyncingResourceInfo;return this._SyncingResourceInfo=null,t}RegisterOnloadCallback(t){const e=this._OnloadCallbackIdGenerator++;return this._OnloadCallbacks[`${e}`]=t,this._OnloadCallbacksSize++,null!==this._SyncingResourceInfo&&(this._SyncingResourceInfo.NdLd=1),e}UnregisterOnloadCallback(t){delete this._OnloadCallbacks[`${t}`],this._OnloadCallbacksSize--}InvokeOnloadCallbacks(t,e){if(this._OnloadCallbacksSize>0)for(const i in this._OnloadCallbacks)this._OnloadCallbacks.hasOwnProperty(i)&&this._OnloadCallbacks[i](t,e)}IsLoaded(){return 0!==this.LoadTime&&!this.Unloaded}};_.DeprecatedRenderer=class{constructor(){_.sDeprecatedRenderer=this,this._SharedTextureManager=this.CreateTextureManager()}SetUserId(t){_.sRenderBridge.UpdateUserId(t)}GetScreenInfo(){return _.sRenderBridge.GetScreenInfo()}StringWithFont(){return _.sTextUtils.StringWithFont.apply(this,arguments)}GetTextWidth(){return _.sTextUtils.GetTextWidth.apply(this,arguments)}GetTextUtils(){return _.sTextUtils}RectArea(t,e,i,n){return new _.RectArea(t,e,i,n)}TextAttr(){return _.sTextUtils.TextAttr.apply(this,arguments)}GarbageCollect(){_.LogM("GarbageCollect called")}TriggerFrameDraw(){_.sRenderBridge.RequestSwap()}GetSharedTextureManager(){return this._SharedTextureManager}CreateTextureManager(){return new _.TextureManager}},_.sDeprecatedRenderer=null;const K={STRING:Symbol("STRING"),FUNCTION:Symbol("FUNCTION"),LINE_FEED:Symbol("LINE_FEED"),LEFT_BRACE:Symbol("LEFT_BRACE"),RIGHT_BRACE:Symbol("RIGHT_BRACE")};const J={},q={BASE:Symbol("BASE"),COLOR:Symbol("COLOR"),BOLD:Symbol("BOLD"),ITALIC:Symbol("ITALIC"),DECORATION:Symbol("DECORATION"),SUPERSCRIPT:Symbol("SUPERSCRIPT"),SUBSCRIPT:Symbol("SUBSCRIPT")};class Z{constructor(){this.style,this.styleValue=""}}class Q{constructor(){this.textStyle=new Z,this.childNodes=[],this.parent}}class tt extends Q{constructor(){super(),this.styleList=[],this.indexPair,this.lineFeedNode=!1,this.testValue}}function et(t){if(null===t||0===t.length)return null;const e=function(t){const e=[];let i=0;for(;i<t.length;)if("\\"===t[i])if(i<t.length-1)if("\\"===t[i+1]||"{"===t[i+1]||"}"===t[i+1]){const t={type:K.STRING,indexPair:[i+1,i+2]};e.push(t),i+=2}else{++i;const n=i;let s=i,r=!1;for(;i<t.length&&"{"!==t[i]&&"}"!==t[i];)" "!==t[i]&&(r=!0)," "===t[i]&&r?++i:s=++i;const a={type:K.FUNCTION,indexPair:[n,s]};e.push(a)}else console.error("backslash at end.");else if("{"===t[i]){const t={type:K.LEFT_BRACE,indexPair:null};e.push(t),++i}else if("}"===t[i]){const t={type:K.RIGHT_BRACE,indexPair:null};e.push(t),++i}else if("\n"===t[i]){const t={type:K.LINE_FEED,indexPair:null};e.push(t),++i}else{const n=i;let s=i;for(;i<t.length&&"\\"!==t[i]&&"{"!==t[i]&&"}"!==t[i]&&"\n"!==t[i];)++i,s=i;const r={type:K.STRING,indexPair:[n,s]};e.push(r)}for(let i=e.length-1;i>=0;i--){const n=e[i];if(n.type===K.STRING){let s=!0;for(let e=n.indexPair[0];e<n.indexPair[1];e++)if(" "!==t[e]){s=!1;break}!(s&&i>0&&i<e.length-1)||e[i-1].type!==K.LEFT_BRACE&&e[i-1].type!==K.RIGHT_BRACE||e[i+1].type!==K.RIGHT_BRACE&&e[i+1].type!==K.LEFT_BRACE||e.splice(i,1)}}return e}(t),i=[],n=[];let s=0;for(;s<e.length;){const r=e[s];if(r.type===K.STRING){const t=new tt;n.push(t),t.indexPair=r.indexPair,t.textStyle.style=q.BASE,i.push(t)}else if(r.type===K.LINE_FEED){const t=new tt;n.push(t),t.lineFeedNode=!0}else if(r.type===K.LEFT_BRACE)i.push(J);else if(r.type===K.RIGHT_BRACE)if(i.length>0){const t=[];let e=i.pop();for(;e!==J&&(t.push(e),i.length>0);)e=i.pop();if(i.length>0){const e=i[i.length-1];if(e.textStyle.style===q.BASE)console.error("lack of function");else for(;t.length>0;){const i=t.pop();e.childNodes.push(i),i.parent=e}}else console.error("lack of function")}else console.error("extra }");else if(r.type===K.FUNCTION){const n=t.substring(r.indexPair[0],r.indexPair[1]),a=new Q;switch(n){case"textcolor":if(s<e.length-3){a.textStyle.style=q.COLOR;const i=e[s+1],n=e[s+2],r=e[s+3];i.type===K.LEFT_BRACE&&n.type===K.STRING&&r.type===K.RIGHT_BRACE?(a.textStyle.styleValue=t.substring(n.indexPair[0],n.indexPair[1]),s+=3):console.error("textcolor param format error.")}else console.error("textcolor param format error.");break;case"textb":a.textStyle.style=q.BOLD;break;case"texti":a.textStyle.style=q.ITALIC;break;case"textdecoration":if(s<e.length-3){a.textStyle.style=q.DECORATION;const i=e[s+1],n=e[s+2],r=e[s+3];i.type===K.LEFT_BRACE&&n.type===K.STRING&&r.type===K.RIGHT_BRACE?(a.textStyle.styleValue=t.substring(n.indexPair[0],n.indexPair[1]),s+=3):console.error("textdecoration param format error.")}else console.error("textdecoration param format error.");break;case"textsup":a.textStyle.style=q.SUPERSCRIPT;break;case"textsub":a.textStyle.style=q.SUBSCRIPT;break;default:console.error(`undefined style type: ${n}`)}i.push(a)}++s}return n.forEach(((t,e,i)=>{let n=t.parent;for(;n;)t.styleList.push(n.textStyle),n=n.parent})),{nodeList:n,text:t}}function it(){this.positionQueue=[],this.timeQueue=[]}it.prototype.reset=function(){this.positionQueue=[],this.timeQueue=[]},it.prototype.pruneQueue=function(t){for(;this.timeQueue.length&&this.timeQueue[0]<Date.now()-t;)this.timeQueue.shift(),this.positionQueue.shift()},it.prototype.updatePosition=function(t){this.positionQueue.push(t),this.timeQueue.push(Date.now()),this.pruneQueue(50)},it.prototype.getVelocity=function(){this.pruneQueue(1e3);const t=this.timeQueue.length;if(t<2)return 0;const e=(this.timeQueue[t-1]-this.timeQueue[0])/1e3,i=this.positionQueue[t-1]-this.positionQueue[0];return console.log(`getVelocity distance:${i}, time:${e}, velocity:${i/e}, this.timeQueue[length-1]:${this.timeQueue[t-1]}, this.timeQueue[0]:${this.timeQueue[0]}`),i/e},window.gRootView=null,_.sRootView=null;class nt{constructor(t,e,i,n){this.Texture=t,this._IsTextureExternal=!1,e instanceof _.ImageTexture?(e&&e.RenderTexture&&e.RenderTexture.NeedCheckExpired&&(e.RenderTexture.RequireTime=0),this.MaskSetting=new _.ViewTextureMask(e)):this.MaskSetting=e,t&&t.RenderTexture&&t.RenderTexture.NeedCheckExpired&&(t.RenderTexture.RequireTime=0),this._IsMaskTextureExternal=!1,this.TextureBeforeImageLoad=i,this._IsPreloadImageTextureExternal=!1,void 0===n&&(n=!0),this.HasAlpha=n}SetExternal(t,e,i){this._IsTextureExternal=t,this._IsMaskTextureExternal=e,this._IsPreloadImageTextureExternal=i}ReleaseInternalTexture(t,e){!this._IsTextureExternal&&this.Texture&&(this.Texture.UnloadTex(),this.Texture=null),!this._IsMaskTextureExternal&&this.MaskSetting&&(this.MaskSetting.UnLoad(),this.MaskSetting=null),!this._IsPreloadImageTextureExternal&&this.TextureBeforeImageLoad&&(this.TextureBeforeImageLoad.UnloadTex(),this.TextureBeforeImageLoad=null)}DebugPrint(){return` _IsTextureExternal=${this._IsTextureExternal}`}}_.TextureSetting=nt,window.TextureSetting=_.TextureSetting;class st extends _.TextureSetting{constructor(t,e,i,n){super(t,e,i,n),this.SetExternal(!0,!0,!0)}}_.ExternalTextureSetting=st,window.ExternalTextureSetting=_.ExternalTextureSetting;_.PackedLayout=class{constructor(t){const e=t.RectInfo;this.RectInfo={coordX:e.coordX,coordY:e.coordY,width:e.width,height:e.height},this.LayoutParams=JSON.parse(JSON.stringify(t.LayoutParams))}ApplyToView(t){const e=this.RectInfo;t.RectInfo={coordX:e.coordX,coordY:e.coordY,width:e.width,height:e.height},t.LayoutParams=JSON.parse(JSON.stringify(this.LayoutParams))}};class rt{constructor(){this._MaskType="COMMON"}Type(){return this._MaskType}UnLoad(){}}_.ViewMask=rt;class at extends _.ViewMask{constructor(t){super(),this._MaskType="TEXTURE",this.ImageTexture=t}UnLoad(){this.ImageTexture.UnloadTex()}}_.ViewTextureMask=at;class ot extends _.ViewMask{constructor(t,e,i,n){super(),this._MaskType="CORNER",this._TopLeft=t,this._TopRight=isNaN(e)?t:e,this._BottomLeft=isNaN(i)?t:i,this._BottomRight=isNaN(n)?t:n,this._CornersWidth=[0,0,0,0],this._CornersDisable=[0===this._TopLeft?1:0,0===this._TopRight?1:0,0===this._BottomLeft?1:0,0===this._BottomRight?1:0]}UnLoad(){}}_.ViewRoundCornerMask=ot;class lt{constructor(t,e,i,n,s,r){this.DragDirection=t||0,this.TriggerMovedDistance=e||0,this._EnableJsFling=i?1:0,this.SlidePile=n||new _.RectArea(0,0,1280,720),this.PageWidth=s>0?s:65535,this.EnableTabMode=s>0,this.PageEdge=r||1/4}}lt.DIRECTION_DISABLE=0,lt.DIRECTION_VERTICAL=1,lt.DIRECTION_HORIZONTAL=2,lt.DIRECTION_AUTO=lt.DIRECTION_VERTICAL|lt.DIRECTION_HORIZONTAL,_.DragSetting=lt;class ht{constructor(){this.Settings=null,this.Listener=null,this.ListenerFlags=0,this.OverListener=null,this.OverListenerFlags=0,this.Formula=null,this.SyncString=null}SetListener(t){this.Listener=t}}ht.INFLEXION=.35,ht.DECELERATION_RATE=Math.log(.78)/Math.log(.9),ht.PHYSICAL_COEF=51890.2,_.DragInfo=ht,_.DragInfo.SCROLL_FRICTION=.06,_.DragInfo.EVENT_TYPE={OnDown:0,OnTap:1,OnLongPress:2,OnDragStart:3,OnMoved:4,OnDragEnd:5,OnRelease:6,OnFling:7};let ct=0;class ut{constructor(t,e){this.TextureSetting=t,t&&console.error("LayoutViewBase constructor texture_setting not undefined!"),this._dispatchLongPress=this._dispatchLongPress.bind(this),this.Visibility="VISIBLE",this.LayoutParams=null,this.ParentView=null,this.ChildViews=[],this.zIndex=0,this._Perspective=0,this._PerspectiveAnchor=[.5,.5],this._BackfaceVisibility=1,this._DebugCount=++ct,this.childZIndexCount=0,this._IsChildOfRootView=!1,this._DetachFromSystemCallback=null,this.Element=null,this.InnerChildElement=null,"root"===e?(this.Element=window.originDocument.getElementById(e),this.Element||(this.Element=window.originDocument.getElementById("app"))):"svg"===e||"path"===e?this.Element=document.createElementNS("http://www.w3.org/2000/svg",e):"jsv-element-proxy"===e?this.Element=null:e&&(this.Element=window.originDocument.createElement(e),"div"!=e&&(this.Element.style.position="absolute")),this.TransitionStore={},this.TransformAnimationObj=null,this._TextureAnimationObj=null,this._DragInfo=null,this.DragControl=null,this._Velocity={x:new it,y:new it},this._TouchSlopSquare=64,this._InDragging=null,this._InLongPress=null,this._AlwaysInTapRegion=null,this._LastFocusX=null,this._LastFocusY=null,this._DownFocusX=null,this._DownFocusY=null,this._LastTimeStamp=null,this._ObjectFitTestCache=null,this._ProxyView=null,this.Expired=!1}Init(t){this.ResetTexture(t)}SetElementProp(t,e,i){switch(e){case"innerview":{const t=_.sViewStore.get(i);if(t){const e=t.view;null==this.LayoutParams&&this.ResetLayoutParams({x:0,y:0,width:0,height:0});let i=this.LayoutParams;this.ResetLayoutParams({x:0,y:0,width:0,height:0}),e&&(null===this._ProxyView?this._InsertProxyLayer(e,i):e!==this._ProxyView&&console.error("Error: Can not reset proxy view"))}break}case"enable-fade":case"poster-on-top":case"text-definition":break;case"id":this.Element&&this.Element.setAttribute("id",i);break;default:_.LogE(`Error: View Unknown prop name=${e}`)}}InsertView(t,e,i){this._InsertView(t,e,i)}AddView(t,e=0,i=0,n=0,s=0){this._InsertView(t,null,{x:e,y:i,width:n,height:s})}MoveChildView(t,e,i){if(null!=this._ProxyView&&t!=this._ProxyView)return void this._ProxyView.MoveChildView(t,e);let n=!1;for(var s=0;s<this.ChildViews.length;s++)if(this.ChildViews[s]==t){0!=t.zIndex&&this.childZIndexCount--,this.ChildViews.splice(s,1),t.ParentView=null,n=!0;break}n||_.LogE("MoveChildView(): view is not in child list stack="),e._InsertView(t,i,t.LayoutParams);let r=null;i&&(r=e.ChildViews[e.ChildViews.indexOf(i)+1]),r&&e.Element.contains(r.Element)?e.Element.insertBefore(t.Element,r.Element):e.Element.appendChild(t.Element)}_InsertView(t,e,i){if(i?i instanceof _.LayoutParamsBase?t.LayoutParams=i.Clone():t.LayoutParams=new _.LayoutParams(i):t.LayoutParams||(t.LayoutParams=new _.LayoutParams({x:0,y:0})),null!==t.LayoutParams&&(t.LayoutParams.MarginLeft&&(t.Element.style.left=`${t.LayoutParams.MarginLeft}px`),t.LayoutParams.MarginTop&&(t.Element.style.top=`${t.LayoutParams.MarginTop}px`),t.LayoutParams.Width&&(t.Element.style.width=`${t.LayoutParams.Width}px`),t.LayoutParams.Height?t.Element.style.height=`${t.LayoutParams.Height}px`:t.Element.style.height=""),t.ParentView=this,e){let i=this.ChildViews.indexOf(e);i<0&&(i=this.ChildViews.length),this.ChildViews.splice(i,0,t)}else this.ChildViews.push(t);this._ChildrenListDirty=!0,this._IsChildOfRootView&&t._OnAttachToSystem(),0!=t.zIndex&&this.childZIndexCount++,this.childZIndexCount>0&&this._RequestZIndexReorder()}SetZIndex(t){if(t!=this.zIndex){var e=this.zIndex;this.zIndex=t;var i=this.ParentView;i&&(0==e&&0!=t?i.childZIndexCount++:0!=e&&0==t&&i.childZIndexCount--,i.childZIndexCount<0&&_.ThrowError("ERROR: LayoutViewBase, child z-index count ERROR"),i._RequestZIndexReorder())}}_RequestZIndexReorder(){let t=[],e=[],i=0,n=this.ChildViews.length;for(var s=0;s<n;s++){let n=this.ChildViews[s].zIndex;n<0?(n<i&&(i=n),t.push(this.ChildViews[s])):n>0&&e.push(this.ChildViews[s])}i=1e3*Math.floor(-i/1e3)+1e3;let r=t.length,a=e.length;if(r>0){t.sort(((t,e)=>t.zIndex-e.zIndex));for(s=0;s<r;s++)t[s].Element.style.zIndex=t[s].zIndex+i}if(this.ChildViews.length-t.length-e.length>0)for(s=0;s<n;s++)0==this.ChildViews[s].zIndex&&(this.ChildViews[s].Element.style.zIndex=i);if(a>0){e.sort(((t,e)=>t.zIndex-e.zIndex));for(s=0;s<a;s++)e[s].Element.style.zIndex=e[s].zIndex+i}}SetPerspective(t,e){this.Element.style.perspective=`${t}px`,this.Element.style.webkitPerspective=`${t}px`,this.Element.style.perspectiveOrigin=e,this.Element.style.webkitPerspectiveOrigin=e,this._Perspective=t,this._PerspectiveOrigin=e}SetBackfaceVisibility(t){this.Element.style.backfaceVisibility=t?"visible":"hidden",this.Element.style.webkitBackfaceVisibility=t?"visible":"hidden",console.log(`back face style ${this.Element.style.backfaceVisibility}`),this._BackfaceVisibility=t?1:0}SetTransformStyle(t){this.Element.style.transformStyle=t,this.Element.style.webkitTransformStyle=t,this._TransformStyle=t}EnableDivTouch(t,e){t.eventHandlers&&t.eventHandlers.onClick&&(this.Element.onclick=e=>{t.eventHandlers.onClick(),e.preventDefault&&e.preventDefault()},this.Element.style.pointerEvents="auto")}_DoDragPause(t){this._DragInfo.Settings.EnableTabMode||this.DragControl&&this.DragControl.pause(((e,i)=>{if(null!==this.Element.style.transform){let n=this.GetLayoutParams();n=this._GetMovedLayoutParams(e-n.MarginLeft,i-n.MarginTop),this.ResetLayoutParams(n),this._DragImactSensorRecycle(),console.log(`_DoDragPause lp.MarginLeft:${n.MarginLeft}, lp.MarginTop:${n.MarginTop}`),this.DragControl=null,this.Element.style.transform=null,t.viewX=e,t.viewY=i,this._DragInfo.Listener.OnFling(t)}}))}TouchEventProcess(t){let e=!1;switch(t.type){case _.DragInfo.EVENT_TYPE.OnDown:console.log("TouchEventProcess OnDown in"),this._DoDragPause(t),this._DragInfo.Listener&&this._DragInfo.Listener.OnDown&&(e=this._DragInfo.Listener.OnDown(t));break;case _.DragInfo.EVENT_TYPE.OnTap:this._DragInfo.Listener&&this._DragInfo.Listener.OnTap&&(e=this._DragInfo.Listener.OnTap(t));break;case _.DragInfo.EVENT_TYPE.OnLongPress:this._DragInfo.Listener&&this._DragInfo.Listener.OnLongPress&&(e=this._DragInfo.Listener.OnLongPress(t));break;case _.DragInfo.EVENT_TYPE.OnDragStart:this._DragMovedDistanceX=0,this._DragMovedDistanceY=0,this._DragInfo.Listener&&this._DragInfo.Listener.OnDragStart&&(e=this._DragInfo.Listener.OnDragStart(t));break;case _.DragInfo.EVENT_TYPE.OnMoved:this._DragInfo.Listener&&this._DragInfo.Listener.OnMoved&&(e=this._DoDragMove(t,!0));break;case _.DragInfo.EVENT_TYPE.OnDragEnd:if(this._DragInfo.Listener&&this._DragInfo.Listener.OnDragEnd){e=!!this._SlideIfEnableTabMod(t,-1)||this._DoDragEnd(t)}break;case _.DragInfo.EVENT_TYPE.OnRelease:this._DragInfo.Listener&&this._DragInfo.Listener.OnRelease&&(e=this._DragInfo.Listener.OnRelease(t));break;case _.DragInfo.EVENT_TYPE.OnFling:if(this._DragInfo.Listener&&this._DragInfo.Listener.OnFling){e=!!this._SlideIfEnableTabMod(t,-1)||this._DoFling(t)}break;default:console.log(`TouchEventProcess:${t}`)}return e}DisableDrag(){this._DragInfo=null}EnableDrag(t,e,i){t instanceof _.DragSetting||_.ThrowError("EnableDrag The setting is not Forge.DragSetting"),null===e&&_.ThrowError("EnableDrag The listener is null");const n=new _.DragInfo;n.Settings=t,n.SetListener(e),n.Formula=i,this._DragInfo=n,this.DragControl=null,this._AddEventListener(),_.sRenderBridge.RequestSwap()}RemoveView(t){for(let e=0;e<this.ChildViews.length;e++)if(this.ChildViews[e]===t){t.IsChildOfRootView()&&t._OnDetachFromSystem(),this.ChildViews.splice(e,1),t.ParentView=null;break}}_OnDetachFromSystem(){this._IsChildOfRootView=!1,this._DetachFromSystemCallback?(this._DetachFromSystemCallback.some(((t,e,i)=>{t()})),this._DetachFromSystemCallback=null):this.OnDettachFromSystem();for(let t=0;t<this.ChildViews.length;t++){this.ChildViews[t]._OnDetachFromSystem()}this.ParentView.Element.removeChild(this.Element),this._releaseViewResources()}RegisterDetachCallback(t){t&&(null==this._DetachFromSystemCallback&&(this._DetachFromSystemCallback=[]),this._DetachFromSystemCallback.push(t))}UnregisterDetachCallback(t){if(t&&this._DetachFromSystemCallback){let e=!1,i=this._DetachFromSystemCallback;for(let n=0;n<i.length;n++)if(i[n]===t){i.splice(n,1),e=!0;break}e?0==i.length&&(this._DetachFromSystemCallback=null):console.error("no found")}else console.error("Unregister nothing...")}OnDettachFromSystem(){}_releaseViewResources(){this.Expired||(this.StopAnimation(),this.StopTextureAnimation(),this.Expired=!0)}ClearViews(){const t=this.ChildViews.length;if(0!==t){for(let e=0;e<t;e++){const t=this.ChildViews[e];t&&t.IsChildOfRootView()&&t._OnDetachFromSystem()}this.ChildViews=[]}}_ResetTextStyle(t){this.Element.style.overflow="hidden";let e=_.sTextStyleCache.GetDsFromId(t.Set.IDS.DS).Describe,i=_.sTextStyleCache.GetFsFromId(t.Set.IDS.FS).Describe,n=_.sTextStyleCache.GetCsFromId(t.Set.IDS.CS).Describe,s=null;"DISABLE"!==t.Set.IDS.SS&&(s=_.sTextStyleCache.GetSsFromId(t.Set.IDS.SS).Describe),this.Element.style.fontFamily=i.font,this.Element.style.fontSize=`${t.Set.FS}px`,i.italic&&(this.Element.style.fontStyle="italic"),i.bold?this.Element.style.fontWeight="bold":this.Element.style.fontWeight="normal",this.Element.style.textAlign=e.alignment,this.Element.style.verticalAlign=e.vertical_area_align,this.Element.style.direction=e.direction;let r=n.text_color;this.Element.style.color=r;let a=n.bg_color;this.Element.style.backgroundColor=a,s&&(s.shadow_blur>0&&(this.Element.style.textShadow=`${s.shadow_offset_x}px ${s.shadow_offset_y}px ${s.shadow_blur}px ${s.shadow_color}`),s.stroke_width>0&&(this.Element.style.WebkitTextStroke=`${s.stroke_width}px ${s.stroke_color}`)),this.Element.style.width=`${t.Set.W}px`,this.Element.style.height=`${t.Set.H}px`;let o=parseInt(this.Element.style.fontSize);if(t.Set.LH&&(this.Element.style.lineHeight=`${t.Set.LH}px`,o=parseInt(this.Element.style.lineHeight)),t.Set.EA){let e=t.Set.EA,i=window.originDocument.createElement("div");i.style.float=e.x>0?"right":"left",i.style.width=e.w+"px",i.style.height=e.h-1+"px",i.style.backgroundColor="rgba(0,0,0,0)",i.style.position="relative",this.Element.appendChild(i)}this.Element.style.textOverflow=e.text_overflow,this.Element.style.wordBreak="normal";let l=!1,h=e.word_wrap;if("none"===h?this.Element.style.whiteSpace="nowrap":h&&(this.Element.style.wordWrap=h.replace("_","-"),l=!0),l&&"ellipsis"==this.Element.style.textOverflow&&(this.Element.style.display="-webkit-box",this.Element.style.webkitLineClamp=""+Math.floor(parseInt(this.Element.style.height)/o),this.Element.style.webkitBoxOrient="vertical"),t.Set.LA){const e=et(t.Set.ST);!function(t,e){const i=e.text;for(const n of e.nodeList){if(n.lineFeedNode){t.appendChild(window.originDocument.createElement("br"));continue}const e=i.substring(n.indexPair[0],n.indexPair[1]),s=window.originDocument.createElement("span");let r,a=s;for(const t of n.styleList)switch(t.style){case q.BASE:break;case q.BOLD:r=window.originDocument.createElement("b"),a.appendChild(r),a=r;break;case q.ITALIC:r=window.originDocument.createElement("i"),a.appendChild(r),a=r;break;case q.COLOR:s.style.color=t.styleValue;break;case q.DECORATION:s.style.textDecoration=t.styleValue;break;case q.SUPERSCRIPT:r=window.originDocument.createElement("sup"),a.appendChild(r),a=r;break;case q.SUBSCRIPT:r=window.originDocument.createElement("sub"),a.appendChild(r),a=r}a.textContent=e,t.appendChild(s)}}(this.Element,e)}else{let e=window.originDocument.createElement("span");e.textContent=t.Set.ST,this.Element.appendChild(e)}}_SetBorderRadius(t){(this.InnerChildElement?this.InnerChildElement:this.Element).style.borderRadius=`${t._TopLeft}px ${t._TopRight}px ${t._BottomRight}px ${t._BottomLeft}px`}_InsertProxyLayer(t,e){if(t.ParentView=this,this._IsChildOfRootView){for(let t of this.ChildViews)t._AdvanceDepthForProxyLayer();t._OnAttachToSystem()}t.ChildViews=t.ChildViews.concat(this.ChildViews),t._ChildrenListDirty=!0;for(let e=0;e<t.ChildViews.length;e++)t.ChildViews[e].ParentView=t,t._RequestLayoutForAddingView(t.ChildViews[e]);null!==e?e instanceof _.LayoutParamsBase?t.LayoutParams=e.Clone():t.LayoutParams=new _.LayoutParams(e):null===t.LayoutParams&&(t.LayoutParams=new _.LayoutParams({x:0,y:0})),t.ResetLayoutParams(t.LayoutParams),this.ChildViews=[t],this._ChildrenListDirty=!0,this._RequestLayoutForAddingView(t),this._ProxyView=t,this._IsChildOfRootView&&t._OnAttachToSystem()}_RequestLayoutForAddingView(t){this._RequestLayout()}ResetTexture(t,e){let i=null;if(t&&(i=new _.ExternalTextureSetting(t,e)),this.TextureSetting=i,i){if(i.Texture.Source)"IMG"===this.Element.tagName?this.Element.src=i.Texture.Source:(this.Element.style.backgroundImage=`url(${i.Texture.Source})`,this.Element.style.backgroundSize="100% 100%");else if(i.Texture.Gradient)this.Element.style.backgroundImage=i.Texture.Gradient;else if(i.Texture.RenderTexture&&i.Texture.RenderTexture._SyncingResourceInfo){const t=i.Texture.RenderTexture._SyncingResourceInfo;if("TST"===t.Nam)this._ResetTextStyle(t);else if("CT"===t.Nam)this.Element.style.backgroundColor=t.Set.Clr;else if("VPLY"===t.Nam){const e=t.Set.Hdl;e.style.width="100%",e.style.height="100%",e.style.objectFit="fill",this.Element.appendChild(e),this.InnerChildElement=e}}i.MaskSetting&&"CORNER"===i.MaskSetting._MaskType&&this._SetBorderRadius(i.MaskSetting)}else this.Element.style.backgroundColor="",this.Element.style.backgroundImage="",this.Element.style.borderRadius=""}SetVisibility(t){if("string"==typeof t){let e=t.toLocaleLowerCase();this.Element.style.visibility="visible"==e?"inherit":e}else this.Element.style.visibility="inherit"}_OnAttachToSystem(){"svg"!==this.Element.id&&"path"!==this.Element.id||console.log("_OnAttachToSystem appendChild");let t=this.ParentView.ChildViews[this.ParentView.ChildViews.indexOf(this)+1];t&&this.ParentView.Element.contains(t.Element)?this.ParentView.Element.insertBefore(this.Element,t.Element):this.ParentView.Element.appendChild(this.Element),this._IsChildOfRootView=!0;const e=this.ChildViews;let i;for(let t=0;t<e.length;t++)i=e[t],i._OnAttachToSystem()}IsChildOfRootView(){return this._IsChildOfRootView}StartAnimation(t,e,i){void 0!==this.TransformAnimationObj&&this.TransformAnimationObj&&(this.TransformAnimationObj.Cancel(t),this.TransformAnimationObj=null,window.jsvInAndroidWebView?this.Element.style.webkitAnimation=null:this.Element.style.animation=null),null==this._ProxyView?(this.TransformAnimationObj=t,!isNaN(i)&&i>0&&t.EnableDelay(i),t.Start(this)):this._ProxyView.StartAnimation(t,e,i)}ApplyStyleTransition(t){this.TransitionStore={...this.TransitionStore,...t};let e="";Object.values(this.TransitionStore).forEach((t=>{e&&(e+=","),e+=t})),window.jsvInAndroidWebView?this.Element.style.webkitTransition=e:this.Element.style.transition=e}StopAnimation(){void 0!==this.TransformAnimationObj&&this.TransformAnimationObj&&(this.TransformAnimationObj.Cancel(),this.TransformAnimationObj=null),null==this._ProxyView||this._ProxyView.StopAnimation()}StartTextureAnimation(t){void 0!==this._TextureAnimationObj&&this._TextureAnimationObj&&(this._TextureAnimationObj.Cancel(t),this._TextureAnimationObj=null),this._TextureAnimationObj=t,t.AsTextureAnimation(),t.Start(this),this._RequestLayout()}_RequestLayout(){}StopTextureAnimation(){void 0!==this._TextureAnimationObj&&this._TextureAnimationObj&&(this._TextureAnimationObj.Cancel(),this._TextureAnimationObj=null)}StopAllAnimations(){this.StopAnimation(),this.StopTextureAnimation();for(let t=0;t<this.ChildViews.length;t++)this.ChildViews[t].StopAllAnimations()}GetAnimation(){return this.TransformAnimationObj}DetachAnimation(t){this.TransformAnimationObj===t&&(this.TransformAnimationObj=null,window.jsvInAndroidWebView?(this.Element.style.webkitAnimation=null,this.Element.style.webkitTransition=null):(this.Element.style.animation=null,this.Element.style.transition=null))}ResetCssTransform(t,e){if(t){const e=t.split("translate3d");for(let t=1;t<e.length;t++){let i=!1,n=e[t].replace(/\).*/,"");n=n.replace(/.*\(/,"");const s=n.split(",");for(let t=0;t<s.length;t++){const e=s[t].trim();e.match(/[0-9]$/)&&(s[t]=e+"px",i=!0)}i&&(n=s.join(","),e[t]=e[t].replace(/\(.*?\)/,"("+n+")"))}t=e.join("translate3d")}t===this._CssTransform&&e===this._CssTransformOrigin||(window.jsvInAndroidWebView?(this.Element.style.webkitTransform=t,this.Element.style.webkitTransformOrigin=e):(this.Element.style.transform=t,this.Element.style.transformOrigin=e),this._CssTransform=t,this._CssTransformOrigin=e)}ResetTextureCssTransform(t,e){this.ResetCssTransform(t,e)}SetId(t){this.Id=t}ResetLayoutParams(t){null==this._ProxyView?null!==t?(t instanceof _.LayoutParamsBase?this.LayoutParams=t.Clone():this.LayoutParams=new _.LayoutParams(t),this.Element.style.left=`${this.LayoutParams.MarginLeft}px`,this.Element.style.top=`${this.LayoutParams.MarginTop}px`,this.LayoutParams.Width&&(this.Element.style.width=`${this.LayoutParams.Width}px`),this.LayoutParams.Height&&(this.Element.style.height=`${this.LayoutParams.Height}px`)):_.ThrowError("ResetLayoutParams(): new params is null"):this._ProxyView.ResetLayoutParams(t)}GetRenderer(){return _.LayoutViewBase.sRenderer}GetLayoutParams(){return this.LayoutParams?this.LayoutParams.Clone():new _.LayoutParams}EnableAutoHeight(){this._AutoHeight=!0}WaitTextureToResize(t){}ApplyObjectFit(t,e,i,n,s){if(this._ProxyView)return console.warn("ProxiedView not support ApplyObjectFit"),null;null===this._ObjectFitTestCache&&(this._ObjectFitTestCache={frameWidth:NaN,frameHeight:NaN,textureWidth:NaN,textureHeight:NaN,objectFit:"fill",clipLayout:null});let r=this._ObjectFitTestCache;if(r.frameWidth===t&&r.objectFit===s&&r.frameHeight===e&&r.textureWidth===i&&r.textureHeight===n)return r.clipLayout;r.frameWidth=t,r.frameHeight=e,r.textureWidth=i,r.textureHeight=n,r.objectFit=s;let a={width:0,height:0},o=t/e;const l=i/n;if(!l)return console.warn("Warning:Texture size is 0!"),clip_layout;if(0===t||0===e){if(0===t&&0===e)return clip_layout;0===t?t=e*l:e=t/l,o=t/e}let h="";switch(s){case"fill":a.width=t,a.height=e,h="fill";break;case"none":a.width=i,a.height=n,h="none";break;case"cover":a=this._StretchSize(t,e,l,l<o),h="cover";break;case"scale-down":a=this._StretchSize(t,e,l,l>o),a.width>i&&(a.width=i,a.height=n),h="scale-down";break;case"contain":a=this._StretchSize(t,e,l,l>o),h="contain"}if(a.width=Math.floor(a.width),a.height=Math.floor(a.height),a.width!=t||a.height!=e){let i={};i.width=Math.min(a.width,t),i.height=Math.min(a.height,e),i.x=Math.floor((t-i.width)/2),i.y=Math.floor((e-i.height)/2),r.clipLayout=i;return(this.InnerChildElement?this.InnerChildElement:this.Element).style.objectFit=h,i}return null}_StretchSize(t,e,i,n){const s={width:0,height:0};return n?(s.width=t,s.height=t/i):(s.height=e,s.width=e*i),s}GetPositionOffset(t){let e=this,i=0,n=0;for(;t!==e;)i+=e.LayoutParams?e.LayoutParams.MarginLeft:0,n+=e.LayoutParams?e.LayoutParams.MarginTop:0,e=e.ParentView,e||_.ThrowError("ERROR: Target parent layoutview is not found in LayoutView tree");return new _.Coordinate(i,n)}_dispatchLongPress(){this._LongPressDelayRequestTaskId=0,this._InLongPress=!0;const t={type:_.DragInfo.EVENT_TYPE.OnLongPress,x:this._CurrentDownEvent.designX,y:this._CurrentDownEvent.designY};this.TouchEventProcess(t)}_onMouseDown(t,e,i){this._Velocity.x.reset(),this._Velocity.y.reset(),this._Velocity.x.updatePosition(t),this._Velocity.y.updatePosition(e),this._LastFocusX=t,this._DownFocusX=this._LastFocusX,this._LastFocusY=e,this._DownFocusY=this._LastFocusY,this._CurrentDownEvent={designX:t,designY:e,timeStamp:i},this._AlwaysInTapRegion=!0,this._InLongPress=!1,0!==this._LongPressDelayRequestTaskId&&(clearTimeout(this._LongPressDelayRequestTaskId),this._LongPressDelayRequestTaskId=0),this._LongPressDelayRequestTaskId=setTimeout(this._dispatchLongPress,600);return{type:_.DragInfo.EVENT_TYPE.OnDown,x:t,y:e,deltaX:0,deltaY:0}}_onMouseMove(t,e,i){if(!this._CurrentDownEvent)return null;this._Velocity.x.updatePosition(t),this._Velocity.y.updatePosition(e);const n=parseInt(t-this._LastFocusX,10),s=parseInt(e-this._LastFocusY,10),r=parseInt(t-this._DownFocusX,10),a=parseInt(e-this._DownFocusY,10);let o=null;if(this._AlwaysInTapRegion){r*r+a*a>this._TouchSlopSquare&&(o={type:_.DragInfo.EVENT_TYPE.OnDragStart,x:t,y:e},this._LastFocusX=t,this._LastFocusY=e,this._LastTimeStamp=i,this._AlwaysInTapRegion=!1,this._InLongPress=!1,this._InDragging=!0,0!==this._LongPressDelayRequestTaskId&&(clearTimeout(this._LongPressDelayRequestTaskId),this._LongPressDelayRequestTaskId=0))}else this._InDragging&&(Math.abs(n)>=1||Math.abs(s)>=1)&&(o={type:_.DragInfo.EVENT_TYPE.OnMoved,x:t,y:e,deltaX:r,deltaY:a,_deltaX:n,_deltaY:s,timeStamp:parseInt((this._LastTimeStamp-i)/1e3,10)},this._LastFocusX=t,this._LastFocusY=e,this._LastTimeStamp=i);return o}_onMouseUp(t,e,i){let n=null;if(this._CurrentDownEvent){const i=window.Forge.DesignMap(),s=Math.floor(i.displayScale*i.width),r=window.innerWidth/s,a=this._Velocity.x.getVelocity()/r,o=this._Velocity.y.getVelocity()/r;let l=t-this._CurrentDownEvent.designX,h=e-this._CurrentDownEvent.designY;const c=t-this._LastFocusX,u=e-this._LastFocusY;this._InLongPress||(this._AlwaysInTapRegion?n={type:_.DragInfo.EVENT_TYPE.OnTap,x:t,y:e,velocityX:0,velocityY:0,deltaX:l,deltaY:h,_deltaX:c,_deltaY:u}:(Math.abs(o)>70||Math.abs(a)>70?(l=this._GetSplineFlingDistance(a),h=this._GetSplineFlingDistance(o),n={type:_.DragInfo.EVENT_TYPE.OnFling,x:t,y:e,velocityX:a,velocityY:o,deltaX:a<0?-l:l,deltaY:o<0?-h:h,_deltaX:c,_deltaY:u}):n={type:_.DragInfo.EVENT_TYPE.OnDragEnd,x:t,y:e,deltaX:l,deltaY:h,_deltaX:c,_deltaY:u},this.TouchEventProcess(n),n={type:_.DragInfo.EVENT_TYPE.OnRelease,x:t,y:e,deltaX:l,deltaY:h,_deltaX:c,_deltaY:u},this._CurrentDownEvent=null)),this._InLongPress=!1,0!==this._LongPressDelayRequestTaskId&&(clearTimeout(this._LongPressDelayRequestTaskId),this._LongPressDelayRequestTaskId=0)}return n}_onTouchEvent(t){const e=window.Forge.DesignMap(),i=Math.floor(e.displayScale*e.width),n=window.innerWidth/i,s=t.clientX/n,r=t.clientY/n;let a=null;switch(t.type){case"touchstart":case"mousedown":a=this._onMouseDown(s,r,t.timeStamp);break;case"touchmove":case"mousemove":a=this._onMouseMove(s,r,t.timeStamp);break;case"touchend":case"touchcancel":case"mouseup":a=this._onMouseUp(s,r,t.timeStamp)}return!!a&&this.TouchEventProcess(a)}_AddEventListener(){this.Element.style.pointerEvents="auto",this._ValidTouch=!1;"ontouchstart"in window?(this.Element.addEventListener("touchstart",(t=>{if(console.log("touchstart",t),this._ValidTouch=!0,t.touches&&t.touches.length>0){console.log(`touchstart event.touches[0].clientX:${t.touches[0].clientX}, event.touches[0].clientY:${t.touches[0].clientY}`);this._onTouchEvent({type:t.type,clientX:t.touches[0].clientX,clientY:t.touches[0].clientY,timeStamp:t.timeStamp})&&t.stopPropagation()}}),!0),this.Element.addEventListener("touchmove",(t=>{if(this._ValidTouch&&(console.log("touchmove",t),t.touches&&t.touches.length>0)){console.log(`touchmove event.touches[0].clientX:${t.touches[0].clientX}, event.touches[0].clientY:${t.touches[0].clientY}`);this._onTouchEvent({type:t.type,clientX:t.touches[0].clientX,clientY:t.touches[0].clientY,timeStamp:t.timeStamp})&&t.stopPropagation()}}),!0),this.Element.addEventListener("touchend",(t=>{if(console.log(`touchend event.touches.length:${t.touches.length}, event.clientX:${t.clientX}, event.pageX:${t.pageX}`),this._ValidTouch=!1,t.changedTouches&&t.changedTouches.length>0){console.log(`touchend event.changedTouches[0].clientX:${t.changedTouches[0].clientX}, event.changedTouches[0].pageX:${t.changedTouches[0].pageX}`);this._onTouchEvent({type:t.type,clientX:t.changedTouches[0].clientX,clientY:t.changedTouches[0].clientY,timeStamp:t.timeStamp})&&t.stopPropagation()}}),!0),this.Element.addEventListener("touchcancel",(t=>{if(this._ValidTouch=!1,console.log("touchcancel",t),t.changedTouches&&t.changedTouches.length>0){console.log(`touchcancel event.clientX:${t.clientX}, event.clientY:${t.clientY}`);this._onTouchEvent({type:t.type,clientX:t.touches[0].clientX,clientY:t.touches[0].clientY,timeStamp:t.timeStamp})&&t.stopPropagation()}}),!0)):(this.Element.addEventListener("mousedown",(t=>{console.log("mousedown",t),this._ValidTouch=!0;this._onTouchEvent(t)&&t.stopPropagation()}),!0),this.Element.addEventListener("mousemove",(t=>{if(this._ValidTouch){this._onTouchEvent(t)&&t.stopPropagation()}}),!0),this.Element.addEventListener("mouseup",(t=>{console.log("mouseup",t),this._ValidTouch=!1;this._onTouchEvent(t)&&t.stopPropagation()}),!0))}_GetSplineDeceleration(t){return Math.log(_.DragInfo.INFLEXION*Math.abs(t)/(_.DragInfo.SCROLL_FRICTION*_.DragInfo.PHYSICAL_COEF))}_GetSplineFlingDistance(t){const e=this._GetSplineDeceleration(t),i=_.DragInfo.DECELERATION_RATE-1;return _.DragInfo.SCROLL_FRICTION*_.DragInfo.PHYSICAL_COEF*Math.exp(_.DragInfo.DECELERATION_RATE/i*e)}_DoDragMove(t,e){let i=t._deltaX,n=t._deltaY;this._DragMovedDistanceX+=i,this._DragMovedDistanceY+=n,e||(i=t.deltaX,n=t.deltaY);const s=t.timeStamp/1e3;let r=`left ${s}s, top ${s}s`;this._DragInfo.Settings.DragDirection===_.DragSetting.DIRECTION_VERTICAL?(i=0,r=`top ${s}s`):this._DragInfo.Settings.DragDirection===_.DragSetting.DIRECTION_HORIZONTAL?(n=0,r=`left ${s}s`):this._DragInfo.Settings.DragDirection===_.DragSetting.DIRECTION_DISABLE&&(i=0,n=0);let a=this.GetLayoutParams();return a=this._GetMovedLayoutParams(i,n),e&&(this.Element.style.transition=r,this.ResetLayoutParams(a)),!!((Math.abs(this._DragMovedDistanceX)>=this._DragInfo.Settings.TriggerMovedDistance||Math.abs(this._DragMovedDistanceY)>=this._DragInfo.Settings.TriggerMovedDistance)&&this._DragInfo.Listener&&this._DragInfo.Listener.OnMoved)&&(t.viewX=a.MarginLeft,t.viewY=a.MarginTop,this._DragInfo.Listener.OnMoved(t))}_GetMovedLayoutParams(t,e){const i=this.GetLayoutParams();let n=i.MarginLeft+t,s=i.MarginTop+e;return n>this._DragInfo.Settings.SlidePile.x?n=this._DragInfo.Settings.SlidePile.x:n+i.Width<this._DragInfo.Settings.SlidePile.x+this._DragInfo.Settings.SlidePile.width&&(n=this._DragInfo.Settings.SlidePile.x+this._DragInfo.Settings.SlidePile.width-i.Width),s>this._DragInfo.Settings.SlidePile.y?s=this._DragInfo.Settings.SlidePile.y:s+i.Height<this._DragInfo.Settings.SlidePile.y+this._DragInfo.Settings.SlidePile.height&&(s=this._DragInfo.Settings.SlidePile.y+this._DragInfo.Settings.SlidePile.height-i.Height),i.SetPosition(n,s),i}_SlideIfEnableTabMod(t,e){if(!this._DragInfo.Settings.EnableTabMode)return!1;const i=t._deltaX,n=t._deltaY;let s=t.deltaX,r=t.deltaY,a=this._DragInfo.Settings.PageWidth*this._DragInfo.Settings.PageEdge;const o=this.GetLayoutParams(),l=o.MarginLeft+i,h=o.MarginTop+n;switch(t.type===_.DragInfo.EVENT_TYPE.OnFling&&(a=0),this._DragInfo.Settings.DragDirection){case _.DragSetting.DIRECTION_VERTICAL:if(s=0,r>=0){const t=this._DragInfo.Settings.PageWidth-Math.abs(h)%this._DragInfo.Settings.PageWidth;r=t>=a?this._DragInfo.Settings.PageWidth-t:-t}else{const t=Math.abs(h)%this._DragInfo.Settings.PageWidth;r=t>=a?-(this._DragInfo.Settings.PageWidth-t):t}break;case _.DragSetting.DIRECTION_HORIZONTAL:if(r=0,s>=0){const t=this._DragInfo.Settings.PageWidth-Math.abs(l)%this._DragInfo.Settings.PageWidth;s=t>=a?this._DragInfo.Settings.PageWidth-t:-t,console.log(`right, left_width:${t}, distance_x:${s}`)}else{const t=Math.abs(l)%this._DragInfo.Settings.PageWidth;s=t>=a?-(this._DragInfo.Settings.PageWidth-t):t,console.log(`left, left_width:${t}, distance_x:${s}`)}break;case _.DragSetting.DIRECTION_AUTO:console.log("slideIfEnableTabMode DragDirection error DRAG_DIRECTION_AUTO")}if(0===s&&0===r)return console.log("slideIfEnableTabMode distance_x === 0 && distance_y === 0"),!1;const c=Math.sqrt(s*s+r*r)/.3;return t.deltaX=s,t.deltaY=r,this._DonFlingAnim(t,c),!0}_DoDragEnd(t){let e=t._deltaX,i=t._deltaY;this._DragInfo.Settings.DragDirection===_.DragSetting.DIRECTION_VERTICAL?e=0:this._DragInfo.Settings.DragDirection===_.DragSetting.DIRECTION_HORIZONTAL?i=0:this._DragInfo.Settings.DragDirection===_.DragSetting.DIRECTION_DISABLE&&(e=0,i=0),console.log("_DoDragEnd event:",t,this.Element.style);let n=this.GetLayoutParams();return n=this._GetMovedLayoutParams(e,i),this.ResetLayoutParams(n),t.viewX=n.MarginLeft,t.viewY=n.MarginTop,this._DragInfo.Listener.OnDragEnd(t)}_DragImactSensorRecycle(){console.log("_DragImactSensorRecycle this._DragImactSensor:",this._DragImactSensor),this._DragImactSensor&&this._DragImactSensor.Recycle()}_DonFlingAnim(t,e){const i=t.deltaX,n=t.deltaY,s=this.GetLayoutParams(),r=s.MarginLeft,a=s.MarginTop,o=s.MarginLeft+i,l=s.MarginTop+n,h=this._GetMovedLayoutParams(i,n);if(h.MarginLeft===s.MarginLeft&&h.MarginTop===s.MarginTop)return void console.log("_DonFlingAnim adjust_lp.MarginLeft === lp.MarginLeft && adjust_lp.MarginTop === lp.MarginTop");this.DragControl=new _.DragTranslateControl,this.DragControl._SetView(this),this.DragControl.speed(e),console.log(`OnFling speed:${e}`);const c=this._DragInfo.Settings;this._DragImactSensorRecycle(),this.Element.style.transform=null,this.DragControl.target(s.MarginLeft,s.MarginTop).jumpSilent(),s.SetPosition(0,0),this.ResetLayoutParams(s);let u=0;this.DragControl.target(o,l).start(((e,r)=>{this.DragControl=null,s.SetPosition(e,r),this.ResetLayoutParams(s),this.Element.style.transform=null,this._DragImactSensorRecycle(),t.viewX=e,t.viewY=r,this._DragInfo.Listener.OnFling(t),console.log(`_DonFlingAnim end view_x:${e}, view_y:${r}, distance_x:${i}, distance_y:${n}`)}),(t=>{const e=i*t,s=n*t;if(console.log(`_DonFlingAnim progress:${t}, deltaX:${e}, deltaY:${s}`),Math.abs(e)>this._DragInfo.Settings.TriggerMovedDistance||Math.abs(s)>this._DragInfo.Settings.TriggerMovedDistance){const t={deltaX:r+e,deltaY:a+s,_deltaX:e,_deltaY:s,timeStamp:parseInt((Date.now()-u)/1e3,10)};this._DoDragMove(t,!1),u=Date.now()}}));const d=this.GetPositionOffset(this.ParentView);this._DragImactSensor=new _.DragImpactSensor([{x:c.SlidePile.x+d.x,y:c.SlidePile.y+d.y},{x:c.SlidePile.x+d.x+c.SlidePile.width,y:c.SlidePile.y+d.y},{x:c.SlidePile.x+d.x,y:c.SlidePile.y+d.y+c.SlidePile.height},{x:c.SlidePile.x+d.x+c.SlidePile.width,y:c.SlidePile.y+d.y+c.SlidePile.height}],this.Element,new _.sImpactSensorManager.Callback((e=>{this._DoDragPause(t),this._DragImactSensorRecycle()}),null))}_DoFling(t){let e=t.deltaX,i=t.deltaY,n=!0,s=0;switch(this._DragInfo.Settings.DragDirection){case _.DragSetting.DIRECTION_VERTICAL:e=0,0===i&&(n=!1),s=Math.abs(t.velocityY);break;case _.DragSetting.DIRECTION_HORIZONTAL:i=0,0===e&&(n=!1),s=Math.abs(t.velocityX);break;case _.DragSetting.DIRECTION_DISABLE:n=!1;break;default:s=Math.sqrt(t.velocityX**2,t.velocityY**2)}return n&&(t.deltaX=e,t.deltaY=i,this._DonFlingAnim(t,s)),!0}GetBoundingClientRect(t){this.Element?setTimeout((()=>{let e=this,i=0;for(;e;)e.TransformAnimationObj&&e.TransformAnimationObj.repeatTimes>0&&(i++,e.TransformAnimationObj.AddAnimationListener(new _.AnimationListener(null,(e=>{if(i--,i<=0){const{left:e,top:i,width:n,height:s}=this.Element.getBoundingClientRect();t?.(JSON.stringify({status:0,data:{left:e,top:i,width:n,height:s}}))}})))),e=e.ParentView;if(0==i){const{left:e,top:i,width:n,height:s}=this.Element.getBoundingClientRect();t?.(JSON.stringify({status:0,data:{left:e,top:i,width:n,height:s}}))}}),1):t?.(JSON.stringify({status:-1,error:"BrowserError: dom element is null."}))}}ut.DivId=0,_.LayoutViewBase=ut;class dt extends ut{constructor(t,e){!t||t instanceof _.TextureSetting||_.ThrowError("ERROR:LayoutView need TextureSetting as parameter"),super(t,e=e||"div")}HtmlCanAccessElement(){return!0}HtmlGetElement(){return this.Element}}_.LayoutView=dt,window.LayoutView=_.LayoutView;class gt extends _.LayoutView{constructor(){super(void 0,"root"),this._ViewType=1,this._IsChildOfRootView=!0,window.gRootView=this,_.sRootView=this}Init(t,e,i,n,s){this.InitLayoutViewStaticValues(t),this.ResetLayoutParams({x:0,y:0,width:1280,height:720})}InitLayoutViewStaticValues(t){_.LayoutViewBase.sRenderer=t,_.LayoutViewBase.sInternalTextureManager=t.GetSharedTextureManager(),_.LayoutViewBase.sIdentityMat4=new _.Mat4,_.LayoutViewBase.sNullDirectParentMat4=new _.Mat4,_.LayoutViewBase.sBakeFlipYMat4=(new _.Mat4).rotatex(180)}}_.RootView=gt,window.RootView=_.RootView;class ft{constructor(t,e,i,n,s){this.coordX=t,this.coordY=e,this.width=i,this.height=n,this.useScissors=s,this.maskStencil=null}updateInfo(t,e,i,n,s){this.coordX=t,this.coordY=e,this.width=i,this.height=n,this.useScissors=s}setMaskStencil(t){this.maskStencil=t}}class mt extends _.LayoutView{constructor(t){super(t,"div"),this._ClipRectInfo=null,this.Id="ClipView",this.TextureSetting=null}SetId(t){this.Id=`${t}_ClipView`}SetClipRect(t,e,i,n,s){null===this._ClipRectInfo?this._ClipRectInfo=new ft(t,e,i,n,s):this._ClipRectInfo.updateInfo(t,e,i,n,s);const r=t,a=e,o=this.LayoutParams.Width-r-i,l=this.LayoutParams.Height-a-n;s?(this.Element.style.overflow="hidden",this.Element.style.clipPath=`inset(${a}px ${o}px ${l}px ${r}px)`):(this.Element.style.overflow="visible",this.Element.style.clipPath="unset")}SetWholeSizeScissor(t,e){this.Element.style.overflow=t&&e?"hidden":"visible"}}_.ClipView=mt,window.ClipView=_.ClipView;class pt extends _.LayoutView{constructor(t){super(t,"div"),this._HorizontalRepeats=[0,0,0,0],this._VerticalRepeats=[0,0,0,0],this._HorizontalPadding=[0,0],this._VerticalPadding=[0,0],this._ImageDspWidth=0,this._ImageDspHeight=0}ResetTexture(t,e){let i=null;t&&(i=new _.ExternalTextureSetting(t,e)),this.TextureSetting=i,this._ApplyChanges()}SetRepeat(t,e){_.Assert(t.length<=2),_.Assert(e.length<=2);for(let i=0;i<2;i++)i<t.length?(this._HorizontalRepeats[2*i]=t[i].start,this._HorizontalRepeats[2*i+1]=t[i].width):(this._HorizontalRepeats[2*i]=0,this._HorizontalRepeats[2*i+1]=0),i<e.length?(this._VerticalRepeats[2*i]=e[i].start,this._VerticalRepeats[2*i+1]=e[i].width):(this._VerticalRepeats[2*i]=0,this._VerticalRepeats[2*i+1]=0);return this._ApplyChanges(),this}SetPadding(t,e){return _.Assert(null!==t),_.Assert(null!==e),this._VerticalPadding[0]=e.start,this._VerticalPadding[1]=e.width,this._HorizontalPadding[0]=t.start,this._HorizontalPadding[1]=t.width,this._ApplyChanges(),this}SetImageDspSize(t,e){this._ImageDspWidth=t,this._ImageDspHeight=e}_ApplyChanges(){let t=this.TextureSetting;if(t){if(t.MaskSetting&&"CORNER"===t.MaskSetting._MaskType&&this._SetBorderRadius(t.MaskSetting),t.Texture.Source){const e=t.Texture.RenderTexture.Width,i=t.Texture.RenderTexture.Height,n=e/this._ImageDspWidth,s=i/this._ImageDspHeight,r=this._HorizontalRepeats[0],a=this._ImageDspWidth-this._HorizontalRepeats[1]-r,o=this._VerticalRepeats[0],l=this._ImageDspHeight-this._VerticalRepeats[1]-o;let h=Math.floor(this._HorizontalRepeats[0]*n),c=e-Math.floor(this._HorizontalRepeats[1]*n)-h,u=Math.floor(this._VerticalRepeats[0]*s),d=i-Math.floor(this._VerticalRepeats[1]*s)-u;h+c>=e&&(h-=1,c-=1),u+d>=i&&(u-=1,d-=1);const g=`${u} ${c} ${d} ${h}`;this.Element.style.borderImage=`url(${t.Texture.Source}) ${g} fill`;const f=this._HorizontalPadding[0],m=this._ImageDspWidth-this._HorizontalPadding[1]-f,p=this._VerticalPadding[0],_=this._ImageDspHeight-this._VerticalPadding[1]-p;this.Element.style.borderImageWidth=`${o}px ${a}px ${l}px ${r}px`,this.Element.style.borderImageOutset=`${p}px ${m}px ${_}px ${f}px`}}else this.Element.style.borderRadius="",this.Element.style.borderImage=""}}_.NinePatchView=pt;class _t extends _.LayoutView{constructor(t){let e;e=t.startsWith("jsve-")?t.substr(5):t.substr(3),super(void 0,e)}setAttribute(t,e){this.Element.setAttribute(t,e)}removeAttribute(t){this.Element.removeAttribute(t)}getAttribute(t){return this.Element.getAttribute(t)}hasAttribute(t){return this.Element.hasAttribute(t)}get textContent(){return this.Element.textContent}set textContent(t){this.Element.textContent=t}}_.JsvElementView=_t;_.VideoView=class extends dt{constructor(t,e){super(e),this._ViewType=8,this.Element=t,this.Id="VideoView"}SetId(t){this.Id=`${t}_VideoView`}ResetLayoutParams(t){null!==t?(t instanceof _.LayoutParamsBase?this.LayoutParams=t.Clone():this.LayoutParams=new _.LayoutParams(t),this.Element.style.left=`${this.LayoutParams.MarginLeft}px`,this.Element.style.top=`${this.LayoutParams.MarginTop}px`,this.LayoutParams.Width&&(this.Element.style.width=`${this.LayoutParams.Width}px`),this.LayoutParams.Height&&(this.Element.style.height=`${this.LayoutParams.Height}px`)):_.ThrowError("ResetLayoutParams(): new params is null")}_OnAttachToSystem(){console.log("Video attach"),super._OnAttachToSystem()}_OnDetachFromSystem(){super._OnDetachFromSystem()}};class Tt extends _.LayoutView{constructor(){super(null,"input"),this._ViewType=5,this._InputType=_.TextInputType.TEXT,this.Id="EditControlView"}_OnAttachToSystem(){super._OnAttachToSystem(),this.Element.style.left="-1920px",this.Element.style.top="-1080px",this.Element.style.width="1px",this.Element.style.height="1px",this.Element.style.pointerEvents="auto",this.Element.addEventListener("keydown",(t=>{t=t||window.event;let e=this.Element.selectionStart;console.log(`keydown cur_offset:${e}`),37===t.keyCode?(--e,e<0&&(e=0),e!==this.Element.selectionStart?(this.OnTextChanged(this.Element.value,e,!0),t.stopPropagation&&t.stopPropagation()):this.Element.blur()):39===t.keyCode?(++e,e>this.Element.value.length&&(e=this.Element.value.length),e!==this.Element.selectionStart?(this.OnTextChanged(this.Element.value,e,!0),t.stopPropagation&&t.stopPropagation()):this.Element.blur()):38===t.keyCode||40===t.keyCode?this.Element.blur():27!==t.keyCode&&1e4!==t.keyCode||this.Element.blur()})),this.Element.onfocus=t=>{console.log("onfocus in"),this.OnStatusChanged(1)},this.Element.onblur=t=>{console.log("onblur in"),this.OnStatusChanged(0)};this.Element.oninput=t=>{if(console.log("oninput:",t),t.target.value.length>0&&t.target.selectionStart>0){const i=t.target.selectionStart-1,n=t.target.selectionStart,s=t.target.value.slice(i,n);e=s,"0".charCodeAt()<=e.charCodeAt()&&e.charCodeAt()<="9".charCodeAt()||this._InputType!==_.TextInputType.NUMBER||(t.target.value=t.target.value.substr(0,i)+t.target.value.substr(n),t.target.selectionStart=i)}var e;const i=t.target.value,n=t.target.selectionStart;this.OnTextChanged(decodeURIComponent(i),n)}}SetId(t){this.Id=`${t}_EditControlView`}showIme(t,e,i){this.Element?t!==_.TextInputType.NONE?(null==i&&(i=e.length>0?e.length:0),i<0?i=0:i>e.length&&(i=e.length>0?e.length:0),this._InputType=t,this.Element.type="text",this.Element.value=e,this.Element.focus(),this.Element.selectionStart=i,this.Element.selectionEnd=i):console.log("showIme input_type error"):console.log("showIme but ele is null!")}hideIme(){this.Element?this.Element.blur():console.log("hideIme, but ele is null!")}updateCursorOffset(t,e){this.Element?(this.Element.selectionStart=e,this.Element.selectionEnd=e,this.Element.value=t):console.log("updateCursorOffset, but ele is null!")}OnTextChanged(t,e,i){console.log(`OnTextChanged value:${t}`)}OnStatusChanged(t){}OnEditAction(t){}}class yt extends _.LayoutView{constructor(t,e=1){super(t),this._ViewType=10,this._FilterType=e,this.Id="FilterView",this._Type=e,e==yt.Type.GRAY_DOWN?this.Element.style.filter="grayscale(100%)":e==yt.Type.WAVE&&console.warn("FilterView: ripple effect has not been implemented on the browser side.")}FilterSwitch(t){this.Element&&this._Type==yt.Type.GRAY_DOWN&&(this.Element.style.filter=t?"grayscale(100%)":"")}SetId(t){this.Id=t+"_FilterView"}AddWaveSourceList(){}AddWaveSourceSingle(){}RemoveSource(){}DispatchCommand(){}}yt.Type={GRAY_DOWN:1,WAVE:2},yt.WAVE={CIRCLE_WAVE:1,RECTANGLE_WAVE:2},_.FilterView=yt;let wt={NONE:0,TEXT:1,PASSWORD:2,TEXT_AREA:3,CONTENT_EDITABLE:4,SEARCH:5,URL:6,EMAIL:7,TELEPHONE:8,NUMBER:9};_.TextInputType=wt,_.EditControlView=Tt;class St{constructor(t){this._Current=new Array(t).fill(0),this._Target=new Array(t).fill(0),this._RepeatStart=new Array(t).fill(0),this._JumpTarget=null,this._Jumping=!1,this._ParameterCount=t,this._StateIndex=0,this._StateLocked=!1,this._StartSwitcher=!1,this._PausedCallback=null,this._EndCallback=null,this._NextEndCallback=null,this._Token=0,this._Repeat=!1,this._OnRepeatCallback=null,this._SpriteView=null,this._AdvanceCallback=null}setRepeat(t,e){return this._Repeat=t,this._OnRepeatCallback=t?e:null,this}start(t,e){this._NextEndCallback=t,this._EndCallback=null,this._AdvanceCallback=e,this._StartSwitcher=!0,this._Jumping=!1,this._StateMachineNext()}pause(t){this._AdvanceCallback=null,null===this._EndCallback&&null===this._NextEndCallback||(this._EndCallback=null,this._NextEndCallback=null),0===this._StateIndex?t&&this._CallbackWithCatch(this._Current,t):(t&&(this._PausedCallback=t),this._StateMachineNext())}jump(){this._JumpTarget=[...this._Target],this._Jumping=!0,this._StartSwitcher=!0,this._StateMachineNext()}jumpSilent(){this._JumpTarget=[...this._Target]}startFpsTesting(){_.sRenderBridge.SetStepFpsSwitch(!0)}stopFpsTesting(){_.sRenderBridge.SetStepFpsSwitch(!1)}_WrapBuildAnimation(t,e,i,n){console.warn("Should Override")}_WrapCallback(t,e){console.warn("Should Override")}_CallbackWithCatch(t,e){try{this._WrapCallback(t,e)}catch(t){console.error("Error:in callback"),console.error(t)}}_StateMachineNext(){this._StateLocked||(0===this._StateIndex?this._StartSwitcher&&(this._StartSwitcher=!1,this._StartAnimation()&&(this._StateIndex=1)):1===this._StateIndex&&this._StopAnimation())}_StartAnimation(){this._EndCallback=this._NextEndCallback,this._NextEndCallback=null;const t=this._JumpTarget?[...this._JumpTarget]:[...this._Current],e=this._Target,i=this._Repeat?[...this._RepeatStart]:null,n=this._WrapBuildAnimation(i,t,e,this._Jumping);if(this._JumpTarget=null,this._Jumping=!1,null===n)return;const s=[...e],r=this,a=(new _.AnimationListener).OnFinalProgress((e=>{r._OnPaused(null!==i?i:t,s,e)})).OnAdvance((t=>{this._AdvanceCallback&&this._AdvanceCallback(t)}));return this._OnRepeatCallback&&a.OnRepeat((t=>{r._OnRepeatCallback&&r._OnRepeatCallback(t)})),n.AddAnimationListener(a),n.Enable(_.AnimationEnable.KeepTransform),this._Repeat&&n.EnableInfinite(),this._SpriteView.StartAnimation(n),!0}_StopAnimation(){this._SpriteView.StopAnimation()}_OnPaused(t,e,i){for(let n=0;n<this._ParameterCount;n++)this._Current[n]=Math.floor((e[n]-t[n])*i+t[n]);this._StateLocked=!0;const n=this._PausedCallback,s=this._EndCallback;this._PausedCallback=null,n&&this._CallbackWithCatch(this._Current,n),s&&1===i&&(this._EndCallback=null,this._CallbackWithCatch(this._Current,s)),this._StateLocked=!1,this._StateIndex=0;this._StateMachineNext()}_SetView(t){this._SpriteView=t}}_.DragTranslateControl=class extends St{constructor(){super(2),this._Mode=0,this._Speed=0,this._VerlocityAcc=0,this._VerlocityInit=0,this._AccAlongX=!0,this._AnimationRef=null,this._AllowFrameStep=!1}allowFrameStepMode(t){return this._AllowFrameStep=t,this}selectMode(t){switch(t){case"UniformMotion":this._Mode=0;break;case"AcceleratedMotion":this._Mode=1,this.setRepeat(!1);break;default:console.error(`Unsupported input=${t}`)}return this}targetX(t){return this._Target[0]=t,this}targetY(t){return this._Target[1]=t,this}target(t,e){return this._Target[0]=t,this._Target[1]=e,this}enableRepeatFrom(t,e,i){if(this._ComfirmMode(0))return this.setRepeat(!0,i),this._RepeatStart[0]=t,this._RepeatStart[1]=e,this}speed(t){if(console.log(`speed, pixel_per_second:${t}`),this._ComfirmMode(0))return this._Speed=t,this}accelerateX(t,e){if(this._ComfirmMode(1))return this._Target[0]=e,this._VerlocityAcc=t,this._VerlocityInit=0,this._AccAlongX=!0,this}accelerateY(t,e){if(this._ComfirmMode(1))return this._Target[1]=e,this._VerlocityAcc=t,this._VerlocityInit=0,this._AccAlongX=!1,this}decelerateX(t,e){if(this._ComfirmMode(1))return this._VerlocityAcc=t,this._VerlocityInit=e,this._AccAlongX=!0,this}decelerateY(t,e){if(this._ComfirmMode(1))return this._VerlocityAcc=t,this._VerlocityInit=e,this._AccAlongX=!1,this}decelerate(t,e,i,n){if(1===this._Mode)return this._VerlocityAcc[0]=t,this._VerlocityAcc[1]=e,this._VerlocityInit[0]=i,this._VerlocityInit[1]=n,this;console.error("Error: mode error")}_ComfirmMode(t){return this._Mode===t||(console.error("Error: mode error"),!1)}_WrapBuildAnimation(t,e,i,n){return n?this._AnimationRef=this._UniformMove(null,e,i,n):0===this._Mode?this._AnimationRef=this._UniformMove(t,e,i,!1):1===this._Mode&&(this._AnimationRef=this._AccelerMove(e,i)),this._AnimationRef}_UniformMove(t,e,i,n){let s=0,r=0,a=0,o=1;const l=e[0],h=e[1],c=i[0],u=i[1];if(null!==t){s=t[0],r=t[1];const e=this._Distance(l,h,c,u),i=this._Distance(s,r,c,u);a=(i-e)/i,n||(o=1e3*i/this._Speed)}else s=l,r=h,a=0,n||(o=1e3*this._Distance(l,h,c,u)/this._Speed);n||0!==o||console.warn("Discard starting request for no distance");let d=null;if(s!==c&&r!==u||n||!this._AllowFrameStep||!window.JsView)d=new _.TranslateAnimation(s,c,r,u,o,null);else{console.log("Using frame translate animation");let t=0,e=0,i=!0;s!==c?(t=s,e=c,i=!0):(t=r,e=u,i=!1),d=new _.TranslateFrameAnimation(t,e,this._Speed,i)}return 0!==a&&(a<0?console.warn("Warning: start position out of repeating range"):d.SetStartPos(a)),d}_AccelerMove(t,e){const i=this._AccAlongX?t[0]:t[1],n=this._VerlocityInit,s=this._VerlocityAcc;let r,a,o,l,h=!0;if(0!==s)return 0===n?(r=this._AccAlongX?e[0]:e[1],a=Math.floor(1e3*Math.sqrt(2*Math.abs(r-i)/s)),h=!0):(a=Math.floor(1e3*Math.abs(n)/s),r=i+Math.floor(5e-4*n*a),h=!1),0===a&&console.warn("no moved..."),this._AccAlongX?(o=r,this._Target[0]=o,l=this._Target[1]):(o=this._Target[0],l=r,this._Target[1]=l),new _.TranslateAnimation(t[0],o,t[1],l,a,h?_.Easing.Circular.In:_.Easing.Circular.Out);console.error("Error: no found acceleration")}_Distance(t,e,i,n){const s=i-t,r=n-e;return Math.sqrt(s*s+r*r)}_WrapCallback(t,e){this._AnimationRef=null,e&&e(t[0],t[1])}};class xt extends _.LayoutView{constructor(){super(),this._ChildTextView=null}PutChildTextView(t){this._ChildTextView=t;const e=t.GetLayoutParams();this.AddView(t,e.MarginLeft,e.MarginTop,e.Width,e.Height)}EnableAutoHeight(){this._ChildTextView.EnableAutoHeight()}}class bt{StringWithFont(t,e,i,n,s,r,a,o,l,h,c){e||(e=bt._sDefaultFontSize),i||(i=bt._sDefaultFont);let u="";!0===a&&(u="italic");let d="";return!0===o&&(d="bold"),n||(n="left"),s||(s="middle"),r||(r=bt._sDefaultFontColor),l||(l=null),c||(c="top"),h||(h=-1),{str:`${t}`,font:i,size:e,italic:u,bold:d,stroke_width:h,alignment:n,vertical_align:s,textColour:r,backgroundColour:bt._sDefaultBackgroundColor,enableBlend:!0,shadow:l,vertical_area_align:c}}TextAttr(t,e){return t||(t="none"),e||(e="none"),{text_overflow:t,word_wrap:e}}GetTextWidth(...t){if(t.length<=1){let e=t[0];return void 0!==window.PlatformUtils?window.PlatformUtils.GetTextWidth(e):e.str.length*e.size+1}{let e=t[0];if(void 0!==window.PlatformUtils){let i={str:e,font:t[1]?t[1]:"黑体",size:t[2],bold:t[3],italic:t[4]};return window.PlatformUtils.GetTextWidth(i)}return e.length*e.size+1}}GetOneLineTextDrawWidth(t,e,i,n,s,r){if(void 0!==window.PlatformUtils){let a=window.PlatformUtils.GetOneLineTextDrawWidth(t,e??"黑体",i,n,s);r.push(...a)}else console.error("GetOneLineTextDrawWidth: window.PlatformUtils undefined.")}GetTextRect(t,e,i,n,s){return void 0!==window.PlatformUtils?window.PlatformUtils.GetTextRect(t,e,i,n,s):{width:e.width,height:e.height}}GetTextInfo(t,e,i,n,s){return void 0!==window.PlatformUtils?window.PlatformUtils.GetTextInfo(t,e,i,n,s):{start:0,end:t.length,width:e.width,height:e.height}}GetCursorOffset(t,e,i,n,s,r,a){return void 0!==window.PlatformUtils?window.PlatformUtils.GetCursorOffset(t,e,i,n,s,r,a):0}GetCursorPosition(t,e,i,n,s,r){return void 0!==window.PlatformUtils?window.PlatformUtils.GetCursorPosition(t,e,i,n,s,r):{x:0,y:0}}BuildTextView(t,e,i,n,s,r,a,o,l,h,c){s.width=isNaN(s.width)?0:s.width,s.height=isNaN(s.height)?0:s.height,r=isNaN(r)?10:r,a=isNaN(a)?0:a;let u=new _.LayoutView;const d=t.GetTextTextureFromStylePack(e,i,!!n,s,r,a,o,l,h,c);if(n&&setTimeout((()=>{n(u.Element.clientWidth,u.Element.clientHeight)})),null===d)return console.error("Error: Build text texture failed!"),null;u.ResetTexture(d),e.length<10?u.SetId("Text-"+e):u.SetId("Text-Long-"+e.length),u.ResetLayoutParams({x:0,y:0,width:s.width,height:s.height});const g=i.DS.Describe;if("middle"===g.vertical_area_align||"bottom"===g.vertical_area_align){const t=new xt;t.PutChildTextView(u),u.Element.style.display="table-cell",u.Element.style.position="static",t.Element.style.display="table",t.Element.style.position="static",u=t}return u}}bt._sDefaultFont="黑体",bt._sDefaultFontSize=30,bt._sDefaultFontColor="#FFFFFF",bt._sDefaultBackgroundColor="rgba(0, 0, 0, 0)",_.TextUtils=bt,_.sTextUtils=new _.TextUtils;class vt{constructor(){this._InnerViews={},this._ViewToken=1}add(t){const e=++this._ViewToken;return this._InnerViews[`${e}`]=t,e}remove(t){this._InnerViews[t]&&delete this._InnerViews[t]}get(t){return this._InnerViews[t]}clear(){this._InnerViews={},this._ViewToken=1}}_.ViewStore=vt;let Et=new vt;_.sViewStore=Et;class It{constructor(t,e){this.view=t,this.layout_params=e}}_.ViewInfo=It;let Ct=0;_.AnimationBase=class{constructor(){this.IdToken=Ct++,this._AttachedGroup=null,this.AnimationListenerObj=null,this._AnimationClose=!1,this._LayoutViewRef=null,this._IsTextureAnim=!1}SetAnimationListener(t){this.AnimationListenerObj=t,this.OnNewListener(t)}AddAnimationListener(t){this.AnimationListenerObj&&t.AddInherit(this.AnimationListenerObj),this.AnimationListenerObj=t,this.OnNewListener(t)}OnNewListener(t){}GetAnimationListener(){return this.AnimationListenerObj}Cancel(t){this._LayoutViewRef&&this._LayoutViewRef.DetachAnimation(this);const e=this.AnimationListenerObj;if(e&&e.OnAnimationEnd&&!this._AnimationClose&&(this._AnimationClose=!0,e.OnAnimationEnd(!1)),this._AttachedGroup){let e=!0;t&&(e=t._AttachedGroup!==this._AttachedGroup),e&&(this._AttachedGroup.CancelFromInternalAnimation(this),this._AttachedGroup=null)}}AttachToGroup(t){null!==this._AttachedGroup&&_.ThrowError("ERROR: In TransformAnimation.AttachToGroup(), animation already attached to other group"),this._AttachedGroup=t}RemoveFromGroup(){this._AttachedGroup=null}AsTextureAnimation(){this._IsTextureAnim=!0}Start(t){this._LayoutViewRef=t}SetCannotDisable(t){}OnStart(){const t=this.AnimationListenerObj;t&&t.OnAnimationStart&&t.OnAnimationStart()}OnEnd(t){this._LayoutViewRef&&!t&&(this._LayoutViewRef.DetachAnimation(this),this._LayoutViewRef=null);const e=this.AnimationListenerObj;e&&e.OnAnimationEnd&&!this._AnimationClose&&(this._AnimationClose=!0,e.OnAnimationEnd(!0))}OnRepeatEvent(){const t=this.AnimationListenerObj;t&&t.OnAnimRepeat&&t.OnAnimRepeat()}OnViewHide(){const t=this.AnimationListenerObj;t&&t.OnViewNoVisible&&t.OnViewNoVisible()}OnFinalProgress(t){const e=this.AnimationListenerObj;e&&e.OnAnimFinal&&e.OnAnimFinal(t)}OnAnimAdvance(t){const e=this.AnimationListenerObj;e&&e.OnAnimAdvance&&e.OnAnimAdvance(t)}};class At{constructor(t,e,i){this.OnAnimationStart=t,this._OnAnimationStart=t,this.OnAnimationEnd=e,this._OnAnimationEnd=e,this.OnViewNoVisible=i,this._OnViewNoVisible=i,this.OnAnimFinal=null,this._OnAnimFinal=null,this.OnAnimRepeat=null,this._OnAnimRepeat=null,this._AttachedGroup=null,this._InheritListener=[],this._OnAnimAdvance=null,this.OnAnimAdvance=null}OnStart(t){return this._OnAnimationStart=t,this.OnAnimationStart=t,this}OnEnd(t){return this._OnAnimationEnd=t,this.OnAnimationEnd=t,this}OnAdvance(t){return this._OnAnimAdvance=t,this.OnAnimAdvance=t,this}OnFinalProgress(t){return this._OnAnimFinal=t,this.OnAnimFinal=t,this}OnRepeat(t){return this._OnAnimRepeat=t,this.OnAnimRepeat=t,this}AddInherit(t){if(t){if(0===this._InheritListener.length){const t=this;this.OnAnimationStart=function(){t._OnAnimationStart&&t._OnAnimationStart();for(let e=0;e<t._InheritListener.length;e++)t._InheritListener[e].OnAnimationStart&&t._InheritListener[e].OnAnimationStart()},this.OnAnimationEnd=function(e){t._OnAnimationEnd&&t._OnAnimationEnd(e);for(let i=0;i<t._InheritListener.length;i++)t._InheritListener[i].OnAnimationEnd&&t._InheritListener[i].OnAnimationEnd(e)},this.OnViewNoVisible=function(){t._OnViewNoVisible&&t._OnViewNoVisible();for(let e=0;e<t._InheritListener.length;e++)t._InheritListener[e].OnViewNoVisible&&t._InheritListener[e].OnViewNoVisible()},this.OnAnimFinal=function(e){t._OnAnimFinal&&t._OnAnimFinal(e);for(let i=0;i<t._InheritListener.length;i++)t._InheritListener[i].OnAnimFinal&&t._InheritListener[i].OnAnimFinal(e)},this.OnAnimRepeat=function(){t._OnAnimRepeat&&t._OnAnimRepeat();for(let e=0;e<t._InheritListener.length;e++)t._InheritListener[e].OnAnimRepeat&&t._InheritListener[e].OnAnimRepeat()},this.OnAnimAdvance=function(){t._OnAnimAdvance&&t._OnAnimAdvance();for(let e=0;e<t._InheritListener.length;e++)t._InheritListener[e].OnAnimAdvance&&t._InheritListener[e].OnAnimAdvance()}}this._InheritListener.push(t)}}}_.AnimationListener=At;class Pt{constructor(t){this._SS=t}insertRule(t){window.jsvInAndroidWebView&&(t=(t=t.replace(/@keyframes/,"@-webkit-keyframes")).replace(/transform/g,"-webkit-transform"));const e=this._SS.cssRules.length;this._SS.insertRule(t,e)}removeRule(t){this.removeMultiRules([t])}hasRule(t){const e=this._SS.cssRules;for(let i=e.length-1;i>=0;i--)if(e[i].name===t)return!0;return!1}removeMultiRules(t){const e=this._SS,i=this._SS.cssRules;for(let n=i.length-1;n>=0;n--)for(const s in t)if(i[n].name===t[s]){t.splice(s,1),e.deleteRule(n);break}}}let Lt=null;function Rt(){return null===Lt&&(Lt=function(t){let e=null;const i=document.styleSheets;if(!i||0===i.length)return console.error("Error: styleSheet empty"),null;if(t){for(let n=0;n<i.length;++n){const s=i[n];if(s.cssRules[0]&&s.cssRules[0].name&&s.cssRules[0].name===t){e=s;break}}if(null===e)return console.error(`Error: no found tag=${t}`),null}else e=i[i.length-1];return new Pt(e)}()),Lt}function kt(t){let e="linear";if(t&&void 0!==t.T)switch(t.T){case _.EasingTypeIn:e="ease-in";break;case _.EasingTypeOut:e="ease-out";break;case _.EasingTypeInOut:e="ease-in-out";break;case _.EasingTypeBezier:e=`cubic-bezier(${t.St.X1},${t.St.Y1},${t.St.X2},${t.St.Y2})`;break;case _.EasingTypeSteps:e=`steps(${t.St.S},${0===t.St.T?"start":"end"})`;case _.EasingTypeBlink:case _.EasingTypeDeceleration:}return e}function Dt(t,e){const i=-1===t.repeatTimes?"infinite":t.repeatTimes;let n="linear";t.easing&&(n=kt(t.easing));return`${e} ${t.duration/1e3}s ${n} ${t.delayedTime/1e3}s ${i}`}const Vt=(t,e,i)=>{t.hasOwnProperty("__jsvHookListeners")||(t.__jsvHookListeners=new Map);const n=t.__jsvHookListeners;n.has(e)&&n.forEach((i=>{t.removeEventListener(e,i),t.__jsvHookListeners.delete(e)})),t.addEventListener(e,i),t.__jsvHookListeners.set(e,i)},Ot=t=>t>=65&&t<=90||t>=97&&t<=122,Mt=t=>t>=48&&t<=57,Ft=t=>{if(!t)return null;let e="",i="",n=[],s=0;for(let r=0;r<t.length;r++){const a=t.charCodeAt(r);if(0===s?(Ot(a)||Mt(a))&&(e+=t[r]):(Mt(a)||46===a||45===a||101===a)&&(i+=t[r]),40===a)s=1,i="",n=[];else{if(41===a)return n.push(parseFloat(i)),{name:e,params:n};44===a&&(n.push(parseFloat(i)),i="")}}return console.error("transform error",t),null};function Gt(t){const e=t.Element.children;let i=null;for(let t=0;t<e.length;t++)if("_AnimateProgressTracer"===e[t].id){i=e[t];break}return null===i&&(i=window.originDocument.createElement("div"),i.id="_AnimateProgressTracer",t.Element.appendChild(i)),i}let Nt=0;class Bt{constructor(t){this._TracerDiv=Gt(t),this._IdToken=Nt++,this._KeyFrameName=null,this._AdvanceTimer=null,this._AdvanceListener=null,this._TracerDiv.hasOwnProperty("_ForgeProgressToken")||(this._TracerDiv._ForgeProgressToken=0),this._OnEndListener=t=>{t.stopPropagation()},Vt(this._TracerDiv,"animationend",this._OnEndListener)}_ClearAdvanceTimer(){null!==this._AdvanceTimer&&(clearInterval(this._AdvanceTimer),this._AdvanceTimer=null)}_NotifyAdvance(){this._ClearAdvanceTimer(),null!==this._AdvanceListener&&(this._AdvanceTimer=setInterval((()=>{const t=this.GetProgress();this._AdvanceListener(t),1===t&&this._ClearAdvanceTimer()}),100))}Start(t,e,i){this._AdvanceListener=i,this._KeyFrameName&&console.error("Error: Asset!! should Stop before start"),this._TracerDiv._ForgeProgressToken=(this._TracerDiv._ForgeProgressToken+1)%2,this._KeyFrameName=this._BuildTraceKeyFrame(e,this._IdToken,this._TracerDiv._ForgeProgressToken),this._TracerDiv.style.animation=Dt(t,this._KeyFrameName),Vt(this._TracerDiv,"animationend",this._OnEndListener),this._NotifyAdvance()}Stop(){const t=this.GetProgress();return this._TracerDiv.style.animation=null,this._KeyFrameName&&(this._RemoveTraceKeyFrame(this._KeyFrameName),this._KeyFrameName=null),this._AdvanceListener&&(this._ClearAdvanceTimer(),this._AdvanceListener(t),this._AdvanceListener=null),t}GetProgress(){const t=window.getComputedStyle(this._TracerDiv);if(0===t.transform.length);else if(t.transform.length>0&&"none"!==t.transform){const e=Ft(t.transform);return null!==e?e.params[4]/1e3:(console.error("Error:internal error"),0)}return 1}_BuildTraceKeyFrame(t,e,i){const n=`_AnimateProgress_${e}_${i}`,s=Rt(),r=`@keyframes ${n}\n {0%{transform:translate3d(${Math.floor(1e3*t)}px,0,0)}\n 100%{transform:translate3d(1000px,0,0)}}`;return s.insertRule(r),n}_RemoveTraceKeyFrame(t){Rt().removeRule(t)}}class Wt{constructor(t,e){this._TracerDiv=Gt(t),this._IdToken=Nt++,this._KeyFrameNameArray=null,this._StepsTotal=e,this._RunAnimList=null,this._TracerDiv.hasOwnProperty("_ForgeProgressToken")||(this._TracerDiv._ForgeProgressToken=0),this._OnEndListener=t=>{t.stopPropagation()},this._TracerDiv.addEventListener("animationend",this._OnEndListener)}Start(t){this._KeyFrameName&&console.error("Error: Asset!! should Stop before start"),this._TracerDiv._ForgeProgressToken=(this._TracerDiv._ForgeProgressToken+1)%2,this._BuildTraceKeyFrameGroup(this._IdToken,this._TracerDiv._ForgeProgressToken),this._RunAnimList=this._ConvertToAnimationStyle(t),this._TracerDiv.style.animation=this._RunAnimList[0]}TriggerNextStep(t){this._TracerDiv.style.animation=this._RunAnimList[t]}Stop(){const t=this.GetProgress();return this._TracerDiv.style.animation=null,null!==this._KeyFrameNameArray&&(this._RemoveTraceKeyFrameGroup(),this._KeyFrameNameArray=null),t}GetProgress(){const t=window.getComputedStyle(this._TracerDiv);if(0===t.transform.length);else if("none"!==t.transform){const e=Ft(t.transform);if(null!==e){return e.params[4]/(100*this._StepsTotal)}return console.error("Error:internal error"),0}return 1}_BuildTraceKeyFrameGroup(t,e){this._KeyFrameNameArray=new Array(this._StepsTotal);const i=Rt();for(let n=0;n<this._KeyFrameNameArray.length;n++){const s=`_AnimateGroupProgress_${t}_${e}_Cnt_${n===this._KeyFrameNameArray.length-1?"finalStep":`${n}`}`,r=`@keyframes ${s}\n {0%{transform:translate3d(${100*n}px,0,0)}\n 100%{transform:translate3d(${100+100*n}px,0,0)}}`;i.insertRule(r),this._KeyFrameNameArray[n]=s}}_RemoveTraceKeyFrameGroup(){const t=Rt();this._KeyFrameNameArray.forEach((e=>{t.removeRule(e)}))}_ConvertToAnimationStyle(t){const e=[];for(let i=0;i<t.length;i++){let n="linear";const s=t[i];s.easing&&(n=kt(s.easing)),e.push(`${this._KeyFrameNameArray[i]} ${s.duration/1e3}s ${n}`)}return e}}let Ht=0;_.AnimationDelegate=class extends _.AnimationBase{constructor(t,e,i){super();let n=null;i&&(n=i.Package()),this.typeName=t,this.duration=e,this.easing=n,this.repeatTimes=1,this.delayedTime=0,this.enableFlags=0,this.enableStartPos=0,this._Progress=null}EnableDelay(t){return this.delayedTime=t,this}SetStartPos(t){this.enableStartPos=t}EnableInfinite(){return this.repeatTimes=-1,this}SetRepeat(t){return this.repeatTimes=t,this}Enable(t){return this._EnableFlagsInner(t),this}OnNewListener(t){let e=0;t.OnAnimFinal&&(e|=_.AnimationEnable.AckFinalProgress),t.OnAnimRepeat&&(e|=_.AnimationEnable.AckRepeat),0!==e&&this._EnableFlagsInner(e)}_EnableFlagsInner(t){-1!==this.enableFlags?this.enableFlags|=t:this.enableFlags=t}_GetCSSKeyframesRule(t){let e=null;const i=document.styleSheets;for(let n=0;n<i.length;++n)if(i[n]&&i[n].cssRules){for(const s in i[n].cssRules)if(i[n].cssRules[s].name===t){e=i[n].cssRules[s];break}if(e)break}return e}CheckCssAnimationFormat(t){const e=this._GetCSSKeyframesRule(t);if(e&&e.cssRules)for(const i in e.cssRules){if(!e.cssRules[i]||!e.cssRules[i].style)continue;if(!e.cssRules[i].style.opacity&&!e.cssRules[i].style.transform)continue;const n=e.cssRules[i].style.transform;n&&(-1!==n.indexOf("rotate(")?console.error(`@keyframe ${t}, only support rotate3d, current transform:${n}`):-1!==n.indexOf("translate(")?console.error(`@keyframe ${t}, only support translate3d, current transform:${n}`):-1!==n.indexOf("scale(")&&console.error(`@keyframe ${t}, only support scale3d, current transform:${n}`))}}},_.KeyFrameAnimation=class extends _.AnimationDelegate{constructor(t,e,i){super(t,e,i),this._KeyFrameNameToRecycle=null,this._TestRepeat=this._TestRepeat.bind(this),this._LatestProgressValue=0;const n=this;this._OnEndEvent=t=>{t.stopPropagation(),n._PerformAnimationEnd(!0)},this._CurrentEndEventFunc=null}Start(t){super.Start(t),t.ResetCssTransform(null,null),t.Element&&(t.Element.style.pointerEvents="auto"),this.enableStartPos>0?this._EnableStarterAnimation():this._EnableCssAnimation(this._BuildKeyFrame(),this._OnEndEvent,0)}Cancel(){super.Cancel(),this._PerformAnimationEnd(!1)}_EnableStarterAnimation(){let t=this._OnEndEvent;if(1!==this.repeatTimes){const e=this;t=t=>{t.stopPropagation(),null!==e._Progress&&e._Progress.Stop(),e.delayedTime=0,e.repeatTimes>0&&(e.repeatTimes-=1),this.OnRepeatEvent(),e._EnableCssAnimation(e._BuildKeyFrame(),e._OnEndEvent,0)}}const e=this.repeatTimes,i=this.duration;this.repeatTimes=1,this.duration*=1-this.enableStartPos,this._EnableCssAnimation(this._BuildStarterKeyFrame(),t,this.enableStartPos),this.repeatTimes=e,this.duration=i}_CreateAnimation(t){const e=Rt();e.removeRule(t.name),e.insertRule(t.keyFrameString)}_EnableCssAnimation(t,e,i){if(null===t)return;t.tmp?null!==t.keyFrameString&&(Rt().insertRule(t.keyFrameString),this._KeyFrameNameToRecycle=t.name):this._CreateAnimation(t);const n=t.name;this.CheckCssAnimationFormat(n);const s=this._LayoutViewRef.Element;0==(this.enableFlags&_.AnimationEnable.AckFinalProgress)&&0==(this.enableFlags&_.AnimationEnable.KeepTransform)&&0==(this.enableFlags&_.AnimationEnable.AckRepeat)||(this._Progress=new Bt(this._LayoutViewRef),this._Progress.Start(this,i,(t=>{this.OnAnimAdvance(t)})),0!=(this.enableFlags&_.AnimationEnable.AckRepeat)&&(this._LatestProgressValue=0,_.sRenderBridge.RegisterPerFrameCallback(this._TestRepeat)));const r=Dt(this,n);window.jsvInAndroidWebView?(s.style.webkitAnimation=r,s.addEventListener("webkitAnimationEnd",e)):(s.style.animation=r,s.addEventListener("animationend",e)),this._CurrentEndEventFunc=e}_PerformAnimationEnd(t){if(null!==this._CurrentEndEventFunc){const t=this._LayoutViewRef.Element,e=this._CurrentEndEventFunc;setTimeout((()=>{window.jsvInAndroidWebView?t.removeEventListener("webkitAnimationEnd",e):t.removeEventListener("animationend",e)}),0),this._CurrentEndEventFunc=null}if(null===this._Progress)return void(t&&this.OnEnd());0!=(this.enableFlags&_.AnimationEnable.AckRepeat)&&_.sRenderBridge.UnregisterPerFrameCallback(this._TestRepeat);let e=this._Progress.Stop();if(t&&(e=1),0!=(this.enableFlags&_.AnimationEnable.KeepTransform)){const t=this._GetFrozenTransform(e);this._LayoutViewRef.ResetCssTransform(t.transform,t.transformOrigin)}t&&this.OnEnd(),0!=(this.enableFlags&_.AnimationEnable.AckFinalProgress)&&window.setTimeout((()=>{this.OnFinalProgress(e)}),0),null!==this._KeyFrameNameToRecycle&&(Rt().removeRule(this._KeyFrameNameToRecycle),this._KeyFrameNameToRecycle=null)}_TestRepeat(){const t=this._Progress.GetProgress();this._LatestProgressValue>t&&this.OnRepeatEvent(),this._LatestProgressValue=t}_BuildStarterKeyFrame(){console.warn("Warning:Should override and return keyframe name")}_BuildKeyFrame(){console.warn("Warning:Should override and return keyframe name")}_GetFrozenTransform(t){console.warn("Warning:Should override and keep view transform by ResetCssTransform()")}};let Yt=class extends _.KeyFrameAnimation{constructor(t,e,i,n,s,r){super("TL",s,r),this.startX=t,this.startY=i,this.endX=e,this.endY=n}_BuildStarterKeyFrame(){if(this.enableStartPos>0){const t=(this.endX-this.startX)*this.enableStartPos+this.startX,e=(this.endY-this.startY)*this.enableStartPos+this.startY,i="_ForgeAnim_TL_"+Ht++;return{name:i,keyFrameString:`@keyframes ${i} {0%{transform:translate3d(${t}px,${e}px,0);}100%{transform:translate3d(${this.endX}px,${this.endY}px,0);}}`}}console.error("Error: no enabled starter position")}_BuildKeyFrame(){const t="_ForgeAnim_TL_"+Ht++;return{name:t,keyFrameString:`@keyframes ${t} {0%{transform:translate3d(${this.startX}px,${this.startY}px,0);}100%{transform:translate3d(${this.endX}px,${this.endY}px,0);}}`,tmp:!0}}_GetFrozenTransform(t){return{transform:`translate3d(${Math.floor((this.endX-this.startX)*t+this.startX)}px,${Math.floor((this.endY-this.startY)*t+this.startY)}px,0)`,transformOrigin:null}}};_.FuncAnimation=class extends _.AnimationDelegate{constructor(t,e,i){super("FC2",e,i),this.formula=t,console.warn("NO implemented")}},_.TranslateAnimation=Yt;let $t=class extends _.AnimationDelegate{constructor(t,e,i,n,s,r){super("RO",s,r),i instanceof _.Vec3||(i=new _.Vec3(i)),n instanceof _.Vec3||(n=new _.Vec3(n)),this.startAngle=t,this.offsetAngle=e,this.anchorVec3=i,this.axisVec3=n,console.warn("NO implemented")}};_.RotateAnimation=$t,_.BasicScaleAnimation=class extends _.AnimationDelegate{constructor(t,e,i,n,s,r,a,o,l,h){super("SC",a,o),console.warn("NO implemented")}};let Ut=class extends _.BasicScaleAnimation{constructor(t,e,i,n,s,r){const a=200;super(t*a,t*a,e*a,e*a,i,n,s,r,200,200)}};_.ScaleAnimation=Ut,_.OpacityAnimation=class extends _.AnimationDelegate{constructor(t,e,i,n){super("OP",i,n),console.warn("NO implemented")}},_.CssKeyframeAnimation=class extends _.KeyFrameAnimation{constructor(t,e,i,n,s){super("CK",e,i),this._keyFramesSet=t}_BuildKeyFrame(){let t=this._keyFramesSet.replaceAll("\n","");if(t.indexOf("@keyframes")<0&&t.indexOf("@-webkit-keyframes")<0)return console.warn("Warning:keyframes array empty"),null;let e=t.split(" ")[1];e.indexOf("{")>=0&&(e=e.substr(0,e.indexOf("{"))),t=t.replaceAll(/([left|top|width|height]:\s+\d+)/g,"$1px");const i=t.split("translate3d");for(let t=1;t<i.length;t++){let e=!1,n=i[t].replace(/\).*/,"");n=n.replace(/.*\(/,"");const s=n.split(",");for(let t=0;t<s.length;t++){const i=s[t].trim();i.match(/[0-9]$/)&&(s[t]=i+"px",e=!0)}e&&(n=s.join(","),i[t]=i[t].replace(/\(.*?\)/,"("+n+")"))}return{name:e,keyFrameString:i.join("translate3d"),tmp:!1}}_GetLastKeyframeTransform(t){let e=t.indexOf("to");if(e<0&&(e=t.indexOf("100%")),e<0)return"";{let i=t.indexOf("transform:",e);return i<0?"":t.substring(i+10,t.indexOf(";",i))}}_GetFrozenTransform(t){let e={transform:"",transformOrigin:null};return 1===t?e={transform:this._GetLastKeyframeTransform(this._keyFramesSet),transformOrigin:null}:console.warn("CssKeyframeAnimation can not get transform whill progress is not 1"),e}},_.CssTransitionAnimation=class extends _.AnimationDelegate{constructor(t){super("CT",null,null),this._transArray=t}Start(t){super.Start(t);const e=this,i=this._transArray,n={};if(0===i.length)return void console.warn("Warning:transition empty");let s="";for(let t=0;t<i.length;t++){let e="linear";const r=i[t];r.tf&&(e=kt(r.tf)),s=`${r.name} ${r.dur/1e3}s ${e} ${r.dly/1e3}s`,n[r.name]=s}t.ApplyStyleTransition(n),s&&(t.Element.addEventListener("transitionend",(t=>{t.stopPropagation(),e.OnEnd(!0)})),t.Element.addEventListener("webkitTransitionEnd",(t=>{t.stopPropagation(),e.OnEnd(!0)})))}},_.KeyFrameGroupAnimation=class extends _.AnimationDelegate{constructor(t){super(t,0,null),this._KeyFrameArray=null,this._LatestProgressValue=0,this._CurrentEndEventFunc=null,this._Progress=null,this._AnimRunList=null,this._AnimationRunIndex=0;const e=this;this._OnEndEvent=t=>{t.stopPropagation(),this._TestFinalKeyFrame(t)?e._PerformAnimationEnd(!0):(this._AnimationRunIndex++,this._LayoutViewRef.Element.style.animation=this._AnimRunList[this._AnimationRunIndex],this._Progress.TriggerNextStep(this._AnimationRunIndex),e._OnSubKeyFrameDone(t))}}Start(t){super.Start(t),t.ResetCssTransform(null,null),t.Element&&(t.Element.style.pointerEvents="auto"),this._EnableCssAnimation(this._BuildKeyFrameGroup(),this._OnEndEvent)}Cancel(){super.Cancel(),this._PerformAnimationEnd(!1)}_EnableCssAnimation(t,e){if(null===t)return;this._KeyFrameArray=new Array(t.length);const i=Rt();for(let e=0;e<t.length;e++){const n=t[e];this.CheckCssAnimationFormat(n.name),this._KeyFrameArray[e]={name:n.name,easing:n.ease.Package(),duration:n.duration,needRecycle:!1},null!==n.keyFrameString&&(i.insertRule(n.keyFrameString),this._KeyFrameArray.needRecycle=!0)}const n=this._LayoutViewRef.Element;0==(this.enableFlags&_.AnimationEnable.AckFinalProgress)&&0==(this.enableFlags&_.AnimationEnable.KeepTransform)||(this._Progress=new Wt(this._LayoutViewRef,this._KeyFrameArray.length),this._Progress.Start(this._KeyFrameArray)),this._AnimRunList=this._ConvertToAnimationStyle(this._KeyFrameArray),this._AnimationRunIndex=0,window.jsvInAndroidWebView?(n.style.webkitAnimation=this._AnimRunList[0],n.addEventListener("webkitAnimationEnd",e)):(n.style.animation=this._AnimRunList[0],n.addEventListener("animationend",e)),this._CurrentEndEventFunc=e}_PerformAnimationEnd(t){if(null!==this._CurrentEndEventFunc){const t=this._LayoutViewRef.Element,e=this._CurrentEndEventFunc;setTimeout((()=>{window.jsvInAndroidWebView?t.removeEventListener("webkitAnimationEnd",e):t.removeEventListener("animationend",e)}),0),this._CurrentEndEventFunc=null}if(null===this._Progress)return void(t&&this.OnEnd());let e=this._Progress.Stop();if(t&&(e=1),0!=(this.enableFlags&_.AnimationEnable.KeepTransform)){const t=this._GetFrozenTransform(e);this._LayoutViewRef.ResetCssTransform(t.transform,t.transformOrigin)}t&&this.OnEnd(),0!=(this.enableFlags&_.AnimationEnable.AckFinalProgress)&&window.setTimeout((()=>{this.OnFinalProgress(e)}),0);const i=Rt();for(const t of this._KeyFrameArray)t.needRecycle&&i.removeRule(t.name);this._KeyFrameArray=null}_ConvertToAnimationStyle(t){const e=[];for(let i=0;i<t.length;i++){let n="linear";const s=t[i];s.easing&&(n=kt(s.easing)),e.push(`${s.name} ${s.duration/1e3}s ${n}`)}return e}_BuildKeyFrameGroup(){console.warn("Warning:Should override and return keyframe name")}_GetFrozenTransform(t){console.warn("Warning:Should override and keep view transform by ResetCssTransform()")}_TestFinalKeyFrame(t){console.warn("Warning:Should override")}_OnSubKeyFrameDone(t){console.warn("Warning:Should override")}};let jt=class extends _.TranslateAnimation{constructor(t,e,i,n,s,r){let a=s,o=r,l=s,h=r;n?(a=t,l=e):(o=t,h=e);super(a,l,o,h,Math.abs(Math.floor((e-t)/i*1e3)),null)}};_.TranslateFrameAnimation=jt;let zt=class extends _.KeyFrameGroupAnimation{constructor(t,e,i,n,s,r,a,o){super("Thr"),this._FromX=t,this._FromY=e,this._XorY=i,this._InitV=n,this._Acc=s,this._To=r,this._HasPole=a,this._PoleCallback=null,this._PolePosition=o,this._IsPositiveMove=this._InitV>0||0===this._InitV&&this._Acc>0}SetPoleCallback(t){this._PoleCallback=t}_MakeTranslateString(t,e,i){return`@keyframes ${t} {0%{transform:translate3d(${e.x.value}px,${e.y.value}px,0);}100%{transform:translate3d(${i.x.value}px,${i.y.value}px,0);}}`}_BuildKeyFrameGroup(){const t=""+Ht++,e=[],i={x:{value:this._FromX},y:{value:this._FromY}},n={x:{value:this._FromX},y:{value:this._FromY}},s=0===this._XorY?i.x:i.y,r=0===this._XorY?n.x:n.y;if(this._HasPole){let a=`_ForgeAnim_Thr_Forw_${t}`;r.value=this._PolePosition;let o=this._MakeTranslateString(a,i,n);e.push({name:a,keyFrameString:o,ease:_.Easing.Circular.Out,duration:Math.floor(-this._InitV/this._Acc*1e3)}),a=`_ForgeAnim_Thr_Backw_${t}`,s.value=this._PolePosition,r.value=this._To,o=this._MakeTranslateString(a,i,n),e.push({name:a,keyFrameString:o,ease:_.Easing.Circular.In,duration:Math.floor(1e3*Math.sqrt(2*(this._To-this._PolePosition)/this._Acc))})}else{const a=`_ForgeAnim_Thr_Forw_${t}`;r.value=this._To;const o=this._MakeTranslateString(a,i,n),l=this._IsPositiveMove?this._InitV:-this._InitV,h=this._IsPositiveMove?this._Acc:-this._Acc,c=this._IsPositiveMove?r.value-s.value:s.value-r.value;e.push({name:a,keyFrameString:o,ease:h>0?_.Easing.Circular.In:_.Easing.Circular.Out,duration:Math.floor((Math.sqrt(l*l+2*h*c)-l)/h*1e3)})}return e}_GetFrozenTransform(t){const e={x:{value:this._FromX},y:{value:this._FromY}};let i=0===this._XorY?e.x.value:e.y.value;const n=0===this._XorY?e.x:e.y;let s=0;i=this._IsPositiveMove?i:-i;const r=this._IsPositiveMove?this._To:-this._To,a=this._IsPositiveMove?this._PolePosition:-this._PolePosition;if(this._HasPole){const e=(2*a-i-r)*t;s=e>a-i?a-(e-(a-i)):i+e}else s=i+(r-i)*t;n.value=Math.floor(this._IsPositiveMove?s:-s);return{transform:`translate3d(${e.x.value}px,${e.y.value}px,0)`,transformOrigin:null}}_TestFinalKeyFrame(t){return this._HasPole?t.animationName.indexOf("_ForgeAnim_Thr_Backw_")>=0:t.animationName.indexOf("_ForgeAnim_Thr_Forw_")>=0}_OnSubKeyFrameDone(t){this._HasPole&&this._PoleCallback&&this._PoleCallback()}};_.ThrowAnimation=zt;let Xt={ReleaseAfterEndCallback:1,KeepTransform:2,AckFinalProgress:4,AckRepeat:8};_.AnimationEnable=Xt,_.AnimFireCommand={AltSpeed:(t,e,i)=>{}};let Kt=0;class Jt extends _.AnimationDelegate{constructor(t,e){super(t,e,null),this._StepsCount=1,this._Running=!1,this._NextStepIndex=0;const i=this;this._OnStepEnd=()=>{i._NextStep()}}SetStepsCount(t){this._StepsCount=t,this._SplitSteps()}Start(t){super.Start(t),window.jsvInAndroidWebView?this._LayoutViewRef.Element.addEventListener("webkitAnimationEnd",this._OnStepEnd):this._LayoutViewRef.Element.addEventListener("animationend",this._OnStepEnd),this._Running=!0,this._NextStep()}Cancel(){this._Running=!1}_NextStep(){null!==this._KeyFrameName&&(Rt().removeRule(this._KeyFrameName),this._KeyFrameName=null);const t=this._NextStepIndex===this._StepsCount;if(!this._Running||t)return void this._PerformAnimationEnd(t);const e=this._CreateOneStepKeyFrame(this._NextStepIndex);this._KeyFrameName=e.name,Rt().insertRule(e.keyFrameString);const i=Dt({repeatTimes:this.repeatTimes,easing:this.easing,delayedTime:0,duration:this.duration/this._StepsCount},this._KeyFrameName),n=this._LayoutViewRef.Element;window.jsvInAndroidWebView?n.style.webkitAnimation=i:n.style.animation=i,this._NextStepIndex++}_PerformAnimationEnd(t){window.jsvInAndroidWebView?this._LayoutViewRef.Element.removeEventListener("webkitAnimationEnd",this._OnStepEnd):this._LayoutViewRef.Element.removeEventListener("animationend",this._OnStepEnd);const e=this._NextStepIndex/this._StepsCount;if(0!=(this.enableFlags&_.AnimationEnable.KeepTransform)){const t=this._GetFrozenTransform(this._NextStepIndex-1);this._LayoutViewRef.ResetCssTransform(t.transform,t.transformOrigin)}t&&this.OnEnd(),window.setTimeout((()=>{this.OnFinalProgress(e)}),0)}_GetFrozenTransform(t){console.warn("Warning:Should override and keep view transform by ResetCssTransform()")}_SplitSteps(){console.warn("Warning: should be override by child class")}_CreateOneStepKeyFrame(t){console.warn("Warning: should be override by child class")}}_.TranslateStepAnimation=class extends Jt{constructor(t,e,i,n,s){super("TL-S",s),this.startX=t,this.startY=i,this.endX=e,this.endY=n,this._StepsArray=null}_SplitSteps(){const t=this._StepsCount,e=(this.endX-this.startX)/t,i=(this.endY-this.startY)/t;this._StepsArray=new Array(t);let n=this.startX,s=this.startY;for(let r=0;r<t-1;r++)n+=e,s+=i,this._StepsArray[r]={targetX:Math.floor(n),targetY:Math.floor(s)};this._StepsArray[t-1]={targetX:this.endX,targetY:this.endY}}_CreateOneStepKeyFrame(t){let e=0,i=0;0===t?(e=this.startX,i=this.startY):(e=this._StepsArray[t-1].targetX,i=this._StepsArray[t-1].targetY);const n=this._StepsArray[t].targetX,s=this._StepsArray[t].targetY,r="_ForgeStepAnim_TL_"+Kt++;return{name:r,keyFrameString:`@keyframes ${r} {\n 0%{transform:translate3d(${e}px,${i}px,0);}\n 100%{transform:translate3d(${n}px,${s}px,0);}}`}}_GetFrozenTransform(t){return{transform:`translate3d(${this._StepsArray[t].targetX}px,${this._StepsArray[t].targetY}px,0)`,transformOrigin:null}}};_.RenderBridge=class{constructor(){this._ScreenInfo={width:160,height:90,x:2/160,y:2/90,perspective:2/160,scaleRatio:1,designedWidth:1280},this._FrameLoopFunc=null,this._CallbacksPerFrame=new Set,this._WillSwapCallbacks=new Map,this._DoWillSwapCallback=this._OnWillSwap.bind(this),this._AfterSwapCallbacks=new Map,this._DoAfterSwapCallback=this._OnAfterSwap.bind(this)}BeginHtmlFrameLoop(){null===this._FrameLoopFunc&&window.requestAnimationFrame&&(this._FrameLoopFunc=this._OnAnimation.bind(this),window.requestAnimationFrame(this._FrameLoopFunc))}_OnAnimation(){let t=!1;if(_.sViewSensorManager.HtmlHasActiveSensor()&&(_.sViewSensorManager.HtmlDoWorkOnFrame(),_.sViewSensorManager.HtmlHasActiveSensor()&&(t=!0)),this._CallbacksPerFrame.size>0){for(const t of this._CallbacksPerFrame)t();this._CallbacksPerFrame.size>0&&(t=!0)}t?window.requestAnimationFrame(this._FrameLoopFunc):this._FrameLoopFunc=null}GetScreenInfo(){return this._ScreenInfo}InitScreenBuffer(t,e){isNaN(t)&&(t=1),isNaN(e)&&(e=1280);const i=e*t,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=t,this._ScreenInfo.designedWidth=e}RequestSwap(){this._OnRequesting||(this._OnRequesting=!0,Promise.resolve().then((()=>{Promise.resolve().then((()=>{Promise.resolve().then((()=>{Promise.resolve().then((()=>{Promise.resolve().then(this._DoRequestSwap.bind(this))}))}))}))})))}SetGlobalConfig(t){}AddWillSwapListener(t,e){this._WillSwapCallbacks.set(t,e)}AddAfterSwapListener(t,e){this._AfterSwapCallbacks.set(t,e)}_DoRequestSwap(){this._WillSwapCallbacks.size>0&&this._WillSwapCallbacks.forEach(this._DoWillSwapCallback),this._AfterSwapCallbacks.size>0&&this._AfterSwapCallbacks.forEach(this._DoAfterSwapCallback),this._OnRequesting=!1,_.sFrameCount.update()}GetSwapCount(){return _.sFrameCount.count}InstantPerformSwap(){this._OnRequesting&&(this._OnRequesting=!1,this._DoRequestSwap(!1))}_OnWillSwap(t){t()}_OnAfterSwap(t){t()}RegisterPerFrameCallback(t){this._CallbacksPerFrame.add(t),this.BeginHtmlFrameLoop()}UnregisterPerFrameCallback(t){this._CallbacksPerFrame.delete(t)}};let qt=new _.RenderBridge;_.sRenderBridge=qt;class Zt{constructor(t,e,i){this._TextureManager=t,this._GL=e,this._Loaded=!1,this._OnLoad=i,this.TextureId=null,this._TextureSource=null}_setGLTexture(){this.TextureId=this._GL.createTexture(),this._GL.activeTexture(this._GL.TEXTURE0),this._GL.bindTexture(this._GL.TEXTURE_2D,this.TextureId),this._GL.texParameteri(this._GL.TEXTURE_2D,this._GL.TEXTURE_WRAP_S,this._GL.CLAMP_TO_EDGE),this._GL.texParameteri(this._GL.TEXTURE_2D,this._GL.TEXTURE_WRAP_T,this._GL.CLAMP_TO_EDGE),this._GL.texParameteri(this._GL.TEXTURE_2D,this._GL.TEXTURE_MIN_FILTER,this._GL.NEAREST),this._GL.texParameteri(this._GL.TEXTURE_2D,this._GL.TEXTURE_MAG_FILTER,this._GL.LINEAR),this._GL.texImage2D(this._GL.TEXTURE_2D,0,this._GL.RGBA,this._GL.RGBA,this._GL.UNSIGNED_BYTE,this._TextureSource)}loaded(){return this._Loaded}recycle(){this._TextureManager.recycle(this._TextureSource)}}Zt.IMAGE=Symbol("Texture.IMAGE"),Zt.COLOR=Symbol("Texture.COLOR");class Qt extends Zt{constructor(t,e,i,n){if(super(t,e,i),n){const t=n.trim();if(0===t.indexOf("http"))this.Url=t;else if(0===t.indexOf("url")){const e=t.indexOf("("),i=t.indexOf(")");this.Url=t.substring(e+1,i)}else this.Url=n;this._TextureSource=new Image,this._TextureSource.onload=()=>{this._setGLTexture(),this._Loaded=!0,this._OnLoad&&this._OnLoad()},this._TextureSource.src=this.Url}}}class te{constructor(){this._Canvas=window.originDocument.createElement("canvas"),this._Canvas.setAttribute("width","1px"),this._Canvas.setAttribute("height","1px"),this._Canvas.setAttribute("style","position: absolute; pointer-events: none;"),document.body.appendChild(this._Canvas),this._GL=this._Canvas.getContext("2d")}getColorImageData(t,e,i,n){const s=this._GL.createImageData(1,1);return s.data[0]=t,s.data[1]=e,s.data[2]=i,s.data[3]=n,s}}let ee=null;class ie extends Zt{constructor(t,e,i,n){super(t,e,i),null===ee&&(ee=new te),this.Color=n;const s=(t=>{if(!t)return null;if(0===(t=t.trim()).indexOf("rgba")){const e=t.indexOf("("),i=t.indexOf(")");return t.substr(e+1,i-e-1).split(",").map(((t,e)=>3===e?Math.ceil(255*parseFloat(t)):parseInt(t,10)))}if(0===t.indexOf("#")){let e=t.substr(1);const i=e.length;if(6===i||8===i){6===i&&(e+="FF");const t=parseInt(`0x${e}`,10);return[t>>24&255,t>>16&255,t>>8&255,255&t]}return null}return null})(this.Color);this._TextureSource=ee.getColorImageData(...s),this._setGLTexture(),this._Loaded=!0,this._OnLoad&&this._OnLoad()}}const ne=new class{constructor(){this._TextureMap={}}getTexture(t,e,i,n){let s;if(this._TextureMap[n])s=this._TextureMap[n].texture,this._TextureMap[n].useCount++;else{switch(t){case Zt.IMAGE:s=new Qt(this,e,i,n);break;case Zt.COLOR:s=new ie(this,e,i,n);break;default:console.log(`getTexture type is error:${t}`)}this._TextureMap[n]={texture:s,useCount:1}}return s}recycle(t){this._TextureMap[t]&&(this._TextureMap[t].useCount--,this._TextureMap[t].useCount<0&&delete this._TextureMap[t])}},se=(t,e)=>Math.random()*(e-t)+t;class re{constructor(t,e,i,n,s){this._ViewId=t,this._Type=e.type,this._ParticleNum=e.particleNum,this._DeltaAngle=e.deltaAngle/180*Math.PI,this._DeltaWidthFact=e.deltaWidth/n.width,this._DeltaHeightFact=e.deltaHeight/n.height,this._PointSizeMin=e.pointSizeMin,this._PointSizeMax=e.pointSizeMax,this._SpeedMin=e.speedMin,this._SpeedMax=e.speedMax,this._LifeMin=e.lifeMin/1e3,this._LifeMax=e.lifeMax/1e3,this._AddNumSpeed=e.addNumSpeed,this._AcceletateX=e.accelerateX,this._AcceletateY=e.accelerateY,this._EnableFade=e.enableFade,this._EnableShrink=e.enableShrink,this._AngularVelocityMin=0,this._AngularVelocityMax=0,"number"==typeof e.angularVelocityMin&&"number"==typeof e.angularVelocityMax&&(this._AngularVelocityMin=e.angularVelocityMin,this._AngularVelocityMax=e.angularVelocityMax),this._AlphaMin=1,this._AlphaMax=1,"number"==typeof e.alphaMin&&"number"==typeof e.alphaMax&&(this._AlphaMin=e.alphaMin,this._AlphaMax=e.alphaMax),this._Texture=i,this._Buffer=new Float32Array(9*this._ParticleNum),this._AddedParticleNum=0,this._DomProxyView=s,this._StartTime=-1,this._LastFrameTime=-1,this._Stopped=!1,this._getTransform=this._getTransform.bind(this)}_getTransform(){let t=this._DomProxyView.HtmlGetElement();const e=le(t.style.width),i=le(t.style.height);let n=new window.WebKitCSSMatrix;for(;t.parentNode;){const e=getComputedStyle(t);if(e.transform){const i=e.transformOrigin?e.transformOrigin:e.webkitTransformOrigin;if(i){const s=le(i),r=new window.WebKitCSSMatrix(`translate(-${s[0]}px,-${s[1]}px)`),a=new window.WebKitCSSMatrix(`translate(${s[0]}px,${s[1]}px)`),o=new window.WebKitCSSMatrix(`translate(${t.offsetLeft}px,${t.offsetTop}px)`),l=new window.WebKitCSSMatrix(e.transform);n=o.multiply(a.multiply(l.multiply(r.multiply(n))))}else n=new window.WebKitCSSMatrix(e.transform).multiply(n)}t=t.parentNode}const s=new window.WebKitCSSMatrix;s.m11=0,s.m12=0,s.m14=1,s.m21=e,s.m22=0,s.m24=1,s.m31=0,s.m32=i,s.m34=1,s.m41=e,s.m42=i,s.m44=1,n=n.multiply(s);return[n.m11,n.m12,n.m21,n.m22,n.m31,n.m32,n.m41,n.m42]}_updateParticleInfo(t,e,i,n,s,r){const a=se(0,2*this._DeltaWidthFact),o=se(0,2*this._DeltaHeightFact);this._Buffer[9*t]=a*i[0]+o*n[0]+e[0],this._Buffer[9*t+1]=a*i[1]+o*n[1]+e[1],this._Buffer[9*t+2]=s+se(-this._DeltaAngle,this._DeltaAngle),this._Buffer[9*t+3]=se(this._SpeedMin,this._SpeedMax),this._Buffer[9*t+4]=r,this._Buffer[9*t+5]=se(this._LifeMin,this._LifeMax),this._Buffer[9*t+6]=se(this._PointSizeMin,this._PointSizeMax),this._Buffer[9*t+7]=se(this._AngularVelocityMin,this._AngularVelocityMax),this._Buffer[9*t+8]=se(this._AlphaMin,this._AlphaMax)}onDrawFrame(t,e,i){if(!this._DomProxyView||!this._DomProxyView.HtmlCanAccessElement())return;if(!this._Texture.loaded()||this._Stopped)return;this._StartTime<0&&(this._StartTime=Date.now()),this._LastFrameTime<0&&(this._LastFrameTime=this._StartTime);const n=this._getTransform();for(let t=0;t<n.length;t++)n[t]=t%2==0?2*n[t]/window.innerWidth-1:1-2*n[t]/window.innerHeight;const s=(Date.now()-this._StartTime)/1e3,r=[n[0],n[1]],a=[n[2]-n[0],n[3]-n[1]],o=[n[4]-n[0],n[5]-n[1]],l=Math.sqrt(a[0]*a[0]+a[1]*a[1]),h=-a[1]/l,c=a[0]/l>0?Math.acos(h):2*Math.PI-Math.acos(h);if(0===this._Type)if(this._AddedParticleNum<this._ParticleNum){for(let t=0;t<this._ParticleNum;t++)this._updateParticleInfo(t,r,a,o,c,s);this._AddedParticleNum=this._ParticleNum}else{let t=!0;for(let e=0;e<this._ParticleNum;e++)if(this._Buffer[9*e+4]+this._Buffer[9*e+5]>s){t=!1;break}t&&(this._Stopped=!0)}else if(this._AddedParticleNum<this._ParticleNum){let t=Math.round((Date.now()-this._LastFrameTime)*this._AddNumSpeed);this._AddedParticleNum+t>this._ParticleNum&&(t=this._ParticleNum-this._AddedParticleNum);for(let e=0;e<t;e++)this._updateParticleInfo(this._AddedParticleNum+e,r,a,o,c,s);this._AddedParticleNum+=t}else for(let t=0;t<this._ParticleNum;t++)this._Buffer[9*t+4]+this._Buffer[9*t+5]<s&&this._updateParticleInfo(t,r,a,o,c,s);const u=t.getUniformLocation(e,"uTime");t.uniform1f(u,s);const d=t.getUniformLocation(e,"uAccelerate");t.uniform2f(d,this._AcceletateX,this._AcceletateY);const g=t.getUniformLocation(e,"uEnableFade");t.uniform1i(g,this._EnableFade?1:0);const f=t.getUniformLocation(e,"uEnableShrink");t.uniform1i(f,this._EnableShrink?1:0),t.bindBuffer(t.ARRAY_BUFFER,i),t.activeTexture(t.TEXTURE0),t.bindTexture(t.TEXTURE_2D,this._Texture.TextureId),t.bufferSubData(t.ARRAY_BUFFER,0,this._Buffer);const m=this._Buffer.BYTES_PER_ELEMENT,p=t.getAttribLocation(e,"aPosition");t.vertexAttribPointer(p,2,t.FLOAT,!1,9*m,0),t.enableVertexAttribArray(p);const _=t.getAttribLocation(e,"aSpeed");t.vertexAttribPointer(_,2,t.FLOAT,!1,9*m,2*m),t.enableVertexAttribArray(_);const T=t.getAttribLocation(e,"aLife");t.vertexAttribPointer(T,2,t.FLOAT,!1,9*m,4*m),t.enableVertexAttribArray(T);const y=t.getAttribLocation(e,"aPointSize");t.vertexAttribPointer(y,1,t.FLOAT,!1,9*m,6*m),t.enableVertexAttribArray(y);const w=t.getAttribLocation(e,"aAngularVelocity");t.vertexAttribPointer(w,1,t.FLOAT,!1,9*m,7*m),t.enableVertexAttribArray(w);const S=t.getAttribLocation(e,"aAlpha");t.vertexAttribPointer(S,1,t.FLOAT,!1,9*m,8*m),t.enableVertexAttribArray(S),t.drawArrays(t.POINTS,0,this._AddedParticleNum)}recycle(){this._Buffer=null,this._Texture.recycle(),this._Stopped=!0}}let ae=0;let oe=new class{constructor(){this._Inited=!1,this._Canvas=null,this._GL=null,this._GLProgram=null,this._VBO=null,this._ParticleViewMap={},this._LoopStarted=!1,this._onDrawFrame=this._onDrawFrame.bind(this)}_initCanvas(){if(this._Canvas=window.originDocument.createElement("canvas"),this._Canvas.setAttribute("width",`${window.innerWidth}px`),this._Canvas.setAttribute("height",`${window.innerHeight}px`),this._Canvas.setAttribute("style","position: absolute; pointer-events: none;"),document.body.appendChild(this._Canvas),this._GL=this._Canvas.getContext("webgl"),!this._GL)return void console.error("init webgl failed");console.log("webgl info: ",this._GL.getParameter(this._GL.VERSION),this._GL.getParameter(this._GL.SHADING_LANGUAGE_VERSION),this._GL.getParameter(this._GL.VENDOR));const t=this._GL.createShader(this._GL.VERTEX_SHADER);this._GL.shaderSource(t,"attribute vec2 aPosition;attribute vec2 aSpeed;attribute vec2 aLife;attribute float aPointSize;attribute float aAngularVelocity;attribute float aAlpha;uniform float uTime;uniform vec2 uAccelerate;uniform bool uEnableFade;uniform bool uEnableShrink;varying float vAlpha;varying mat2 vTextureRotate;void main() { float use_time = (uTime - aLife.x) / 10.0; float x = aSpeed.y * cos(aSpeed.x) * use_time + 0.5 * uAccelerate.x * use_time * use_time; float y = aSpeed.y * sin(aSpeed.x) * use_time + 0.5 * uAccelerate.y * use_time * use_time; float percent = (uTime - aLife.x) / aLife.y; percent = percent > 1.0 ? 0.0 : cos(1.57 * percent); vAlpha = aAlpha * (uEnableFade ? percent : 1.0); float angular = aAngularVelocity * use_time; vTextureRotate = mat2(cos(angular), sin(angular), -sin(angular), cos(angular)); gl_PointSize = uEnableShrink ? aPointSize * percent : aPointSize; gl_Position = vec4(x + aPosition.x, y + aPosition.y, 0.0, 1.0);}"),this._GL.compileShader(t);const e=this._GL.createShader(this._GL.FRAGMENT_SHADER);this._GL.shaderSource(e,"precision mediump float;uniform sampler2D uTexture;varying float vAlpha;varying mat2 vTextureRotate;void main(void) { vec2 center = vec2(0.5, 0.5); vec2 rotateCoord = vTextureRotate * (gl_PointCoord - center) + center; vec4 texture = texture2D(uTexture, rotateCoord) * vAlpha; gl_FragColor = texture;}"),this._GL.compileShader(e),this._GLProgram=this._GL.createProgram(),this._GL.attachShader(this._GLProgram,t),this._GL.attachShader(this._GLProgram,e),this._GL.linkProgram(this._GLProgram);const i=new Float32Array(4500),n=i.BYTES_PER_ELEMENT;this._VBO=this._GL.createBuffer(),this._GL.bindBuffer(this._GL.ARRAY_BUFFER,this._VBO),this._GL.bufferData(this._GL.ARRAY_BUFFER,i,this._GL.DYNAMIC_DRAW);const s=this._GL.getAttribLocation(this._GLProgram,"aPosition");this._GL.vertexAttribPointer(s,2,this._GL.FLOAT,!1,9*n,0),this._GL.enableVertexAttribArray(s);const r=this._GL.getAttribLocation(this._GLProgram,"aSpeed");this._GL.vertexAttribPointer(r,2,this._GL.FLOAT,!1,9*n,2*n),this._GL.enableVertexAttribArray(r);const a=this._GL.getAttribLocation(this._GLProgram,"aLife");this._GL.vertexAttribPointer(a,2,this._GL.FLOAT,!1,9*n,4*n),this._GL.enableVertexAttribArray(a);const o=this._GL.getAttribLocation(this._GLProgram,"aPointSize");this._GL.vertexAttribPointer(o,1,this._GL.FLOAT,!1,9*n,6*n),this._GL.enableVertexAttribArray(o);const l=this._GL.getAttribLocation(this._GLProgram,"aAngularVelocity");this._GL.vertexAttribPointer(l,1,this._GL.FLOAT,!1,9*n,7*n),this._GL.enableVertexAttribArray(l);const h=this._GL.getAttribLocation(this._GLProgram,"aAlpha");this._GL.vertexAttribPointer(h,1,this._GL.FLOAT,!1,9*n,8*n),this._GL.enableVertexAttribArray(h),this._GL.useProgram(this._GLProgram);const c=this._GL.getUniformLocation(this._GLProgram,"uTexture");this._GL.uniform1i(c,0),this._GL.enable(this._GL.BLEND),this._GL.enable(this._GL.SAMPLE_ALPHA_TO_COVERAGE),this._GL.blendFunc(this._GL.ONE,this._GL.ONE_MINUS_SRC_ALPHA),this._Inited=!0}_onDrawFrame(){this._GL.clear(this._GL.COLOR_BUFFER_BIT),this._GL.useProgram(this._GLProgram);for(const t in this._ParticleViewMap)this._ParticleViewMap.hasOwnProperty(t)&&this._ParticleViewMap[t].onDrawFrame(this._GL,this._GLProgram,this._VBO);window.requestAnimationFrame(this._onDrawFrame)}addParticle(t,e,i,n){this._Inited||this._initCanvas();const s=ae++;let r;return r=0===e.indexOf("rgba")||0===e.indexOf("#")?ne.getTexture(Zt.COLOR,this._GL,null,e):ne.getTexture(Zt.IMAGE,this._GL,null,e),this._ParticleViewMap[s]=new re(s,t,r,i,n),this._LoopStarted||(this._LoopStarted=!0,window.requestAnimationFrame(this._onDrawFrame)),s}recycleView(t){this._ParticleViewMap[t]&&(this._ParticleViewMap[t].recycle(),delete this._ParticleViewMap[t])}};_.sParticleManager=oe;let le=t=>{if(t.indexOf(" ")>=0){return t.split(" ").map((t=>parseInt(t.substr(0,t.length-2),10)))}return parseInt(t.substr(0,t.length-2),10)};_.ReactUtils={StyleClassMap:{}};{let t=0;class e{constructor(e,i){this._ID=i||e+t++,this.Describe={},this._RefCount=0,this._Recycled=!1}ManualSetId(t){this._ID=t}GetId(){return this._ID}DoRef(){this._RefCount++}UnRef(){this._RefCount>0?this._RefCount--:console.warn("Already 0...")}}class i extends e{constructor(t){super(null,t)}}const n=new i("DISABLE"),s={alignment:"left",vertical_align:"top",vertical_area_align:"top",text_overflow:"clip",word_wrap:"normal",direction:"ltr"},r=["alignment","vertical_align","vertical_area_align","text_overflow","word_wrap","direction"];class a extends e{constructor(t,e,i,n,s,r){super("DS",null),this.Describe.alignment=t,this.Describe.vertical_align=e,this.Describe.vertical_area_align=i,this.Describe.text_overflow=n,this.Describe.word_wrap=s,this.Describe.direction=r}GetSyncData(){return{T:0,ID:this._ID,A:this.Describe.alignment,VA:this.Describe.vertical_align,VAA:this.Describe.vertical_area_align,TO:this.Describe.text_overflow,WW:this.Describe.word_wrap,DIR:this.Describe.direction}}}const o={font:"黑体",italic:!1,bold:!1},l=["font","italic","bold"];class h extends e{constructor(t,e,i){super("FS",null),this.Describe.font=t,this.Describe.italic=e,this.Describe.bold=i}GetSyncData(){return{T:1,ID:this._ID,F:this.Describe.font,I:this.Describe.italic,B:this.Describe.bold}}}const c={text_color:"#000000",bg_color:"#FFFFFF00"},u=["text_color","bg_color"];class d extends e{constructor(t,e){super("CS",null),this.Describe.text_color=t,this.Describe.bg_color=e}GetSyncData(){return{T:2,ID:this._ID,TC:this.Describe.text_color,BC:this.Describe.bg_color}}}const g=["shadow_offset_x","shadow_offset_y","shadow_blur","shadow_color","stroke_width","stroke_color"];class f extends e{constructor(t,e,i,n,s,r){super("SS",null),this.Describe.shadow_offset_x=t,this.Describe.shadow_offset_y=e,this.Describe.shadow_blur=i,this.Describe.shadow_color=n,this.Describe.stroke_width=s,this.Describe.stroke_color=r}GetSyncData(){return{T:3,ID:this._ID,OX:this.Describe.shadow_offset_x,OY:this.Describe.shadow_offset_y,B:this.Describe.shadow_blur,C:this.Describe.shadow_color,SW:this.Describe.stroke_width,SC:this.Describe.stroke_color}}}class m{constructor(t){this.DS=_.sTextStyleCache.GetDisplayStyle(t),this.FS=_.sTextStyleCache.GetFontStyle(t),this.CS=_.sTextStyleCache.GetColorStyle(t),this.SS=_.sTextStyleCache.GetSpecialStyle(t),this._IdsCache=null}DoRef(){this.DS.DoRef(),this.FS.DoRef(),this.CS.DoRef(),this.SS.DoRef()}UnRef(){this.DS.UnRef(),this.FS.UnRef(),this.CS.UnRef(),this.SS.UnRef()}GetIdsPack(){return this._IdsCache||(this._IdsCache={DS:this.DS.GetId(),FS:this.FS.GetId(),CS:this.CS.GetId(),SS:this.SS.GetId()}),this._IdsCache}}class p{constructor(){this._DisplayStyleMap=new Map,this._DisplayStyleIds=new Map,this._FontStyleMap=new Map,this._FontStyleIds=new Map,this._ColorStyleMap=new Map,this._ColorStyleIds=new Map,this._SpecialStyleMap=new Map,this._SpecialStyleIds=new Map,this._NewStyleList=[]}StyleToPack(t){let e={alignment:void 0!==t.hAlign?t.hAlign:s.alignment,vertical_align:void 0!==t.vAlign?t.vAlign:s.vertical_align,vertical_area_align:void 0!==t.vAreaAlign?t.vAreaAlign:s.vertical_area_align,text_overflow:void 0!==t.textOverflow?t.textOverflow:s.text_overflow,word_wrap:void 0!==t.wordWrap?t.wordWrap:s.word_wrap,font:void 0!==t.font?t.font:o.font,italic:void 0!==t.italic?t.italic:o.italic,bold:void 0!==t.bold?t.bold:o.bold,text_color:void 0!==t.textColor?t.textColor:c.text_color,bg_color:void 0!==t.backgroundColor?t.backgroundColor:c.bg_color,direction:void 0!==t.direction?t.direction:"ltr",shadow_offset_x:0,shadow_offset_y:0,shadow_blur:0,shadow_color:null,stroke_width:0,stroke_color:null};if(t.shadow){const i=t.shadow;e.shadow_offset_x=i.shadowOffsetX,e.shadow_offset_y=i.shadowOffsetY,e.shadow_blur=i.shadowBlur,e.shadow_color=i.shadowColor}if(t.stroke){const i=t.stroke;e.stroke_width=i.strokeWidth,e.stroke_color=i.strokeColor}return new m(e)}PrepareSyncNewStyles(){if(this._NewStyleList.length>0){let t=[];for(let e of this._NewStyleList)t.push(e.GetSyncData());_.sRenderTextureDelegateManager.CreateTextureHeadStatus().SetResourceInfo({STA:{Nam:"TST",Sta:t}}),this._NewStyleList=[]}}GetDisplayStyle(t){return this._GetStyle(t,r,a,this._DisplayStyleMap,this._DisplayStyleIds)}GetFontStyle(t){return this._GetStyle(t,l,h,this._FontStyleMap,this._FontStyleIds)}GetColorStyle(t){return this._GetStyle(t,u,d,this._ColorStyleMap,this._ColorStyleIds)}GetSpecialStyle(t){return 0===t.shadow_blur&&0===t.stroke_width?n:this._GetStyle(t,g,f,this._SpecialStyleMap,this._SpecialStyleIds)}GetDsFromId(t){return this._DisplayStyleIds.get(t)}GetFsFromId(t){return this._FontStyleIds.get(t)}GetCsFromId(t){return this._ColorStyleIds.get(t)}GetSsFromId(t){return this._SpecialStyleIds.get(t)}_GetStyle(t,e,i,n,s){let r=[];for(let i of e)r.push(t[i]);let a=r.join(":"),o=null;return n.has(a)?o=n.get(a):(o=new i(...r),n.set(a,o),s.set(o.GetId(),o),window.JsView&&this._NewStyleList.push(o)),o}}_.TextStyleObjectBase=e,_.TextStylePack=m,_.sTextStyleCache=new p}{let t=1,e=2,i=3;class n{constructor(i,n){this.IdToken=_.sViewSensorManager.IdTokenGenerator++,this.Type=i,this.Manager=null,this._OnAnyViewLostList=null,this._AnyViewLostMark=null,this._OnWholeViewLostList=null,this._WholeViewLostMark=null,this._HtmlStatusInfo={target:null==n?t:e}}OnManaged(t){return this._HtmlStatusInfo.target!=i&&(this.Manager?(console.error("manage duplicated"),!1):(this._RegisterViewLostCallbacks(),this.Manager=t,!0))}ResetAutoRecycleViewsRef(t,e){t instanceof Array&&e instanceof Array?this._HtmlStatusInfo.target!=i&&(this._UnregisterViewCallbacks(),this._OnAnyViewLostList=t,this._OnWholdViewLostList=e,this.Manager&&this._RegisterViewLostCallbacks()):console.error("need array ",t,e)}Expired(){return this._HtmlStatusInfo.target==i}Recycle(){this._HtmlStatusInfo.target!=i&&this.Manager&&(this._HtmlStatusInfo.target=i,this.OnSelfRecycle(),this.Manager.RecycleSensor(this),this.Manager=null,this._UnregisterViewCallbacks()),this._OnAnyViewLostList=null,this._OnWholdViewLostList=null}HtmlDoWorkOnFrame(){console.log("Need be override")}HtmlNeedWorkOnFrame(){return!0}OnCallback(t){console.log("Need be override")}OnSelfRecycle(){}_RegisterViewLostCallbacks(){let t=this;if(this._OnAnyViewLostList?.length>0){let e=this._OnAnyViewLostList.length;this._AnyViewLostMark={callbacks:new Array(e).fill(null)};for(let i=0;i<e;i++){let e=this._OnAnyViewLostList[i];if(e.HtmlCanAccessElement()&&e.Expired)this._OnAnyViewLostList[i]=null;else{let n=()=>{t.Recycle()};this._AnyViewLostMark.callbacks[i]=n,e.RegisterDetachCallback(n)}}}else this._AnyViewLostMark=null;if(this._OnWholeViewLostList?.length>0){let e=this._OnWholeViewLostList.length;this._WholeViewLostMark={list:new Array(e).fill({callback:null,lost:!1}),lostCount:0};for(let i=0;i<e;i++){let e=this._OnWholeViewLostList[i];if(e.HtmlCanAccessElement()&&e.Expired)this._OnWholeViewLostList[i]=null,this._WholeViewLostMark.list[i].lost=!0,this._WholeViewLostMark.lostCount++;else{let n=()=>{t._OnViewOfWholeListLost(i)};this._WholeViewLostMark.list[i].callback=n,e.RegisterDetachCallback(n)}}}else this._WholeViewLostMark=null}_UnregisterViewCallbacks(){if(this._AnyViewLostMark){let t=this._OnAnyViewLostList.length;for(let e=0;e<t;e++){this._OnAnyViewLostList[e]&&this._OnAnyViewLostList[e].UnregisterDetachCallback(this._AnyViewLostMark.callbacks[e])}this._AnyViewLostMark=null}if(this._WholeViewLostMark){let t=this._OnWholdViewLostList.length;for(let e=0;e<t;e++){this._OnWholdViewLostList[e]&&this._OnWholdViewLostList[e].UnregisterDetachCallback(this._WholeViewLostMark.list[e].callback)}this._WholeViewLostMark=null}}_OnViewOfWholeListLost(t){this._WholeViewLostMark.list[t].lost||(this._WholeViewLostMark.lostCount++,this._WholeViewLostMark.list[t].lost=!0,this._WholeViewLostMark.list[view_idx].callback=null,this._OnWholdViewLostList[t]=null),this._WholeViewLostMark.lostCount==this._OnWholeViewLostList.length&&this.Recycle()}}n.TypeDefines={TYPE_IMPACT:1,TYPE_FROZE_SET:2,TYPE_ON_SCREEN:3,TYPE_DRAG_IMPACT:101},_.ViewSensor=n}{class t{constructor(){this._SensorMaps={},this.IdTokenGenerator=77}HtmlDoWorkOnFrame(){for(let t in this._SensorMaps){let e=this._SensorMaps[t];e.Expired()?delete this._SensorMaps[t]:e.HtmlDoWorkOnFrame()}}HtmlHasActiveSensor(){for(let t in this._SensorMaps)if(this._SensorMaps[t].HtmlNeedWorkOnFrame())return!0;return!1}AddSensor(t){if(t){t.OnManaged(this)&&(this._SensorMaps[t.IdToken]=t),this.RequestSwap()}}AddToSyncList(t){this._SensorMaps.hasOwnProperty(t.IdToken)||console.error("Error: (Add)No in map",this._SensorMaps,t)}RecycleSensor(t){this._SensorMaps.hasOwnProperty(t.IdToken)?(delete this._SensorMaps[t.IdToken],this.RequestSwap()):console.error("Error: (del)No in map",this._SensorMaps,t)}RequestSwap(){_.sRenderBridge.BeginHtmlFrameLoop()}}_.sViewSensorManager=new t}class he{constructor(t,e,i){this.element=i,this.row=t,this.column=e}toString(){return`[${this.element[0]},${this.element[1]},${this.element[2]},${this.element[3]},${this.element[4]},${this.element[5]},${this.element[6]},${this.element[7]},${this.element[8]},${this.element[9]},${this.element[10]},${this.element[11]},${this.element[12]},${this.element[13]},${this.element[14]},${this.element[15]}]`}multiply(t){if(this.column!==t.row)throw new Error("matrix multiply error");const e=[];for(let i=0;i<this.row;i++)for(let n=0;n<t.column;n++){e[i+n*t.column]=0;for(let s=0;s<this.column;s++)e[i+n*t.column]+=this.element[i+s*this.column]*t.element[s+n*t.column]}return new he(this.row,t.column,e)}static identity(){return new he(4,4,[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])}static translate(t,e,i){return new he(4,4,[1,0,0,0,0,1,0,0,0,0,1,0,t,e,i,1])}static scale(t,e,i){return new he(4,4,[t,0,0,0,0,e,0,0,0,0,i,0,0,0,0,1])}static rotate(t,e,i,n){const s=Math.cos(n/180*Math.PI),r=Math.sin(n/180*Math.PI),a=Math.sqrt(t*t+e*e+i*i);if(1!==a){const n=1/a;t*=n,e*=n,i*=n}const o=1-s,l=t*e,h=e*i,c=i*t,u=t*r,d=e*r,g=i*r,f=[];return f[0]=t*t*o+s,f[1]=l*o+g,f[2]=c*o-d,f[3]=0,f[4]=l*o-g,f[5]=e*e*o+s,f[6]=h*o+u,f[7]=0,f[8]=c*o+d,f[9]=h*o-u,f[10]=i*i*o+s,f[11]=0,f[12]=0,f[13]=0,f[14]=0,f[15]=1,new he(4,4,f)}static skew(t,e){const i=new Array(16).fill(0),n=2*Math.PI*(e/360),s=-2*Math.PI*(t/360);return i[0]=1-s*n,i[1]=-Math.tan(n),i[4]=Math.tan(s),i[5]=1,i[10]=1,i[15]=1,new he(4,4,i)}static transform2d(t,e,i,n,s,r){return new he(4,4,[t,e,0,0,i,n,0,0,0,0,1,0,s,r,0,1])}}const ce=t=>t>=65&&t<=90||t>=97&&t<=122,ue=t=>t>=48&&t<=57,de=(t,e)=>{switch(t){case"translate3d":return he.translate(e[0],e[1],e[2]);case"scale3d":return he.scale(e[0],e[1],e[2]);case"rotate3d":return he.rotate(e[0],e[1],e[2],e[3]);case"skew":return he.skew(e[0],e[1]);case"matrix":return he.transform2d(e[0],e[1],e[2],e[3],e[4],e[5]);case"matrix3d":return new he(4,4,e);default:throw new Error(`no support type ${t}`)}},ge=t=>{let e=he.identity();if(!t)return e;let i="",n="",s=[],r=0;for(let a=0;a<t.length;a++){const o=t.charCodeAt(a);0===r?(ce(o)||ue(o))&&(i+=t[a]):(ue(o)||46===o||45===o||101===o)&&(n+=t[a]),40===o?(r=1,n="",s=[]):41===o?(s.push(parseFloat(n)),e=e.multiply(de(i,s)),i="",r=0):44===o&&(s.push(parseFloat(n)),n="")}return e},fe=t=>{if(t.indexOf(" ")>=0){return t.split(" ").map((t=>parseInt(t.substr(0,t.length-2),10)))}return parseInt(t.substr(0,t.length-2),10)},me=t=>{let e=t;const i=fe(e.style.width),n=fe(e.style.height);let s=he.identity();for(;e.parentNode;){const t=getComputedStyle(e),i=t.transform?t.transform:t.webkitTransform;if(i){const n=t.transformOrigin?t.transformOrigin:t.webkitTransformOrigin,r=ge(i);if(n){const t=fe(n),i=he.translate(-t[0],-t[1],0),a=he.translate(t[0],t[1],0);s=he.translate(e.offsetLeft,e.offsetTop,0).multiply(a.multiply(r.multiply(i.multiply(s))))}else s=r.multiply(s)}e=e.parentNode}const r=new he(4,4,[0,0,0,1,i,0,0,1,0,n,0,1,i,n,0,1]);s=s.multiply(r);const a=s.element;return[a[0],a[1],a[4],a[5],a[8],a[9],a[12],a[13]]};function pe(t){let e=me(t),i=Math.min(e[0],e[2],e[4],e[6]),n=Math.max(e[0],e[2],e[4],e[6]);return[Math.min(e[1],e[3],e[5],e[7]),Math.max(e[1],e[3],e[5],e[7]),i,n]}class _e{constructor(t,e){this.set(t,e)}add(t,e){return t instanceof _e?(this.x+=t.x,this.y+=t.y):(this.x+=t||0,this.y+=e||0),this}angle(t){if(void 0!==t)return this.set(this.length(),0).rotate(t);let e=Math.atan2(this.y,this.x);return e<0&&(e+=2*Math.PI),e}angleDeg(t){return void 0!==t?this.angle(t/180*Math.PI):180*this.angle()/Math.PI}clone(){return new _e(this.x,this.y)}cross(t,e){return t instanceof _e?this.x*t.y-this.y*t.x:this.x*e-this.y*t}distance(t,e){const i=this.distanceSq(t,e);if(void 0!==i)return Math.sqrt(i)}distanceSq(t,e){let i,n;if(t instanceof _e)i=t.x-this.x,n=t.y-this.y;else{if(void 0===e)return;i=t-this.x,n=e-this.y}return i*i+n*n}dot(t,e){return t instanceof _e?this.x*t.x+this.y*t.y:this.x*t+this.y*e}equals(t,e,i){return t instanceof _e?(e=e||0,Math.abs(this.x-t.x)<=e&&Math.abs(this.y-t.y)<=e):void 0!==e&&(i=i||0,Math.abs(this.x-t)<=i&&Math.abs(this.y-e)<=i)}length(){return Math.sqrt(this.lengthSq())}lengthSq(){return this.x*this.x+this.y*this.y}negate(){return this.scale(-1)}normalize(){return this.scale(1/this.length())}rotate(t){const e=Math.cos(t),i=Math.sin(t);return this.set(this.x*e-this.y*i,this.x*i+this.y*e)}rotateDeg(t){return this.rotate(t/180*Math.PI)}scale(t,e){return this.x*=t,this.y*=e||t,this}set(t,e){return t instanceof _e?(this.x=t.x,this.y=t.y):(this.x=t||0,this.y=e||0),this}setPolar(t,e){return this.set(e,0).rotate(t)}setPolarDeg(t,e){return this.setPolar(t/180*Math.PI,e)}sub(t,e){return void 0!==e?(this.x-=t,this.y-=e):(this.x-=t.x,this.y-=t.y),this}toString(){return`(${this.x}, ${this.y})`}}function Te(t,e,i){return i=i||0,Math.abs(t-e)<Math.abs(i)}const ye={isEqual:Te,isZero:(t,e)=>Te(t,0,e),clamp:(t,e,i)=>t>e?t<i?t:i:e},we=ye.isZero,Se=ye.clamp,xe=new _e(0,0),be=1e-4;function ve(t){return"[object Array]"===Object.prototype.toString.call(t)}function Ee(t){if(!ve(t))throw new Error("Polygon must be an array of points");switch(typeof t[0]){case"number":{if(t.length%2!=0)throw new Error("Polygon that contains array of numbers must has even length ([x0, y0, x1, y1, ...., xn, yn])");const e=[];for(let i=0;i<t.length;i+=2)e.push(new _e(t[i],t[i+1]));return e}case"object":return t.map(ve(t[0])?t=>new _e(t[0],t[1]):t=>new _e(t.x,t.y));default:throw new Error("Passed polygon is not an array of 2D coordinates")}}function Ie(t){if(1===t.length)return new _e(t[0]);const e=new _e(0,0);t.forEach((t=>e.add(t))),e.scale(1/t.length);const i=new _e;let n=0;return t.forEach(((s,r)=>{const a=new _e(s),o=new _e(r+1===t.length?t[0]:t[r+1]);a.add(-e.x,-e.y),o.add(-e.x,-e.y);const l=.5*a.cross(o);n+=l,i.add(a.add(o).scale(.3333333333333333).scale(l))})),we(n,be)?i.set(t[0]):i.scale(1/n).add(e)}function Ce(t,e){let i=t[0],n=e.dot(t[0]),s=0;for(let r=1;r<t.length;r++)s=e.dot(t[r]),s>n&&(n=s,i=t[r]);return new _e(i)}function Ae(t,e,i){const n=Ce(t,i),s=Ce(e,i.negate());return new _e(n.sub(s))}function Pe(t,e){const i=new _e(0,0),n=new _e(t).negate(),s=new _e(e).sub(t),r=s.dot(s);if(we(r,be))return i.set(t);let a=n.dot(s)/r;return a=Se(a,0,1),i.set(s.scale(a).add(t))}function Le(t,e){t=Ee(t),e=Ee(e);const i=Ie(t),n=Ie(e).add(i.negate());let s,r,a;s=Ae(t,e,n),r=Ae(t,e,n.negate());for(let i=0;i<30;i++){const i=Pe(s,r);if(we(i.length(),be))return 0;n.set(i.negate().normalize()),a=Ae(t,e,n);const o=a.dot(n),l=s.dot(n);if(we(o-l,be))return o;s.distanceSq(xe)<r.distanceSq(xe)?r=a:s=a}return 0}const Re={intersect:(t,e)=>we(Le(t,e),be),distance:Le};class ke extends _.ViewSensor{constructor(t,e,i,n){super(_.ViewSensor.TypeDefines.TYPE_IMPACT),this._HtmlConfig={view1:t,view2:e,frozeSetId:n?n.IdToken:0,status:{contacted:!1}},this._Callback=i,this._FrozeViewsSet=n,n&&n.DoRef(),this.ResetAutoRecycleViewsRef([t,e],[]),_.sViewSensorManager.AddSensor(this)}HtmlDoWorkOnFrame(){if(!this.Expired()&&this._HtmlConfig.view1&&this._HtmlConfig.view2&&this._HtmlConfig.view1.HtmlCanAccessElement()&&this._HtmlConfig.view1.HtmlCanAccessElement()){(t=this._HtmlConfig.view1.HtmlGetElement(),e=this._HtmlConfig.view2.HtmlGetElement(),Re.intersect(me(t),me(e)))?this._HtmlConfig.status.contacted||(this._HtmlConfig.status.contacted=!0,this.OnCallback(1)):this._HtmlConfig.status.contacted&&(this.OnCallback(2),this._HtmlConfig.status.contacted=!1)}var t,e}OnCallback(t){this._Callback&&(1==t&&this._Callback.OnBeginContact?this._Callback.OnBeginContact():2==t&&this._Callback.OnEndContact&&this._Callback.OnEndContact())}OnSelfRecycle(){this._FrozeViewsSet&&(this._FrozeViewsSet.UnRef(),this._FrozeViewsSet=null),this._HtmlConfig=null}}_.ImpactSensor=ke;class De extends _.ViewSensor{constructor(t,e){super(_.ViewSensor.TypeDefines.TYPE_FROZE_SET),this._PreImpactViewList=null,this._OnImpactViewList=null,this._UpdateAutoRecycleRef(t,!0,e,!0),_.sViewSensorManager.AddSensor(this)}HtmlDoWorkOnFrame(){}HtmlNeedWorkOnFrame(){return!1}UpdatePreImpactList(t){this._UpdateAutoRecycleRef(t,!0,null,!1)}UpdateOnImpactList(t){this._UpdateAutoRecycleRef(null,!1,t,!0)}DoRef(){this.Expired()?console.error("Error: froze set is expired for all bind views lost"):this._RefCount++}UnRef(){this._RefCount>0&&this._RefCount--,0==this._RefCount&&this.Recycle()}OnSelfRecycle(){this._PreImpactViewList=null,this._OnImpactViewList=null}_UpdateAutoRecycleRef(t,e,i,n){e&&(this._PreImpactViewList=t instanceof Array?t:[]),n&&(this._OnImpactViewList=i instanceof Array?i:[]),this.ResetAutoRecycleViewsRef([],[...this._PreImpactViewList,...this._OnImpactViewList])}}class Ve{constructor(t,e){this.Start=t,this.End=e}Merge(t){return this.IsInterAct(t)?(this.Start>t.Start&&(this.Start=t.Start),this.End<t.End&&(this.End=t.End),!0):this.End+1==t.Start?(this.End=t.End,!0):this.Start==t.End+1&&(this.Start=t.Start,!0)}IsInterAct(t){return t.Start<this.Start?!(t.End<this.Start):t.Start<=this.End}IsInclude(t){return this.Start<=t.Start&&this.End>=t.End}Exclude(t){var e={success:!1,newSplitedRange:null};return this.IsInterAct(t)?(t.Start<=this.Start?t.End<this.End?this.Start=t.End+1:this.Clear():(t.End<this.End&&(e.newSplitedRange=new Ve(t.End+1,this.End),e.newSplitedRange=e.newSplitedRange),this.End=t.Start-1),e.success=!0,e.success=e.success,e):e}IsEmpty(){return this.Start>this.End}Clear(){this.End=this.Start-1}Clone(){return new Ve(this.Start,this.End)}}class Oe extends _.ViewSensor{constructor(t,e){super(_.ViewSensor.TypeDefines.TYPE_ON_SCREEN),this._HtmlConfig={view:t,container:null,enable:!1,testRange:null,status:{horizonVisible:!1,verticalVisible:!1}},this._Callback=e,this.ResetAutoRecycleViewsRef([t],[]),_.sViewSensorManager.AddSensor(this)}HtmlDoWorkOnFrame(){if(!this.Expired()&&this._HtmlConfig.enable&&this._HtmlConfig.testRange&&this._HtmlConfig.view&&this._HtmlConfig.view.HtmlCanAccessElement()){let t=_.sRenderBridge.GetScreenInfo().designedWidth,e=Math.floor(9*t/16),i={top:0,bottom:0,left:0,right:0},n=pe(this._HtmlConfig.view.HtmlGetElement());[i.top,i.bottom,i.left,i.right]=n;let s,r,a={top:0,bottom:e,left:0,right:t},o=!0;if(this._HtmlConfig.container&&this._HtmlConfig.container.HtmlCanAccessElement()){let i=pe(this._HtmlConfig.container.HtmlGetElement());[a.top,a.bottom,a.left,a.right]=i,s=new Ve(a.left,a.right),r=new Ve(a.top,a.bottom);let n=new Ve(0,t),l=new Ve(0,e);o=n.IsInterAct(s)&&l.IsInterAct(r)}else s=new Ve(a.left,a.right),r=new Ve(a.top,a.bottom);let l,h,c,u,d=new Ve(i.left,i.right),g=new Ve(i.top,i.bottom),f=this._HtmlConfig.testRange;{let t=Math.floor((i.right-i.left)*f.horizon);l=new Ve(i.left,i.left+t),h=new Ve(i.right-t,i.right)}{let t=Math.floor((i.bottom-i.top)*f.vertical);c=new Ve(i.top,i.top+t),u=new Ve(i.bottom-t,i.bottom)}let m=(s.IsInclude(l)||s.IsInclude(h))&&r.IsInterAct(g)&&o,p=(r.IsInclude(c)||r.IsInclude(u))&&s.IsInterAct(d)&&o;if(m!=this._HtmlConfig.status.horizonVisible||p!=this._HtmlConfig.status.verticalVisible){let t={};t.OH=this._HtmlConfig.status.horizonVisible,t.NH=m,t.OV=this._HtmlConfig.status.verticalVisible,t.NV=p,this._HtmlConfig.status.horizonVisible=m,this._HtmlConfig.status.verticalVisible=p,this.OnCallback(t)}}}HtmlNeedWorkOnFrame(){return this._HtmlConfig.enable}HtmlRequestSync(){_.sRenderBridge.BeginHtmlFrameLoop()}ResetArea(t){"number"!=typeof t.horizon&&(console.log("horizon not set, default to 1.0"),t.horizon=1),"number"!=typeof t.vertical&&(console.log("vertical not set, default to 1.0"),t.vertical=1),this._HtmlConfig.testRange=t,this.HtmlRequestSync()}Enable(t){this._HtmlConfig.enable=t,this.HtmlRequestSync()}ResetContainer(t){this._HtmlConfig.container=t,this.HtmlRequestSync()}OnCallback(t){this._Callback&&this._Callback(t.OH,t.NH,t.OV,t.NV)}OnSelfRecycle(){this._HtmlConfig=null}}function Me(t){if(!t)throw Error("assert :P")}function Fe(t,e,i){for(var n=0;4>n;n++)if(t[e+n]!=i.charCodeAt(n))return!0;return!1}function Ge(t,e,i,n,s){for(var r=0;r<s;r++)t[e+r]=i[n+r]}function Ne(t,e,i,n){for(var s=0;s<n;s++)t[e+s]=i}function Be(t){return new Int32Array(t)}function We(t,e){for(var i=[],n=0;n<t;n++)i.push(new e);return i}function He(t,e){var i=[];return function t(i,n,s){for(var r=s[n],a=0;a<r&&(i.push(s.length>n+1?[]:new e),!(s.length<n+1));a++)t(i[a],n+1,s)}(i,0,t),i}function Ye(t,e){for(var i="",n=0;n<4;n++)i+=String.fromCharCode(t[e++]);return i}function $e(t,e){return(t[e+0]<<0|t[e+1]<<8|t[e+2]<<16)>>>0}function Ue(t,e){return(t[e+0]<<0|t[e+1]<<8|t[e+2]<<16|t[e+3]<<24)>>>0}_.VisibleSensor=Oe,window.WebPDecoder=function(){function t(t,e){for(var i=1<<e-1>>>0;t&i;)i>>>=1;return i?(t&i-1)+i:t}function e(t,e,i,n,s){Me(!(n%i));do{t[e+(n-=i)]=s}while(0<n)}function i(i,s,r,a,o){if(Me(2328>=o),512>=o)var l=Be(512);else if(null==(l=Be(o)))return 0;return function(i,s,r,a,o,l){var h,c,u=s,d=1<<r,g=Be(16),f=Be(16);for(Me(0!=o),Me(null!=a),Me(null!=i),Me(0<r),c=0;c<o;++c){if(15<a[c])return 0;++g[a[c]]}if(g[0]==o)return 0;for(f[1]=0,h=1;15>h;++h){if(g[h]>1<<h)return 0;f[h+1]=f[h]+g[h]}for(c=0;c<o;++c)h=a[c],0<a[c]&&(l[f[h]++]=c);if(1==f[15])return(a=new n).g=0,a.value=l[0],e(i,u,1,d,a),d;var m,p=-1,_=d-1,T=0,y=1,w=1,S=1<<r;for(c=0,h=1,o=2;h<=r;++h,o<<=1){if(y+=w<<=1,0>(w-=g[h]))return 0;for(;0<g[h];--g[h])(a=new n).g=h,a.value=l[c++],e(i,u+T,o,S,a),T=t(T,h)}for(h=r+1,o=2;15>=h;++h,o<<=1){if(y+=w<<=1,0>(w-=g[h]))return 0;for(;0<g[h];--g[h]){if(a=new n,(T&_)!=p){for(u+=S,m=1<<(p=h)-r;15>p&&!(0>=(m-=g[p]));)++p,m<<=1;d+=S=1<<(m=p-r),i[s+(p=T&_)].g=m+r,i[s+p].value=u-s-p}a.g=h-r,a.value=l[c++],e(i,u+(T>>r),o,S,a),T=t(T,h)}}return y!=2*f[15]-1?0:d}(i,s,r,a,o,l)}function n(){this.value=this.g=0}function s(){this.value=this.g=0}function r(){this.G=We(5,n),this.H=Be(5),this.jc=this.Qb=this.qb=this.nd=0,this.pd=We(Fi,s)}function a(t,e,i,n){Me(null!=t),Me(null!=e),Me(2147483648>n),t.Ca=254,t.I=0,t.b=-8,t.Ka=0,t.oa=e,t.pa=i,t.Jd=e,t.Yc=i+n,t.Zc=4<=n?i+n-4+1:i,T(t)}function o(t,e){for(var i=0;0<e--;)i|=w(t,128)<<e;return i}function l(t,e){var i=o(t,e);return y(t)?-i:i}function h(t,e,i,n){var s,r=0;for(Me(null!=t),Me(null!=e),Me(4294967288>n),t.Sb=n,t.Ra=0,t.u=0,t.h=0,4<n&&(n=4),s=0;s<n;++s)r+=e[i+s]<<8*s;t.Ra=r,t.bb=n,t.oa=e,t.pa=i}function c(t){for(;8<=t.u&&t.bb<t.Sb;)t.Ra>>>=8,t.Ra+=t.oa[t.pa+t.bb]<<Bi-8>>>0,++t.bb,t.u-=8;m(t)&&(t.h=1,t.u=0)}function u(t,e){if(Me(0<=e),!t.h&&e<=Ni){var i=f(t)&Gi[e];return t.u+=e,c(t),i}return t.h=1,t.u=0}function d(){this.b=this.Ca=this.I=0,this.oa=[],this.pa=0,this.Jd=[],this.Yc=0,this.Zc=[],this.Ka=0}function g(){this.Ra=0,this.oa=[],this.h=this.u=this.bb=this.Sb=this.pa=0}function f(t){return t.Ra>>>(t.u&Bi-1)>>>0}function m(t){return Me(t.bb<=t.Sb),t.h||t.bb==t.Sb&&t.u>Bi}function p(t,e){t.u=e,t.h=m(t)}function _(t){t.u>=Wi&&(Me(t.u>=Wi),c(t))}function T(t){Me(null!=t&&null!=t.oa),t.pa<t.Zc?(t.I=(t.oa[t.pa++]|t.I<<8)>>>0,t.b+=8):(Me(null!=t&&null!=t.oa),t.pa<t.Yc?(t.b+=8,t.I=t.oa[t.pa++]|t.I<<8):t.Ka?t.b=0:(t.I<<=8,t.b+=8,t.Ka=1))}function y(t){return o(t,1)}function w(t,e){var i=t.Ca;0>t.b&&T(t);var n=t.b,s=i*e>>>8,r=(t.I>>>n>s)+0;for(r?(i-=s,t.I-=s+1<<n>>>0):i=s+1,n=i,s=0;256<=n;)s+=8,n>>=8;return n=7^s+Hi[n],t.b-=n,t.Ca=(i<<n)-1,r}function S(t,e,i){t[e+0]=i>>24&255,t[e+1]=i>>16&255,t[e+2]=i>>8&255,t[e+3]=i>>0&255}function x(t,e){return t[e+0]<<0|t[e+1]<<8}function b(t,e){return x(t,e)|t[e+2]<<16}function v(t,e){return x(t,e)|x(t,e+2)<<16}function E(t,e){var i=1<<e;return Me(null!=t),Me(0<e),t.X=Be(i),null==t.X?0:(t.Mb=32-e,t.Xa=e,1)}function I(t,e){Me(null!=t),Me(null!=e),Me(t.Xa==e.Xa),Ge(e.X,0,t.X,0,1<<e.Xa)}function C(){this.X=[],this.Xa=this.Mb=0}function A(t,e,i,n){Me(null!=i),Me(null!=n);var s=i[0],r=n[0];return 0==s&&(s=(t*r+e/2)/e),0==r&&(r=(e*s+t/2)/t),0>=s||0>=r?0:(i[0]=s,n[0]=r,1)}function P(t,e){return t+(1<<e)-1>>>e}function L(t,e){return((4278255360&t)+(4278255360&e)>>>0&4278255360)+((16711935&t)+(16711935&e)>>>0&16711935)>>>0}function R(t,e){self[e]=function(e,i,n,s,r,a,o){var l;for(l=0;l<r;++l){var h=self[t](a[o+l-1],n,s+l);a[o+l]=L(e[i+l],h)}}}function k(){this.ud=this.hd=this.jd=0}function D(t,e){return((4278124286&(t^e))>>>1)+(t&e)>>>0}function V(t){return 0<=t&&256>t?t:0>t?0:255<t?255:void 0}function O(t,e){return V(t+(t-e+.5>>1))}function M(t,e,i){return Math.abs(e-i)-Math.abs(t-i)}function F(t,e,i,n,s,r,a){for(n=r[a-1],i=0;i<s;++i)r[a+i]=n=L(t[e+i],n)}function G(t,e,i,n,s){var r;for(r=0;r<i;++r){var a=t[e+r],o=a>>8&255,l=16711935&(l=(l=16711935&a)+((o<<16)+o));n[s+r]=(4278255360&a)+l>>>0}}function N(t,e){e.jd=t>>0&255,e.hd=t>>8&255,e.ud=t>>16&255}function B(t,e,i,n,s,r){var a;for(a=0;a<n;++a){var o=e[i+a],l=o>>>8,h=o,c=255&(c=(c=o>>>16)+((t.jd<<24>>24)*(l<<24>>24)>>>5));h=255&(h=(h=h+((t.hd<<24>>24)*(l<<24>>24)>>>5))+((t.ud<<24>>24)*(c<<24>>24)>>>5));s[r+a]=(4278255360&o)+(c<<16)+h}}function W(t,e,i,n,s){self[e]=function(t,e,i,r,a,o,l,h,c){for(r=l;r<h;++r)for(l=0;l<c;++l)a[o++]=s(i[n(t[e++])])},self[t]=function(t,e,r,a,o,l,h){var c=8>>t.b,u=t.Ea,d=t.K[0],g=t.w;if(8>c)for(t=(1<<t.b)-1,g=(1<<c)-1;e<r;++e){var f,m=0;for(f=0;f<u;++f)f&t||(m=n(a[o++])),l[h++]=s(d[m&g]),m>>=c}else self["VP8LMapColor"+i](a,o,d,g,l,h,e,r,u)}}function H(t,e,i,n,s){for(i=e+i;e<i;){var r=t[e++];n[s++]=r>>16&255,n[s++]=r>>8&255,n[s++]=r>>0&255}}function Y(t,e,i,n,s){for(i=e+i;e<i;){var r=t[e++];n[s++]=r>>16&255,n[s++]=r>>8&255,n[s++]=r>>0&255,n[s++]=r>>24&255}}function $(t,e,i,n,s){for(i=e+i;e<i;){var r=(a=t[e++])>>16&240|a>>12&15,a=a>>0&240|a>>28&15;n[s++]=r,n[s++]=a}}function U(t,e,i,n,s){for(i=e+i;e<i;){var r=(a=t[e++])>>16&248|a>>13&7,a=a>>5&224|a>>3&31;n[s++]=r,n[s++]=a}}function j(t,e,i,n,s){for(i=e+i;e<i;){var r=t[e++];n[s++]=r>>0&255,n[s++]=r>>8&255,n[s++]=r>>16&255}}function z(t,e,i,n,s,r){if(0==r)for(i=e+i;e<i;)S(n,((r=t[e++])[0]>>24|r[1]>>8&65280|r[2]<<8&16711680|r[3]<<24)>>>0),s+=32;else Ge(n,s,t,e,i)}function X(t,e){self[e][0]=self[t+"0"],self[e][1]=self[t+"1"],self[e][2]=self[t+"2"],self[e][3]=self[t+"3"],self[e][4]=self[t+"4"],self[e][5]=self[t+"5"],self[e][6]=self[t+"6"],self[e][7]=self[t+"7"],self[e][8]=self[t+"8"],self[e][9]=self[t+"9"],self[e][10]=self[t+"10"],self[e][11]=self[t+"11"],self[e][12]=self[t+"12"],self[e][13]=self[t+"13"],self[e][14]=self[t+"0"],self[e][15]=self[t+"0"]}function K(t){return t==Hn||t==Yn||t==$n||t==Un}function J(){this.eb=[],this.size=this.A=this.fb=0}function q(){this.y=[],this.f=[],this.ea=[],this.F=[],this.Tc=this.Ed=this.Cd=this.Fd=this.lb=this.Db=this.Ab=this.fa=this.J=this.W=this.N=this.O=0}function Z(){this.Rd=this.height=this.width=this.S=0,this.f={},this.f.RGBA=new J,this.f.kb=new q,this.sd=null}function Q(){this.width=[0],this.height=[0],this.Pd=[0],this.Qd=[0],this.format=[0]}function tt(){this.Id=this.fd=this.Md=this.hb=this.ib=this.da=this.bd=this.cd=this.j=this.v=this.Da=this.Sd=this.ob=0}function et(t){return alert("todo:WebPSamplerProcessPlane"),t.T}function it(t,e){var i=t.T,n=e.ba.f.RGBA,s=n.eb,r=n.fb+t.ka*n.A,a=ps[e.ba.S],o=t.y,l=t.O,h=t.f,c=t.N,u=t.ea,d=t.W,g=e.cc,f=e.dc,m=e.Mc,p=e.Nc,_=t.ka,T=t.ka+t.T,y=t.U,w=y+1>>1;for(0==_?a(o,l,null,null,h,c,u,d,h,c,u,d,s,r,null,null,y):(a(e.ec,e.fc,o,l,g,f,m,p,h,c,u,d,s,r-n.A,s,r,y),++i);_+2<T;_+=2)g=h,f=c,m=u,p=d,c+=t.Rc,d+=t.Rc,r+=2*n.A,a(o,(l+=2*t.fa)-t.fa,o,l,g,f,m,p,h,c,u,d,s,r-n.A,s,r,y);return l+=t.fa,t.j+T<t.o?(Ge(e.ec,e.fc,o,l,y),Ge(e.cc,e.dc,h,c,w),Ge(e.Mc,e.Nc,u,d,w),i--):1&T||a(o,l,null,null,h,c,u,d,h,c,u,d,s,r+n.A,null,null,y),i}function nt(t,e,i){var n=t.F,s=[t.J];if(null!=n){var r=t.U,a=e.ba.S,o=a==Nn||a==$n;e=e.ba.f.RGBA;var l=[0],h=t.ka;l[0]=t.T,t.Kb&&(0==h?--l[0]:(--h,s[0]-=t.width),t.j+t.ka+t.T==t.o&&(l[0]=t.o-t.j-h));var c=e.eb;h=e.fb+h*e.A;t=vn(n,s[0],t.width,r,l,c,h+(o?0:3),e.A),Me(i==l),t&&K(a)&&xn(c,h,o,r,l,e.A)}return 0}function st(t){var e=t.ma,i=e.ba.S,n=11>i,s=i==Mn||i==Gn||i==Nn||i==Bn||12==i||K(i);if(e.memory=null,e.Ib=null,e.Jb=null,e.Nd=null,!Vi(e.Oa,t,s?11:12))return 0;if(s&&K(i)&&_i(),t.da)alert("todo:use_scaling");else{if(n){if(e.Ib=et,t.Kb){if(i=t.U+1>>1,e.memory=Be(t.U+2*i),null==e.memory)return 0;e.ec=e.memory,e.fc=0,e.cc=e.ec,e.dc=e.fc+t.U,e.Mc=e.cc,e.Nc=e.dc+i,e.Ib=it,_i()}}else alert("todo:EmitYUV");s&&(e.Jb=nt,n&&mi())}if(n&&!Ls){for(t=0;256>t;++t)Rs[t]=89858*(t-128)+Es>>vs,Vs[t]=-22014*(t-128)+Es,Ds[t]=-45773*(t-128),ks[t]=113618*(t-128)+Es>>vs;for(t=Is;t<Cs;++t)e=76283*(t-16)+Es>>vs,Os[t-Is]=Ft(e,255),Ms[t-Is]=Ft(e+8>>4,15);Ls=1}return 1}function rt(t){var e=t.ma,i=t.U,n=t.T;return Me(!(1&t.ka)),0>=i||0>=n?0:(i=e.Ib(t,e),null!=e.Jb&&e.Jb(t,e,i),e.Dc+=i,1)}function at(t){t.ma.memory=null}function ot(t,e,i,n){return 47!=u(t,8)?0:(e[0]=u(t,14)+1,i[0]=u(t,14)+1,n[0]=u(t,1),0!=u(t,3)?0:!t.h)}function lt(t,e){if(4>t)return t+1;var i=t-2>>1;return(2+(1&t)<<i)+u(e,i)+1}function ht(t,e){return 120<e?e-120:1<=(i=((i=qn[e-1])>>4)*t+(8-(15&i)))?i:1;var i}function ct(t,e,i){var n=f(i),s=t[e+=255&n].g-8;return 0<s&&(p(i,i.u+8),n=f(i),e+=t[e].value,e+=n&(1<<s)-1),p(i,i.u+t[e].g),t[e].value}function ut(t,e,i){return i.g+=t.g,i.value+=t.value<<e>>>0,Me(8>=i.g),t.g}function dt(t,e,i){var n=t.xc;return Me((e=0==n?0:t.vc[t.md*(i>>n)+(e>>n)])<t.Wb),t.Ya[e]}function gt(t,e,i,n){var s=t.ab,r=t.c*e,a=t.C;e=a+e;var o=i,l=n;for(n=t.Ta,i=t.Ua;0<s--;){var h=t.gc[s],c=a,u=e,d=o,g=l,f=(l=n,o=i,h.Ea);switch(Me(c<u),Me(u<=h.nc),h.hc){case 2:Ui(d,g,(u-c)*f,l,o);break;case 0:var m=c,p=u,_=l,T=o,y=(v=h).Ea;0==m&&(Yi(d,g,null,null,1,_,T),F(d,g+1,0,0,y-1,_,T+1),g+=y,T+=y,++m);for(var w=1<<v.b,S=w-1,x=P(y,v.b),b=v.K,v=v.w+(m>>v.b)*x;m<p;){var E=b,I=v,C=1;for($i(d,g,_,T-y,1,_,T);C<y;){var A=(C&~S)+w;A>y&&(A=y),(0,Ji[E[I++]>>8&15])(d,g+ +C,_,T+C-y,A-C,_,T+C),C=A}g+=y,T+=y,++m&S||(v+=x)}u!=h.nc&&Ge(l,o-f,l,o+(u-c-1)*f,f);break;case 1:for(f=d,p=g,y=(d=h.Ea)-(T=d&~(_=(g=1<<h.b)-1)),m=P(d,h.b),w=h.K,h=h.w+(c>>h.b)*m;c<u;){for(S=w,x=h,b=new k,v=p+T,E=p+d;p<v;)N(S[x++],b),qi(b,f,p,g,l,o),p+=g,o+=g;p<E&&(N(S[x++],b),qi(b,f,p,y,l,o),p+=y,o+=y),++c&_||(h+=m)}break;case 3:if(d==l&&g==o&&0<h.b){for(p=l,d=f=o+(u-c)*f-(T=(u-c)*P(h.Ea,h.b)),g=l,_=o,m=[],T=(y=T)-1;0<=T;--T)m[T]=g[_+T];for(T=y-1;0<=T;--T)p[d+T]=m[T];ji(h,c,u,l,f,l,o)}else ji(h,c,u,d,g,l,o)}o=n,l=i}l!=i&&Ge(n,i,o,l,r)}function ft(t,e){var i=t.V,n=t.Ba+t.c*t.C,s=e-t.C;if(Me(e<=t.l.o),Me(16>=s),0<s){var r=t.l,a=t.Ta,o=t.Ua,l=r.width;if(gt(t,s,i,n),s=o=[o],Me((i=t.C)<(n=e)),Me(r.v<r.va),n>r.o&&(n=r.o),i<r.j){var h=r.j-i;i=r.j;s[0]+=h*l}if(i>=n?i=0:(s[0]+=4*r.v,r.ka=i-r.j,r.U=r.va-r.v,r.T=n-i,i=1),i){if(o=o[0],11>(i=t.ca).S){var c=i.f.RGBA,u=(n=i.S,s=r.U,r=r.T,h=c.eb,c.A),d=r;for(c=c.fb+t.Ma*c.A;0<d--;){var g=a,f=o,m=s,p=h,_=c;switch(n){case On:Zi(g,f,m,p,_);break;case Mn:Qi(g,f,m,p,_);break;case Hn:Qi(g,f,m,p,_),xn(p,_,0,m,1,0);break;case Fn:nn(g,f,m,p,_);break;case Gn:z(g,f,m,p,_,1);break;case Yn:z(g,f,m,p,_,1),xn(p,_,0,m,1,0);break;case Nn:z(g,f,m,p,_,0);break;case $n:z(g,f,m,p,_,0),xn(p,_,1,m,1,0);break;case Bn:tn(g,f,m,p,_);break;case Un:tn(g,f,m,p,_),bn(p,_,m,1,0);break;case Wn:en(g,f,m,p,_);break;default:Me(0)}o+=l,c+=u}t.Ma+=r}else alert("todo:EmitRescaledRowsYUVA");Me(t.Ma<=i.height)}}t.C=e,Me(t.C<=t.i)}function mt(t){var e;if(0<t.ua)return 0;for(e=0;e<t.Wb;++e){var i=t.Ya[e].G,n=t.Ya[e].H;if(0<i[1][n[1]+0].g||0<i[2][n[2]+0].g||0<i[3][n[3]+0].g)return 0}return 1}function pt(t,e,i,n,s,r){if(0!=t.Z){var a=t.qd,o=t.rd;for(Me(null!=ms[t.Z]);e<i;++e)ms[t.Z](a,o,n,s,n,s,r),a=n,o=s,s+=r;t.qd=a,t.rd=o}}function _t(t,e){var i=t.l.ma,n=0==i.Z||1==i.Z?t.l.j:t.C;n=t.C<n?n:t.C;if(Me(e<=t.l.o),e>n){var s=t.l.width,r=i.ca,a=i.tb+s*n,o=t.V,l=t.Ba+t.c*n,h=t.gc;Me(1==t.ab),Me(3==h[0].hc),Xi(h[0],n,e,o,l,r,a),pt(i,n,e,r,a,s)}t.C=t.Ma=e}function Tt(t,e,i,n,s,r,a){var o=t.$/n,l=t.$%n,h=t.m,c=t.s,u=i+t.$,d=u;s=i+n*s;var g=i+n*r,T=280+c.ua,y=t.Pb?o:16777216,w=0<c.ua?c.Wa:null,S=c.wc,x=u<g?dt(c,l,o):null;Me(t.C<r),Me(g<=s);var b=!1;t:for(;;){for(;b||u<g;){var v=0;if(o>=y){var E=u-i;Me((y=t).Pb),y.wd=y.m,y.xd=E,0<y.s.ua&&I(y.s.Wa,y.s.vb),y=o+Qn}if(l&S||(x=dt(c,l,o)),Me(null!=x),x.Qb&&(e[u]=x.qb,b=!0),!b)if(_(h),x.jc){v=h,E=e;var C=u,A=x.pd[f(v)&Fi-1];Me(x.jc),256>A.g?(p(v,v.u+A.g),E[C]=A.value,v=0):(p(v,v.u+A.g-256),Me(256<=A.value),v=A.value),0==v&&(b=!0)}else v=ct(x.G[0],x.H[0],h);if(h.h)break;if(b||256>v){if(!b)if(x.nd)e[u]=(x.qb|v<<8)>>>0;else{if(_(h),b=ct(x.G[1],x.H[1],h),_(h),E=ct(x.G[2],x.H[2],h),C=ct(x.G[3],x.H[3],h),h.h)break;e[u]=(C<<24|b<<16|v<<8|E)>>>0}if(b=!1,++u,++l>=n&&(l=0,++o,null!=a&&o<=r&&!(o%16)&&a(t,o),null!=w))for(;d<u;)v=e[d++],w.X[(506832829*v&4294967295)>>>w.Mb]=v}else if(280>v){if(v=lt(v-256,h),E=ct(x.G[4],x.H[4],h),_(h),E=ht(n,E=lt(E,h)),h.h)break;if(u-i<E||s-u<v)break t;for(C=0;C<v;++C)e[u+C]=e[u+C-E];for(u+=v,l+=v;l>=n;)l-=n,++o,null!=a&&o<=r&&!(o%16)&&a(t,o);if(Me(u<=s),l&S&&(x=dt(c,l,o)),null!=w)for(;d<u;)v=e[d++],w.X[(506832829*v&4294967295)>>>w.Mb]=v}else{if(!(v<T))break t;for(b=v-280,Me(null!=w);d<u;)v=e[d++],w.X[(506832829*v&4294967295)>>>w.Mb]=v;v=u,Me(!(b>>>(E=w).Xa)),e[v]=E.X[b],b=!0}b||Me(h.h==m(h))}if(t.Pb&&h.h&&u<s)Me(t.m.h),t.a=5,t.m=t.wd,t.$=t.xd,0<t.s.ua&&I(t.s.vb,t.s.Wa);else{if(h.h)break t;null!=a&&a(t,o>r?r:o),t.a=0,t.$=u-i}return 1}return t.a=3,0}function yt(t){Me(null!=t),t.vc=null,t.yc=null,t.Ya=null;var e=t.Wa;null!=e&&(e.X=null),t.vb=null,Me(null!=t)}function wt(){var t=new ri;return null==t?null:(t.a=0,t.xb=fs,X("Predictor","VP8LPredictors"),X("Predictor","VP8LPredictors_C"),X("PredictorAdd","VP8LPredictorsAdd"),X("PredictorAdd","VP8LPredictorsAdd_C"),Ui=G,qi=B,Zi=H,Qi=Y,tn=$,en=U,nn=j,self.VP8LMapColor32b=zi,self.VP8LMapColor8b=Ki,t)}function St(t,e,s,a,o){var l=1,h=[t],c=[e],d=a.m,g=a.s,m=null,T=0;t:for(;;){if(s)for(;l&&u(d,1);){var y=h,w=c,S=a,x=1,b=S.m,v=S.gc[S.ab],I=u(b,2);if(S.Oc&1<<I)l=0;else{switch(S.Oc|=1<<I,v.hc=I,v.Ea=y[0],v.nc=w[0],v.K=[null],++S.ab,Me(4>=S.ab),I){case 0:case 1:v.b=u(b,3)+2,x=St(P(v.Ea,v.b),P(v.nc,v.b),0,S,v.K),v.K=v.K[0];break;case 3:var C,A=u(b,8)+1,R=16<A?0:4<A?1:2<A?2:3;if(y[0]=P(v.Ea,R),v.b=R,C=x=St(A,1,0,S,v.K)){var k,D=A,V=v,O=1<<(8>>V.b),M=Be(O);if(null==M)C=0;else{var F=V.K[0],G=V.w;for(M[0]=V.K[0][0],k=1;k<1*D;++k)M[k]=L(F[G+k],M[k-1]);for(;k<4*O;++k)M[k]=0;V.K[0]=null,V.K[0]=M,C=1}}x=C;break;case 2:break;default:Me(0)}l=x}}if(h=h[0],c=c[0],l&&u(d,1)&&!(l=1<=(T=u(d,4))&&11>=T)){a.a=3;break t}var N;if(N=l)e:{var B,W,H,Y=a,$=h,U=c,j=T,z=s,X=Y.m,K=Y.s,J=[null],q=1,Z=0,Q=Zn[j];i:for(;;){if(z&&u(X,1)){var tt=u(X,3)+2,et=P($,tt),it=P(U,tt),nt=et*it;if(!St(et,it,0,Y,J))break i;for(J=J[0],K.xc=tt,B=0;B<nt;++B){var st=J[B]>>8&65535;J[B]=st,st>=q&&(q=st+1)}}if(X.h)break i;for(W=0;5>W;++W){var rt=Xn[W];!W&&0<j&&(rt+=1<<j),Z<rt&&(Z=rt)}var at=We(q*Q,n),ot=q,lt=We(ot,r);if(null==lt)var ht=null;else Me(65536>=ot),ht=lt;var ct=Be(Z);if(null==ht||null==ct||null==at){Y.a=1;break i}var dt=at;for(B=H=0;B<q;++B){var gt=ht[B],ft=gt.G,mt=gt.H,pt=0,_t=1,wt=0;for(W=0;5>W;++W){rt=Xn[W],ft[W]=dt,mt[W]=H,!W&&0<j&&(rt+=1<<j);n:{var xt,bt=rt,vt=Y,Et=ct,It=dt,Ct=H,At=0,Pt=vt.m,Lt=u(Pt,1);if(Ne(Et,0,0,bt),Lt){var Rt=u(Pt,1)+1,kt=u(Pt,1),Dt=u(Pt,0==kt?1:8);Et[Dt]=1,2==Rt&&(Et[Dt=u(Pt,8)]=1);var Vt=1}else{var Ot=Be(19),Mt=u(Pt,4)+4;if(19<Mt){vt.a=3;var Ft=0;break n}for(xt=0;xt<Mt;++xt)Ot[Jn[xt]]=u(Pt,3);var Gt=void 0,Nt=void 0,Bt=vt,Wt=Ot,Ht=bt,Yt=Et,$t=0,Ut=Bt.m,jt=8,zt=We(128,n);s:for(;i(zt,0,7,Wt,19);){if(u(Ut,1)){var Xt=2+2*u(Ut,3);if((Gt=2+u(Ut,Xt))>Ht)break s}else Gt=Ht;for(Nt=0;Nt<Ht&&Gt--;){_(Ut);var Kt=zt[0+(127&f(Ut))];p(Ut,Ut.u+Kt.g);var Jt=Kt.value;if(16>Jt)Yt[Nt++]=Jt,0!=Jt&&(jt=Jt);else{var qt=16==Jt,Zt=Jt-16,Qt=zn[Zt],te=u(Ut,jn[Zt])+Qt;if(Nt+te>Ht)break s;for(var ee=qt?jt:0;0<te--;)Yt[Nt++]=ee}}$t=1;break s}$t||(Bt.a=3),Vt=$t}(Vt=Vt&&!Pt.h)&&(At=i(It,Ct,8,Et,bt)),Vt&&0!=At?Ft=At:(vt.a=3,Ft=0)}if(0==Ft)break i;if(_t&&1==Kn[W]&&(_t=0==dt[H].g),pt+=dt[H].g,H+=Ft,3>=W){var ie,ne=ct[0];for(ie=1;ie<rt;++ie)ct[ie]>ne&&(ne=ct[ie]);wt+=ne}}if(gt.nd=_t,gt.Qb=0,_t&&(gt.qb=(ft[3][mt[3]+0].value<<24|ft[1][mt[1]+0].value<<16|ft[2][mt[2]+0].value)>>>0,0==pt&&256>ft[0][mt[0]+0].value&&(gt.Qb=1,gt.qb+=ft[0][mt[0]+0].value<<8)),gt.jc=!gt.Qb&&6>wt,gt.jc){var se,re=gt;for(se=0;se<Fi;++se){var ae=se,oe=re.pd[ae],le=re.G[0][re.H[0]+ae];256<=le.value?(oe.g=le.g+256,oe.value=le.value):(oe.g=0,oe.value=0,ae>>=ut(le,8,oe),ae>>=ut(re.G[1][re.H[1]+ae],16,oe),ae>>=ut(re.G[2][re.H[2]+ae],0,oe),ut(re.G[3][re.H[3]+ae],24,oe))}}}K.vc=J,K.Wb=q,K.Ya=ht,K.yc=at,N=1;break e}N=0}if(!(l=N)){a.a=3;break t}if(0<T){if(g.ua=1<<T,!E(g.Wa,T)){a.a=1,l=0;break t}}else g.ua=0;var he=a,ce=h,ue=c,de=he.s,ge=de.xc;if(he.c=ce,he.i=ue,de.md=P(ce,ge),de.wc=0==ge?-1:(1<<ge)-1,s){a.xb=gs;break t}if(null==(m=Be(h*c))){a.a=1,l=0;break t}l=(l=Tt(a,m,0,h,c,c,null))&&!d.h;break t}return l?(null!=o?o[0]=m:(Me(null==m),Me(s)),a.$=0,s||yt(g)):yt(g),l}function xt(t,e){var i=t.c*t.i,n=i+e+16*e;return Me(t.c<=e),t.V=Be(n),null==t.V?(t.Ta=null,t.Ua=0,t.a=1,0):(t.Ta=t.V,t.Ua=t.Ba+i+e,1)}function bt(t,e){var i=t.C,n=e-i,s=t.V,r=t.Ba+t.c*i;for(Me(e<=t.l.o);0<n;){var a=16<n?16:n,o=t.l.ma,l=t.l.width,h=l*a,c=o.ca,u=o.tb+l*i,d=t.Ta,g=t.Ua;gt(t,a,s,r),En(d,g,c,u,h),pt(o,i,i+a,c,u,l),n-=a,s+=a*t.c,i+=a}Me(i==e),t.C=t.Ma=e}function vt(){this.ub=this.yd=this.td=this.Rb=0}function Et(){this.Kd=this.Ld=this.Ud=this.Td=this.i=this.c=0}function It(){this.Fb=this.Bb=this.Cb=0,this.Zb=Be(4),this.Lb=Be(4)}function Ct(){this.Yb=function(){var t=[];return function t(e,i,n){for(var s=n[i],r=0;r<s&&(e.push(n.length>i+1?[]:0),!(n.length<i+1));r++)t(e[r],i+1,n)}(t,0,[3,11]),t}()}function At(){this.jb=Be(3),this.Wc=He([4,8],Ct),this.Xc=He([4,17],Ct)}function Pt(){this.Pc=this.wb=this.Tb=this.zd=0,this.vd=new Be(4),this.od=new Be(4)}function Lt(){this.ld=this.La=this.dd=this.tc=0}function Rt(){this.Na=this.la=0}function kt(){this.Sc=[0,0],this.Eb=[0,0],this.Qc=[0,0],this.ia=this.lc=0}function Dt(){this.ad=Be(384),this.Za=0,this.Ob=Be(16),this.$b=this.Ad=this.ia=this.Gc=this.Hc=this.Dd=0}function Vt(){this.uc=this.M=this.Nb=0,this.wa=Array(new Lt),this.Y=0,this.ya=Array(new Dt),this.aa=0,this.l=new Gt}function Ot(){this.y=Be(16),this.f=Be(8),this.ea=Be(8)}function Mt(){this.cb=this.a=0,this.sc="",this.m=new d,this.Od=new vt,this.Kc=new Et,this.ed=new Pt,this.Qa=new It,this.Ic=this.$c=this.Aa=0,this.D=new Vt,this.Xb=this.Va=this.Hb=this.zb=this.yb=this.Ub=this.za=0,this.Jc=We(8,d),this.ia=0,this.pb=We(4,kt),this.Pa=new At,this.Bd=this.kc=0,this.Ac=[],this.Bc=0,this.zc=[0,0,0,0],this.Gd=Array(new Ot),this.Hd=0,this.rb=Array(new Rt),this.sb=0,this.wa=Array(new Lt),this.Y=0,this.oc=[],this.pc=0,this.sa=[],this.ta=0,this.qa=[],this.ra=0,this.Ha=[],this.B=this.R=this.Ia=0,this.Ec=[],this.M=this.ja=this.Vb=this.Fc=0,this.ya=Array(new Dt),this.L=this.aa=0,this.gd=He([4,2],Lt),this.ga=null,this.Fa=[],this.Cc=this.qc=this.P=0,this.Gb=[],this.Uc=0,this.mb=[],this.nb=0,this.rc=[],this.Ga=this.Vc=0}function Ft(t,e){return 0>t?0:t>e?e:t}function Gt(){this.T=this.U=this.ka=this.height=this.width=0,this.y=[],this.f=[],this.ea=[],this.Rc=this.fa=this.W=this.N=this.O=0,this.ma="void",this.put="VP8IoPutHook",this.ac="VP8IoSetupHook",this.bc="VP8IoTeardownHook",this.ha=this.Kb=0,this.data=[],this.hb=this.ib=this.da=this.o=this.j=this.va=this.v=this.Da=this.ob=this.w=0,this.F=[],this.J=0}function Nt(){var t=new Mt;return null!=t&&(t.a=0,t.sc="OK",t.cb=0,t.Xb=0,is||(is=Yt)),t}function Bt(t,e,i){return 0==t.a&&(t.a=e,t.sc=i,t.cb=0),0}function Wt(t,e,i){return 3<=i&&157==t[e+0]&&1==t[e+1]&&42==t[e+2]}function Ht(t,e){if(null==t)return 0;if(t.a=0,t.sc="OK",null==e)return Bt(t,2,"null VP8Io passed to VP8GetHeaders()");var i=e.data,n=e.w,s=e.ha;if(4>s)return Bt(t,7,"Truncated header.");var r=i[n+0]|i[n+1]<<8|i[n+2]<<16,h=t.Od;if(h.Rb=!(1&r),h.td=r>>1&7,h.yd=r>>4&1,h.ub=r>>5,3<h.td)return Bt(t,3,"Incorrect keyframe parameters.");if(!h.yd)return Bt(t,4,"Frame not displayable.");n+=3,s-=3;var c=t.Kc;if(h.Rb){if(7>s)return Bt(t,7,"cannot parse picture header");if(!Wt(i,n,s))return Bt(t,3,"Bad code word");c.c=16383&(i[n+4]<<8|i[n+3]),c.Td=i[n+4]>>6,c.i=16383&(i[n+6]<<8|i[n+5]),c.Ud=i[n+6]>>6,n+=7,s-=7,t.za=c.c+15>>4,t.Ub=c.i+15>>4,e.width=c.c,e.height=c.i,e.Da=0,e.j=0,e.v=0,e.va=e.width,e.o=e.height,e.da=0,e.ib=e.width,e.hb=e.height,e.U=e.width,e.T=e.height,Ne((r=t.Pa).jb,0,255,r.jb.length),Me(null!=(r=t.Qa)),r.Cb=0,r.Bb=0,r.Fb=1,Ne(r.Zb,0,0,r.Zb.length),Ne(r.Lb,0,0,r.Lb)}if(h.ub>s)return Bt(t,7,"bad partition length");a(r=t.m,i,n,h.ub),n+=h.ub,s-=h.ub,h.Rb&&(c.Ld=y(r),c.Kd=y(r)),c=t.Qa;var u,d=t.Pa;if(Me(null!=r),Me(null!=c),c.Cb=y(r),c.Cb){if(c.Bb=y(r),y(r)){for(c.Fb=y(r),u=0;4>u;++u)c.Zb[u]=y(r)?l(r,7):0;for(u=0;4>u;++u)c.Lb[u]=y(r)?l(r,6):0}if(c.Bb)for(u=0;3>u;++u)d.jb[u]=y(r)?o(r,8):255}else c.Bb=0;if(r.Ka)return Bt(t,3,"cannot parse segment header");if((c=t.ed).zd=y(r),c.Tb=o(r,6),c.wb=o(r,3),c.Pc=y(r),c.Pc&&y(r)){for(d=0;4>d;++d)y(r)&&(c.vd[d]=l(r,6));for(d=0;4>d;++d)y(r)&&(c.od[d]=l(r,6))}if(t.L=0==c.Tb?0:c.zd?1:2,r.Ka)return Bt(t,3,"cannot parse filter header");var g=s;if(s=u=n,n=u+g,c=g,t.Xb=(1<<o(t.m,2))-1,g<3*(d=t.Xb))i=7;else{for(u+=3*d,c-=3*d,g=0;g<d;++g){var f=i[s+0]|i[s+1]<<8|i[s+2]<<16;f>c&&(f=c),a(t.Jc[+g],i,u,f),u+=f,c-=f,s+=3}a(t.Jc[+d],i,u,c),i=u<n?0:5}if(0!=i)return Bt(t,i,"cannot parse partitions");for(i=o(u=t.m,7),s=y(u)?l(u,4):0,n=y(u)?l(u,4):0,c=y(u)?l(u,4):0,d=y(u)?l(u,4):0,u=y(u)?l(u,4):0,g=t.Qa,f=0;4>f;++f){if(g.Cb){var m=g.Zb[f];g.Fb||(m+=i)}else{if(0<f){t.pb[f]=t.pb[0];continue}m=i}var p=t.pb[f];p.Sc[0]=ts[Ft(m+s,127)],p.Sc[1]=es[Ft(m+0,127)],p.Eb[0]=2*ts[Ft(m+n,127)],p.Eb[1]=101581*es[Ft(m+c,127)]>>16,8>p.Eb[1]&&(p.Eb[1]=8),p.Qc[0]=ts[Ft(m+d,117)],p.Qc[1]=es[Ft(m+u,127)],p.lc=m+u}if(!h.Rb)return Bt(t,4,"Not a key frame.");for(y(r),h=t.Pa,i=0;4>i;++i){for(s=0;8>s;++s)for(n=0;3>n;++n)for(c=0;11>c;++c)d=w(r,ls[i][s][n][c])?o(r,8):as[i][s][n][c],h.Wc[i][s].Yb[n][c]=d;for(s=0;17>s;++s)h.Xc[i][s]=h.Wc[i][hs[s]]}return t.kc=y(r),t.kc&&(t.Bd=o(r,8)),t.cb=1}function Yt(t,e,i,n,s,r,a){var o=e[s].Yb[i];for(i=0;16>s;++s){if(!w(t,o[i+0]))return s;for(;!w(t,o[i+1]);)if(o=e[++s].Yb[0],i=0,16==s)return 16;var l=e[s+1].Yb;if(w(t,o[i+2])){var h=t,c=0;if(w(h,(d=o)[(u=i)+3]))if(w(h,d[u+6])){for(o=0,u=2*(c=w(h,d[u+8]))+(d=w(h,d[u+9+c])),c=0,d=ns[u];d[o];++o)c+=c+w(h,d[o]);c+=3+(8<<u)}else w(h,d[u+7])?(c=7+2*w(h,165),c+=w(h,145)):c=5+w(h,159);else c=w(h,d[u+4])?3+w(h,d[u+5]):2;o=l[2]}else c=1,o=l[1];l=a+ss[s],0>(h=t).b&&T(h);var u,d=h.b,g=(u=h.Ca>>1)-(h.I>>d)>>31;--h.b,h.Ca+=g,h.Ca|=1,h.I-=(u+1&g)<<d,r[l]=((c^g)-g)*n[(0<s)+0]}return 16}function $t(t){var e=t.rb[t.sb-1];e.la=0,e.Na=0,Ne(t.zc,0,0,t.zc.length),t.ja=0}function Ut(t,e){if(null==t)return 0;if(null==e)return Bt(t,2,"NULL VP8Io parameter in VP8Decode().");if(!t.cb&&!Ht(t,e))return 0;if(Me(t.cb),null==e.ac||e.ac(e)){e.ob&&(t.L=0);var i=Gs[t.L];if(2==t.L?(t.yb=0,t.zb=0):(t.yb=e.v-i>>4,t.zb=e.j-i>>4,0>t.yb&&(t.yb=0),0>t.zb&&(t.zb=0)),t.Va=e.o+15+i>>4,t.Hb=e.va+15+i>>4,t.Hb>t.za&&(t.Hb=t.za),t.Va>t.Ub&&(t.Va=t.Ub),0<t.L){var n=t.ed;for(i=0;4>i;++i){var s;if(t.Qa.Cb){var r=t.Qa.Lb[i];t.Qa.Fb||(r+=n.Tb)}else r=n.Tb;for(s=0;1>=s;++s){var a=t.gd[i][s],o=r;if(n.Pc&&(o+=n.vd[0],s&&(o+=n.od[0])),0<(o=0>o?0:63<o?63:o)){var l=o;0<n.wb&&((l=4<n.wb?l>>2:l>>1)>9-n.wb&&(l=9-n.wb)),1>l&&(l=1),a.dd=l,a.tc=2*o+l,a.ld=40<=o?2:15<=o?1:0}else a.tc=0;a.La=s}}}i=0}else Bt(t,6,"Frame setup failed"),i=t.a;if(i=0==i){if(i){t.$c=0,0<t.Aa||(t.Ic=Bs);t:{i=t.Ic;n=4*(l=t.za);var h=32*l,c=l+1,u=0<t.L?l*(0<t.Aa?2:1):0,d=(2==t.Aa?2:1)*l;if((a=n+832+(s=3*(16*i+Gs[t.L])/2*h)+(r=null!=t.Fa&&0<t.Fa.length?t.Kc.c*t.Kc.i:0))!=a)i=0;else{if(a>t.Vb){if(t.Vb=0,t.Ec=Be(a),t.Fc=0,null==t.Ec){i=Bt(t,1,"no memory during frame initialization.");break t}t.Vb=a}a=t.Ec,o=t.Fc,t.Ac=a,t.Bc=o,o+=n,t.Gd=We(h,Ot),t.Hd=0,t.rb=We(c+1,Rt),t.sb=1,t.wa=u?We(u,Lt):null,t.Y=0,t.D.Nb=0,t.D.wa=t.wa,t.D.Y=t.Y,0<t.Aa&&(t.D.Y+=l),Me(!0),t.oc=a,t.pc=o,o+=832,t.ya=We(d,Dt),t.aa=0,t.D.ya=t.ya,t.D.aa=t.aa,2==t.Aa&&(t.D.aa+=l),t.R=16*l,t.B=8*l,l=(h=Gs[t.L])*t.R,h=h/2*t.B,t.sa=a,t.ta=o+l,t.qa=t.sa,t.ra=t.ta+16*i*t.R+h,t.Ha=t.qa,t.Ia=t.ra+8*i*t.B+h,t.$c=0,o+=s,t.mb=r?a:null,t.nb=r?o:null,Me(o+r<=t.Fc+t.Vb),$t(t),Ne(t.Ac,t.Bc,0,n),i=1}}if(i){if(e.ka=0,e.y=t.sa,e.O=t.ta,e.f=t.qa,e.N=t.ra,e.ea=t.Ha,e.Vd=t.Ia,e.fa=t.R,e.Rc=t.B,e.F=null,e.J=0,!Ln){for(i=-255;255>=i;++i)In[255+i]=0>i?-i:i;for(i=-1020;1020>=i;++i)Cn[1020+i]=-128>i?-128:127<i?127:i;for(i=-112;112>=i;++i)An[112+i]=-16>i?-16:15<i?15:i;for(i=-255;510>=i;++i)Pn[255+i]=0>i?0:255<i?255:i;Ln=1}sn=ee,rn=qt,on=Zt,ln=Qt,hn=te,an=Jt,cn=ze,un=Xe,dn=qe,gn=Ze,fn=Ke,mn=Je,pn=Qe,_n=ti,Tn=Ve,yn=Oe,wn=Ye,Sn=$e,us[0]=pe,us[1]=ne,us[2]=fe,us[3]=me,us[4]=_e,us[5]=ye,us[6]=Te,us[7]=we,us[8]=xe,us[9]=Se,cs[0]=he,cs[1]=re,cs[2]=ae,cs[3]=oe,cs[4]=ce,cs[5]=ue,cs[6]=de,ds[0]=Ie,ds[1]=se,ds[2]=be,ds[3]=ve,ds[4]=Ae,ds[5]=Ce,ds[6]=Pe,i=1}else i=0}i&&(i=function(t,e){for(t.M=0;t.M<t.Va;++t.M){var i,n=t.Jc[t.M&t.Xb],s=t.m,r=t;for(i=0;i<r.za;++i){var a=s,o=r,l=o.Ac,h=o.Bc+4*i,c=o.zc,u=o.ya[o.aa+i];if(o.Qa.Bb?u.$b=w(a,o.Pa.jb[0])?2+w(a,o.Pa.jb[2]):w(a,o.Pa.jb[1]):u.$b=0,o.kc&&(u.Ad=w(a,o.Bd)),u.Za=!w(a,145)+0,u.Za){var d=u.Ob,g=0;for(o=0;4>o;++o){var f,m=c[0+o];for(f=0;4>f;++f){m=os[l[h+f]][m];for(var p=rs[w(a,m[0])];0<p;)p=rs[2*p+w(a,m[p])];m=-p,l[h+f]=m}Ge(d,g,l,h,4),g+=4,c[0+o]=m}}else m=w(a,156)?w(a,128)?1:3:w(a,163)?2:0,u.Ob[0]=m,Ne(l,h,m,4),Ne(c,0,m,4);u.Dd=w(a,142)?w(a,114)?w(a,183)?1:3:2:0}if(r.m.Ka)return Bt(t,7,"Premature end-of-partition0 encountered.");for(;t.ja<t.za;++t.ja){if(r=n,a=(s=t).rb[s.sb-1],l=s.rb[s.sb+s.ja],i=s.ya[s.aa+s.ja],h=s.kc?i.Ad:0)a.la=l.la=0,i.Za||(a.Na=l.Na=0),i.Hc=0,i.Gc=0,i.ia=0;else{var _,T;if(a=l,l=r,h=s.Pa.Xc,c=s.ya[s.aa+s.ja],u=s.pb[c.$b],o=c.ad,d=0,g=s.rb[s.sb-1],m=f=0,Ne(o,d,0,384),c.Za)var y=0,S=h[3];else{p=Be(16);var x=a.Na+g.Na;if(x=is(l,h[1],x,u.Eb,0,p,0),a.Na=g.Na=(0<x)+0,1<x)sn(p,0,o,d);else{var b=p[0]+3>>3;for(p=0;256>p;p+=16)o[d+p]=b}y=1,S=h[0]}var v=15&a.la,E=15&g.la;for(p=0;4>p;++p){var I=1&E;for(b=T=0;4>b;++b)v=v>>1|(I=(x=is(l,S,x=I+(1&v),u.Sc,y,o,d))>y)<<7,T=T<<2|(3<x?3:1<x?2:0!=o[d+0]),d+=16;v>>=4,E=E>>1|I<<7,f=(f<<8|T)>>>0}for(S=v,y=E>>4,_=0;4>_;_+=2){for(T=0,v=a.la>>4+_,E=g.la>>4+_,p=0;2>p;++p){for(I=1&E,b=0;2>b;++b)x=I+(1&v),v=v>>1|(I=0<(x=is(l,h[2],x,u.Qc,0,o,d)))<<3,T=T<<2|(3<x?3:1<x?2:0!=o[d+0]),d+=16;v>>=2,E=E>>1|I<<5}m|=T<<4*_,S|=v<<4<<_,y|=(240&E)<<_}a.la=S,g.la=y,c.Hc=f,c.Gc=m,c.ia=43690&m?0:u.ia,h=!(f|m)}if(0<s.L&&(s.wa[s.Y+s.ja]=s.gd[i.$b][i.Za],s.wa[s.Y+s.ja].La|=!h),r.Ka)return Bt(t,7,"Premature end-of-file encountered.")}if($t(t),s=e,r=1,i=(n=t).D,a=0<n.L&&n.M>=n.zb&&n.M<=n.Va,0==n.Aa)t:{if(i.M=n.M,i.uc=a,ki(n,i),r=1,i=(T=n.D).Nb,a=(m=Gs[n.L])*n.R,l=m/2*n.B,p=16*i*n.R,b=8*i*n.B,h=n.sa,c=n.ta-a+p,u=n.qa,o=n.ra-l+b,d=n.Ha,g=n.Ia-l+b,E=0==(v=T.M),f=v>=n.Va-1,2==n.Aa&&ki(n,T),T.uc)for(I=(x=n).D.M,Me(x.D.uc),T=x.yb;T<x.Hb;++T){y=T,S=I;var C=(A=(F=x).D).Nb;_=F.R;var A=A.wa[A.Y+y],P=F.sa,L=F.ta+16*C*_+16*y,R=A.dd,k=A.tc;if(0!=k)if(Me(3<=k),1==F.L)0<y&&yn(P,L,_,k+4),A.La&&Sn(P,L,_,k),0<S&&Tn(P,L,_,k+4),A.La&&wn(P,L,_,k);else{var D=F.B,V=F.qa,O=F.ra+8*C*D+8*y,M=F.Ha,F=F.Ia+8*C*D+8*y;C=A.ld,0<y&&(un(P,L,_,k+4,R,C),gn(V,O,M,F,D,k+4,R,C)),A.La&&(mn(P,L,_,k,R,C),_n(V,O,M,F,D,k,R,C)),0<S&&(cn(P,L,_,k+4,R,C),dn(V,O,M,F,D,k+4,R,C)),A.La&&(fn(P,L,_,k,R,C),pn(V,O,M,F,D,k,R,C))}}if(n.ia&&alert("todo:DitherRow"),null!=s.put){if(T=16*v,v=16*(v+1),E?(s.y=n.sa,s.O=n.ta+p,s.f=n.qa,s.N=n.ra+b,s.ea=n.Ha,s.W=n.Ia+b):(T-=m,s.y=h,s.O=c,s.f=u,s.N=o,s.ea=d,s.W=g),f||(v-=m),v>s.o&&(v=s.o),s.F=null,s.J=null,null!=n.Fa&&0<n.Fa.length&&T<v&&(s.J=ci(n,s,T,v-T),s.F=n.mb,null==s.F&&0==s.F.length)){r=Bt(n,3,"Could not decode alpha data.");break t}T<s.j&&(m=s.j-T,T=s.j,Me(!(1&m)),s.O+=n.R*m,s.N+=n.B*(m>>1),s.W+=n.B*(m>>1),null!=s.F&&(s.J+=s.width*m)),T<v&&(s.O+=s.v,s.N+=s.v>>1,s.W+=s.v>>1,null!=s.F&&(s.J+=s.v),s.ka=T-s.j,s.U=s.va-s.v,s.T=v-T,r=s.put(s))}i+1!=n.Ic||f||(Ge(n.sa,n.ta-a,h,c+16*n.R,a),Ge(n.qa,n.ra-l,u,o+8*n.B,l),Ge(n.Ha,n.Ia-l,d,g+8*n.B,l))}if(!r)return Bt(t,6,"Output aborted.")}return 1}(t,e)),null!=e.bc&&e.bc(e),i&=1}return i?(t.cb=0,i):0}function jt(t,e,i,n,s){s=t[e+i+32*n]+(s>>3),t[e+i+32*n]=-256&s?0>s?0:255:s}function zt(t,e,i,n,s,r){jt(t,e,0,i,n+s),jt(t,e,1,i,n+r),jt(t,e,2,i,n-r),jt(t,e,3,i,n-s)}function Xt(t){return(20091*t>>16)+t}function Kt(t,e,i,n){var s,r=0,a=Be(16);for(s=0;4>s;++s){var o=t[e+0]+t[e+8],l=t[e+0]-t[e+8],h=(35468*t[e+4]>>16)-Xt(t[e+12]),c=Xt(t[e+4])+(35468*t[e+12]>>16);a[r+0]=o+c,a[r+1]=l+h,a[r+2]=l-h,a[r+3]=o-c,r+=4,e++}for(s=r=0;4>s;++s)o=(t=a[r+0]+4)+a[r+8],l=t-a[r+8],h=(35468*a[r+4]>>16)-Xt(a[r+12]),jt(i,n,0,0,o+(c=Xt(a[r+4])+(35468*a[r+12]>>16))),jt(i,n,1,0,l+h),jt(i,n,2,0,l-h),jt(i,n,3,0,o-c),r++,n+=32}function Jt(t,e,i,n){var s=t[e+0]+4,r=35468*t[e+4]>>16,a=Xt(t[e+4]),o=35468*t[e+1]>>16;zt(i,n,0,s+a,t=Xt(t[e+1]),o),zt(i,n,1,s+r,t,o),zt(i,n,2,s-r,t,o),zt(i,n,3,s-a,t,o)}function qt(t,e,i,n,s){Kt(t,e,i,n),s&&Kt(t,e+16,i,n+4)}function Zt(t,e,i,n){rn(t,e+0,i,n,1),rn(t,e+32,i,n+128,1)}function Qt(t,e,i,n){var s;for(t=t[e+0]+4,s=0;4>s;++s)for(e=0;4>e;++e)jt(i,n,e,s,t)}function te(t,e,i,n){t[e+0]&&ln(t,e+0,i,n),t[e+16]&&ln(t,e+16,i,n+4),t[e+32]&&ln(t,e+32,i,n+128),t[e+48]&&ln(t,e+48,i,n+128+4)}function ee(t,e,i,n){var s,r=Be(16);for(s=0;4>s;++s){var a=t[e+0+s]+t[e+12+s],o=t[e+4+s]+t[e+8+s],l=t[e+4+s]-t[e+8+s],h=t[e+0+s]-t[e+12+s];r[0+s]=a+o,r[8+s]=a-o,r[4+s]=h+l,r[12+s]=h-l}for(s=0;4>s;++s)a=(t=r[0+4*s]+3)+r[3+4*s],o=r[1+4*s]+r[2+4*s],l=r[1+4*s]-r[2+4*s],h=t-r[3+4*s],i[n+0]=a+o>>3,i[n+16]=h+l>>3,i[n+32]=a-o>>3,i[n+48]=h-l>>3,n+=64}function ie(t,e,i){var n,s=e-32,r=Dn,a=255-t[s-1];for(n=0;n<i;++n){var o,l=r,h=a+t[e-1];for(o=0;o<i;++o)t[e+o]=l[h+t[s+o]];e+=32}}function ne(t,e){ie(t,e,4)}function se(t,e){ie(t,e,8)}function re(t,e){ie(t,e,16)}function ae(t,e){var i;for(i=0;16>i;++i)Ge(t,e+32*i,t,e-32,16)}function oe(t,e){var i;for(i=16;0<i;--i)Ne(t,e,t[e-1],16),e+=32}function le(t,e,i){var n;for(n=0;16>n;++n)Ne(e,i+32*n,t,16)}function he(t,e){var i,n=16;for(i=0;16>i;++i)n+=t[e-1+32*i]+t[e+i-32];le(n>>5,t,e)}function ce(t,e){var i,n=8;for(i=0;16>i;++i)n+=t[e-1+32*i];le(n>>4,t,e)}function ue(t,e){var i,n=8;for(i=0;16>i;++i)n+=t[e+i-32];le(n>>4,t,e)}function de(t,e){le(128,t,e)}function ge(t,e,i){return t+2*e+i+2>>2}function fe(t,e){var i,n=e-32;n=new Uint8Array([ge(t[n-1],t[n+0],t[n+1]),ge(t[n+0],t[n+1],t[n+2]),ge(t[n+1],t[n+2],t[n+3]),ge(t[n+2],t[n+3],t[n+4])]);for(i=0;4>i;++i)Ge(t,e+32*i,n,0,n.length)}function me(t,e){var i=t[e-1],n=t[e-1+32],s=t[e-1+64],r=t[e-1+96];S(t,e+0,16843009*ge(t[e-1-32],i,n)),S(t,e+32,16843009*ge(i,n,s)),S(t,e+64,16843009*ge(n,s,r)),S(t,e+96,16843009*ge(s,r,r))}function pe(t,e){var i,n=4;for(i=0;4>i;++i)n+=t[e+i-32]+t[e-1+32*i];for(n>>=3,i=0;4>i;++i)Ne(t,e+32*i,n,4)}function _e(t,e){var i=t[e-1+0],n=t[e-1+32],s=t[e-1+64],r=t[e-1-32],a=t[e+0-32],o=t[e+1-32],l=t[e+2-32],h=t[e+3-32];t[e+0+96]=ge(n,s,t[e-1+96]),t[e+1+96]=t[e+0+64]=ge(i,n,s),t[e+2+96]=t[e+1+64]=t[e+0+32]=ge(r,i,n),t[e+3+96]=t[e+2+64]=t[e+1+32]=t[e+0+0]=ge(a,r,i),t[e+3+64]=t[e+2+32]=t[e+1+0]=ge(o,a,r),t[e+3+32]=t[e+2+0]=ge(l,o,a),t[e+3+0]=ge(h,l,o)}function Te(t,e){var i=t[e+1-32],n=t[e+2-32],s=t[e+3-32],r=t[e+4-32],a=t[e+5-32],o=t[e+6-32],l=t[e+7-32];t[e+0+0]=ge(t[e+0-32],i,n),t[e+1+0]=t[e+0+32]=ge(i,n,s),t[e+2+0]=t[e+1+32]=t[e+0+64]=ge(n,s,r),t[e+3+0]=t[e+2+32]=t[e+1+64]=t[e+0+96]=ge(s,r,a),t[e+3+32]=t[e+2+64]=t[e+1+96]=ge(r,a,o),t[e+3+64]=t[e+2+96]=ge(a,o,l),t[e+3+96]=ge(o,l,l)}function ye(t,e){var i=t[e-1+0],n=t[e-1+32],s=t[e-1+64],r=t[e-1-32],a=t[e+0-32],o=t[e+1-32],l=t[e+2-32],h=t[e+3-32];t[e+0+0]=t[e+1+64]=r+a+1>>1,t[e+1+0]=t[e+2+64]=a+o+1>>1,t[e+2+0]=t[e+3+64]=o+l+1>>1,t[e+3+0]=l+h+1>>1,t[e+0+96]=ge(s,n,i),t[e+0+64]=ge(n,i,r),t[e+0+32]=t[e+1+96]=ge(i,r,a),t[e+1+32]=t[e+2+96]=ge(r,a,o),t[e+2+32]=t[e+3+96]=ge(a,o,l),t[e+3+32]=ge(o,l,h)}function we(t,e){var i=t[e+0-32],n=t[e+1-32],s=t[e+2-32],r=t[e+3-32],a=t[e+4-32],o=t[e+5-32],l=t[e+6-32],h=t[e+7-32];t[e+0+0]=i+n+1>>1,t[e+1+0]=t[e+0+64]=n+s+1>>1,t[e+2+0]=t[e+1+64]=s+r+1>>1,t[e+3+0]=t[e+2+64]=r+a+1>>1,t[e+0+32]=ge(i,n,s),t[e+1+32]=t[e+0+96]=ge(n,s,r),t[e+2+32]=t[e+1+96]=ge(s,r,a),t[e+3+32]=t[e+2+96]=ge(r,a,o),t[e+3+64]=ge(a,o,l),t[e+3+96]=ge(o,l,h)}function Se(t,e){var i=t[e-1+0],n=t[e-1+32],s=t[e-1+64],r=t[e-1+96];t[e+0+0]=i+n+1>>1,t[e+2+0]=t[e+0+32]=n+s+1>>1,t[e+2+32]=t[e+0+64]=s+r+1>>1,t[e+1+0]=ge(i,n,s),t[e+3+0]=t[e+1+32]=ge(n,s,r),t[e+3+32]=t[e+1+64]=ge(s,r,r),t[e+3+64]=t[e+2+64]=t[e+0+96]=t[e+1+96]=t[e+2+96]=t[e+3+96]=r}function xe(t,e){var i=t[e-1+0],n=t[e-1+32],s=t[e-1+64],r=t[e-1+96],a=t[e-1-32],o=t[e+0-32],l=t[e+1-32],h=t[e+2-32];t[e+0+0]=t[e+2+32]=i+a+1>>1,t[e+0+32]=t[e+2+64]=n+i+1>>1,t[e+0+64]=t[e+2+96]=s+n+1>>1,t[e+0+96]=r+s+1>>1,t[e+3+0]=ge(o,l,h),t[e+2+0]=ge(a,o,l),t[e+1+0]=t[e+3+32]=ge(i,a,o),t[e+1+32]=t[e+3+64]=ge(n,i,a),t[e+1+64]=t[e+3+96]=ge(s,n,i),t[e+1+96]=ge(r,s,n)}function be(t,e){var i;for(i=0;8>i;++i)Ge(t,e+32*i,t,e-32,8)}function ve(t,e){var i;for(i=0;8>i;++i)Ne(t,e,t[e-1],8),e+=32}function Ee(t,e,i){var n;for(n=0;8>n;++n)Ne(e,i+32*n,t,8)}function Ie(t,e){var i,n=8;for(i=0;8>i;++i)n+=t[e+i-32]+t[e-1+32*i];Ee(n>>4,t,e)}function Ce(t,e){var i,n=4;for(i=0;8>i;++i)n+=t[e+i-32];Ee(n>>3,t,e)}function Ae(t,e){var i,n=4;for(i=0;8>i;++i)n+=t[e-1+32*i];Ee(n>>3,t,e)}function Pe(t,e){Ee(128,t,e)}function Le(t,e,i){var n=t[e-i],s=t[e+0],r=3*(s-n)+Rn[1020+t[e-2*i]-t[e+i]],a=kn[112+(r+4>>3)];t[e-i]=Dn[255+n+kn[112+(r+3>>3)]],t[e+0]=Dn[255+s-a]}function Re(t,e,i,n){var s=t[e+0],r=t[e+i];return Vn[255+t[e-2*i]-t[e-i]]>n||Vn[255+r-s]>n}function ke(t,e,i,n){return 4*Vn[255+t[e-i]-t[e+0]]+Vn[255+t[e-2*i]-t[e+i]]<=n}function De(t,e,i,n,s){var r=t[e-3*i],a=t[e-2*i],o=t[e-i],l=t[e+0],h=t[e+i],c=t[e+2*i],u=t[e+3*i];return 4*Vn[255+o-l]+Vn[255+a-h]>n?0:Vn[255+t[e-4*i]-r]<=s&&Vn[255+r-a]<=s&&Vn[255+a-o]<=s&&Vn[255+u-c]<=s&&Vn[255+c-h]<=s&&Vn[255+h-l]<=s}function Ve(t,e,i,n){var s=2*n+1;for(n=0;16>n;++n)ke(t,e+n,i,s)&&Le(t,e+n,i)}function Oe(t,e,i,n){var s=2*n+1;for(n=0;16>n;++n)ke(t,e+n*i,1,s)&&Le(t,e+n*i,1)}function Ye(t,e,i,n){var s;for(s=3;0<s;--s)Ve(t,e+=4*i,i,n)}function $e(t,e,i,n){var s;for(s=3;0<s;--s)Oe(t,e+=4,i,n)}function Ue(t,e,i,n,s,r,a,o){for(r=2*r+1;0<s--;){if(De(t,e,i,r,a))if(Re(t,e,i,o))Le(t,e,i);else{var l=t,h=e,c=i,u=l[h-2*c],d=l[h-c],g=l[h+0],f=l[h+c],m=l[h+2*c],p=27*(T=Rn[1020+3*(g-d)+Rn[1020+u-f]])+63>>7,_=18*T+63>>7,T=9*T+63>>7;l[h-3*c]=Dn[255+l[h-3*c]+T],l[h-2*c]=Dn[255+u+_],l[h-c]=Dn[255+d+p],l[h+0]=Dn[255+g-p],l[h+c]=Dn[255+f-_],l[h+2*c]=Dn[255+m-T]}e+=n}}function je(t,e,i,n,s,r,a,o){for(r=2*r+1;0<s--;){if(De(t,e,i,r,a))if(Re(t,e,i,o))Le(t,e,i);else{var l=t,h=e,c=i,u=l[h-c],d=l[h+0],g=l[h+c],f=kn[112+((m=3*(d-u))+4>>3)],m=kn[112+(m+3>>3)],p=f+1>>1;l[h-2*c]=Dn[255+l[h-2*c]+p],l[h-c]=Dn[255+u+m],l[h+0]=Dn[255+d-f],l[h+c]=Dn[255+g-p]}e+=n}}function ze(t,e,i,n,s,r){Ue(t,e,i,1,16,n,s,r)}function Xe(t,e,i,n,s,r){Ue(t,e,1,i,16,n,s,r)}function Ke(t,e,i,n,s,r){var a;for(a=3;0<a;--a)je(t,e+=4*i,i,1,16,n,s,r)}function Je(t,e,i,n,s,r){var a;for(a=3;0<a;--a)je(t,e+=4,1,i,16,n,s,r)}function qe(t,e,i,n,s,r,a,o){Ue(t,e,s,1,8,r,a,o),Ue(i,n,s,1,8,r,a,o)}function Ze(t,e,i,n,s,r,a,o){Ue(t,e,1,s,8,r,a,o),Ue(i,n,1,s,8,r,a,o)}function Qe(t,e,i,n,s,r,a,o){je(t,e+4*s,s,1,8,r,a,o),je(i,n+4*s,s,1,8,r,a,o)}function ti(t,e,i,n,s,r,a,o){je(t,e+4,1,s,8,r,a,o),je(i,n+4,1,s,8,r,a,o)}function ei(){this.ba=new Z,this.ec=[],this.cc=[],this.Mc=[],this.Dc=this.Nc=this.dc=this.fc=0,this.Oa=new tt,this.memory=0,this.Ib="OutputFunc",this.Jb="OutputAlphaFunc",this.Nd="OutputRowFunc"}function ii(){this.data=[],this.offset=this.kd=this.ha=this.w=0,this.na=[],this.xa=this.gb=this.Ja=this.Sa=this.P=0}function ni(){this.nc=this.Ea=this.b=this.hc=0,this.K=[],this.w=0}function si(){this.ua=0,this.Wa=new C,this.vb=new C,this.md=this.xc=this.wc=0,this.vc=[],this.Wb=0,this.Ya=new r,this.yc=new n}function ri(){this.xb=this.a=0,this.l=new Gt,this.ca=new Z,this.V=[],this.Ba=0,this.Ta=[],this.Ua=0,this.m=new g,this.Pb=0,this.wd=new g,this.Ma=this.$=this.C=this.i=this.c=this.xd=0,this.s=new si,this.ab=0,this.gc=We(4,ni),this.Oc=0}function ai(){this.Lc=this.Z=this.$a=this.i=this.c=0,this.l=new Gt,this.ic=0,this.ca=[],this.tb=0,this.qd=null,this.rd=0}function oi(t,e,i,n,s,r,a){for(t=null==t?0:t[e+0],e=0;e<a;++e)s[r+e]=t+i[n+e]&255,t=s[r+e]}function li(t,e,i,n,s,r,a){var o;if(null==t)oi(null,null,i,n,s,r,a);else for(o=0;o<a;++o)s[r+o]=t[e+o]+i[n+o]&255}function hi(t,e,i,n,s,r,a){if(null==t)oi(null,null,i,n,s,r,a);else{var o,l=t[e+0],h=l,c=l;for(o=0;o<a;++o)h=c+(l=t[e+o])-h,c=i[n+o]+(-256&h?0>h?0:255:h)&255,h=l,s[r+o]=c}}function ci(t,e,i,n){var s=e.width,r=e.o;if(Me(null!=t&&null!=e),0>i||0>=n||i+n>r)return null;if(!t.Cc){if(null==t.ga){var a;if(t.ga=new ai,(a=null==t.ga)||(a=e.width*e.o,Me(0==t.Gb.length),t.Gb=Be(a),t.Uc=0,null==t.Gb?a=0:(t.mb=t.Gb,t.nb=t.Uc,t.rc=null,a=1),a=!a),!a){a=t.ga;var o=t.Fa,l=t.P,c=t.qc,u=t.mb,d=t.nb,g=l+1,f=c-1,p=a.l;if(Me(null!=o&&null!=u&&null!=e),ms[0]=null,ms[1]=oi,ms[2]=li,ms[3]=hi,a.ca=u,a.tb=d,a.c=e.width,a.i=e.height,Me(0<a.c&&0<a.i),1>=c)e=0;else if(a.$a=o[l+0]>>0&3,a.Z=o[l+0]>>2&3,a.Lc=o[l+0]>>4&3,l=o[l+0]>>6&3,0>a.$a||1<a.$a||4<=a.Z||1<a.Lc||l)e=0;else if(p.put=rt,p.ac=st,p.bc=at,p.ma=a,p.width=e.width,p.height=e.height,p.Da=e.Da,p.v=e.v,p.va=e.va,p.j=e.j,p.o=e.o,a.$a)t:{Me(1==a.$a),e=wt();e:for(;;){if(null==e){e=0;break t}if(Me(null!=a),a.mc=e,e.c=a.c,e.i=a.i,e.l=a.l,e.l.ma=a,e.l.width=a.c,e.l.height=a.i,e.a=0,h(e.m,o,g,f),!St(a.c,a.i,1,e,null))break e;if(1==e.ab&&3==e.gc[0].hc&&mt(e.s)?(a.ic=1,o=e.c*e.i,e.Ta=null,e.Ua=0,e.V=Be(o),e.Ba=0,null==e.V?(e.a=1,e=0):e=1):(a.ic=0,e=xt(e,a.c)),!e)break e;e=1;break t}a.mc=null,e=0}else e=f>=a.c*a.i;a=!e}if(a)return null;1!=t.ga.Lc?t.Ga=0:n=r-i}Me(null!=t.ga),Me(i+n<=r);t:{if(e=(o=t.ga).c,r=o.l.o,0==o.$a){if(g=t.rc,f=t.Vc,p=t.Fa,l=t.P+1+i*e,c=t.mb,u=t.nb+i*e,Me(l<=t.P+t.qc),0!=o.Z)for(Me(null!=ms[o.Z]),a=0;a<n;++a)ms[o.Z](g,f,p,l,c,u,e),g=c,f=u,u+=e,l+=e;else for(a=0;a<n;++a)Ge(c,u,p,l,e),g=c,f=u,u+=e,l+=e;t.rc=g,t.Vc=f}else{if(Me(null!=o.mc),e=i+n,Me(null!=(a=o.mc)),Me(e<=a.i),a.C>=e)e=1;else if(o.ic||mi(),o.ic){o=a.V,g=a.Ba,f=a.c;var T=a.i,y=(p=1,l=a.$/f,c=a.$%f,u=a.m,d=a.s,a.$),w=f*T,S=f*e,x=d.wc,b=y<S?dt(d,c,l):null;Me(y<=w),Me(e<=T),Me(mt(d));e:for(;;){for(;!u.h&&y<S;){if(c&x||(b=dt(d,c,l)),Me(null!=b),_(u),256>(T=ct(b.G[0],b.H[0],u)))o[g+y]=T,++y,++c>=f&&(c=0,++l<=e&&!(l%16)&&_t(a,l));else{if(!(280>T)){p=0;break e}T=lt(T-256,u);var v,E=ct(b.G[4],b.H[4],u);if(_(u),!(y>=(E=ht(f,E=lt(E,u)))&&w-y>=T)){p=0;break e}for(v=0;v<T;++v)o[g+y+v]=o[g+y+v-E];for(y+=T,c+=T;c>=f;)c-=f,++l<=e&&!(l%16)&&_t(a,l);y<S&&c&x&&(b=dt(d,c,l))}Me(u.h==m(u))}_t(a,l>e?e:l);break e}!p||u.h&&y<w?(p=0,a.a=u.h?5:3):a.$=y,e=p}else e=Tt(a,a.V,a.Ba,a.c,a.i,e,bt);if(!e){n=0;break t}}i+n>=r&&(t.Cc=1),n=1}if(!n)return null;if(t.Cc&&(null!=(n=t.ga)&&(n.mc=null),t.ga=null,0<t.Ga))return alert("todo:WebPDequantizeLevels"),null}return t.nb+i*s}function ui(t,e,i,n,s,r){for(;0<s--;){var a,o=t,l=e+(i?1:0),h=t,c=e+(i?0:3);for(a=0;a<n;++a){var u=h[c+4*a];255!=u&&(u*=32897,o[l+4*a+0]=o[l+4*a+0]*u>>23,o[l+4*a+1]=o[l+4*a+1]*u>>23,o[l+4*a+2]=o[l+4*a+2]*u>>23)}e+=r}}function di(t,e,i,n,s){for(;0<n--;){var r;for(r=0;r<i;++r){var a=t[e+2*r+0],o=15&(h=t[e+2*r+1]),l=4369*o,h=(240&h|h>>4)*l>>16;t[e+2*r+0]=(240&a|a>>4)*l>>16&240|(15&a|a<<4)*l>>16>>4&15,t[e+2*r+1]=240&h|o}e+=s}}function gi(t,e,i,n,s,r,a,o){var l,h,c=255;for(h=0;h<s;++h){for(l=0;l<n;++l){var u=t[e+l];r[a+4*l]=u,c&=u}e+=i,a+=o}return 255!=c}function fi(t,e,i,n,s){var r;for(r=0;r<s;++r)i[n+r]=t[e+r]>>8}function mi(){xn=ui,bn=di,vn=gi,En=fi}function pi(t,e,i){self[t]=function(t,n,s,r,a,o,l,h,c,u,d,g,f,m,p,_,T){var y,w=T-1>>1,S=a[o+0]|l[h+0]<<16,x=c[u+0]|d[g+0]<<16;Me(null!=t);var b=3*S+x+131074>>2;for(e(t[n+0],255&b,b>>16,f,m),null!=s&&(b=3*x+S+131074>>2,e(s[r+0],255&b,b>>16,p,_)),y=1;y<=w;++y){var v=a[o+y]|l[h+y]<<16,E=c[u+y]|d[g+y]<<16,I=S+v+x+E+524296,C=I+2*(v+x)>>3;b=C+S>>1,S=(I=I+2*(S+E)>>3)+v>>1,e(t[n+2*y-1],255&b,b>>16,f,m+(2*y-1)*i),e(t[n+2*y-0],255&S,S>>16,f,m+(2*y-0)*i),null!=s&&(b=I+x>>1,S=C+E>>1,e(s[r+2*y-1],255&b,b>>16,p,_+(2*y-1)*i),e(s[r+2*y+0],255&S,S>>16,p,_+(2*y+0)*i)),S=v,x=E}1&T||(b=3*S+x+131074>>2,e(t[n+T-1],255&b,b>>16,f,m+(T-1)*i),null!=s&&(b=3*x+S+131074>>2,e(s[r+T-1],255&b,b>>16,p,_+(T-1)*i)))}}function _i(){ps[On]=_s,ps[Mn]=ys,ps[Fn]=Ts,ps[Gn]=ws,ps[Nn]=Ss,ps[Bn]=xs,ps[Wn]=bs,ps[Hn]=ys,ps[Yn]=ws,ps[$n]=Ss,ps[Un]=xs}function Ti(t){return t&~Ps?0>t?0:255:t>>As}function yi(t,e){return Ti((19077*t>>8)+(26149*e>>8)-14234)}function wi(t,e,i){return Ti((19077*t>>8)-(6419*e>>8)-(13320*i>>8)+8708)}function Si(t,e){return Ti((19077*t>>8)+(33050*e>>8)-17685)}function xi(t,e,i,n,s){n[s+0]=yi(t,i),n[s+1]=wi(t,e,i),n[s+2]=Si(t,e)}function bi(t,e,i,n,s){n[s+0]=Si(t,e),n[s+1]=wi(t,e,i),n[s+2]=yi(t,i)}function vi(t,e,i,n,s){var r=wi(t,e,i);e=r<<3&224|Si(t,e)>>3,n[s+0]=248&yi(t,i)|r>>5,n[s+1]=e}function Ei(t,e,i,n,s){var r=240&Si(t,e)|15;n[s+0]=240&yi(t,i)|wi(t,e,i)>>4,n[s+1]=r}function Ii(t,e,i,n,s){n[s+0]=255,xi(t,e,i,n,s+1)}function Ci(t,e,i,n,s){bi(t,e,i,n,s),n[s+3]=255}function Ai(t,e,i,n,s){xi(t,e,i,n,s),n[s+3]=255}function Ft(t,e){return 0>t?0:t>e?e:t}function Pi(t,e,i){self[t]=function(t,n,s,r,a,o,l,h,c){for(var u=h+(-2&c)*i;h!=u;)e(t[n+0],s[r+0],a[o+0],l,h),e(t[n+1],s[r+0],a[o+0],l,h+i),n+=2,++r,++o,h+=2*i;1&c&&e(t[n+0],s[r+0],a[o+0],l,h)}}function Li(t,e,i){return 0==i?0==t?0==e?6:5:0==e?4:0:i}function Ri(t,e,i,n,s){switch(t>>>30){case 3:rn(e,i,n,s,0);break;case 2:an(e,i,n,s);break;case 1:ln(e,i,n,s)}}function ki(t,e){var i,n,s=e.M,r=e.Nb,a=t.oc,o=t.pc+40,l=t.oc,h=t.pc+584,c=t.oc,u=t.pc+600;for(i=0;16>i;++i)a[o+32*i-1]=129;for(i=0;8>i;++i)l[h+32*i-1]=129,c[u+32*i-1]=129;for(0<s?a[o-1-32]=l[h-1-32]=c[u-1-32]=129:(Ne(a,o-32-1,127,21),Ne(l,h-32-1,127,9),Ne(c,u-32-1,127,9)),n=0;n<t.za;++n){var d=e.ya[e.aa+n];if(0<n){for(i=-1;16>i;++i)Ge(a,o+32*i-4,a,o+32*i+12,4);for(i=-1;8>i;++i)Ge(l,h+32*i-4,l,h+32*i+4,4),Ge(c,u+32*i-4,c,u+32*i+4,4)}var g=t.Gd,f=t.Hd+n,m=d.ad,p=d.Hc;if(0<s&&(Ge(a,o-32,g[f].y,0,16),Ge(l,h-32,g[f].f,0,8),Ge(c,u-32,g[f].ea,0,8)),d.Za){var _=a,T=o-32+16;for(0<s&&(n>=t.za-1?Ne(_,T,g[f].y[15],4):Ge(_,T,g[f+1].y,0,4)),i=0;4>i;i++)_[T+128+i]=_[T+256+i]=_[T+384+i]=_[T+0+i];for(i=0;16>i;++i,p<<=2)_=a,T=o+Fs[i],us[d.Ob[i]](_,T),Ri(p,m,16*+i,_,T)}else if(_=Li(n,s,d.Ob[0]),cs[_](a,o),0!=p)for(i=0;16>i;++i,p<<=2)Ri(p,m,16*+i,a,o+Fs[i]);for(i=d.Gc,_=Li(n,s,d.Dd),ds[_](l,h),ds[_](c,u),p=m,_=l,T=h,255&(d=i>>0)&&(170&d?on(p,256,_,T):hn(p,256,_,T)),d=c,p=u,255&(i>>=8)&&(170&i?on(m,320,d,p):hn(m,320,d,p)),s<t.Ub-1&&(Ge(g[f].y,0,a,o+480,16),Ge(g[f].f,0,l,h+224,8),Ge(g[f].ea,0,c,u+224,8)),i=8*r*t.B,g=t.sa,f=t.ta+16*n+16*r*t.R,m=t.qa,d=t.ra+8*n+i,p=t.Ha,_=t.Ia+8*n+i,i=0;16>i;++i)Ge(g,f+i*t.R,a,o+32*i,16);for(i=0;8>i;++i)Ge(m,d+i*t.B,l,h+32*i,8),Ge(p,_+i*t.B,c,u+32*i,8)}}function Di(t,e,i,n,s,r,a,o,l){var c=[0],u=[0],d=0,f=null!=l?l.kd:0,m=null!=l?l:new ii;if(null==t||12>i)return 7;m.data=t,m.w=e,m.ha=i,e=[e],i=[i],m.gb=[m.gb];t:{var p=e,_=i,T=m.gb;if(Me(null!=t),Me(null!=_),Me(null!=T),T[0]=0,12<=_[0]&&!Fe(t,p[0],"RIFF")){if(Fe(t,p[0]+8,"WEBP")){T=3;break t}var y=v(t,p[0]+4);if(12>y||4294967286<y){T=3;break t}if(f&&y>_[0]-8){T=7;break t}T[0]=y,p[0]+=12,_[0]-=12}T=0}if(0!=T)return T;for(y=0<m.gb[0],i=i[0];;){t:{var w=t;_=e,T=i;var S=c,x=u,E=p=[0];if((A=d=[d])[0]=0,8>T[0])T=7;else{if(!Fe(w,_[0],"VP8X")){if(10!=v(w,_[0]+4)){T=3;break t}if(18>T[0]){T=7;break t}var I=v(w,_[0]+8),C=1+b(w,_[0]+12);if(2147483648<=C*(w=1+b(w,_[0]+15))){T=3;break t}null!=E&&(E[0]=I),null!=S&&(S[0]=C),null!=x&&(x[0]=w),_[0]+=18,T[0]-=18,A[0]=1}T=0}}if(d=d[0],p=p[0],0!=T)return T;if(_=!!(2&p),!y&&d)return 3;if(null!=r&&(r[0]=!!(16&p)),null!=a&&(a[0]=_),null!=o&&(o[0]=0),a=c[0],p=u[0],d&&_&&null==l){T=0;break}if(4>i){T=7;break}if(y&&d||!y&&!d&&!Fe(t,e[0],"ALPH")){i=[i],m.na=[m.na],m.P=[m.P],m.Sa=[m.Sa];t:{I=t,T=e,y=i;var A=m.gb;S=m.na,x=m.P,E=m.Sa;C=22,Me(null!=I),Me(null!=y),w=T[0];var P=y[0];for(Me(null!=S),Me(null!=E),S[0]=null,x[0]=null,E[0]=0;;){if(T[0]=w,y[0]=P,8>P){T=7;break t}var L=v(I,w+4);if(4294967286<L){T=3;break t}var R=8+L+1&-2;if(C+=R,0<A&&C>A){T=3;break t}if(!Fe(I,w,"VP8 ")||!Fe(I,w,"VP8L")){T=0;break t}if(P[0]<R){T=7;break t}Fe(I,w,"ALPH")||(S[0]=I,x[0]=w+8,E[0]=L),w+=R,P-=R}}if(i=i[0],m.na=m.na[0],m.P=m.P[0],m.Sa=m.Sa[0],0!=T)break}i=[i],m.Ja=[m.Ja],m.xa=[m.xa];t:if(A=t,T=e,y=i,S=m.gb[0],x=m.Ja,E=m.xa,I=T[0],w=!Fe(A,I,"VP8 "),C=!Fe(A,I,"VP8L"),Me(null!=A),Me(null!=y),Me(null!=x),Me(null!=E),8>y[0])T=7;else{if(w||C){if(A=v(A,I+4),12<=S&&A>S-12){T=3;break t}if(f&&A>y[0]-8){T=7;break t}x[0]=A,T[0]+=8,y[0]-=8,E[0]=C}else E[0]=5<=y[0]&&47==A[I+0]&&!(A[I+4]>>5),x[0]=y[0];T=0}if(i=i[0],m.Ja=m.Ja[0],m.xa=m.xa[0],e=e[0],0!=T)break;if(4294967286<m.Ja)return 3;if(null==o||_||(o[0]=m.xa?2:1),a=[a],p=[p],m.xa){if(5>i){T=7;break}o=a,f=p,_=r,null==t||5>i?t=0:5<=i&&47==t[e+0]&&!(t[e+4]>>5)?(y=[0],A=[0],S=[0],h(x=new g,t,e,i),ot(x,y,A,S)?(null!=o&&(o[0]=y[0]),null!=f&&(f[0]=A[0]),null!=_&&(_[0]=S[0]),t=1):t=0):t=0}else{if(10>i){T=7;break}o=p,null==t||10>i||!Wt(t,e+3,i-3)?t=0:(f=t[e+0]|t[e+1]<<8|t[e+2]<<16,_=16383&(t[e+7]<<8|t[e+6]),t=16383&(t[e+9]<<8|t[e+8]),1&f||3<(f>>1&7)||!(f>>4&1)||f>>5>=m.Ja||!_||!t?t=0:(a&&(a[0]=_),o&&(o[0]=t),t=1))}if(!t)return 3;if(a=a[0],p=p[0],d&&(c[0]!=a||u[0]!=p))return 3;null!=l&&(l[0]=m,l.offset=e-l.w,Me(4294967286>e-l.w),Me(l.offset==l.ha-i));break}return 0==T||7==T&&d&&null==l?(null!=r&&(r[0]|=null!=m.na&&0<m.na.length),null!=n&&(n[0]=a),null!=s&&(s[0]=p),0):T}function Vi(t,e,i){var n=e.width,s=e.height,r=0,a=0,o=n,l=s;if(e.Da=null!=t&&0<t.Da,e.Da&&(o=t.cd,l=t.bd,r=t.v,a=t.j,11>i||(r&=-2,a&=-2),0>r||0>a||0>=o||0>=l||r+o>n||a+l>s))return 0;if(e.v=r,e.j=a,e.va=r+o,e.o=a+l,e.U=o,e.T=l,e.da=null!=t&&0<t.da,e.da){if(!A(o,l,i=[t.ib],r=[t.hb]))return 0;e.ib=i[0],e.hb=r[0]}return e.ob=null!=t&&t.ob,e.Kb=null==t||!t.Sd,e.da&&(e.ob=e.ib<3*n/4&&e.hb<3*s/4,e.Kb=0),1}function Oi(t){if(null==t)return 2;if(11>t.S){var e=t.f.RGBA;e.fb+=(t.height-1)*e.A,e.A=-e.A}else e=t.f.kb,t=t.height,e.O+=(t-1)*e.fa,e.fa=-e.fa,e.N+=(t-1>>1)*e.Ab,e.Ab=-e.Ab,e.W+=(t-1>>1)*e.Db,e.Db=-e.Db,null!=e.F&&(e.J+=(t-1)*e.lb,e.lb=-e.lb);return 0}function Mi(t,e,i,n){if(null==n||0>=t||0>=e)return 2;if(null!=i){if(i.Da){var s=i.cd,r=i.bd,a=-2&i.v,o=-2&i.j;if(0>a||0>o||0>=s||0>=r||a+s>t||o+r>e)return 2;t=s,e=r}if(i.da){if(!A(t,e,s=[i.ib],r=[i.hb]))return 2;t=s[0],e=r[0]}}n.width=t,n.height=e;t:{var l=n.width,h=n.height;if(t=n.S,0>=l||0>=h||!(t>=On&&13>t))t=2;else{if(0>=n.Rd&&null==n.sd){a=r=s=e=0;var c=(o=l*Ws[t])*h;if(11>t||(r=(h+1)/2*(e=(l+1)/2),12==t&&(a=(s=l)*h)),null==(h=Be(c+2*r+a))){t=1;break t}n.sd=h,11>t?((l=n.f.RGBA).eb=h,l.fb=0,l.A=o,l.size=c):((l=n.f.kb).y=h,l.O=0,l.fa=o,l.Fd=c,l.f=h,l.N=0+c,l.Ab=e,l.Cd=r,l.ea=h,l.W=0+c+r,l.Db=e,l.Ed=r,12==t&&(l.F=h,l.J=0+c+2*r),l.Tc=a,l.lb=s)}if(e=1,s=n.S,r=n.width,a=n.height,s>=On&&13>s)if(11>s)t=n.f.RGBA,e&=(o=Math.abs(t.A))*(a-1)+r<=t.size,e&=o>=r*Ws[s],e&=null!=t.eb;else{t=n.f.kb,o=(r+1)/2,c=(a+1)/2,l=Math.abs(t.fa);h=Math.abs(t.Ab);var u=Math.abs(t.Db),d=Math.abs(t.lb),g=d*(a-1)+r;e&=l*(a-1)+r<=t.Fd,e&=h*(c-1)+o<=t.Cd,e=(e&=u*(c-1)+o<=t.Ed)&l>=r&h>=o&u>=o,e&=null!=t.y,e&=null!=t.f,e&=null!=t.ea,12==s&&(e&=d>=r,e&=g<=t.Tc,e&=null!=t.F)}else e=0;t=e?0:2}}return 0!=t||null!=i&&i.fd&&(t=Oi(n)),t}var Fi=64,Gi=[0,1,3,7,15,31,63,127,255,511,1023,2047,4095,8191,16383,32767,65535,131071,262143,524287,1048575,2097151,4194303,8388607,16777215],Ni=24,Bi=32,Wi=8,Hi=[0,0,1,1,2,2,2,2,3,3,3,3,3,3,3,3,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7];R("Predictor0","PredictorAdd0"),self.Predictor0=function(){return 4278190080},self.Predictor1=function(t){return t},self.Predictor2=function(t,e,i){return e[i+0]},self.Predictor3=function(t,e,i){return e[i+1]},self.Predictor4=function(t,e,i){return e[i-1]},self.Predictor5=function(t,e,i){return D(D(t,e[i+1]),e[i+0])},self.Predictor6=function(t,e,i){return D(t,e[i-1])},self.Predictor7=function(t,e,i){return D(t,e[i+0])},self.Predictor8=function(t,e,i){return D(e[i-1],e[i+0])},self.Predictor9=function(t,e,i){return D(e[i+0],e[i+1])},self.Predictor10=function(t,e,i){return D(D(t,e[i-1]),D(e[i+0],e[i+1]))},self.Predictor11=function(t,e,i){var n=e[i+0];return 0>=M(n>>24&255,t>>24&255,(e=e[i-1])>>24&255)+M(n>>16&255,t>>16&255,e>>16&255)+M(n>>8&255,t>>8&255,e>>8&255)+M(255&n,255&t,255&e)?n:t},self.Predictor12=function(t,e,i){var n=e[i+0];return(V((t>>24&255)+(n>>24&255)-((e=e[i-1])>>24&255))<<24|V((t>>16&255)+(n>>16&255)-(e>>16&255))<<16|V((t>>8&255)+(n>>8&255)-(e>>8&255))<<8|V((255&t)+(255&n)-(255&e)))>>>0},self.Predictor13=function(t,e,i){var n=e[i-1];return(O((t=D(t,e[i+0]))>>24&255,n>>24&255)<<24|O(t>>16&255,n>>16&255)<<16|O(t>>8&255,n>>8&255)<<8|O(t>>0&255,n>>0&255))>>>0};var Yi=self.PredictorAdd0;self.PredictorAdd1=F,R("Predictor2","PredictorAdd2"),R("Predictor3","PredictorAdd3"),R("Predictor4","PredictorAdd4"),R("Predictor5","PredictorAdd5"),R("Predictor6","PredictorAdd6"),R("Predictor7","PredictorAdd7"),R("Predictor8","PredictorAdd8"),R("Predictor9","PredictorAdd9"),R("Predictor10","PredictorAdd10"),R("Predictor11","PredictorAdd11"),R("Predictor12","PredictorAdd12"),R("Predictor13","PredictorAdd13");var $i=self.PredictorAdd2;W("ColorIndexInverseTransform","MapARGB","32b",(function(t){return t>>8&255}),(function(t){return t})),W("VP8LColorIndexInverseTransformAlpha","MapAlpha","8b",(function(t){return t}),(function(t){return t>>8&255}));var Ui,ji=self.ColorIndexInverseTransform,zi=self.MapARGB,Xi=self.VP8LColorIndexInverseTransformAlpha,Ki=self.MapAlpha,Ji=self.VP8LPredictorsAdd=[];Ji.length=16,(self.VP8LPredictors=[]).length=16,(self.VP8LPredictorsAdd_C=[]).length=16,(self.VP8LPredictors_C=[]).length=16;var qi,Zi,Qi,tn,en,nn,sn,rn,an,on,ln,hn,cn,un,dn,gn,fn,mn,pn,_n,Tn,yn,wn,Sn,xn,bn,vn,En,In=Be(511),Cn=Be(2041),An=Be(225),Pn=Be(767),Ln=0,Rn=Cn,kn=An,Dn=Pn,Vn=In,On=0,Mn=1,Fn=2,Gn=3,Nn=4,Bn=5,Wn=6,Hn=7,Yn=8,$n=9,Un=10,jn=[2,3,7],zn=[3,3,11],Xn=[280,256,256,256,40],Kn=[0,1,1,1,0],Jn=[17,18,0,1,2,3,4,5,16,6,7,8,9,10,11,12,13,14,15],qn=[24,7,23,25,40,6,39,41,22,26,38,42,56,5,55,57,21,27,54,58,37,43,72,4,71,73,20,28,53,59,70,74,36,44,88,69,75,52,60,3,87,89,19,29,86,90,35,45,68,76,85,91,51,61,104,2,103,105,18,30,102,106,34,46,84,92,67,77,101,107,50,62,120,1,119,121,83,93,17,31,100,108,66,78,118,122,33,47,117,123,49,63,99,109,82,94,0,116,124,65,79,16,32,98,110,48,115,125,81,95,64,114,126,97,111,80,113,127,96,112],Zn=[2954,2956,2958,2962,2970,2986,3018,3082,3212,3468,3980,5004],Qn=8,ts=[4,5,6,7,8,9,10,10,11,12,13,14,15,16,17,17,18,19,20,20,21,21,22,22,23,23,24,25,25,26,27,28,29,30,31,32,33,34,35,36,37,37,38,39,40,41,42,43,44,45,46,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,76,77,78,79,80,81,82,83,84,85,86,87,88,89,91,93,95,96,98,100,101,102,104,106,108,110,112,114,116,118,122,124,126,128,130,132,134,136,138,140,143,145,148,151,154,157],es=[4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,60,62,64,66,68,70,72,74,76,78,80,82,84,86,88,90,92,94,96,98,100,102,104,106,108,110,112,114,116,119,122,125,128,131,134,137,140,143,146,149,152,155,158,161,164,167,170,173,177,181,185,189,193,197,201,205,209,213,217,221,225,229,234,239,245,249,254,259,264,269,274,279,284],is=null,ns=[[173,148,140,0],[176,155,140,135,0],[180,157,141,134,130,0],[254,254,243,230,196,177,153,140,133,130,129,0]],ss=[0,1,4,8,5,2,3,6,9,12,13,10,7,11,14,15],rs=[-0,1,-1,2,-2,3,4,6,-3,5,-4,-5,-6,7,-7,8,-8,-9],as=[[[[128,128,128,128,128,128,128,128,128,128,128],[128,128,128,128,128,128,128,128,128,128,128],[128,128,128,128,128,128,128,128,128,128,128]],[[253,136,254,255,228,219,128,128,128,128,128],[189,129,242,255,227,213,255,219,128,128,128],[106,126,227,252,214,209,255,255,128,128,128]],[[1,98,248,255,236,226,255,255,128,128,128],[181,133,238,254,221,234,255,154,128,128,128],[78,134,202,247,198,180,255,219,128,128,128]],[[1,185,249,255,243,255,128,128,128,128,128],[184,150,247,255,236,224,128,128,128,128,128],[77,110,216,255,236,230,128,128,128,128,128]],[[1,101,251,255,241,255,128,128,128,128,128],[170,139,241,252,236,209,255,255,128,128,128],[37,116,196,243,228,255,255,255,128,128,128]],[[1,204,254,255,245,255,128,128,128,128,128],[207,160,250,255,238,128,128,128,128,128,128],[102,103,231,255,211,171,128,128,128,128,128]],[[1,152,252,255,240,255,128,128,128,128,128],[177,135,243,255,234,225,128,128,128,128,128],[80,129,211,255,194,224,128,128,128,128,128]],[[1,1,255,128,128,128,128,128,128,128,128],[246,1,255,128,128,128,128,128,128,128,128],[255,128,128,128,128,128,128,128,128,128,128]]],[[[198,35,237,223,193,187,162,160,145,155,62],[131,45,198,221,172,176,220,157,252,221,1],[68,47,146,208,149,167,221,162,255,223,128]],[[1,149,241,255,221,224,255,255,128,128,128],[184,141,234,253,222,220,255,199,128,128,128],[81,99,181,242,176,190,249,202,255,255,128]],[[1,129,232,253,214,197,242,196,255,255,128],[99,121,210,250,201,198,255,202,128,128,128],[23,91,163,242,170,187,247,210,255,255,128]],[[1,200,246,255,234,255,128,128,128,128,128],[109,178,241,255,231,245,255,255,128,128,128],[44,130,201,253,205,192,255,255,128,128,128]],[[1,132,239,251,219,209,255,165,128,128,128],[94,136,225,251,218,190,255,255,128,128,128],[22,100,174,245,186,161,255,199,128,128,128]],[[1,182,249,255,232,235,128,128,128,128,128],[124,143,241,255,227,234,128,128,128,128,128],[35,77,181,251,193,211,255,205,128,128,128]],[[1,157,247,255,236,231,255,255,128,128,128],[121,141,235,255,225,227,255,255,128,128,128],[45,99,188,251,195,217,255,224,128,128,128]],[[1,1,251,255,213,255,128,128,128,128,128],[203,1,248,255,255,128,128,128,128,128,128],[137,1,177,255,224,255,128,128,128,128,128]]],[[[253,9,248,251,207,208,255,192,128,128,128],[175,13,224,243,193,185,249,198,255,255,128],[73,17,171,221,161,179,236,167,255,234,128]],[[1,95,247,253,212,183,255,255,128,128,128],[239,90,244,250,211,209,255,255,128,128,128],[155,77,195,248,188,195,255,255,128,128,128]],[[1,24,239,251,218,219,255,205,128,128,128],[201,51,219,255,196,186,128,128,128,128,128],[69,46,190,239,201,218,255,228,128,128,128]],[[1,191,251,255,255,128,128,128,128,128,128],[223,165,249,255,213,255,128,128,128,128,128],[141,124,248,255,255,128,128,128,128,128,128]],[[1,16,248,255,255,128,128,128,128,128,128],[190,36,230,255,236,255,128,128,128,128,128],[149,1,255,128,128,128,128,128,128,128,128]],[[1,226,255,128,128,128,128,128,128,128,128],[247,192,255,128,128,128,128,128,128,128,128],[240,128,255,128,128,128,128,128,128,128,128]],[[1,134,252,255,255,128,128,128,128,128,128],[213,62,250,255,255,128,128,128,128,128,128],[55,93,255,128,128,128,128,128,128,128,128]],[[128,128,128,128,128,128,128,128,128,128,128],[128,128,128,128,128,128,128,128,128,128,128],[128,128,128,128,128,128,128,128,128,128,128]]],[[[202,24,213,235,186,191,220,160,240,175,255],[126,38,182,232,169,184,228,174,255,187,128],[61,46,138,219,151,178,240,170,255,216,128]],[[1,112,230,250,199,191,247,159,255,255,128],[166,109,228,252,211,215,255,174,128,128,128],[39,77,162,232,172,180,245,178,255,255,128]],[[1,52,220,246,198,199,249,220,255,255,128],[124,74,191,243,183,193,250,221,255,255,128],[24,71,130,219,154,170,243,182,255,255,128]],[[1,182,225,249,219,240,255,224,128,128,128],[149,150,226,252,216,205,255,171,128,128,128],[28,108,170,242,183,194,254,223,255,255,128]],[[1,81,230,252,204,203,255,192,128,128,128],[123,102,209,247,188,196,255,233,128,128,128],[20,95,153,243,164,173,255,203,128,128,128]],[[1,222,248,255,216,213,128,128,128,128,128],[168,175,246,252,235,205,255,255,128,128,128],[47,116,215,255,211,212,255,255,128,128,128]],[[1,121,236,253,212,214,255,255,128,128,128],[141,84,213,252,201,202,255,219,128,128,128],[42,80,160,240,162,185,255,205,128,128,128]],[[1,1,255,128,128,128,128,128,128,128,128],[244,1,255,128,128,128,128,128,128,128,128],[238,1,255,128,128,128,128,128,128,128,128]]]],os=[[[231,120,48,89,115,113,120,152,112],[152,179,64,126,170,118,46,70,95],[175,69,143,80,85,82,72,155,103],[56,58,10,171,218,189,17,13,152],[114,26,17,163,44,195,21,10,173],[121,24,80,195,26,62,44,64,85],[144,71,10,38,171,213,144,34,26],[170,46,55,19,136,160,33,206,71],[63,20,8,114,114,208,12,9,226],[81,40,11,96,182,84,29,16,36]],[[134,183,89,137,98,101,106,165,148],[72,187,100,130,157,111,32,75,80],[66,102,167,99,74,62,40,234,128],[41,53,9,178,241,141,26,8,107],[74,43,26,146,73,166,49,23,157],[65,38,105,160,51,52,31,115,128],[104,79,12,27,217,255,87,17,7],[87,68,71,44,114,51,15,186,23],[47,41,14,110,182,183,21,17,194],[66,45,25,102,197,189,23,18,22]],[[88,88,147,150,42,46,45,196,205],[43,97,183,117,85,38,35,179,61],[39,53,200,87,26,21,43,232,171],[56,34,51,104,114,102,29,93,77],[39,28,85,171,58,165,90,98,64],[34,22,116,206,23,34,43,166,73],[107,54,32,26,51,1,81,43,31],[68,25,106,22,64,171,36,225,114],[34,19,21,102,132,188,16,76,124],[62,18,78,95,85,57,50,48,51]],[[193,101,35,159,215,111,89,46,111],[60,148,31,172,219,228,21,18,111],[112,113,77,85,179,255,38,120,114],[40,42,1,196,245,209,10,25,109],[88,43,29,140,166,213,37,43,154],[61,63,30,155,67,45,68,1,209],[100,80,8,43,154,1,51,26,71],[142,78,78,16,255,128,34,197,171],[41,40,5,102,211,183,4,1,221],[51,50,17,168,209,192,23,25,82]],[[138,31,36,171,27,166,38,44,229],[67,87,58,169,82,115,26,59,179],[63,59,90,180,59,166,93,73,154],[40,40,21,116,143,209,34,39,175],[47,15,16,183,34,223,49,45,183],[46,17,33,183,6,98,15,32,183],[57,46,22,24,128,1,54,17,37],[65,32,73,115,28,128,23,128,205],[40,3,9,115,51,192,18,6,223],[87,37,9,115,59,77,64,21,47]],[[104,55,44,218,9,54,53,130,226],[64,90,70,205,40,41,23,26,57],[54,57,112,184,5,41,38,166,213],[30,34,26,133,152,116,10,32,134],[39,19,53,221,26,114,32,73,255],[31,9,65,234,2,15,1,118,73],[75,32,12,51,192,255,160,43,51],[88,31,35,67,102,85,55,186,85],[56,21,23,111,59,205,45,37,192],[55,38,70,124,73,102,1,34,98]],[[125,98,42,88,104,85,117,175,82],[95,84,53,89,128,100,113,101,45],[75,79,123,47,51,128,81,171,1],[57,17,5,71,102,57,53,41,49],[38,33,13,121,57,73,26,1,85],[41,10,67,138,77,110,90,47,114],[115,21,2,10,102,255,166,23,6],[101,29,16,10,85,128,101,196,26],[57,18,10,102,102,213,34,20,43],[117,20,15,36,163,128,68,1,26]],[[102,61,71,37,34,53,31,243,192],[69,60,71,38,73,119,28,222,37],[68,45,128,34,1,47,11,245,171],[62,17,19,70,146,85,55,62,70],[37,43,37,154,100,163,85,160,1],[63,9,92,136,28,64,32,201,85],[75,15,9,9,64,255,184,119,16],[86,6,28,5,64,255,25,248,1],[56,8,17,132,137,255,55,116,128],[58,15,20,82,135,57,26,121,40]],[[164,50,31,137,154,133,25,35,218],[51,103,44,131,131,123,31,6,158],[86,40,64,135,148,224,45,183,128],[22,26,17,131,240,154,14,1,209],[45,16,21,91,64,222,7,1,197],[56,21,39,155,60,138,23,102,213],[83,12,13,54,192,255,68,47,28],[85,26,85,85,128,128,32,146,171],[18,11,7,63,144,171,4,4,246],[35,27,10,146,174,171,12,26,128]],[[190,80,35,99,180,80,126,54,45],[85,126,47,87,176,51,41,20,32],[101,75,128,139,118,146,116,128,85],[56,41,15,176,236,85,37,9,62],[71,30,17,119,118,255,17,18,138],[101,38,60,138,55,70,43,26,142],[146,36,19,30,171,255,97,27,20],[138,45,61,62,219,1,81,188,64],[32,41,20,117,151,142,20,21,163],[112,19,12,61,195,128,48,4,24]]],ls=[[[[255,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]],[[176,246,255,255,255,255,255,255,255,255,255],[223,241,252,255,255,255,255,255,255,255,255],[249,253,253,255,255,255,255,255,255,255,255]],[[255,244,252,255,255,255,255,255,255,255,255],[234,254,254,255,255,255,255,255,255,255,255],[253,255,255,255,255,255,255,255,255,255,255]],[[255,246,254,255,255,255,255,255,255,255,255],[239,253,254,255,255,255,255,255,255,255,255],[254,255,254,255,255,255,255,255,255,255,255]],[[255,248,254,255,255,255,255,255,255,255,255],[251,255,254,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]],[[255,253,254,255,255,255,255,255,255,255,255],[251,254,254,255,255,255,255,255,255,255,255],[254,255,254,255,255,255,255,255,255,255,255]],[[255,254,253,255,254,255,255,255,255,255,255],[250,255,254,255,254,255,255,255,255,255,255],[254,255,255,255,255,255,255,255,255,255,255]],[[255,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]]],[[[217,255,255,255,255,255,255,255,255,255,255],[225,252,241,253,255,255,254,255,255,255,255],[234,250,241,250,253,255,253,254,255,255,255]],[[255,254,255,255,255,255,255,255,255,255,255],[223,254,254,255,255,255,255,255,255,255,255],[238,253,254,254,255,255,255,255,255,255,255]],[[255,248,254,255,255,255,255,255,255,255,255],[249,254,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]],[[255,253,255,255,255,255,255,255,255,255,255],[247,254,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]],[[255,253,254,255,255,255,255,255,255,255,255],[252,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]],[[255,254,254,255,255,255,255,255,255,255,255],[253,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]],[[255,254,253,255,255,255,255,255,255,255,255],[250,255,255,255,255,255,255,255,255,255,255],[254,255,255,255,255,255,255,255,255,255,255]],[[255,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]]],[[[186,251,250,255,255,255,255,255,255,255,255],[234,251,244,254,255,255,255,255,255,255,255],[251,251,243,253,254,255,254,255,255,255,255]],[[255,253,254,255,255,255,255,255,255,255,255],[236,253,254,255,255,255,255,255,255,255,255],[251,253,253,254,254,255,255,255,255,255,255]],[[255,254,254,255,255,255,255,255,255,255,255],[254,254,254,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]],[[255,254,255,255,255,255,255,255,255,255,255],[254,254,255,255,255,255,255,255,255,255,255],[254,255,255,255,255,255,255,255,255,255,255]],[[255,255,255,255,255,255,255,255,255,255,255],[254,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]],[[255,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]],[[255,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]],[[255,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]]],[[[248,255,255,255,255,255,255,255,255,255,255],[250,254,252,254,255,255,255,255,255,255,255],[248,254,249,253,255,255,255,255,255,255,255]],[[255,253,253,255,255,255,255,255,255,255,255],[246,253,253,255,255,255,255,255,255,255,255],[252,254,251,254,254,255,255,255,255,255,255]],[[255,254,252,255,255,255,255,255,255,255,255],[248,254,253,255,255,255,255,255,255,255,255],[253,255,254,254,255,255,255,255,255,255,255]],[[255,251,254,255,255,255,255,255,255,255,255],[245,251,254,255,255,255,255,255,255,255,255],[253,253,254,255,255,255,255,255,255,255,255]],[[255,251,253,255,255,255,255,255,255,255,255],[252,253,254,255,255,255,255,255,255,255,255],[255,254,255,255,255,255,255,255,255,255,255]],[[255,252,255,255,255,255,255,255,255,255,255],[249,255,254,255,255,255,255,255,255,255,255],[255,255,254,255,255,255,255,255,255,255,255]],[[255,255,253,255,255,255,255,255,255,255,255],[250,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]],[[255,255,255,255,255,255,255,255,255,255,255],[254,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]]]],hs=[0,1,2,3,6,4,5,6,6,6,6,6,6,6,6,7,0],cs=[],us=[],ds=[],gs=1,fs=2,ms=[],ps=[];pi("UpsampleRgbLinePair",xi,3),pi("UpsampleBgrLinePair",bi,3),pi("UpsampleRgbaLinePair",Ai,4),pi("UpsampleBgraLinePair",Ci,4),pi("UpsampleArgbLinePair",Ii,4),pi("UpsampleRgba4444LinePair",Ei,2),pi("UpsampleRgb565LinePair",vi,2);var _s=window.UpsampleRgbLinePair,Ts=window.UpsampleBgrLinePair,ys=window.UpsampleRgbaLinePair,ws=window.UpsampleBgraLinePair,Ss=window.UpsampleArgbLinePair,xs=window.UpsampleRgba4444LinePair,bs=window.UpsampleRgb565LinePair,vs=16,Es=1<<vs-1,Is=-227,Cs=482,As=6,Ps=(256<<As)-1,Ls=0,Rs=Be(256),ks=Be(256),Ds=Be(256),Vs=Be(256),Os=Be(Cs-Is),Ms=Be(Cs-Is);Pi("YuvToRgbRow",xi,3),Pi("YuvToBgrRow",bi,3),Pi("YuvToRgbaRow",Ai,4),Pi("YuvToBgraRow",Ci,4),Pi("YuvToArgbRow",Ii,4),Pi("YuvToRgba4444Row",Ei,2),Pi("YuvToRgb565Row",vi,2);var Fs=[0,4,8,12,128,132,136,140,256,260,264,268,384,388,392,396],Gs=[0,2,8],Ns=[8,7,6,4,4,2,2,2,1,1,1,1],Bs=1;this.WebPDecodeRGBA=function(t,e,i,n,s){var r=Mn,a=new ei,o=new Z;a.ba=o,o.S=r,o.width=[o.width],o.height=[o.height];var l=o.width,c=o.height,u=new Q;if(null==u||null==t)var d=2;else Me(null!=u),d=Di(t,e,i,u.width,u.height,u.Pd,u.Qd,u.format,null);if(0!=d?l=0:(null!=l&&(l[0]=u.width[0]),null!=c&&(c[0]=u.height[0]),l=1),l){o.width=o.width[0],o.height=o.height[0],null!=n&&(n[0]=o.width),null!=s&&(s[0]=o.height);t:{if(n=new Gt,(s=new ii).data=t,s.w=e,s.ha=i,s.kd=1,e=[0],Me(null!=s),(0==(t=Di(s.data,s.w,s.ha,null,null,null,e,null,s))||7==t)&&e[0]&&(t=4),0==(e=t)){if(Me(null!=a),n.data=s.data,n.w=s.w+s.offset,n.ha=s.ha-s.offset,n.put=rt,n.ac=st,n.bc=at,n.ma=a,s.xa){if(null==(t=wt())){a=1;break t}if(function(t,e){var i=[0],n=[0],s=[0];e:for(;;){if(null==t)return 0;if(null==e)return t.a=2,0;if(t.l=e,t.a=0,h(t.m,e.data,e.w,e.ha),!ot(t.m,i,n,s)){t.a=3;break e}if(t.xb=fs,e.width=i[0],e.height=n[0],!St(i[0],n[0],1,t,null))break e;return 1}return Me(0!=t.a),0}(t,n)){if(n=0==(e=Mi(n.width,n.height,a.Oa,a.ba))){e:{n=t;i:for(;;){if(null==n){n=0;break e}if(Me(null!=n.s.yc),Me(null!=n.s.Ya),Me(0<n.s.Wb),Me(null!=(i=n.l)),Me(null!=(s=i.ma)),0!=n.xb){if(n.ca=s.ba,n.tb=s.tb,Me(null!=n.ca),!Vi(s.Oa,i,Gn)){n.a=2;break i}if(!xt(n,i.width))break i;if(i.da)break i;if((i.da||K(n.ca.S))&&mi(),11>n.ca.S||(alert("todo:WebPInitConvertARGBToYUV"),null!=n.ca.f.kb.F&&mi()),n.Pb&&0<n.s.ua&&null==n.s.vb.X&&!E(n.s.vb,n.s.Wa.Xa)){n.a=1;break i}n.xb=0}if(!Tt(n,n.V,n.Ba,n.c,n.i,i.o,ft))break i;s.Dc=n.Ma,n=1;break e}Me(0!=n.a),n=0}n=!n}n&&(e=t.a)}else e=t.a}else{if(null==(t=new Nt)){a=1;break t}if(t.Fa=s.na,t.P=s.P,t.qc=s.Sa,Ht(t,n)){if(0==(e=Mi(n.width,n.height,a.Oa,a.ba))){if(t.Aa=0,i=a.Oa,Me(null!=(s=t)),null!=i){if(0<(l=0>(l=i.Md)?0:100<l?255:255*l/100)){for(c=u=0;4>c;++c)12>(d=s.pb[c]).lc&&(d.ia=l*Ns[0>d.lc?0:d.lc]>>3),u|=d.ia;u&&(alert("todo:VP8InitRandom"),s.ia=1)}s.Ga=i.Id,100<s.Ga?s.Ga=100:0>s.Ga&&(s.Ga=0)}Ut(t,n)||(e=t.a)}}else e=t.a}0==e&&null!=a.Oa&&a.Oa.fd&&(e=Oi(a.ba))}a=e}r=0!=a?null:11>r?o.f.RGBA.eb:o.f.kb.y}else r=null;return r};var Ws=[3,4,3,4,4,2,2,4,4,4,2,1,1]},new window.WebPDecoder,window.WebPRiffParser=function(t,e){var i={},n=0,s=!1,r=0,a=0;if(i.frames=[],!function(t,e,i,n){for(var s=0;s<n;s++)if(t[e+s]!=i.charCodeAt(s))return!0;return!1}(t,e,"RIFF",4)){for(Ue(t,e+=4),e+=8;e<t.length;){var o=Ye(t,e),l=Ue(t,e+=4);e+=4;var h=l+(1&l);switch(o){case"VP8 ":case"VP8L":void 0===i.frames[n]&&(i.frames[n]={}),(d=i.frames[n]).src_off=s?a:e-8,d.src_size=r+l+8,n++,s&&(s=!1,r=0,a=0);break;case"VP8X":(d=i.header={}).feature_flags=t[e];var c=e+4;d.canvas_width=1+$e(t,c),c+=3,d.canvas_height=1+$e(t,c),c+=3;break;case"ALPH":s=!0,r=h+8,a=e-8;break;case"ANIM":(d=i.header).bgcolor=Ue(t,e),c=e+4,d.loop_count=(g=t)[(f=c)+0]<<0|g[f+1]<<8,c+=2;break;case"ANMF":var u,d;(d=i.frames[n]={}).offset_x=2*$e(t,e),e+=3,d.offset_y=2*$e(t,e),e+=3,d.width=1+$e(t,e),e+=3,d.height=1+$e(t,e),e+=3,d.duration=$e(t,e),e+=3,u=t[e++],d.dispose=1&u,d.blend=u>>1&1}"ANMF"!=o&&(e+=h)}var g,f;return i}},window.ApicTools={parseGIF:t,decompressFrames:e},console.log("Using JsView HTML Forge");let je=_;class ze{static StringToInt32(t){let e=g.InvalidInt32,i=parseInt(t);return 0==isNaN(i)&&(e=i),e}static StringTrim(t){return t.trim()}static StringStartsWith(t,e){return t.startsWith(e)}static StringEndsWith(t,e){return t.endsWith(e)}static StringSplit(t,e=" ",i=0,n=0,s=!1){t||(t=""),0==n&&(n=t.length-1);let r=(t=t.substring(i,n+1)).trim().split(e),a=[];for(let t of r)t&&(s&&(t=t.trim(),0==t.length)||a.push(t));return a}static MergeBrackets(t,e=null){let i=[],n="",s=null,r=null,a=0,o=!1;for(let l of t){let t=0;for(;t<l.length;)if(a>0){let e=l.indexOf(")",t),i=l.indexOf("(",t);if(-1!=i&&(-1==e||i<e))a++,t=i+1;else{if(!(e>=0))break;a--,t=e+1}}else{let e=l.indexOf("(",t);if(-1==e)break;a++,t=e+1}o?(e&&(n+=e),n+=l):null!=s?(n+=s,e&&(n+=e),n+=l,s=null,o=!0):s=l,0==a&&(o?(r=n,n=""):r=l,i.push(r),s=null,o=!1)}return i}static ConvertToInt32(t,e){if(e.is(g.DataType.Null))return 0;if(e.is(g.DataType.String)){const t=e.get();if(""===t)return 0;if(ze.StringTrim(t),ze.StringEndsWith(t,"px")){const e='JsView Warning: Using px will make style performance lower, you can directly use numbers instead of "'+t+'".';console.warn(e)}return ze.StringToInt32(t)}return e.is(g.DataType.Int32)||e.is(g.DataType.Float)?e.get():(l(n.InvalidArgument,g.InvalidInt32,["Failed to convert style ",t,"=",e.toString(),", value type is supported."]),g.InvalidInt32)}static ConvertToFloat(t,e){return e.is(g.DataType.Null)?g.InvalidFloat:e.is(g.DataType.String)&&""===e.get()?0:e.is(g.DataType.Int32)||e.is(g.DataType.Float)?e.get():(l(n.InvalidArgument,g.InvalidFloat,["Failed to convert style ",t,"=",e.toString(),", value type is supported."]),g.InvalidFloat)}static ConvertToString(t,e,i=!1){if(e.is(g.DataType.Null))return g.InvalidPointer;0==e.is(g.DataType.String)&&l(n.InvalidArgument,g.InvalidPointer,["Failed to convert style ",t,"=",e.toString(),", type is not string."]);let s=e.get();return null==s||s.length<=0?g.InvalidPointer:(i&&(s=s.toUpperCase()),s)}static ConvertToCorner(t,e){if(e.is(g.DataType.Null))return g.InvalidPointer;let i=null;if(e.is(g.DataType.Int32)){const t=e.get();i=new g.CornerImpl(String(t)),i.topLeft=t,i.topRight=t,i.bottomRight=t,i.bottomLeft=t}else if(e.is(g.DataType.String)){const t=e.get();if(null==t||t.length<=0)return g.InvalidPointer;const n=ze.StringSplit(t),s=n.length;i=new g.CornerImpl(t),i.topLeft=s>0?parseInt(n[0]):0,i.topRight=s>1?parseInt(n[1]):i.topLeft,i.bottomRight=s>2?parseInt(n[2]):i.topLeft,i.bottomLeft=s>3?parseInt(n[3]):i.bottomRight}else l(n.InvalidArgument,g.InvalidPointer,["Failed to convert style ",t,"=",e.toString(),", type is not number or string."]);return i}static ConvertToRect(t,e){if(e.is(g.DataType.Null))return g.InvalidPointer;0==e.is(g.DataType.String)&&l(n.InvalidArgument,g.InvalidPointer,["Failed to convert style "+t+"="+e+", value type is not string."]);const i=e.get();if(null==i||i.length<=0)return g.InvalidPointer;const s=new g.RectImpl(i),r=ze.StringSplit(i),a=r.length;return s.top=a>0?parseInt(r[0]):0,s.right=a>1?parseInt(r[1]):s.top,s.bottom=a>2?parseInt(r[2]):s.top,s.left=a>3?parseInt(r[3]):s.right,s}static ConvertToAnimation(t,e,i=null){if(e.is(g.DataType.Null))return g.InvalidPointer;0==e.is(g.DataType.String)&&l(n.InvalidArgument,g.InvalidPointer,["Failed to convert style ",t,"=",e.toString(),", type is not string."]);const s=e.get();if(null==s||s.length<=0)return g.InvalidPointer;if(null!=i&&null!=i.rawValue&&i.rawValue==s)return i;return ze.ParseToAnimation(s)}static ConvertToTransition(t,e,i=null){if(e.is(g.DataType.Null))return g.InvalidPointer;0==e.is(g.DataType.String)&&l(n.InvalidArgument,g.InvalidPointer,["Failed to convert style ",t,"=",e.toString(),", type is not string."]);const s=e.get();if(null==s||s.length<=0)return g.InvalidPointer;if(null!=i&&null!=i.rawValue&&i.rawValue==s)return i;let r=[];const a=ze.StringSplit(s,",");for(let t=0;t<a.length;t++)if(a[t].indexOf("(")>=0){let e=t;for(;e<a.length&&a[e].indexOf(")")<0;)e++;let i="";for(let n=t;n<=e;n++)n!=t&&(i+=","),i+=a[n];t=e,r.push(i)}else r.push(a[t]);const o=new g.TransitionImpl(s);for(const e of r){const i=ze.ConvertToAnimation(t,new g(e));if(null!=i&&(o.animationMap.set(i.name,i),"all"==i?.name)){const t=["opacity","left","top","width","height","transform"];for(const e of t)o.animationMap.set(e,i)}}return o}static ConvertToTextShadow(t,e){if(e.is(g.DataType.Null))return g.InvalidPointer;0==e.is(g.DataType.String)&&l(n.InvalidArgument,g.InvalidPointer,["Failed to convert style ",t,"=",e.toString(),", type is not string."]);const i=e.get();if(null==i||i.length<=0)return g.InvalidPointer;const s=new g.TextShadowImpl(i),r=ze.StringSplit(i);r.length>0&&(s.hShadow=parseInt(r[0])),r.length>1&&(s.vShadow=parseInt(r[1])),r.length>2&&(s.blur=parseInt(r[2]));let a=-1;return 3==r.length?a=2:r.length>3&&(a=3),a>0&&(s.color=r[a]),s}static ConvertToWebkitTextStroke(t,e){if(e.is(g.DataType.Null))return g.InvalidPointer;0==e.is(g.DataType.String)&&l(n.InvalidArgument,g.InvalidPointer,["Failed to convert style ",t,"=",e.toString(),", type is not string."]);const i=e.get();if(null==i||i.length<=0)return g.InvalidPointer;const s=new g.WebkitTextStrokeImpl(i),r=ze.StringSplit(i);return r.length>0&&(s.length=parseInt(r[0])),r.length>1&&(s.color=r[1]),s}static ConvertToBorderImage(t,e){if(e.is(g.DataType.Null))return g.InvalidPointer;0==e.is(g.DataType.String)&&l(n.InvalidArgument,g.InvalidPointer,["Failed to convert style ",t,"=",e.toString(),", type is not string."]);const i=e.get();if(null==i||i.length<=0)return g.InvalidPointer;const s=new g.BorderImageImpl(i),r=ze.StringSplit(i),a=r.length;return a>0&&(s.source=r[0]),a>1&&(s.slice=ze.ConvertToRect(t,new g(r[1]))),s}static ConvertToBackgroundImage(t,e){if(e.is(g.DataType.Null))return g.InvalidPointer;0==e.is(g.DataType.String)&&l(n.InvalidArgument,g.InvalidPointer,["Failed to convert style ",t,"=",e.toString(),", type is not string."]);let i=e.get();if(null==i||i.length<=0)return g.InvalidPointer;const s=new g.BackgroundImageImpl(i),r="linear-gradient(";if(0==i.indexOf(r)){i=ze.StringTrim(i),s.type=g.BackgroundImageImpl.eType.LINEAR_GRADIENT,s.linearGradient=new g.BackgroundImageImpl.LinearGradient,s.urlPath=i;let t=ze.StringSplit(i,",",r.length,i.length-2);t=ze.MergeBrackets(t,",");let n=t.length;if(n>0){let e=t[0];if(-1!=e.indexOf("to ")){t.splice(0,1);let i=t.length;-1!=e.indexOf("left")?(s.linearGradient.fromX=i+1,s.linearGradient.toX=0):-1!=e.indexOf("right")?(s.linearGradient.fromX=0,s.linearGradient.toX=i+1):(s.linearGradient.fromX=0,s.linearGradient.toX=0),-1!=e.indexOf("top")?(s.linearGradient.fromY=i+1,s.linearGradient.toY=0):-1!=e.indexOf("bottom")?(s.linearGradient.fromY=0,s.linearGradient.toY=i+1):(s.linearGradient.fromY=0,s.linearGradient.toY=0)}else s.linearGradient.fromX=0,s.linearGradient.toX=0,s.linearGradient.fromY=0,s.linearGradient.toY=2}if(n<2)return console.error(`linear gradient format error: str=${e}`),null;let a=1/t.length,o=t.length;for(let e=0;e<o;e++){let i=t[e];i=ze.StringTrim(i);let n=new je.LinearGradientTexture.StopPoint;n.color=i,n.stopPosition=e!=o-1?e*a:1,s.linearGradient.stops.push(n)}}else s.type=g.BackgroundImageImpl.eType.URL_PATH,s.urlPath=i;return s}static ParseToAnimation(t){const e=ze.StringTrim(t);let i=[];const n=e.indexOf("cubic-bezier");if(n>=0){const t=e.indexOf(")"),s=e.substring(n,t-1),r=ze.StringSplit(e,s);for(const t of r){const e=ze.StringSplit(t);i=[...i,...e]}i.push(s)}else i=ze.StringSplit(e);let s="",r=0,a=1,o=e.indexOf("alternate")>=0;for(var l=2;l<i.length;l++){if("infinite"==i[l]){a=-1;continue}let t=ze.ParseToTimeMs(i[l]);0==isNaN(t)?r=t:(t=ze.ParseToFloat(i[l]),0==isNaN(t)?a=t:s=i[l])}const h=i.length>1?ze.ParseToTimeMs(i[1]):0,c=new g.AnimationImpl(e);return c.name=i.length>0?i[0]:"",c.duration=h,c.timingFunction=ze.ParseToEasing(s,h),c.delay=r,c.iterationCount=a,c.direction=o,c}static ParseToTimeMs(t){if(0==ze.StringEndsWith(t,"s"))return NaN;let e=ze.ParseToFloat(t);return ze.StringEndsWith(t,"ms")?e*=1:ze.StringEndsWith(t,"s")&&(e*=1e3),e}static ParseToFloat(t){const e=ze.StringTrim(t);return parseFloat(e)}static ParseToEasing(t,e){let i=null;return t.indexOf("ease")>=0?i=t.indexOf("-in-out")>=0?_.Easing.Circular.InOut:t.indexOf("-out")>=0?_.Easing.Circular.Out:t.indexOf("-in")>=0?_.Easing.Circular.In:_.Easing.Circular.InOut:t.indexOf("linear")>=0?i=null:t.indexOf("cubic-bezier")>=0?i=ze.ParseToEasingBezier(t,e):t.indexOf("steps")>=0&&(i=ze.ParseToEasingSteps(t)),i}static ParseToEasingBezier(t,e){let i=t.indexOf("(");i>=0&&(t=t.substring(i+1));let n=ze.StringSplit(t,","),s={x1:n.length>0?parseFloat(n[0]):0,y1:n.length>1?parseFloat(n[1]):0,x2:n.length>2?parseFloat(n[2]):0,y2:n.length>3?parseFloat(n[3]):0};return new _.BezierEasing(s.x1,s.y1,s.x2,s.y2,e)}static ParseToEasingSteps(t){let e=t.indexOf("(");e>=0&&(t=t.substring(e+1));let i=ze.StringSplit(t,","),n={steps:i.length>0?parseInt(i[0]):1,type:i.length>1?i[1].includes("start")?0:1:0};return new _.StepsEasing(n.steps,n.type)}constructor(){throw new Error("new StyleGroup() is forbidden.")}}class Xe{static IsInheritedProp(t){return t==d.Text.Color||t==d.Text.FontFamily||t==d.Text.FontSize||t==d.Text.FontStyle||t==d.Text.FontWeight||t==d.Text.LineHeight||t==d.Text.TextAlign||t==d.Text.TextOverflow||t==d.Text.TextShadow||t==d.Text.WebkitTextStroke||t==d.Text.WhiteSpace||t==d.Text.WordWrap||t==d.Text.Direction||t==d.Text.JsvTextEmoji||t==d.Text.JsvTextLatex||t==d.Text.JsvTextAlignMinWidth||t==d.Text.JsvTextVerticalAlign||t==d.Text.JsvTextLineAlign||t==d.Text.JsvTextInnerDirection}constructor(){}setPropValue(t,e,i){if(0==i&&1==this.isPropNameLocked(t))return n.CssStyleNotChanged;const s=this.setValue(t,e);return null==s?n.CssStyleNotChanged:(this.changedStyleGroups.add(s),this.needUpdateTransition(t)&&this.changedStyleGroups.add(p.Motion.Name),i&&this.lockedPropNames.add(t),0)}getPropValue(t){return this.getValue(t)}hasPropValue(t){return this.hasValue(t)}hasPropGroup(t){return t==p.Layout.Name?null!=this.layout:t==p.Background.Name?null!=this.background:t==p.Effect.Name?null!=this.effect:t==p.Text.Name?null!=this.text:t==p.Motion.Name&&null!=this.motion}isPropNameLocked(t){return 1==this.lockedPropNames.has(t)}addChangedStyleGroup(t){return t!=p.Layout.Name&&t!=p.Background.Name&&t!=p.Effect.Name&&t!=p.Text.Name&&t!=p.Motion.Name&&o(n.InvalidArgument),this.changedStyleGroups.add(t),0}getChangedStyleGroups(){return this.changedStyleGroups}clearChangedStyleGroups(){this.changedStyleGroups.clear()}setValue(t,e){let i=null;return t==d.Layout.Left||t==d.Layout.Top||t==d.Layout.Width||t==d.Layout.Height?i=this.setLayoutValue(t,e):t==d.Background.BackgroundColor||t==d.Background.BackgroundImage||t==d.Background.BorderRadius?i=this.setBackgroundValue(t,e):t==d.Effect.BackfaceVisibility||t==d.Effect.BorderImage||t==d.Effect.BorderImageWidth||t==d.Effect.BorderImageOutset||t==d.Effect.Display||t==d.Effect.ObjectFit||t==d.Effect.Overflow||t==d.Effect.Perspective||t==d.Effect.PerspectiveOrigin||t==d.Effect.Transform||t==d.Effect.TransformOrigin||t==d.Effect.TransformStyle||t==d.Effect.Visibility||t==d.Effect.ZIndex?i=this.setEffectValue(t,e):t==d.Text.Color||t==d.Text.FontFamily||t==d.Text.FontSize||t==d.Text.FontStyle||t==d.Text.FontWeight||t==d.Text.TextAlign||t==d.Text.TextOverflow||t==d.Text.TextShadow||t==d.Text.LineHeight||t==d.Text.WebkitTextStroke||t==d.Text.WhiteSpace||t==d.Text.WordWrap||t==d.Text.Direction||t==d.Text.JsvTextEmoji||t==d.Text.JsvTextLatex||t==d.Text.JsvTextAlignMinWidth||t==d.Text.JsvTextVerticalAlign||t==d.Text.JsvTextLineAlign||t==d.Text.JsvTextInnerDirection?i=this.setTextValue(t,e):t==d.Motion.Animation||t==d.Motion.Transition?i=this.setMotionValue(t,e):l(n.UnimplementedError,null),null!=i&&this.changedStyleGroups.add(i),i}getValue(t){let e;return t==d.Layout.Left||t==d.Layout.Top||t==d.Layout.Width||t==d.Layout.Height?e=this.getLayoutValue(t):t==d.Background.BackgroundColor||t==d.Background.BackgroundImage||t==d.Background.BorderRadius?e=this.getBackgroundValue(t):t==d.Effect.BackfaceVisibility||t==d.Effect.BorderImage||t==d.Effect.BorderImageWidth||t==d.Effect.BorderImageOutset||t==d.Effect.Display||t==d.Effect.ObjectFit||t==d.Effect.Overflow||t==d.Effect.Perspective||t==d.Effect.PerspectiveOrigin||t==d.Effect.Transform||t==d.Effect.TransformOrigin||t==d.Effect.TransformStyle||t==d.Effect.Visibility||t==d.Effect.ZIndex?e=this.getEffectValue(t):t==d.Text.Color||t==d.Text.FontFamily||t==d.Text.FontSize||t==d.Text.FontStyle||t==d.Text.FontWeight||t==d.Text.TextAlign||t==d.Text.TextOverflow||t==d.Text.TextShadow||t==d.Text.LineHeight||t==d.Text.WebkitTextStroke||t==d.Text.WhiteSpace||t==d.Text.WordWrap||t==d.Text.Direction||t==d.Text.JsvTextEmoji||t==d.Text.JsvTextLatex||t==d.Text.JsvTextAlignMinWidth||t==d.Text.JsvTextVerticalAlign||t==d.Text.JsvTextLineAlign||t==d.Text.JsvTextInnerDirection?e=this.getTextValue(t):t==d.Motion.Animation||t==d.Motion.Transition?e=this.getMotionValue(t):(l(n.UnimplementedError,null),e=new g),e}hasValue(t){let e=!1;return t==d.Layout.Left||t==d.Layout.Top||t==d.Layout.Width||t==d.Layout.Height?e=this.hasLayoutValue(t):t==d.Background.BackgroundColor||t==d.Background.BackgroundImage||t==d.Background.BorderRadius?e=this.hasBackgroundValue(t):t==d.Effect.BackfaceVisibility||t==d.Effect.BorderImage||t==d.Effect.BorderImageWidth||t==d.Effect.BorderImageOutset||t==d.Effect.Display||t==d.Effect.ObjectFit||t==d.Effect.Overflow||t==d.Effect.Perspective||t==d.Effect.PerspectiveOrigin||t==d.Effect.Transform||t==d.Effect.TransformOrigin||t==d.Effect.TransformStyle||t==d.Effect.Visibility||t==d.Effect.ZIndex?e=this.hasEffectValue(t):t==d.Text.Color||t==d.Text.FontFamily||t==d.Text.FontSize||t==d.Text.FontStyle||t==d.Text.FontWeight||t==d.Text.TextAlign||t==d.Text.TextOverflow||t==d.Text.TextShadow||t==d.Text.LineHeight||t==d.Text.WebkitTextStroke||t==d.Text.WhiteSpace||t==d.Text.WordWrap||t==d.Text.Direction||t==d.Text.JsvTextEmoji||t==d.Text.JsvTextLatex||t==d.Text.JsvTextAlignMinWidth||t==d.Text.JsvTextVerticalAlign||t==d.Text.JsvTextLineAlign||t==d.Text.JsvTextInnerDirection?e=this.hasTextValue(t):t!=d.Motion.Animation&&t!=d.Motion.Transition||(e=this.hasMotionValue(t)),e}setLayoutValue(t,e){const i=(t,e)=>{const i=e;return this.layout[t]==i==0&&(this.layout[t]=i,!0)};this.ensureGroupExist(p.Layout.Name);let n=!1;if(t==d.Layout.Height)n=i("height",ze.ConvertToInt32(t,e));else if(t==d.Layout.Left)n=i("left",ze.ConvertToInt32(t,e));else if(t==d.Layout.Top)n=i("top",ze.ConvertToInt32(t,e));else{if(t!=d.Layout.Width)throw new Error;n=i("width",ze.ConvertToInt32(t,e))}return n?p.Layout.Name:null}getLayoutValue(t){const e=t=>this.layout?new g(this.layout[t]):new g;if(t==d.Layout.Height)return e("height");if(t==d.Layout.Left)return e("left");if(t==d.Layout.Top)return e("top");if(t==d.Layout.Width)return e("width");throw new Error}hasLayoutValue(t){const e=t=>!(!this.layout||this.layout[t]==g.InvalidInt32);if(t==d.Layout.Height)return e("height");if(t==d.Layout.Left)return e("left");if(t==d.Layout.Top)return e("top");if(t==d.Layout.Width)return e("width");throw new Error}setBackgroundValue(t,e){const i=(t,e)=>{const i=e;return this.background[t]==i==0&&(this.background[t]=i,!0)};this.ensureGroupExist(p.Background.Name);let n=!1;if(t==d.Background.BackgroundColor)n=i("backgroundColor",ze.ConvertToString(t,e));else if(t==d.Background.BackgroundImage)n=i("backgroundImage",ze.ConvertToBackgroundImage(t,e));else{if(t!=d.Background.BorderRadius)throw new Error;n=i("borderRadius",ze.ConvertToCorner(t,e))}return n?p.Background.Name:null}getBackgroundValue(t){const e=t=>this.background?new g(this.background[t]):new g;if(t==d.Background.BackgroundColor)return e("backgroundColor");if(t==d.Background.BackgroundImage)return e("backgroundImage");if(t==d.Background.BorderRadius)return e("borderRadius");throw new Error}hasBackgroundValue(t){const e=t=>!(!this.background||this.background[t]==g.InvalidPointer);if(t==d.Background.BackgroundColor)return e("backgroundColor");if(t==d.Background.BackgroundImage)return e("backgroundImage");if(t==d.Background.BorderRadius)return e("borderRadius");throw new Error}setEffectValue(t,e){const i=(t,e)=>{const i=e;return this.effect[t]==i==0&&(this.effect[t]=i,!0)};this.ensureGroupExist(p.Effect.Name);let n=!1;if(t==d.Effect.BackfaceVisibility)n=i("backfaceVisibility",ze.ConvertToString(t,e));else if(t==d.Effect.BorderImage)n=i("borderImage",ze.ConvertToBorderImage(t,e));else if(t==d.Effect.BorderImageWidth)n=i("borderImageWidth",ze.ConvertToRect(t,e));else if(t==d.Effect.BorderImageOutset)n=i("borderImageOutset",ze.ConvertToRect(t,e));else if(t==d.Effect.Display)n=i("display",ze.ConvertToString(t,e));else if(t==d.Effect.ObjectFit)n=i("objectFit",ze.ConvertToString(t,e));else if(t==d.Effect.Opacity)n=i("opacity",ze.ConvertToFloat(t,e));else if(t==d.Effect.Overflow)n=i("overflow",ze.ConvertToString(t,e));else if(t==d.Effect.Perspective)n=i("perspective",ze.ConvertToInt32(t,e));else if(t==d.Effect.PerspectiveOrigin)n=i("perspectiveOrigin",ze.ConvertToInt32(t,e));else if(t==d.Effect.Transform)n=i("transform",ze.ConvertToString(t,e));else if(t==d.Effect.TransformOrigin)n=i("transformOrigin",ze.ConvertToString(t,e));else if(t==d.Effect.TransformStyle)n=i("transformStyle",ze.ConvertToString(t,e));else if(t==d.Effect.Visibility)n=i("visibility",ze.ConvertToString(t,e));else{if(t!=d.Effect.ZIndex)throw new Error;n=i("zIndex",ze.ConvertToInt32(t,e))}return n?p.Effect.Name:null}getEffectValue(t){const e=t=>this.effect?new g(this.effect[t]):new g;if(t==d.Effect.BackfaceVisibility)return e("backfaceVisibility");if(t==d.Effect.BorderImage)return e("borderImage");if(t==d.Effect.BorderImageWidth)return e("borderImageWidth");if(t==d.Effect.BorderImageOutset)return e("borderImageOutset");if(t==d.Effect.Display)return e("display");if(t==d.Effect.ObjectFit)return e("objectFit");if(t==d.Effect.Opacity)return e("opacity");if(t==d.Effect.Overflow)return e("overflow");if(t==d.Effect.Perspective)return e("perspective");if(t==d.Effect.PerspectiveOrigin)return e("perspectiveOrigin");if(t==d.Effect.Transform)return e("transform");if(t==d.Effect.TransformOrigin)return e("transformOrigin");if(t==d.Effect.TransformStyle)return e("transformStyle");if(t==d.Effect.Visibility)return e("visibility");if(t==d.Effect.ZIndex)return e("zIndex");throw new Error}hasEffectValue(t){const e=(t,e)=>!(!this.effect||this.effect[t]==e);if(t==d.Effect.BackfaceVisibility)return e("backfaceVisibility",g.InvalidInt32);if(t==d.Effect.BorderImage)return e("borderImage",g.InvalidPointer);if(t==d.Effect.BorderImageWidth)return e("borderImageWidth",g.InvalidPointer);if(t==d.Effect.BorderImageOutset)return e("borderImageOutset",g.InvalidPointer);if(t==d.Effect.Display)return e("display",g.InvalidPointer);if(t==d.Effect.ObjectFit)return e("objectFit",g.InvalidPointer);if(t==d.Effect.Opacity)return e("opacity",g.InvalidFloat);if(t==d.Effect.Overflow)return e("overflow",g.InvalidPointer);if(t==d.Effect.Perspective)return e("perspective",g.InvalidInt32);if(t==d.Effect.PerspectiveOrigin)return e("perspectiveOrigin",g.InvalidInt32);if(t==d.Effect.Transform)return e("transform",g.InvalidPointer);if(t==d.Effect.TransformOrigin)return e("transformOrigin",g.InvalidPointer);if(t==d.Effect.TransformStyle)return e("transformStyle",g.InvalidPointer);if(t==d.Effect.Visibility)return e("visibility",g.InvalidPointer);if(t==d.Effect.ZIndex)return e("zIndex",g.InvalidInt32);throw new Error}setTextValue(t,e){const i=(t,e)=>{const i=e;return this.text[t]==i==0&&(this.text[t]=i,!0)};this.ensureGroupExist(p.Text.Name);let n=!1;if(t==d.Text.Color)n=i("color",ze.ConvertToString(t,e));else if(t==d.Text.FontFamily)n=i("fontFamily",ze.ConvertToString(t,e));else if(t==d.Text.FontSize)n=i("fontSize",ze.ConvertToInt32(t,e));else if(t==d.Text.FontStyle)n=i("fontStyle",ze.ConvertToString(t,e));else if(t==d.Text.FontWeight)n=i("fontWeight",ze.ConvertToString(t,e));else if(t==d.Text.LineHeight)n=i("lineHeight",ze.ConvertToInt32(t,e));else if(t==d.Text.TextAlign)n=i("textAlign",ze.ConvertToString(t,e));else if(t==d.Text.TextOverflow)n=i("textOverflow",ze.ConvertToString(t,e));else if(t==d.Text.TextShadow)n=i("textShadow",ze.ConvertToTextShadow(t,e));else if(t==d.Text.WebkitTextStroke)n=i("webkitTextStroke",ze.ConvertToWebkitTextStroke(t,e));else if(t==d.Text.WhiteSpace)n=i("whiteSpace",ze.ConvertToString(t,e));else if(t==d.Text.WordWrap)n=i("wordWrap",ze.ConvertToString(t,e));else if(t==d.Text.Direction)n=i("direction",ze.ConvertToString(t,e));else if(t==d.Text.JsvTextEmoji)n=i("jsvTextEmoji",ze.ConvertToInt32(t,e));else if(t==d.Text.JsvTextLatex)n=i("jsvTextLatex",ze.ConvertToInt32(t,e));else if(t==d.Text.JsvTextAlignMinWidth)n=i("jsvTextAlignMinWidth",ze.ConvertToInt32(t,e));else if(t==d.Text.JsvTextVerticalAlign)n=i("jsvTextVerticalAlign",ze.ConvertToString(t,e));else if(t==d.Text.JsvTextLineAlign)n=i("jsvTextLineAlign",ze.ConvertToString(t,e));else{if(t!=d.Text.JsvTextInnerDirection)throw new Error;n=i("jsvTextInnerDirection",ze.ConvertToString(t,e))}return n?p.Text.Name:null}getTextValue(t){const e=t=>this.text?new g(this.text[t]):new g;if(t==d.Text.Color)return e("color");if(t==d.Text.FontFamily)return e("fontFamily");if(t==d.Text.FontSize)return e("fontSize");if(t==d.Text.FontStyle)return e("fontStyle");if(t==d.Text.FontWeight)return e("fontWeight");if(t==d.Text.LineHeight)return e("lineHeight");if(t==d.Text.TextAlign)return e("textAlign");if(t==d.Text.TextOverflow)return e("textOverflow");if(t==d.Text.TextShadow)return e("textShadow");if(t==d.Text.WebkitTextStroke)return e("webkitTextStroke");if(t==d.Text.WhiteSpace)return e("whiteSpace");if(t==d.Text.WordWrap)return e("wordWrap");if(t==d.Text.Direction)return e("direction");if(t==d.Text.JsvTextEmoji)return e("jsvTextEmoji");if(t==d.Text.JsvTextLatex)return e("jsvTextLatex");if(t==d.Text.JsvTextAlignMinWidth)return e("jsvTextAlignMinWidth");if(t==d.Text.JsvTextVerticalAlign)return e("jsvTextVerticalAlign");if(t==d.Text.JsvTextLineAlign)return e("jsvTextLineAlign");if(t==d.Text.JsvTextInnerDirection)return e("jsvTextInnerDirection");throw new Error}hasTextValue(t){const e=(t,e)=>!(!this.text||this.text[t]==e);if(t==d.Text.Color)return e("color",g.InvalidPointer);if(t==d.Text.FontFamily)return e("fontFamily",g.InvalidPointer);if(t==d.Text.FontSize)return e("fontSize",g.InvalidInt32);if(t==d.Text.FontStyle)return e("fontStyle",g.InvalidPointer);if(t==d.Text.FontWeight)return e("fontWeight",g.InvalidPointer);if(t==d.Text.LineHeight)return e("lineHeight",g.InvalidInt32);if(t==d.Text.TextAlign)return e("textAlign",g.InvalidPointer);if(t==d.Text.TextOverflow)return e("textOverflow",g.InvalidPointer);if(t==d.Text.TextShadow)return e("textShadow",g.InvalidPointer);if(t==d.Text.WebkitTextStroke)return e("webkitTextStroke",g.InvalidPointer);if(t==d.Text.WhiteSpace)return e("whiteSpace",g.InvalidPointer);if(t==d.Text.WordWrap)return e("wordWrap",g.InvalidPointer);if(t==d.Text.Direction)return e("direction",g.InvalidPointer);if(t==d.Text.JsvTextEmoji)return e("jsvTextEmoji",g.InvalidInt32);if(t==d.Text.JsvTextLatex)return e("jsvTextLatex",g.InvalidInt32);if(t==d.Text.JsvTextAlignMinWidth)return e("jsvTextAlignMinWidth",g.InvalidInt32);if(t==d.Text.JsvTextVerticalAlign)return e("jsvTextVerticalAlign",g.InvalidPointer);if(t==d.Text.JsvTextLineAlign)return e("jsvTextLineAlign",g.InvalidPointer);if(t==d.Text.JsvTextInnerDirection)return e("jsvTextInnerDirection",g.InvalidPointer);throw new Error}setMotionValue(t,e){const i=(t,e)=>{const i=e;return this.motion[t]==i==0&&(this.motion[t]=i,!0)};this.ensureGroupExist(p.Motion.Name);let n=!1;if(t==d.Motion.Animation)n=i("animation",ze.ConvertToAnimation(t,e,this.motion.animation));else{if(t!=d.Motion.Transition)throw new Error;n=i("transition",ze.ConvertToTransition(t,e,this.motion.transition))}return n?p.Motion.Name:null}getMotionValue(t){const e=t=>this.motion?new g(this.motion[t]):new g;if(t==d.Motion.Animation)return e("animation");if(t==d.Motion.Transition)return e("transition");throw new Error}hasMotionValue(t){const e=t=>!(!this.motion||this.motion[t]==g.InvalidPointer);if(t==d.Motion.Animation)return e("animation");if(t==d.Motion.Transition)return e("transition");throw new Error}needUpdateTransition(t){return null!=this.motion&&null==this.motion.animation&&null!=this.motion.transition&&(t==d.Layout.Height||t==d.Layout.Left||t==d.Layout.Top||t==d.Layout.Width||t==d.Effect.Opacity||t==d.Effect.Transform)}ensureGroupExist(t){t==p.Layout.Name&&null==this.layout?this.layout=new p.Layout:t==p.Background.Name&&null==this.background?this.background=new p.Background:t==p.Effect.Name&&null==this.effect?this.effect=new p.Effect:t==p.Text.Name&&null==this.text?this.text=new p.Text:t==p.Motion.Name&&null==this.motion&&(this.motion=new p.Motion)}changedStyleGroups=new Set;lockedPropNames=new Set;layout=void 0;background=void 0;effect=void 0;text=void 0;motion=void 0}class Ke{static Manager=class{static StyleSheetKeyGlobal=0;declareStyleSheets(t){for(const[e,i]of Object.entries(t)){let t=0;t=parseInt(e,16),0==this.styleSheetMap.has(t)&&this.styleSheetMap.set(t,new Map);const n=this.styleSheetMap.get(t);for(const[t,e]of Object.entries(i))n.set(t,e)}return 0}getStyleSheets(){return this.styleSheetMap}appendStyleClassCache(t,e){0==this.parsedStyleClassCache.has(t)&&(e=null),this.parsedStyleClassCache.set(t,e)}findStyleClassCache(t){const e=this.parsedStyleClassCache.get(t);return null==e?null:e}clearStyleClassCache(){this.parsedStyleClassCache.clear()}static VariableInfo=class{static WatchListener=class{propName;listener};value=new g;watchListenerMap=new Map};watchVariable(t,e,i,r,a){let l=d.ToConst(e);s(null!=l,n.InvalidArgument);let h=this.getVariableInfo(r);if(s(null!=h,n.InvalidArgument),0==h.watchListenerMap.has(t)){const e=new Set;h.watchListenerMap.set(t,e)}const c=h.watchListenerMap.get(t),u=new Ke.Manager.VariableInfo.WatchListener;if(u.propName=l,u.listener=i,c.add(u),0==h.value.is(g.DataType.Null)){const t=i(l,h.value,a);if(t==n.CssStyleNotChanged)return t;o(t)}return 0}watchKeyframeVariables(t,e,i,n,s){const r=this.getRawKeyframes(t.classAttributes,n);if(0==r.length)return 0;const a=new Set;let l=this.getKeyframesVarNames(r,a);o(l);for(const n of a)l=this.watchVariable(t,e,i,n,s),o(l);return 0}unwatchVariable(t,e){for(const[i,n]of this.propVariableMap){if(0==n.watchListenerMap.has(t))continue;let i=n.watchListenerMap.get(t);for(const t of i)if(t.propName!=e){i.delete(t);break}}return 0}unwatchAllVariables(t){for(const[e,i]of this.propVariableMap)i.watchListenerMap.delete(t)}setVariable(t,e,i){let r=this.getVariableInfo(t);s(null!=r,n.InvalidArgument),r.value=e;for(const[t,s]of r.watchListenerMap)for(const t of s){let s=new Set;const r=t.listener(t.propName,e,s);if(r==n.CssStyleNotChanged)return r;o(r);for(const t of s)i.add(t)}return 0}insertKeyFrame(t,e){const i=this.styleSheetMap.get(Ke.Manager.StyleSheetKeyGlobal);r(i,null),i?.set(t,e)}removeKeyFrame(t){const e=this.styleSheetMap.get(Ke.Manager.StyleSheetKeyGlobal);if(r(e,null),e?.has(t)){e.delete(t);const i=document.styleSheets[0],n=i.cssRules;for(let e=n.length-1;e>=0;e--)if(n[e].name===t){i.deleteRule(e);break}}}getKeyframes(t,e){if(0==e.length)return"";const i=this.getRawKeyframes(t,e);if(0==i.length)return"";const n=new Set;if(l(this.getKeyframesVarNames(i,n),""),0==n.size)return i;let s=i;for(const t of n){const e=this.getVariableInfo(t);r(null!=e,""),a=t,o=e.value.toString(),s=s.replaceAll(a,o)}var a,o;return s}getRawKeyframes(t,e){if(0==e.length)return Ke.Manager.ConstEmptyString;if(0==this.styleSheetMap.has(Ke.Manager.StyleSheetKeyGlobal))return Ke.Manager.ConstEmptyString;const i=this.styleSheetMap.get(Ke.Manager.StyleSheetKeyGlobal);for(const n of t){const t=e+"-"+n.toString(16).padStart(8,"0");if(0==i.has(t))continue;return i.get(t)}if(i.has(e)){return i.get(e)}return Ke.Manager.ConstEmptyString}getKeyframesVarNames(t,e){e.clear();let i=t;const n=/var\([\s\S]+?\)/;let s;for(;null!==(s=n.exec(i));)e.add(s[0]),i=i.substring(s.index+s[0].length);return 0}getVariableInfo(t){let e=m.FormatVariableName(t);if(s(null!=e,null),0==this.propVariableMap.has(e)){const t=new Ke.Manager.VariableInfo;this.propVariableMap.set(e,t)}let i=this.propVariableMap.get(e);return i}static ConstEmptyString="";styleSheetMap=new Map;parsedStyleClassCache=new Map;propVariableMap=new Map};constructor(t){this.classStyleManager=t}getManager(){return this.classStyleManager}setClassNames(t){return null==t&&(t=""),this.classNames==t?n.CssClassNotChanged:(this.classNames=t,0)}getClassNames(){return this.classNames}appendClassAttribute(t){return this.classAttributes.has(t)?n.CssClassNotChanged:(this.classAttributes.add(t),0)}mergeClassAttributes(t){for(let e of t.classAttributes)this.classAttributes.add(e);return 0}hasClassAttribute(t){return this.classAttributes.has(t)}getClassAttributes(){return this.classAttributes}getClassDeclarations(t){if(0==this.classNames.length)return null;let e="";for(const i of t)e+=i+"{";e+=this.classNames;for(const i of t)e+="}";e+=" @ ";for(const t of this.classAttributes)e+=t+" ";const i=e;let n=this.classStyleManager.findStyleClassCache(i);return null==n&&(n=this.makeClassDeclarations(t),this.classStyleManager.appendStyleClassCache(i,n)),n}getKeyframes(t){if(0==t.length)return"";const e=this.classStyleManager.getKeyframes(this.classAttributes,t);return 0==e.length?"":e}static CastToStyleValue(t){let e;return null==t||Number(t)===t||"string"==typeof t?e=new g(t):"boolean"==typeof t?e=new g(Number(t)):(l(n.UnimplementedError,null),e=new g),e}static ParseDeclarations(t,e,i){let n=new Map;for(let s of e){if(0==t.has(i))continue;const e=t.get(i);if(0==e.has(s))continue;const r=e.get(s),a=JSON.parse(r);for(const[t,e]of Object.entries(a)){const i=d.ToConst(t);if(null==i){console.error("Unsupported style name: "+t);continue}const s=Ke.CastToStyleValue(e);n.set(i,s)}}return n}makeClassDeclarations(t){let e=new Map;const i=this.classStyleManager.getStyleSheets(),n=this.getNestedClassCombine(t),s=Ke.ParseDeclarations(i,n,Ke.Manager.StyleSheetKeyGlobal);for(const[t,i]of s)e.set(t,i);for(const t of this.classAttributes){const s=Ke.ParseDeclarations(i,n,t);for(const[t,i]of s)e.set(t,i)}return e}getNestedClassCombine(t){const e=ze.StringSplit(this.classNames),i=[];for(const t of e)i.push("."+t);for(let e=t.length-1;e>=0;e--){const n=t[e],s=i.length,r=ze.StringSplit(n);for(const t of r)for(let e=0;e<s;e++){const n=i[e];i.push("."+t+" "+n)}}return i}classStyleManager;classNames="";classAttributes=new Set}class Je{static STYLE_PROPERTY_GETTER(t,e,i){let n=new g;return t.getProperty(e,n)>=0?n.get():i}constructor(t,e){this.elementDelegate=t,this.style=new Xe,this.styleClass=new Ke(e)}finalize(){this.styleClass.getManager().unwatchAllVariables(this.styleClass)}hasPropGroup(t){return this.style.hasPropGroup(t)}setProperty(t,e,i){let r=t;0==m.IsVariable(t)&&(r=d.ToConst(t)),s(r,n.UnsupportedError),i.clear();return this.setStyleInheritedProperty(r,e,!0,i)}getProperty(t,e){const i=d.ToConst(t);s(i,n.UnsupportedError);return this.getStyleInheritedProperty(i,e)}setClassNames(t){const e=this.styleClass.setClassNames(t);return s(e>=0||e==n.CssClassNotChanged,e),0}getClassNames(){return this.styleClass.getClassNames()}appendClassAttribute(t){const e=this.styleClass.appendClassAttribute(t);return e==n.CssClassNotChanged||o(e),0}mergeClassAttributes(t){return o(this.styleClass.mergeClassAttributes(t.styleClass)),0}getKeyframes(t){const e=this.styleClass.getKeyframes(t);return r(null!=e,null,["Failed to get keyframes:"+t]),e}getNestedClassNames(t){const e=this.elementDelegate;s(null!=e,n.InvalidElement);const i=e.parentNode;s(null!=i,n.InvalidElement);const r=i.styleDelegate,a=this.styleClass.getClassAttributes();let l=[];for(const t of a){const e=[];o(r.getNestedClassNamesRecursive(t,e)),(l.length<=0||l.length>e.length)&&(l=e)}for(const e of l)t.push(e);if(t.length>5){let t="JsView: Low performance warning: ";t+="It is recommended that the nesting of style classes in a single vue file should less than 6.",t+="You can avoid this risk by splitting the vue file.",console.warn(t)}return 0}updateClassDeclarations(t,e){e.clear();const i=this.lastCssClassKeySet,s=new Set,r=this.styleClass.getClassDeclarations(t);if(null!=r)for(const[t,a]of r){let r=this.setStyleInheritedProperty(t,a,!1,e);r==n.CssStyleNotChanged&&(r=0),h(r),s.add(t),i.delete(t)}let a=new g;for(const t of i){let i=this.setStyleInheritedProperty(t,a,!1,e);i==n.CssStyleNotChanged&&(i=0),h(i)}this.lastCssClassKeySet=s}addChangedStyleGroup(t){return this.style.addChangedStyleGroup(t)}getChangedStyleGroups(){return this.style.getChangedStyleGroups()}clearChangedStyleGroups(){this.style.clearChangedStyleGroups()}jsvValidHeight(){return Je.STYLE_PROPERTY_GETTER(this,d.Layout.Height,0)}height(){return Je.STYLE_PROPERTY_GETTER(this,d.Layout.Height,g.InvalidInt32)}left(){return Je.STYLE_PROPERTY_GETTER(this,d.Layout.Left,0)}top(){return Je.STYLE_PROPERTY_GETTER(this,d.Layout.Top,0)}jsvValidWidth(){return Je.STYLE_PROPERTY_GETTER(this,d.Layout.Width,0)}width(){return Je.STYLE_PROPERTY_GETTER(this,d.Layout.Width,g.InvalidInt32)}backgroundColor(){return Je.STYLE_PROPERTY_GETTER(this,d.Background.BackgroundColor,null)}backgroundImage(){return Je.STYLE_PROPERTY_GETTER(this,d.Background.BackgroundImage,null)}borderRadius(){return Je.STYLE_PROPERTY_GETTER(this,d.Background.BorderRadius,null)}backfaceVisibility(){return Je.STYLE_PROPERTY_GETTER(this,d.Effect.BackfaceVisibility,null)}borderImage(){return Je.STYLE_PROPERTY_GETTER(this,d.Effect.BorderImage,null)}borderImageWidth(){return Je.STYLE_PROPERTY_GETTER(this,d.Effect.BorderImageWidth,null)}borderImageOutset(){return Je.STYLE_PROPERTY_GETTER(this,d.Effect.BorderImageOutset,null)}display(){return Je.STYLE_PROPERTY_GETTER(this,d.Effect.Display,null)}objectFit(){return Je.STYLE_PROPERTY_GETTER(this,d.Effect.ObjectFit,null)}opacity(){return Je.STYLE_PROPERTY_GETTER(this,d.Effect.ObjectFit,0)}overflow(){return Je.STYLE_PROPERTY_GETTER(this,d.Effect.Overflow,null)}perspective(){return Je.STYLE_PROPERTY_GETTER(this,d.Effect.Perspective,0)}perspectiveOrigin(){return Je.STYLE_PROPERTY_GETTER(this,d.Effect.PerspectiveOrigin,null)}transform(){return Je.STYLE_PROPERTY_GETTER(this,d.Effect.Transform,null)}transformOrigin(){return Je.STYLE_PROPERTY_GETTER(this,d.Effect.TransformOrigin,null)}transformStyle(){return Je.STYLE_PROPERTY_GETTER(this,d.Effect.TransformStyle,null)}visibility(){return Je.STYLE_PROPERTY_GETTER(this,d.Effect.Visibility,null)}zIndex(){return Je.STYLE_PROPERTY_GETTER(this,d.Effect.ZIndex,0)}color(){return Je.STYLE_PROPERTY_GETTER(this,d.Text.Color,f.Text.Color)}fontFamily(){return Je.STYLE_PROPERTY_GETTER(this,d.Text.FontFamily,f.Text.FontFamily)}fontSize(){return Je.STYLE_PROPERTY_GETTER(this,d.Text.FontSize,f.Text.FontSize)}fontStyle(){return Je.STYLE_PROPERTY_GETTER(this,d.Text.FontStyle,f.Text.FontStyle)}fontWeight(){return Je.STYLE_PROPERTY_GETTER(this,d.Text.FontWeight,f.Text.FontWeight)}lineHeight(){return Je.STYLE_PROPERTY_GETTER(this,d.Text.LineHeight,f.Text.LineHeight)}textAlign(){return Je.STYLE_PROPERTY_GETTER(this,d.Text.TextAlign,f.Text.TextAlign)}textOverflow(){return Je.STYLE_PROPERTY_GETTER(this,d.Text.TextOverflow,f.Text.TextOverflow)}textShadow(){return Je.STYLE_PROPERTY_GETTER(this,d.Text.TextShadow,f.Text.TextShadow)}webkitTextStroke(){return Je.STYLE_PROPERTY_GETTER(this,d.Text.WebkitTextStroke,f.Text.WebkitTextStroke)}whiteSpace(){return Je.STYLE_PROPERTY_GETTER(this,d.Text.WhiteSpace,f.Text.WhiteSpace)}wordWrap(){return Je.STYLE_PROPERTY_GETTER(this,d.Text.WordWrap,f.Text.WordWrap)}direction(){return Je.STYLE_PROPERTY_GETTER(this,d.Text.Direction,f.Text.Direction)}jsvTextEmoji(){return Je.STYLE_PROPERTY_GETTER(this,d.Text.JsvTextEmoji,f.Text.JsvTextEmoji)}jsvTextLatex(){return Je.STYLE_PROPERTY_GETTER(this,d.Text.JsvTextLatex,f.Text.JsvTextLatex)}jsvTextAlignMinWidth(){return Je.STYLE_PROPERTY_GETTER(this,d.Text.JsvTextAlignMinWidth,f.Text.JsvTextAlignMinWidth)}jsvTextVerticalAlign(){return Je.STYLE_PROPERTY_GETTER(this,d.Text.JsvTextVerticalAlign,f.Text.JsvTextVerticalAlign)}jsvTextLineAlign(){return Je.STYLE_PROPERTY_GETTER(this,d.Text.JsvTextLineAlign,f.Text.JsvTextLineAlign)}jsvTextInnerDirection(){return Je.STYLE_PROPERTY_GETTER(this,d.Text.JsvTextInnerDirection,f.Text.JsvTextInnerDirection)}animation(){return Je.STYLE_PROPERTY_GETTER(this,d.Motion.Animation,null)}transition(){return Je.STYLE_PROPERTY_GETTER(this,d.Motion.Transition,null)}static OnVariableChanged(t,e,i,r){const a=t;if(e==d.Motion.Animation){const t=a.elementDelegate;s(null!=t,n.InvalidElement),a.addChangedStyleGroup(p.Motion.Name),r.add(t.nativeId)}else{const t=a.setStyleInheritedProperty(e,i,!1,r);if(t==n.CssStyleNotChanged)return t;o(t)}return 0}setStyleInheritedProperty(t,e,i,r){const a=this.styleClass.getManager();let l=n.UnknownError;if(m.IsVariable(t))l=a.setVariable(t,e,r);else if(m.IsVariable(e))l=a.watchVariable(this.styleClass,t,Je.OnVariableChanged.bind(null,this),e.get(),r);else{if(l=this.style.setPropValue(t,e,i),l==n.CssStyleNotChanged)return l;if(o(l),t==d.Motion.Animation){i&&(l=a.unwatchVariable(this.styleClass,t),o(l));const e=this.style.getPropValue(t);e.is(g.DataType.Animation)&&(l=a.watchKeyframeVariables(this.styleClass,t,Je.OnVariableChanged.bind(null,this),e.get().name,r),o(l))}}if(l==n.CssStyleNotChanged)return l;o(l);const h=this.elementDelegate;s(null!=h,n.InvalidElement),r.add(h.nativeId);const c=(t,e,i)=>{for(const n of e.childNodes)n.styleDelegate.style.hasPropValue(t)||c(t,n,i);const n=e instanceof si?e:null;null!=n&&0!=n.getTextContent().length&&(e.styleDelegate.addChangedStyleGroup(p.Text.Name),i.add(e.nativeId))};return Xe.IsInheritedProp(t)&&c(t,h,r),0}getStyleInheritedProperty(t,e){if(e.reset(this.style.getPropValue(t)),0==e.is(g.DataType.Null))return 0;if(0==Xe.IsInheritedProp(t))return n.CssStyleNotExists;const i=this.elementDelegate;s(null!=i,n.InvalidElement);const r=i.parentNode;if(null==r)return n.CssStyleNotExists;const a=r.styleDelegate.getStyleInheritedProperty(t,e);return a<0?a:0}getNestedClassNamesRecursive(t,e){const i=this.elementDelegate;if(s(null!=i,n.InvalidElement),0==this.styleClass.hasClassAttribute(t))return 0;const r=i.parentNode;s(null!=r,n.InvalidElement);o(r.styleDelegate.getNestedClassNamesRecursive(t,e));const a=this.styleClass.getClassNames();return a.length<=0||e.push(a),0}elementDelegate;style;styleClass;lastCssClassKeySet=new Set}class qe{static DataType=class{static Null=0;static Int32=1;static Float=2;static String=3};static InvalidInt32=Number.MIN_VALUE;static InvalidFloat=Number.NaN;static InvalidPointer=null;constructor(t){let e=-1;null==t?e=qe.DataType.Null:Number(t)===t&&t%1==0?e=qe.DataType.Int32:Number(t)===t&&t%1!=0?e=qe.DataType.Float:"string"==typeof t&&(e=qe.DataType.String),this.data=new qe.DataInfo,t!=qe.InvalidInt32&&t!=qe.InvalidFloat&&t!=qe.InvalidPointer?this.data.value=t:this.data.value=null,this.data.index=e}is(t){return this.data.index==t}get(){return this.data.value}reset(t){this.data.value=t.data.value,this.data.index=t.data.index}equals(t){return this.data.value===t.data.value&&this.data.index===t.data.index}static DataInfo=class{value=null;index=-1};data}class Ze{constructor(){this._PersistMap=new Map,this._PersistMax=300,this._PersistIdx=0,this._PersistTrackList=new Array(this._PersistMax),this._TempMap=new Map,this._TempMax=50,this._TempIdx=0,this._TempTrackList=new Array(this._TempMax)}getPersistPack(t){return this._PersistMap.get(t)}putPersistPack(t,e){Ze._putPack(this._PersistMap,this._PersistTrackList,this._PersistIdx,t,e),this._PersistIdx=(this._PersistIdx+1)%this._PersistMax}getTempPack(t){return this._TempMap.get(t)}putTempPack(t,e){Ze._putPack(this._TempMap,this._TempTrackList,this._TempIdx,t,e),this._TempIdx=(this._TempIdx+1)%this._TempMax}static _putPack(t,e,i,n,s){let r=e[i];r&&(t.delete(r),e[i]=n),t.set(n,s)}}let Qe=new Ze;class ti{static ClipView=_.ClipView;static LayoutView=_.LayoutView;static NinePatchView=_.NinePatchView;static ViewRoundCornerMask=_.ViewRoundCornerMask;static AnimationListener=_.AnimationListener;static sRenderBridge=_.sRenderBridge;static Animation=class{constructor(){}Cancel(){this.animation.Cancel()}Enable(t){this.animation.Enable(t)}EnableDelay(t){this.animation.EnableDelay(t)}SetAnimationListener(t){this.animation.SetAnimationListener(t)}SetRepeat(t){this.animation.SetRepeat(t)}Start(t){this.animation.Start(t)}animation};static AnimationCssKeyframes=class extends _.CssKeyframeAnimation{constructor(t,e){super(e.keyframes,e.duration,e.easing,e.width,e.height)}};static AnimationCssTransition=class extends _.CssTransitionAnimation{static Value=class{constructor(t){this.data=t}data};constructor(t,e){let i=[];for(const t of e){let e={name:t.name,dur:t.duration,tf:null,dly:t.delay,from:t.from.data,to:t.to.data};i.push(e)}super(i)}};static AnimationEnable=_.AnimationEnable;GetAnimationManager(){}static TextUtils=class{static GetTextWidth(t,e,i,n,s,r){return _.sTextUtils.GetTextWidth(e,i,n,s,r)}static GetOneLineTextDrawWidth(t,e,i,n,s,r,a){_.sTextUtils.GetOneLineTextDrawWidth(e,i,n,s,r,a)}static BuildTextView(t,e,i,n,s,r,a,o,l,h,c){return _.sTextUtils.BuildTextView(t,e,i.GetStylePack(),n,{width:s,height:r},0!=a?a:null,o,l,0!=h,0!=c)}};static TextStyleCache=class{UpdateShadow(t,e,i,n){this.stylePackData.shadow={shadowOffsetX:t,shadowOffsetY:e,shadowBlur:i,shadowColor:n}}UpdateStroke(t,e){this.stylePackData.stroke={strokeWidth:t,strokeColor:e}}CommitChanges(){this.stylePackData.textColor=this.textColor,this.stylePackData.font=this.font,this.stylePackData.italic=this.italic,this.stylePackData.bold=this.bold,this.stylePackData.hAlign=this.hAlign,this.stylePackData.vAlign=this.vAlign,this.stylePackData.vAreaAlign=this.vAreaAlign,this.stylePackData.textOverflow=this.textOverflow,this.stylePackData.wordWrap=this.wordWrap,this.stylePackData.direction=this.direction,this.stylePackData.textInnerDirection=this.textInnerDirection,this.stylePackData.whiteSpace=this.whiteSpace;let t=JSON.stringify(this.stylePackData);this.stylePackData.textColor=null==this.stylePackData.textColor?void 0:this.stylePackData.textColor,this.stylePackData.font=null==this.stylePackData.font?void 0:this.stylePackData.font,this.stylePackData.italic=null==this.stylePackData.italic?void 0:this.stylePackData.italic,this.stylePackData.bold=null==this.stylePackData.bold?void 0:this.stylePackData.bold,this.stylePackData.hAlign=null==this.stylePackData.hAlign?void 0:this.stylePackData.hAlign,this.stylePackData.vAlign=null==this.stylePackData.vAlign?void 0:this.stylePackData.vAlign,this.stylePackData.vAreaAlign=null==this.stylePackData.vAreaAlign?void 0:this.stylePackData.vAreaAlign,this.stylePackData.textOverflow=null==this.stylePackData.textOverflow?void 0:this.stylePackData.textOverflow,this.stylePackData.wordWrap=null==this.stylePackData.wordWrap?void 0:this.stylePackData.wordWrap,this.stylePackData.direction=null==this.stylePackData.direction?void 0:this.stylePackData.direction,this.stylePackData.textInnerDirection=null==this.stylePackData.textInnerDirection?void 0:this.stylePackData.textInnerDirection,this.stylePackData.whiteSpace=null==this.stylePackData.whiteSpace?void 0:this.stylePackData.whiteSpace,"nowrap"===this.stylePackData.whiteSpace&&(this.stylePackData.wordWrap="none");let e=Qe.getTempPack(t);e||(e=_.sTextStyleCache.StyleToPack(this.stylePackData),Qe.putTempPack(t,e)),this.textStylePack=e}GetStylePack(){return this.textStylePack}stylePackData={};textStylePack};GetRootView(){return new _.RootView}GetTextureManager(){return window.JsvCode.ForgeHandles.TextureManager}GetTextureSetting(t,e){return new _.ExternalTextureSetting(t,e)}GetRenderBridge(){return ti.sRenderBridge}}ti.LayoutView.eVisibility={VIEW_HIDDEN:"hidden",VIEW_VISIBLE:"visible"};class ei{name;value;viewType;constructor(t,e,i){this.name=t,this.value=e,this.viewType=i}}class ii{static TAG="ElementDelegate";static MakeShared(t,e,i,n){const s=new n(t,e);return s.styleDelegate=new Je(s,i),s}static State={NeedRefreshCssClass:1,NeedRefreshCssClassAttribute:2,NeedCallPostProcess:3};bindToForgeRootView(t){this.forgeMainView=t.GetRootView(),this.forgeMaskView=this.forgeMainView}insertForgeView(t,e,i){e.ensureForgeMaskView(t);const n=this.forgeMainView.InsertView(e.forgeMaskView,i?i.forgeMaskView:null);a(n||void 0===n),this.linkChild(t,e,i)}removeForgeView(t,e){this.forgeMainView.RemoveView(e.forgeMaskView),this.unlinkChild(t,e)}linkChild(t,e,i){this.childNodes.push(e),e.parentNode=this,(e.attrStore.extendClassAttributeDepth>0||e.hasExtendClassAttributeChildren)&&(this.hasExtendClassAttributeChildren=!0)}unlinkChild(t,e){const i=this.childNodes.indexOf(e);this.childNodes.splice(i,1),e.parentNode=void 0}moveForgeView(t,e,i,n){e.unlinkChild(t,i),this.linkChild(t,i,n),(e.forgeMaskView?e.forgeMaskView:e.forgeMainView).MoveChildView(i.forgeMaskView,this.forgeMaskView?this.forgeMaskView:this.forgeMainView,n?n.forgeMaskView:null),console.log("moving child")}addEventListener(t,e,i){if(null==this.eventInfoMap&&(this.eventInfoMap=new Map),0==this.eventInfoMap.has(t)){const i=new ii.EventInfo;i.listener=e,this.eventInfoMap.set(t,i)}this.eventInfoMap.get(t).count++;const n=this.tryDealWithCustomEvent(t,i);return o(n),n}removeEventListener(t,e){if(null==this.eventInfoMap)return;if(0==this.eventInfoMap.has(t))return;const i=this.eventInfoMap.get(t);i.count--,i.count<=0&&this.eventInfoMap.delete(t)}setAttribute(t,e,i){let r=n.UnsupportedError;if(ze.StringStartsWith(e,"data-v-"))r=this.appendStyleClassAttribute(e),o(r),r=ii.State.NeedRefreshCssClassAttribute;else if(ze.StringStartsWith(e,"class"))r=this.styleDelegate.setClassNames(i),o(r),r=ii.State.NeedRefreshCssClass;else if(ze.StringStartsWith(e,"data-jsv-extend-class-attr")){const t=ze.StringToInt32(i);s(t!=g.InvalidInt32,n.InvalidArgument),r=this.setExtendClassAttributeDepth(t),o(r),r=ii.State.NeedRefreshCssClass}return o(r),r}getExtendClassAttributeChildren(t,e=0){if(this.attrStore.extendClassAttributeDepth==e)return t.add(this),0;if(0==this.hasExtendClassAttributeChildren)return 0;for(let i of this.childNodes){if(i.attrStore.extendClassAttributeDepth<=0&&0==i.hasExtendClassAttributeChildren)continue;o(i.getExtendClassAttributeChildren(t,e+1))}return 0}onCssStyleChanged(t){const e=this.styleDelegate.getChangedStyleGroups();return e.has(p.Layout.Name)&&this.onFlushViewLayout(t),e.has(p.Background.Name)&&this.onFlushViewBackground(t),e.has(p.Effect.Name)&&this.onFlushViewEffect(t),e.has(p.Motion.Name)&&this.onFlushViewMotion(t),this.styleDelegate.clearChangedStyleGroups(),0}onAllChangeFinished(t){if(null==this.onAllChangeFinishTasks)return 0;for(const t of this.onAllChangeFinishTasks)t();return this.onAllChangeFinishTasks=void 0,0}handleAfterAllChangeFinish(t){null==this.onAllChangeFinishTasks&&(this.onAllChangeFinishTasks=[]),this.onAllChangeFinishTasks.push(t)}setForgeViewInnerProps(t,e,i,n){return 1==i?this.forgeMaskView?this.forgeMaskView.SetElementProp(t,e,n):this.forgeInnerPropsCacheList.push(new ei(e,n,i)):this.forgeMainView.SetElementProp(t,e,n),0}getElementView(t){return t?this.forgeMaskView:this.forgeMainView}setClientWidth(t,e){this.clientWidth=e}getClientWidth(t){return this.clientWidth<0?this.styleDelegate.width():this.clientWidth}setClientHeight(t,e){this.clientHeight=e}getClientHeight(t){return this.clientHeight>0?this.clientHeight:this.styleDelegate.jsvValidHeight()}nativeId;styleDelegate;childNodes=[];parentNode=void 0;constructor(t,e){this.nativeId=e,this.forgeMainView=new ti.LayoutView,this.forgeMaskView=null}sendEvent(t,e){if(null==this.eventInfoMap||0==this.eventInfoMap.has(t))return;console.log("ElementDelegate.sendEvent(). event="+t);const i=this.eventInfoMap.get(t);let n=[];n.push(new qe(this.nativeId)),n.push(new qe(t));for(const t of e)n.push(t);i.listener(n)}getObjectFitClipStatus(t){return!1}flushMaskViewClip(t){if(null==this.forgeMaskView)return;const e=this.forgeMaskView instanceof ti.ClipView?this.forgeMaskView:null;if(null==e)return;let i={left:0,top:0,width:0,height:0,autoSizeClip:!1,useScissors:!1};if(!this.getObjectFitClipStatus(i)){const t=this.styleDelegate.overflow();null!=t&&"hidden"==t&&(i.autoSizeClip=!0,i.useScissors=!0)}i.autoSizeClip?e.SetWholeSizeScissor(i.useScissors,!0):e.SetClipRect(i.left,i.top,i.width,i.height,i.useScissors)}onFlushViewLayout(t){if(0==this.styleDelegate.hasPropGroup(p.Layout.Name))return;const e=this.styleDelegate.left(),i=this.styleDelegate.top(),n=this.styleDelegate.jsvValidWidth(),s=this.styleDelegate.jsvValidHeight();this.forgeMaskView.ResetLayoutParams({x:e,y:i,width:n,height:s}),this.forgeMaskView!=this.forgeMainView&&this.forgeMainView.ResetLayoutParams({x:0,y:0,width:n,height:s})}onFlushViewBackground(t){if(0==this.styleDelegate.hasPropGroup(p.Background.Name))return;const e=t.GetTextureManager(),i=this.styleDelegate.backgroundColor(),n=this.styleDelegate.backgroundImage(),s=this.styleDelegate.borderRadius();let r,a;i&&(r=e.GetColorTexture(i)),n&&(n.type==g.BackgroundImageImpl.eType.LINEAR_GRADIENT?(r=e.GetNamedCachedTexture(n.urlPath),null==r&&(r=e.CreateCssGradientColorTexture(n.urlPath,n.linearGradient.fromX,n.linearGradient.fromY,n.linearGradient.toX,n.linearGradient.toY,n.linearGradient.stops))):r=e.GetImage(n.urlPath,null)),s&&(a=new ti.ViewRoundCornerMask(s.topLeft,s.topRight,s.bottomLeft,s.bottomRight)),this.forgeMainView.ResetTexture(r,a)}onFlushViewEffect(t){if(0==this.styleDelegate.hasPropGroup(p.Effect.Name))return;const e=this.styleDelegate.visibility();let i=e&&"hidden"==e?ti.LayoutView.eVisibility.VIEW_HIDDEN:ti.LayoutView.eVisibility.VIEW_VISIBLE;"none"==this.styleDelegate.display()&&(i=ti.LayoutView.eVisibility.VIEW_HIDDEN),this.forgeMaskView.SetVisibility(i),this.flushMaskViewClip(t);const n=this.styleDelegate.perspective();if(n>0){const t=this.styleDelegate.perspectiveOrigin();this.forgeMainView.SetPerspective(n,t)}const s=this.styleDelegate.backfaceVisibility();s&&this.forgeMainView.SetBackfaceVisibility("visible"==s),this.styleDelegate.transformStyle()&&this.forgeMainView.SetTransformStyle(this.styleDelegate.transformStyle()),this.forgeMaskView.ResetCssTransform(this.styleDelegate.transform(),this.styleDelegate.transformOrigin()),this.forgeMaskView.SetZIndex(this.styleDelegate.zIndex())}onFlushViewMotion(t){if(null!=this.forgeAnimation&&(this.forgeAnimation.Cancel(),this.forgeAnimation=null),0==this.styleDelegate.hasPropGroup(p.Motion.Name))return;let e="",i="";const n=this.styleDelegate.animation(),s=this.styleDelegate.transition();if(null!=n&&null!=s&&console.warn("ElementDelegate","Cannot set both animation and transition on a single element at the same time."),null!=n){e="animation",i=n.name;const s=this.styleDelegate.getKeyframes(n.name);this.forgeAnimation=this.makeAnimation(t,n,s)}if(null!=s&&null==this.forgeAnimation){const i=t.GetRenderBridge().GetSwapCount();if(this.transitionSetInfo.alreadySet&&this.transitionSetInfo.swapCount!=i)e="transition",this.forgeAnimation=this.makeTransition(t,s);else{for(const[t,e]of s.animationMap){let e=new g;const i=d.ToConst(t);null!=i&&(this.styleDelegate.getProperty(i,e),this.attrStore.transitionStyleMap.set(t,e))}this.transitionSetInfo.alreadySet||(this.transitionSetInfo.alreadySet=!0,this.transitionSetInfo.swapCount=i)}}else this.attrStore.transitionStyleMap.clear(),this.transitionSetInfo.swapCount=0,this.transitionSetInfo.alreadySet=!1;if(null!=this.forgeAnimation){const t=this.makeForgeAnimationListener(e,i);null!=t&&this.forgeAnimation.SetAnimationListener(t),this.forgeMaskView.StartAnimation(this.forgeAnimation)}}tryDealWithCustomEvent(t,e){if("jsvgetbound"===t){s(e.has("jsvtoken"),n.InvalidArgument);const i=e.get("jsvtoken"),r=()=>{const e=this;null!=e?e.getBoundingClientRect(t,i,e.forgeMainView):console.error("ElementDelegate.tryDealWithCustomEvent(), Element has been released.")};return this.handleAfterAllChangeFinish(r),ii.State.NeedCallPostProcess}return 0}makeAnimation(t,e,i){if(null==e||null==i)return null;const n=this.styleDelegate.jsvValidWidth(),s=this.styleDelegate.jsvValidHeight();let r={keyframes:i,duration:e.duration,easing:e.timingFunction,width:n,height:s,left:this.styleDelegate.left(),top:this.styleDelegate.top()};const a=new ti.AnimationCssKeyframes(t.GetAnimationManager(),r);return a.EnableDelay(e.delay),a.SetRepeat(e.iterationCount),a.Enable(ti.AnimationEnable.ReleaseAfterEndCallback),a}makeTransition(t,e){if(null==e)return this.attrStore.transitionStyleMap.clear(),null;let i=[];for(const[t,n]of e.animationMap){if(null==n)continue;const e=this.attrStore.transitionStyleMap.get(t)??new g;let r=new g;const a=d.ToConst(t);if(s(a,null,["Failed makeTransition no support:"+t]),this.styleDelegate.getProperty(a,r),e==r)continue;const o={name:t,duration:n.duration,easing:n.timingFunction,delay:n.delay,from:new ti.AnimationCssTransition.Value,to:new ti.AnimationCssTransition.Value,origin:""};if(e.is(g.DataType.Int32)){const t=e.get();o.from=new ti.AnimationCssTransition.Value(t)}else if(e.is(g.DataType.Float)){const t=e.get();o.from=new ti.AnimationCssTransition.Value(t)}else if(e.is(g.DataType.String)){const t=e.get();o.from=new ti.AnimationCssTransition.Value(t)}if(r.is(g.DataType.Int32)){const t=r.get();o.to=new ti.AnimationCssTransition.Value(t)}else if(r.is(g.DataType.Float)){const t=r.get();o.to=new ti.AnimationCssTransition.Value(t)}else if(r.is(g.DataType.String)){const t=r.get();o.to=new ti.AnimationCssTransition.Value(t)}t==d.Effect.Transform&&(o.origin=null!=this.styleDelegate.transformOrigin()?this.styleDelegate.transformOrigin():"center center"),i.push(o),this.attrStore.transitionStyleMap.set(t,r)}return new ti.AnimationCssTransition(t.GetAnimationManager(),i)}makeForgeAnimationListener(t,e){const i=new ti.AnimationListener(null,null,null);return i.OnStart((()=>{const i=t+"start";this.sendEvent(i,[new qe(e)])})),i.OnRepeat((i=>{const n=t+"iteration";this.sendEvent(n,[new qe(e)])})),i.OnEnd((i=>{let n;n=i?t+"end":t+"cancel",this.sendEvent(n,[new qe(e)])})),i}ensureForgeMaskView(t){if(this.forgeMainView.mParentView)return void console.log("ElementDelegate.ensureForgeMaskView(), Failed to ensure forge mask view, main view's parent is not null.");const e=this.styleDelegate.objectFit(),i=this.styleDelegate.overflow();if(null!=e||null!=i?(null!=this.forgeMaskView&&console.error(ii.TAG,"Jsview: jsvMaskView is conflicting."),this.forgeMaskView=new ti.ClipView):null==this.forgeMaskView&&(this.forgeMaskView=this.forgeMainView),this.forgeMaskView!==this.forgeMainView&&this.forgeMaskView.AddView(this.forgeMainView,0,0),this.forgeInnerPropsCacheList.length>0){for(let e of this.forgeInnerPropsCacheList)this.forgeMaskView.SetElementProp(t,e.name,e.value);this.forgeInnerPropsCacheList=[]}}appendStyleClassAttribute(t){const e=t.replace("data-v-","");let i=0;i=parseInt(e,16);let n=this.styleDelegate.appendClassAttribute(i);o(n);const s=new Set;n=this.getExtendClassAttributeChildren(s),o(n);for(let t of s)n=t.styleDelegate.appendClassAttribute(i),o(n);return 0}setExtendClassAttributeDepth(t){if(t<=0)return 0;this.attrStore.extendClassAttributeDepth=t;let e=this;for(let i=0;i<t&&(e=e.parentNode,null!=e);i++);if(e){o(this.styleDelegate.mergeClassAttributes(e.styleDelegate))}return 0}convertObjectFit(t){return t?"fill"==t?"fill":"none"==t?"none":"cover"==t?"cover":"contain"==t?"contain":"scale-down"==t?"scale-down":"fill":"fill"}getBoundingClientRect(t,e,i){if(i){const n=i=>{this.sendEvent(t,[new qe(i),new qe(e)])};i.GetBoundingClientRect(n)}else{const i='{"status": -100, "error": target LayoutView is null})';this.sendEvent(t,[new qe(i),new qe(e)])}}static EventInfo=class{listener=void 0;count=0};static AttrStore=class{transitionStyleMap=new Map;extendClassAttributeDepth=-1};static TransitionSetInfo=class{swapCount=0;alreadySet=!1};forgeAnimation=null;eventInfoMap=void 0;onAllChangeFinishTasks=void 0;attrStore=new ii.AttrStore;hasExtendClassAttributeChildren=!1;transitionSetInfo=new ii.TransitionSetInfo;forgeMaskView;forgeMainView;clientWidth=-1;clientHeight=-1;forgeInnerPropsCacheList=[]}class ni{static isRtl(t){for(let e=0;e<t.length;++e){let i=t.charCodeAt(e);if(32!==i)return i>=1536&&i<=1791}return!1}}class si extends ii{static TAG="DivDelegate";setTextContent(t){this.textContent=t}getTextContent(){return this.textContent}onCssStyleChanged(t){const e=this.styleDelegate.getChangedStyleGroups();return(e.has(p.Text.Name)||e.has(p.Layout.Name)&&this.clientWidth!=this.styleDelegate.jsvValidHeight())&&this.onFlushViewText(t),e.has(p.Effect.Name)&&null!=this.styleDelegate.borderImage()&&this.onFlushViewBorder(t),super.onCssStyleChanged(t)}constructor(t,e){super(t,e)}onFlushViewText(t){if(!this.textContent)return void(this.forgeContentView&&(this.forgeMainView.RemoveView(this.forgeContentView),this.forgeContentView=null));null==this.forgeContentView&&(this.forgeContentView=new ti.LayoutView,this.forgeMainView.InsertView(this.forgeContentView)),this.forgeContentView.ClearViews(),this.clientWidth=0,this.clientHeight=0;let e=t.GetTextureManager(),i=new ti.TextStyleCache;const n=this.styleDelegate.fontSize();let s=this.styleDelegate.lineHeight();s<=0&&(s=n>0?Math.ceil(1.3*n):14);const r=this.styleDelegate.jsvTextEmoji(),a=this.styleDelegate.jsvTextLatex(),o=this.styleDelegate.fontStyle(),l=this.styleDelegate.fontWeight(),h=this.styleDelegate.textShadow(),c=this.styleDelegate.webkitTextStroke();s>=0&&(i.vAlign="middle"),i.textColor=this.styleDelegate.color(),i.font=this.styleDelegate.fontFamily(),i.italic=o&&"italic"==o,i.bold=l&&"bold"==l,i.hAlign=this.styleDelegate.textAlign(),i.vAlign=this.styleDelegate.jsvTextLineAlign(),i.vAreaAlign=this.styleDelegate.jsvTextVerticalAlign(),i.textOverflow=this.styleDelegate.textOverflow(),h&&i.UpdateShadow(h.hShadow,h.vShadow,h.blur,h.color),c&&i.UpdateStroke(c.length,c.color),i.whiteSpace=this.styleDelegate.whiteSpace(),i.wordWrap=this.styleDelegate.wordWrap(),i.direction=this.styleDelegate.direction(),i.textInnerDirection=this.styleDelegate.jsvTextInnerDirection(),i.CommitChanges(e);const u=this.styleDelegate.height();let d=this.styleDelegate.width(),f=u!=g.InvalidInt32?u:0,m=d==g.InvalidInt32;if(m&&(d=ti.TextUtils.GetTextWidth(e,this.textContent,i.font,n,i.bold,i.italic)),d<=0)return void console.error(si.TAG,"Failed to render text: %s, text width is invalid.");let p=d,_=this.styleDelegate.jsvTextAlignMinWidth();_>0&&p<_&&(p=_);const T=u==g.InvalidInt32||0==u,y=T?(t,e,i)=>{this.clientWidth=t,this.clientHeight=e}:null;let w=Math.floor(d*ti.sRenderBridge.GetScreenInfo().scaleRatio);if(w>3e3){if(!m)return void console.error(`long text only support style.width=undefine. str=${this.textContent}`);console.log(`text too long, start to break down. width(${w})`),this.forgeTextView=new ti.LayoutView;const t=[];ti.TextUtils.GetOneLineTextDrawWidth(e,this.textContent,i.font,n,i.bold,i.italic,t);const o=t[0];let l=0;const h="unset"===i.textInnerDirection?ni.isRtl(this.textContent):"rtl"===i.textInnerDirection;for(let c=1;c<t.length;c+=3){const u=t[c],d=t[c+1],g=t[c+2],m=this.textContent.slice(u,d);let p=ti.TextUtils.BuildTextView(e,m,i,0==u?y:null,g,f,n,s,!0,a,r);const _=h?o-l-g:l;this.forgeTextView.AddView(p,_,0,g,f),l+=g}this.clientWidth=o}else this.forgeTextView=ti.TextUtils.BuildTextView(e,this.textContent,i,y,p,f,n,s,!0,a,r),this.clientWidth=d;T&&this.forgeTextView.EnableAutoHeight(),this.forgeContentView.InsertView(this.forgeTextView)}ensureForgeMaskView(t){null!=this.styleDelegate.borderImage()&&(this.forgeMaskView=new ti.NinePatchView),super.ensureForgeMaskView(t)}onFlushViewBorder(t){if(null==this.forgeMaskView)return;const e=this.styleDelegate.borderImage();if(null!=e)if(0==e.source.length)this.forgeMaskView.ResetTexture(null,null);else{const i=t.GetTextureManager(),n=e.source,s=i.GetImage(n,null);this.forgeMaskView.ResetTexture(s,null),this.forgeMaskView.WaitTextureToResize(!0);const r=(t,i,n)=>{const s=this.styleDelegate.borderImageWidth(),r=this.styleDelegate.borderImageOutset();if(null==this.forgeMaskView||null==e.slice||null==s||null==r)return void console.log(si.TAG,"Nine patch settings are not complete.");const a=this.forgeMaskView,o=Math.floor(t*s.top/e.slice.top),l=Math.floor(i*s.left/e.slice.left);a.SetImageDspSize(o,l);const h={start:r.left,width:Math.max(0,o-r.left-r.right)},c={start:r.top,width:Math.max(0,l-r.top-r.bottom)};a.SetPadding(h,c);const u=[{start:s?.left,width:Math.max(0,o-2*s.left)}],d=[{start:s.top,width:Math.max(0,l-2*s.top)}];a.SetRepeat(u,d),a.WaitTextureToResize(!1)};s.RegisterLoadImageCallback(r)}}getBoundingClientRect(t,e,i){this.styleDelegate.height()!=g.InvalidInt32&&this.styleDelegate.width()!=g.InvalidInt32||null==this.forgeTextView||(i=this.forgeTextView),super.getBoundingClientRect(t,e,i)}forgeContentView;forgeTextView;textContent=""}class ri extends ii{constructor(t,e){super(t,e)}}class ai extends ri{constructor(t,e){super(t,e)}}class oi extends ii{setAttribute(t,e,i){const n=()=>{const e=this;null!=e?e.loadImage(t,e.imgAttrStore.src):console.error("ElementDelegate.tryDealWithCustomEvent(), Element has been released.")};if("src"==e)return this.imgAttrStore.src=i,this.handleAfterAllChangeFinish(n),oi.State.NeedCallPostProcess;return 0==this.setTextureAttribute(t,e,i)?(this.handleAfterAllChangeFinish(n),oi.State.NeedCallPostProcess):super.setAttribute(t,e,i)}onCssStyleChanged(t){const e=this.styleDelegate.getChangedStyleGroups();return(e.has(p.Layout.Name)||e.has(p.Effect.Name))&&this.onFlushViewImage(t),super.onCssStyleChanged(t)}constructor(t,e){super(t,e),this.forgeImageView=new ti.LayoutView(null,"img"),this.forgeMainView.InsertView(this.forgeImageView)}setForgeViewInnerProps(t,e,i,n){return 1==i?super.setForgeViewInnerProps(t,e,i,n):(this.forgeImageView.SetElementProp(t,e,n),0)}getObjectFitClipStatus(t){if(0!=this.imgAttrStore.imageWidth&&0!=this.imgAttrStore.imageHeight){let e=this.convertObjectFit(this.styleDelegate.objectFit());if("fill"!=e){let i=this.forgeImageView.ApplyObjectFit(this.styleDelegate.jsvValidWidth(),this.styleDelegate.jsvValidHeight(),this.imgAttrStore.imageWidth,this.imgAttrStore.imageHeight,e);if(i)return t.left=i.x,t.top=i.y,t.width=i.width,t.height=i.height,t.autoSizeClip=!1,t.useScissors=!0,!0}}return!1}onFlushViewImage(t){if(0!=this.imgAttrStore.imageWidth&&0!=this.imgAttrStore.imageHeight&&!this.imgAttrStore.sizeApplied){this.flushMaskViewClip(t),this.imgAttrStore.sizeApplied=!0;let e=this.styleDelegate.jsvValidWidth(),i=this.styleDelegate.jsvValidHeight();0==e&&0!=i?e=this.imgAttrStore.imageWidth*i/this.imgAttrStore.imageHeight:0!=e&&0==i&&(i=this.imgAttrStore.imageHeight*e/this.imgAttrStore.imageWidth),this.clientWidth=e,this.clientHeight=i,this.imgAttrStore.sizeApplied=!0}const e={x:0,y:0,width:this.getClientWidth(t),height:this.getClientHeight(t)};this.forgeImageView.ResetLayoutParams({x:e.x,y:e.y,width:e.width,height:e.height})}setTextureAttribute(t,e,i){let s=n.UnsupportedError;return"dataJsvImgColorSpace"==e||"data-jsv-img-color-space"==e?(this.imageInLoading&&console.log("Failed to set attribute "+e+", this attribute must be set before src"),this.imgAttrStore.dataJsvColorSpace=i,s=0):"dataJsvImgScaledownTex"!=e&&"data-jsv-img-scaledown-tex"!=e||(this.imageInLoading&&console.log("Failed to set attribute "+e+", this attribute must be set before src"),this.imgAttrStore.dataJsvScaleDownTex=""==i||"true"==i,s=0),s}loadImage(t,e){if(null==e)return;this.imgAttrStore.imageWidth=0,this.imgAttrStore.imageHeight=0;let i=0;1==this.imgAttrStore.dataJsvScaleDownTex&&(i=this.styleDelegate.width(),0==i&&console.error("set dataJsvScaleDownTex while style.width is not set"));let n=t.GetTextureManager();this.forgeImageTexture=n.GetImage2(this.imgAttrStore.src,i,0,this.imgAttrStore.dataJsvColorSpace,null),this.imageInLoading=!0;let s,r=++this.loadCallbackSeq;this.imageOperatorKey=this.forgeImageTexture.RegisterLoadImageCallback(((e,i,n)=>{r==this.loadCallbackSeq&&(this.imgAttrStore.imageWidth=e,this.imgAttrStore.imageHeight=i,this.imageInLoading=!1,this.onFlushViewImage(t),this.sendEvent("load",[new qe(e),new qe(i)]))}));let a=this.styleDelegate.borderRadius();a&&(s=new ti.ViewRoundCornerMask(a.topLeft,a.topRight,a.bottomLeft,a.bottomRight)),this.forgeImageView.ResetTexture(this.forgeImageTexture,s)}getClientWidth(t){const e=super.getClientWidth(t);return e<=0&&this.imgAttrStore.imageWidth>0?this.imgAttrStore.imageWidth:e}getClientHeight(t){const e=super.getClientHeight(t);return e<=0&&this.imgAttrStore.imageHeight>0?this.imgAttrStore.imageHeight:e}forgeImageView;imageInLoading=!1;forgeImageTexture=null;imageOperatorKey=null;loadCallbackSeq=0;static ImgAttrStore=class{src=void 0;imageWidth=0;imageHeight=0;sizeApplied=!1;dataJsvColorSpace="RGBA_8888";dataJsvScaleDownTex=!1};imgAttrStore=new oi.ImgAttrStore}class li extends ri{onCssStyleChanged(t){return this.styleDelegate.getChangedStyleGroups().has(p.Layout.Name)&&this.onFlushViewHole(t),super.onCssStyleChanged(t)}constructor(t,e){super(t,e)}onFlushViewHole(t){this.forgeMainView.Element.style.backgroundColor="#222222"}}class hi{static SetForgeFrontToContext(t,e){t.forgeFront=e}static GetForgeFrontFromContext(t){return t.forgeFront}}class ci{static TaskType={CreateElement:10,BindElementToRootView:11,InsertElementChild:12,RemoveElementChild:13,AddElementEventListener:14,RemoveElementEventListener:15,SetElementText:16,SetElementAttribute:17,GetElementBoundingClientStyles:18,GetElementAttribute:19,MoveElementChild:20,GetRelativePosition:21,DeclareStyleSheets:30,SetStyleProperty:31,GetStyleProperties:32,SetForgeViewInnerProps:40,InsertKeyFrameDefine:41,RemoveKeyFrameDefine:42};static TaskStash=class{removedIdSet=new Set;cssClassChangedIdSet=new Set;cssStyleChangedIdSet=new Set;postprocessingIdSet=new Set};static EventListener=class{jseContext=null;jseFunction};static GetInstance(t){const e=ci.PlatformBridgeInstanceMap.get(t);if(e)return e;const i=new class extends ci{};return i.jsviewId=t,ci.PlatformBridgeInstanceMap.set(t,i),hi.SetForgeFrontToContext(i,new ti),window.JsvCode.Debug||(window.JsvCode.Debug={}),window.JsvCode.Debug.PlatformBridge=[],window.JsvCode.Debug.PlatformBridge.push(i),i}static JsViewId=1;static SetOnEventListener(...t){r(t.length>=2,null);const e=t[0],i=t[1],n=ci.GetInstance(e);return n.onEventListener=new ci.EventListener,n.onEventListener.jseFunction=i,null}static RunSyncTask(...t){s(t.length>=3,n.BadArgumentSize);const e=t[0],i=t[1],r=t[2],a=t,o=ci.GetInstance(e),l=hi.GetForgeFrontFromContext(o);let h=new qe,c=o.runGetterTaskByType(l,i,r,a,h);if(c<0)throw new Error("Failed to run synctask, error: "+c);return ci.CastFromUnionValue(h)}static RunLazyTaskList(...t){r(t.length>=2,null);const e=t[0],i=t[1],s=JSON.parse(i),a=ci.GetInstance(e),o=hi.GetForgeFrontFromContext(a),l=s,h=new ci.TaskStash;for(const t of l){const e=t[0],i=t[1],s=t;if(h.removedIdSet.has(i))continue;let r=a.runSetterTaskByType(o,e,i,s,h);if(r==n.CssStyleNotChanged&&(r=0),r<0)throw new Error("Failed to run lazytask, error: "+r)}for(const t of h.removedIdSet)h.cssClassChangedIdSet.delete(t),h.cssStyleChangedIdSet.delete(t),h.postprocessingIdSet.delete(t);const u=a.syncCssClasses(h.cssClassChangedIdSet,h.cssStyleChangedIdSet);h.cssClassChangedIdSet.clear(),function(t,e,i=[]){c(t,n.GetErrorMessage(i),e)}(u,null);for(const t of h.cssStyleChangedIdSet){a.getElementById(t).onCssStyleChanged(o)}h.cssStyleChangedIdSet.clear();for(const t of h.postprocessingIdSet){a.getElementById(t).onAllChangeFinished(o)}return h.postprocessingIdSet.clear(),null}static CastFromUnionValue(t){let e;return t.is(qe.DataType.String)||t.is(qe.DataType.Int32)||t.is(qe.DataType.Float)?e=t.get():t.is(qe.DataType.Null)?e=null:r(!1,null),e}static AppendToJsonObject(t,e,i){let s,r;if(s=e,i.is(g.DataType.String)){const t=i.get();t&&(r=t)}else if(i.is(g.DataType.Int32)){r=i.get()}else if(i.is(g.DataType.Float)){r=i.get()}else i.is(g.DataType.Null)||o(n.CssStyleBadType);return t[s]=r,0}getElementById(t){let e=null;const i=this.elementDelegateMap.get(t);return null!=i&&(e=i),r(e,null),e}forgeElementGetter(t){let e=null;const i=this.elementDelegateMap.get(t);return null!=i&&(e=i),e}static PlatformBridgeInstanceMap=new Map;syncCssClasses(t,e){for(const i of t){const n=this.getElementById(i),s=[];o(n.styleDelegate.getNestedClassNames(s)),this.syncCssClassesRecursive(n,s,t,e)}return this.styleClassMgr.clearStyleClassCache(),0}syncCssClassesRecursive(t,e,i,n){let s=new Set;t.styleDelegate.updateClassDeclarations(e,s);for(const t of s)n.add(t);const r=t.styleDelegate.getClassNames(),a=[...e];r.length>0&&a.push(r);for(const e of t.childNodes){if(i.has(e.nativeId))return;this.syncCssClassesRecursive(e,a,i,n)}}runSetterTaskByType(t,e,i,s,r){let a=n.BadTaskType;switch(e){case ci.TaskType.CreateElement:a=this.createElement(t,i,s);break;case ci.TaskType.BindElementToRootView:a=this.bindElementToRootView(t,i,s);break;case ci.TaskType.InsertElementChild:a=this.insertElementChild(t,i,s);break;case ci.TaskType.RemoveElementChild:a=this.removeElementChild(t,i,s,r);break;case ci.TaskType.MoveElementChild:a=this.moveElementChild(t,i,s);break;case ci.TaskType.AddElementEventListener:a=this.addElementEventListener(t,i,s,r);break;case ci.TaskType.RemoveElementEventListener:a=this.removeElementEventListener(t,i,s);break;case ci.TaskType.SetElementText:a=this.setElementText(t,i,s,r);break;case ci.TaskType.SetElementAttribute:a=this.setElementAttribute(t,i,s,r);break;case ci.TaskType.SetForgeViewInnerProps:a=this.setForgeViewInnerProps(t,i,s);break;case ci.TaskType.InsertKeyFrameDefine:a=this.insertKeyFrame(t,i,s);break;case ci.TaskType.RemoveKeyFrameDefine:a=this.removeKeyFrame(t,i,s);break;case ci.TaskType.DeclareStyleSheets:a=this.declareStyleSheets(t,i,s);break;case ci.TaskType.SetStyleProperty:a=this.setStyleProperty(t,i,s,r)}return o(a),0}runGetterTaskByType(t,e,i,s,r){let a=n.BadTaskType;switch(e){case ci.TaskType.GetElementBoundingClientStyles:a=this.getElementBoundingClientStyles(t,i,s,r);case ci.TaskType.GetStyleProperties:a=this.getStyleProperties(t,i,s,r);break;case ci.TaskType.GetElementAttribute:a=this.getElementAttributes(t,i,s,r);break;case ci.TaskType.GetRelativePosition:a=this.getRelativePosition(t,i,s,r)}return o(a),0}createElement(t,e,i){const r=i;s(r.length>=3,n.BadArgumentSize);const a=r[2];let o;return o="AUDIO"==a?ii.MakeShared(t,e,this.styleClassMgr,ai):"DIV"==a?ii.MakeShared(t,e,this.styleClassMgr,si):"IMG"==a?ii.MakeShared(t,e,this.styleClassMgr,oi):"VIDEO"==a?ii.MakeShared(t,e,this.styleClassMgr,li):ii.MakeShared(t,e,this.styleClassMgr,ii),this.elementDelegateMap.set(e,o),0}bindElementToRootView(t,e,i){s(i.length>=2,n.BadArgumentSize);return this.getElementById(e).bindToForgeRootView(t),0}insertElementChild(t,e,i){const r=i;s(r.length>=3,n.BadArgumentSize);const a=r[2],o=r.length>=4&&r[3]?r[3]:-1,l=this.getElementById(e),h=this.getElementById(a),c=o>0?this.getElementById(o):void 0;return l.insertForgeView(t,h,c),0}removeElementChild(t,e,i,r){const a=i;s(a.length>=3,n.BadArgumentSize);const o=a[2],l=this.getElementById(e),h=this.getElementById(o),c=(t,e,i)=>{for(const n of t.childNodes)c(n,e,i);t.styleDelegate.finalize(),e.add(t.nativeId),i.delete(t.nativeId)};return c(h,r.removedIdSet,this.elementDelegateMap),l.removeForgeView(t,h),0}moveElementChild(t,e,i){const r=i;s(r.length>=4,n.BadArgumentSize);const a=r[2],o=r[3],l=r.length>=5&&r[4]?r[4]:-1,h=this.getElementById(e),c=this.getElementById(a),u=this.getElementById(o),d=l>0?this.getElementById(l):void 0;return h.moveForgeView(t,c,u,d),0}addElementEventListener(t,e,i,r){const l=i;s(l.length>=4,n.BadArgumentSize);const h=l[2],c=new Map;if("object"==typeof l[3]&&null!==l[3]){const t=l[3];for(const[e,i]of Object.entries(t))s("number"==typeof i,n.InvalidArgument),c.set(e,i)}const u=this.getElementById(e).addEventListener(h,((t,e,i)=>{a(ci.GetInstance(t).onEventListener),setTimeout(e.bind(this,t,i),0)}).bind(this,this.jsviewId,((t,e)=>{const i=ci.GetInstance(t);if(null==i.onEventListener)return;const n=i.onEventListener.jseFunction;let s=[];for(const t of e){const e=ci.CastFromUnionValue(t);s.push(e)}n(...s)})),c);return o(u),u==ii.State.NeedCallPostProcess&&r.postprocessingIdSet.add(e),0}removeElementEventListener(t,e,i){const r=i;s(r.length>=4,n.BadArgumentSize);const a=r[2],o=new Map;if("object"==typeof r[3]&&null!==r[3]){const t=r[3];for(const[e,i]of Object.entries(t))s("number"==typeof i,n.InvalidArgument),o.set(e,i)}return this.getElementById(e).removeEventListener(a,o),0}setElementText(t,e,i,r){const a=i;s(a.length>=3,n.BadArgumentSize);const o=a[2],l=this.getElementById(e),h=l instanceof si?l:null;return s(h,n.BadElementType),h.setTextContent(o),h.styleDelegate.addChangedStyleGroup(p.Text.Name),r.cssStyleChangedIdSet.add(h.nativeId),0}setElementAttribute(t,e,i,r){const a=i;s(a.length>=4,n.BadArgumentSize);const l=a[2],h=a[3],c=this.getElementById(e);let u=c.setAttribute(t,l,h);if(o(u),u==ii.State.NeedRefreshCssClass)r.cssClassChangedIdSet.add(e);else if(u==ii.State.NeedRefreshCssClassAttribute){r.cssClassChangedIdSet.add(e);const t=new Set;u=c.getExtendClassAttributeChildren(t),o(u);for(const e of t)r.cssClassChangedIdSet.add(e.nativeId)}else u==ii.State.NeedCallPostProcess&&r.postprocessingIdSet.add(e);return 0}getElementBoundingClientStyles(t,e,i,r){const a=i;s(a.length>=4,n.BadArgumentSize);const l=a[3];s(l,n.InvalidElement);const h=JSON.parse(l),c=this.getElementById(e),u=c.styleDelegate,f={},m=h;for(const t of m){const e=t,i=d.ToConst(e);s(i,n.CssStyleBadName);let r=new g;if(i==d.Layout.Left){let t=u.left(),e=c.parentNode;for(;null!=e;){t+=e.styleDelegate.left(),e=e.parentNode}r=new g(t)}else if(i==d.Layout.Top){let t=u.top(),e=c.parentNode;for(;null!=e;){t+=e.styleDelegate.top(),e=e.parentNode}r=new g(t)}else{let t=u.getProperty(i,r);s(t>=0||n.CssStyleNotExists,t,["Failed to get style ",i])}o(ci.AppendToJsonObject(f,i,r))}const p=JSON.stringify(f),_=new qe(p);return r.reset(_),0}declareStyleSheets(t,e,i){const r=i;s(r.length>=2,n.BadArgumentSize);const a=r[2];return o(this.styleClassMgr.declareStyleSheets(a)),0}setStyleProperty(t,e,i,r){const a=i;s(a.length>=3,n.BadArgumentSize);const l=a[2],h=a.length>=4?a[3]:null,c=this.getElementById(e).styleDelegate,u=Ke.CastToStyleValue(h);let d=new Set;const g=c.setProperty(l,u,d);if(g==n.CssStyleNotChanged)return 0;o(g,["Failed to set style ",l]);for(const t of d)r.cssStyleChangedIdSet.add(t);return 0}getStyleProperties(t,e,i,r){const a=i;s(a.length>=4,n.BadArgumentSize);const l=a[3];s(l,n.InvalidElement);const h=JSON.parse(l),c=this.getElementById(e).styleDelegate,u={},f=h;for(const t of f){const e=t,i=d.ToConst(e);s(i,n.CssStyleBadName);const r=new g;let a=c.getProperty(i,r);s(a>=0||n.CssStyleNotExists,a,["Failed to get style ",i]),a=ci.AppendToJsonObject(u,i,r),o(a)}const m=JSON.stringify(u),p=new qe(m);return r.reset(p),0}getElementAttributes(t,e,i,r){const a=i;s(a.length>=3,n.BadArgumentSize);const o=a[3],l=this.getElementById(e);if("clientWidth"==o){const e=new qe(l.getClientWidth(t));r.reset(e)}else if("clientHeight"==o){const e=new qe(l.getClientHeight(t));r.reset(e)}return 0}getRelativePosition(t,e,i,r){const a=i;s(a.length>=3,n.BadArgumentSize);const o=a[3],l=this.getElementById(e),h=this.getElementById(o);let c=0,u=0,d=l.getClientWidth(t),g=l.getClientHeight(t),f=l;for(;null!=f&&f!=h;)c+=f.styleDelegate.left(),u+=f.styleDelegate.top(),f=f.parentNode;const m=new qe(JSON.stringify({left:c,top:u,width:d,height:g}));return r.reset(m),0}setForgeViewInnerProps(t,e,i){const r=i;s(r.length>=5,n.BadArgumentSize);const a=r[2],o=r[3],l=r[4];return this.getElementById(e).setForgeViewInnerProps(t,a,o,l)}insertKeyFrame(t,e,i){const r=i;s(r.length>=4,n.BadArgumentSize);const a=r[2],o=r[3];return this.styleClassMgr.insertKeyFrame(a,o),0}removeKeyFrame(t,e,i){const r=i;s(r.length>=3,n.BadArgumentSize);const a=r[2];return this.styleClassMgr.removeKeyFrame(a),0}jsviewId;elementDelegateMap=new Map;onEventListener=void 0;styleClassMgr=new Ke.Manager}ci.RegisterOriginDocument=function(t){let e=t.createElement("style");e.type="text/css",e.innerHTML="\n * {\n margin: 0px;\n }\n div {\n position: absolute;\n background-size: 100% 100%;\n white-space: pre-wrap;\n pointer-events: none;\n z-index: 0; /* 所有元素都设置zindex以触发DOM为每个view创建单独的zIndex stack context,使和Forge native动作一致 */\n }\n video {\n position: absolute;\n background-size: 100% 100%;\n }\n img {\n position: absolute;\n pointer-events: none;\n }\n ";t.getElementsByTagName("Head")[0].appendChild(e),window.originDocument=t},window.JsvCode.BrowserPlatformDomBridge=ci,i.LogF=function(t){},i.LogE=function(t){},i.LogW=function(t){},i.LogI=function(t){},i.LogD=function(t){},i.LogM=function(t){},i.ThrowError=function(t){throw new Error(t)},i.Assert=function(t){if(!t)throw new Error("ASSERT!!!!!")},i.EnableLog=function(t){i.LogM=console.log.bind(console),t>0&&(i.LogF=console.error.bind(console)),t>1&&(i.LogE=console.error.bind(console)),t>2&&(i.LogW=console.warn.bind(console)),t>3&&(i.LogI=console.log.bind(console)),t>4&&(i.LogD=console.debug.bind(console))},i.EnableLog(4),i.BaseActivity=class{},console.log("Log debug replace Forge.BaseActivity");{class t{constructor(t,e,i){this.PageName=t,this._FocusChild=null,this._LatestFocusChild=null,this.SubPages=[],this._ParentPage=null,this._ConsumeKeycodeUntilUp=-1,this.TouchDispatcher=null,this._Acc=.001,this._KeyLock=!1,this._CVSet=null,this._AutoShow=!1,this._IsShowing=!1,this._HostActivity=i,e&&this.SetContentView(e)}OnRenderFrame(){i.LogE("OnRenderFrame() MUST override")}OnKeyDown(t){return!1}OnKeyUp(t){return!1}DispatchKeyDown(e){if(this._KeyLock)return!0;var i=!1;return t.sLastFocusPage=this,this._FocusChild&&(i=this._FocusChild.DispatchKeyDown(e)),i||(i=this.OnKeyDown(e)),i}OnCustomerEvent(t){return!1}BubbleCustomerEvent(t){this.OnCustomerEvent(t)||this._ParentPage&&this._ParentPage.BubbleCustomerEvent(t)}DispatchKeyUp(t){if(this._KeyLock)return!0;var e=!1;return this._FocusChild&&(e=this._FocusChild.DispatchKeyUp(t)),e||(e=this.OnKeyUp(t)),e}PrintLastFocusPage(){var t="------"+this.PageName+"\n",e=this._ParentPage;return e&&(t+=e.PrintLastFocusPage()),t}OnMouseDown(t){return!1}EnableTouchDispatcher(){this.TouchDispatcher=new i.TouchDispatcher(this)}DisableTouchDispatcher(){this.TouchDispatcher=null}GetTouchView(){return null}GetSwipeParams(t,e,i){var n=void 0===i||0==i?this._Acc:i,s=t*t/2/n;t<0&&(s=-s);var r=e*e/2/n;return e<0&&(r=-r),{durationX:Math.floor(Math.abs(t/n)),durationY:Math.floor(Math.abs(e/n)),distanceX:s,distanceY:r}}OnTouch(t){return!1}DispatchTouch(t){var e=!1;return this.TouchDispatcher&&(e=this.TouchDispatcher.OnTouch(t)),e}LostTouchFocus(t){}OnJavaKey(t,e){return!0}OnPlatformKey(t,e){return!0}PassPlatformKey(t,e){if(this._KeyLock)return!1;var i=this.OnPlatformKey(t,e);return i&&(i=this.OnJavaKey(t,e)),i}DispatchJavaKey(t,e){if(t==this._ConsumeKeycodeUntilUp)return 1==e&&(this._ConsumeKeycodeUntilUp=-1),i.LogM("Consume Javakey until up keycode="+t+" keyaction="+e),!1;if(this._KeyLock)return!1;-1!=this._ConsumeKeycodeUntilUp&&(i.LogE("ERROR: Other key pressed before locked key release"),this._ConsumeKeycodeUntilUp=-1);var n=this._FocusChild,s=!0;return n&&(s=n.DispatchJavaKey(t,e)),s&&(s=this.PassPlatformKey(t,e)),n!=this._FocusChild&&0==e&&this.CosumeAllKeyUnitlUpForFocusChange(t),s}CosumeAllKeyUnitlUpForFocusChange(t){this._ParentPage?this._ParentPage.CosumeAllKeyUnitlUpForFocusChange(t):this._ConsumeKeycodeUntilUp=t}OnHostActivityGetFocus(){this._ConsumeKeycodeUntilUp=-1}IsFocus(){return!this._ParentPage||this._ParentPage._FocusChild==this}_IsLeafInChain(){return this.IsFocus()&&!this._FocusChild}SetParent(t,e){null!=t?(null!=e&&this.SetContentView(e),t instanceof i.BaseActivity&&(t=t.GetRootPageBase()),this._ParentPage=t,t.SubPages.push(this),this._HostActivity=t._HostActivity,t._IsShowing&&this._AutoShow&&this._OnShowInternal()):i.ThrowError("ERROR: parent is null")}SetParentPage(t){this.SetParent(t)}OnRemoveFromTree(){if(this._ParentPage=null,this.SubPages&&this.SubPages.length>0){for(let t of this.SubPages)t.OnRemoveFromTree();this.SubPages=[]}}RemoveSubPage(t){t==this._FocusChild&&(this._FocusChild=null),t==this._LatestFocusChild&&(this._LatestFocusChild=null);for(var e=0;e<this.SubPages.length;e++)if(t==this.SubPages[e]){t._OnHideInternal(),this.SubPages.splice(e,1);break}}ClearSubPages(){this.SubPages=[],this._FocusChild=null,this._LatestFocusChild=null}GetParentPage(){return this._ParentPage}Focus(e){if(this.IsFocus()){if(!e)return void i.LogI("Already focused page_name="+this.PageName);if(this._IsLeafInChain())return void i.LogI("Already focused page_name="+this.PageName)}if(t.sChangingFocusLock)return void t.sDelayedFocusChanges.push(this);if(t.sChangingFocusLock=!0,this._ParentPage){for(var n,s=[],r=this;r._ParentPage&&!r.IsFocus();)s.push(r),r=r._ParentPage;n=e&&0==s.length?this._FocusChild:s[s.length-1]._ParentPage._FocusChild;for(var a=[];n;)a.push(n),n=n._FocusChild;for(var o=a.length-1;o>=0;o--)a[o]._BlurInternal();for(o=s.length-1;o>=0;o--)s[o]._FocusInternal();if(!e)for(var l=s[0];l._LatestFocusChild&&null==l._FocusChild;)l._LatestFocusChild._FocusInternal(),(l=l._FocusChild)||i.ThrowError("ERROR: focus chain is broken")}t.sChangingFocusLock=!1;let h=t.sDelayedFocusChanges.length;if(h>0){let e=t.sDelayedFocusChanges;t.sDelayedFocusChanges=[];for(let t=0;t<h;t++)e[t].Focus()}}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()):i.LogE("No dispatcher")}_BlurInternal(){this._ParentPage||i.LogE("No dispacher"),this._ParentPage._FocusChild==this?(this._ParentPage._FocusChild=null,this.OnBlur()):i.LogW("Not focus yet, page name="+this.PageName)}GetFocusChild(){return this._FocusChild}Hide(){this._AutoShow=!1,this._OnHideInternal()}Show(t){this._OnShowInternal(),t&&this.Focus()}OnFocus(){i.LogW("No overrided Page OnFocus event, page name="+this.PageName)}OnBlur(){i.LogW("No overrided Page OnBlur event, page name="+this.PageName)}OnShow(){i.LogW("No overrided Page OnShow event, page name="+this.PageName)}OnHide(){i.LogW("No overrided Page OnHide event, page name="+this.PageName)}_OnShowInternal(){for(var t,e=0;e<this.SubPages.length;e++)(t=this.SubPages[e])._AutoShow&&t._OnShowInternal();this._IsShowing||(this._IsShowing=!0,this.OnShow())}_OnHideInternal(){for(var t,e=0;e<this.SubPages.length;e++)(t=this.SubPages[e])._IsShowing&&t._OnHideInternal();this._IsShowing&&(this._IsShowing=!1,this.OnHide())}GetMainView(){return null==this._CVSet&&(this._CVSet=new i.MainViewSetting(null,null)),this._CVSet}GetContentView(){return null==this._CVSet?null:this._CVSet.View}SetContentView(t){null!=t&&(null!=this._CVSet&&this._CVSet.View.BindedPageBase(null),this._CVSet=new i.MainViewSetting(t,null),t.BindedPageBase(this))}OnContentViewLostInternal(){this.OnContentViewLost()}OnContentViewLost(){}GetHostActivity(){return this._HostActivity}SetHostActivity(t){this._HostActivity=t}GetTextureManager(){return null!=this._HostActivity?this._HostActivity.GetTextureManager():null}SetAutoShow(t){this._AutoShow=t}KeyLock(){this._KeyLock=!0}UnKeyLock(){this._KeyLock=!1}}t.sLastFocusPage=null,t.sChangingFocusLock=!1,t.sDelayedFocusChanges=[],i.PageBase=t}i.RectArea=C,i.sParticleManager=oe,i.AnimationListener=At,i.TranslateAnimation=Yt,i.RotateAnimation=$t,i.ScaleAnimation=Ut,i.TranslateFrameAnimation=jt,i.ThrowAnimation=zt,i.AnimationEnable=Xt,i.TextureSetting=nt,i.ExternalTextureSetting=st,i.DragInfo=ht,i.DragSetting=lt;let ui=qt;i.sRenderBridge=ui;{let t=[];ui.AddAfterSwapListener("NewDomView",(()=>{!function(){if(t.length>0){for(let e of t)e.DoAttachToElement();t=[]}}()}));class e extends dt{constructor(e,i){super(null,"jsv-element-proxy"),this.ProxiedView=null,this._DomNativeId=e,this._UseMaskView=i,this.DelayedCalls=[],this._OnReadyCallbacks=[],t.push(this)}DoAttachToElement(){let t=i.DomElementGetter?.(this._DomNativeId);if(t){this.ProxiedView=t?.getElementView(this._UseMaskView),this.InvokeDelayCalls();for(const t of this._OnReadyCallbacks)t();this._OnReadyCallbacks=null}else console.warn("expired domProxyView id="+this._DomNativeId)}RegisterOnProxyReady(t){this.ProxiedView?t():"function"==typeof t&&this._OnReadyCallbacks.push(t)}PushDelayCalls(t,e){this.DelayedCalls.push({name:t,args:e})}InvokeDelayCalls(){if(this.DelayedCalls.length>0)for(let t of this.DelayedCalls)this.ProxiedView[t.name].apply(this.ProxiedView,t.args)}HtmlCanAccessElement(){return null!=this.ProxiedView}}i.NewDomProxyView=function(t,n){let s=new e(t,n);return new Proxy(s,{get(t,e){if("string"!=typeof e||e.startsWith("_"))return t[e];if(null!=t.ProxiedView)return void 0!==t.ProxiedView[e]?"function"==typeof t.ProxiedView[e]?t.ProxiedView[e].bind(t.ProxiedView):t.ProxiedView[e]:Reflect.get(t,e);if("function"==typeof t[e]){if("RegisterOnProxyReady"===e)return t[e].bind(t);{let n=t;return(...t)=>{n.PushDelayCalls(e,t),i.sRenderBridge.RequestSwap()}}}console.warn(`proxy not ready to get prop(${e})`)},set(t,e){console.warn("no support set prop")}})}}i.LayoutView=class extends dt{ResetTexture(t){t?super.ResetTexture(t.Texture,t.MaskSetting?.ImageTexture):super.ResetTexture(null)}AddView(t,e){let n=0,s=0,r=0,a=0;e&&(e instanceof i.LayoutParams?(n=e.MarginLeft,s=e.MarginTop,r=e.Width,a=e.Height):(n=isNaN(e.x)?0:e.x,s=isNaN(e.y)?0:e.y,r=isNaN(e.width)?0:e.width,a=isNaN(e.height)?0:e.height)),super.AddView(t,n,s,r,a)}},i.FilterView=yt,i.EditControlView=Tt,i.DragSetting=lt,i.DragInfo=ht;i.TextureManager=class extends j{RegisterLoadImageCallback(t,e,i){return super.RegisterLoadImageCallback(((t,n)=>{e({width:t,height:n},i)}))}},i.sViewStore=Et,i.ViewInfo=It,i.ViewMask=rt,i.ViewTextureMask=at,i.ViewRoundCornerMask=ot;{class t{constructor(t,e){this.OnBeginContact=t,this.OnEndContact=e}UpdateImpactCallback(t){this.OnBeginContact=t}UpdateLeaveCallback(t){this.OnEndContact=t}}i.sImpactSensorManager={StartTrace:(t,e,i,n)=>new ke(t,e,i,n),Callback:t,AutoFroze:De}}i.ImpactAutoFroze=De,i.ImpactSensor=ke,i.VisibleSensor=Oe,i.TextInputType=wt;const di=window.ForgeFront,gi=Object.keys(di);for(let t of gi)Object.hasOwn(i,t)||(i[t]=di[t]);export{i as default};
|
|
2
2
|
|