@shijiu/jsview 2.1.448-test.0 → 2.1.482-test.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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/package.json +1 -1
- package/patches/node_modules/@originjs/vite-plugin-federation/1.3.4/@originjs+vite-plugin-federation+1.3.4.patch +50 -6
- package/patches/node_modules/vite/dist/node/jsview-vite-extension.js +1 -1
- package/tools/jsview-common.mjs +32 -1
- package/tools/jsview-logger.js +12 -0
- package/tools/jsview-run-tool.mjs +27 -30
- package/tools/jsview-vue-devtools.mjs +97 -0
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/* eslint-disable */ import{parseGIF as e,decompressFrames as t}from"gifuct-js";void 0===window.Forge?(window.Forge={},console.log("Define forge browser")):console.log("Define using JsView forge engine-js");var i,n,s,r,a,o,l,h,c,u,d,g,f,m,p,y=window.Forge;function T(e,t,i){return"symbol"==typeof t&&(t=t.description?"[".concat(t.description,"]"):""),Object.defineProperty(e,"name",{configurable:!0,value:i?"".concat(i," ",t):t})}class _{static ToString(e){switch(e){case _.UnknownError:return"UnknownError("+e+")";case _.UnimplementedError:return"UnimplementedError("+e+")";case _.UnsupportedError:return"UnsupportedError("+e+")";case _.NotFoundError:return"NotFoundError("+e+")";case _.InvalidArgument:return"InvalidArgument("+e+")";case _.BadArgumentSize:return"BadArgumentSize("+e+")";case _.InvalidElement:return"InvalidElement("+e+")";case _.BadElementType:return"BadElementType("+e+")";case _.CssStyleNotExists:return"CssStyleNotExists("+e+")";case _.CssStyleNotChanged:return"CssStyleNotChanged("+e+")";case _.CssStyleBadType:return"CssStyleBadType("+e+")";case _.CssClassNotChanged:return"CssClassNotChanged("+e+")";case _.ForgeInsertView:return"ForgeInsertView("+e+")";default:return"UnknownError("+e+")"}}static GetFormattedMethod(e){var t,i;t=e.indexOf(" ")+1,i=e.indexOf("(")-t;return e.substr(t,i)+"()"}static GetErrorMessage(e=[]){var t="";for(const i of e)t+=i;return t}static PrintErrorMessage(e,t,i=[]){const n=_.GetErrorMessage(i);console.error("ForgeDom","Error@ "+e+":"+t+", "+n)}constructor(){throw new Error("new ErrCode() is forbidden.")}}function x(e,t,i=[]){I(e,_.GetErrorMessage(i),t)}function w(e,t,i=[]){I(e,_.GetErrorMessage(i),t)}function S(e,t=[]){I(e,_.GetErrorMessage(t))}function v(e,t=[]){C(e,_.GetErrorMessage(t),e)}function E(e,t,i=[]){C(e,_.GetErrorMessage(i),t)}function b(e,t=[]){C(e,_.GetErrorMessage(t))}function C(e,t,i=void 0){if(e<0)throw _.PrintErrorMessage("__FILE_NAME__","__LINE__",[_.ToString(e),". ",t]),new Error(i)}function I(e,t,i=void 0){if(!e)throw _.PrintErrorMessage("__FILE_NAME__","__LINE__",["ASSERT("+e+")",". ",t]),new Error(i)}_.UnknownError=-1,_.UnimplementedError=-2,_.UnsupportedError=-3,_.NotFoundError=-4,_.InvalidArgument=-5,_.BadArgumentSize=-6,_.InvalidElement=-100,_.BadElementType=-101,_.BadTaskType=-102,_.CssStyleNotExists=-120,_.CssStyleNotChanged=-121,_.CssStyleBadName=-122,_.CssStyleBadType=-123,_.CssClassNotChanged=-124,_.ForgeInsertView=-200;class A{static HasGetterMethod(e){switch(e){case A.Layout.Height:case A.Layout.Left:case A.Layout.Top:case A.Layout.Width:case A.Effect.ObjectFit:return!0;default:return!1}}static ToConst(e){return e==A.Layout.Height?A.Layout.Height:e==A.Layout.Left?A.Layout.Left:e==A.Layout.Top?A.Layout.Top:e==A.Layout.Width?A.Layout.Width:e==A.Flex.FlexDirection?A.Flex.FlexDirection:e==A.Flex.FlexWrap?A.Flex.FlexWrap:e==A.Flex.JustifyContent?A.Flex.JustifyContent:e==A.Flex.AlignItems?A.Flex.AlignItems:e==A.Flex.AlignContent?A.Flex.AlignContent:e==A.Flex.AlignSelf?A.Flex.AlignSelf:e==A.Flex.FlexGrow?A.Flex.FlexGrow:e==A.Background.BackgroundColor?A.Background.BackgroundColor:e==A.Background.BackgroundImage?A.Background.BackgroundImage:e==A.Background.BorderRadius?A.Background.BorderRadius:e==A.Effect.BackfaceVisibility?A.Effect.BackfaceVisibility:e==A.Effect.BorderImage?A.Effect.BorderImage:e==A.Effect.BorderImageWidth?A.Effect.BorderImageWidth:e==A.Effect.BorderImageOutset?A.Effect.BorderImageOutset:e==A.Effect.Display?A.Effect.Display:e==A.Effect.ObjectFit?A.Effect.ObjectFit:e==A.Effect.Opacity?A.Effect.Opacity:e==A.Effect.Overflow?A.Effect.Overflow:e==A.Effect.Perspective?A.Effect.Perspective:e==A.Effect.PerspectiveOrigin?A.Effect.PerspectiveOrigin:e==A.Effect.Transform?A.Effect.Transform:e==A.Effect.TransformOrigin?A.Effect.TransformOrigin:e==A.Effect.TransformStyle?A.Effect.TransformStyle:e==A.Effect.Visibility?A.Effect.Visibility:e==A.Effect.ZIndex?A.Effect.ZIndex:e==A.Text.Color?A.Text.Color:e==A.Text.FontFamily?A.Text.FontFamily:e==A.Text.FontSize?A.Text.FontSize:e==A.Text.FontStyle?A.Text.FontStyle:e==A.Text.FontWeight?A.Text.FontWeight:e==A.Text.LineHeight?A.Text.LineHeight:e==A.Text.TextAlign?A.Text.TextAlign:e==A.Text.TextOverflow?A.Text.TextOverflow:e==A.Text.TextShadow?A.Text.TextShadow:e==A.Text.WebkitTextStroke?A.Text.WebkitTextStroke:e==A.Text.WhiteSpace?A.Text.WhiteSpace:e==A.Text.WordWrap?A.Text.WordWrap:e==A.Text.Direction?A.Text.Direction:e==A.Text.JsvTextEmoji?A.Text.JsvTextEmoji:e==A.Text.JsvTextLatex?A.Text.JsvTextLatex:e==A.Text.JsvTextAlignMinWidth?A.Text.JsvTextAlignMinWidth:e==A.Text.JsvTextVerticalAlign?A.Text.JsvTextVerticalAlign:e==A.Text.JsvTextLineAlign?A.Text.JsvTextLineAlign:e==A.Text.JsvTextInnerDirection?A.Text.JsvTextInnerDirection:e==A.Motion.Animation?A.Motion.Animation:e==A.Motion.Transition?A.Motion.Transition:e==A.Motion.AnimationFillMode?A.Motion.AnimationFillMode:null}constructor(){throw new Error("new StyleName() is forbidden.")}}A.Layout=(T(i=class{constructor(){throw new Error("new StyleName.Layout() is forbidden.")}},"Layout"),i.Height="height",i.Left="left",i.Top="top",i.Width="width",i),A.Flex=(T(n=class{constructor(){throw new Error("new StyleName.Flex() is forbidden.")}},"Flex"),n.FlexDirection="flexDirection",n.FlexWrap="flexWrap",n.JustifyContent="justifyContent",n.AlignItems="alignItems",n.AlignContent="alignContent",n.AlignSelf="alignSelf",n.FlexGrow="flexGrow",n),A.Background=(T(s=class{constructor(){throw new Error("new StyleName.Background() is forbidden.")}},"Background"),s.BackgroundColor="backgroundColor",s.BackgroundImage="backgroundImage",s.BorderRadius="borderRadius",s),A.Effect=(T(r=class{constructor(){throw new Error("new StyleName.Effect() is forbidden.")}},"Effect"),r.BackfaceVisibility="backfaceVisibility",r.BorderImage="borderImage",r.BorderImageWidth="borderImageWidth",r.BorderImageOutset="borderImageOutset",r.Display="display",r.ObjectFit="objectFit",r.Opacity="opacity",r.Overflow="overflow",r.Perspective="perspective",r.PerspectiveOrigin="perspectiveOrigin",r.Transform="transform",r.TransformOrigin="transformOrigin",r.TransformStyle="transformStyle",r.Visibility="visibility",r.ZIndex="zIndex",r),A.Text=(T(a=class{constructor(){throw new Error("new StyleName.Text() is forbidden.")}},"Text"),a.Color="color",a.FontFamily="fontFamily",a.FontSize="fontSize",a.FontStyle="fontStyle",a.FontWeight="fontWeight",a.LineHeight="lineHeight",a.TextAlign="textAlign",a.TextOverflow="textOverflow",a.TextShadow="textShadow",a.WebkitTextStroke="WebkitTextStroke",a.WhiteSpace="whiteSpace",a.WordWrap="wordWrap",a.Direction="direction",a.JsvTextEmoji="JsvTextEmoji",a.JsvTextLatex="JsvTextLatex",a.JsvTextAlignMinWidth="JsvTextAlignMinWidth",a.JsvTextVerticalAlign="JsvTextVerticalAlign",a.JsvTextLineAlign="JsvTextLineAlign",a.JsvTextInnerDirection="JsvTextInnerDirection",a),A.Motion=(T(o=class{constructor(){throw new Error("new StyleName.Motion() is forbidden.")}},"Motion"),o.Animation="animation",o.Transition="transition",o.AnimationFillMode="animationFillMode",o);class P{constructor(e){let t=-1,i=null;null==e?t=P.DataType.Null:Number(e)===e&&e%1==0?t=P.DataType.Int32:Number(e)===e&&e%1!=0?t=P.DataType.Float:"string"==typeof e||e instanceof String?t=P.DataType.String:e instanceof P.AnimationImpl?t=P.DataType.Animation:e instanceof P.CornerImpl?t=P.DataType.Corner:e instanceof P.RectImpl?t=P.DataType.Rect:e instanceof P.TextShadowImpl?t=P.DataType.TextShadow:e instanceof P.WebkitTextStrokeImpl?t=P.DataType.WebkitTextStroke:e instanceof P.TransitionImpl?t=P.DataType.Transition:e instanceof P.BorderImageImpl&&(t=P.DataType.BorderImage),e!=P.InvalidInt32&&e!=P.InvalidFloat&&e!=P.InvalidPointer?i=e:(t=P.DataType.Null,i=null),this.data=new P.DataInfo,this.data.index=t,this.data.value=i}toString(){let e=null;switch(this.data.index){case P.DataType.Null:return"";case P.DataType.Int32:case P.DataType.Float:return String(this.get());case P.DataType.String:e=this.get();break;case P.DataType.Animation:case P.DataType.Corner:case P.DataType.Rect:case P.DataType.TextShadow:case P.DataType.WebkitTextStroke:case P.DataType.Transition:case P.DataType.BorderImage:case P.DataType.BackgroundImage:e=this.get().rawValue;break;default:console.error("Failed to do StyleValue.toString()")}return e??""}is(e){return this.data.index==e}get(){return this.data.value}reset(e){this.data.value=e.data.value,this.data.index=e.data.index}equals(e){return this.data.value===e.data.value&&this.data.index===e.data.index}}P.Base=class{constructor(e){this.rawValue=e}},P.AnimationImpl=class extends P.Base{constructor(e){super(e),this.name="",this.duration=0,this.timingFunction=null,this.delay=0,this.iterationCount=0,this.direction=!1}},P.CornerImpl=class extends P.Base{constructor(e){super(e),this.topLeft=0,this.topRight=0,this.bottomRight=0,this.bottomLeft=0}},P.RectImpl=class extends P.Base{constructor(e){super(e),this.top=0,this.right=0,this.left=0,this.bottom=0}},P.TextShadowImpl=class extends P.Base{constructor(e){super(e),this.hShadow=0,this.vShadow=0,this.blur=0,this.color=void 0}},P.WebkitTextStrokeImpl=class extends P.Base{constructor(e){super(e),this.length=0,this.color=void 0}},P.TransitionImpl=class extends P.Base{constructor(e){super(e),this.animationMap=new Map}},P.BorderImageImpl=class extends P.Base{constructor(e){super(e),this.source="",this.slice=null}},P.BackgroundImageImpl=(T(l=class extends P.Base{constructor(e){super(e),this.type=0,this.urlPath=""}},"BackgroundImageImpl"),l.eType={UNKNOWN:0,LINEAR_GRADIENT:1,URL_PATH:2},l.LinearGradient=class{constructor(){this.fromX=0,this.fromY=0,this.toX=0,this.toY=0,this.stops=[]}},l),P.DataType=(T(h=class{},"DataType"),h.Null=0,h.Int32=1,h.Float=2,h.String=3,h.Animation=4,h.Corner=5,h.Rect=6,h.TextShadow=7,h.WebkitTextStroke=8,h.Transition=9,h.BorderImage=10,h.BackgroundImage=11,h),P.InvalidInt32=Number.MIN_VALUE,P.InvalidFloat=Number.NaN,P.InvalidPointer=null,P.DataInfo=class{constructor(){this.value=null,this.index=-1}};class L{}L.Text=(T(c=class{},"Text"),c.Color="#000000",c.FontFamily="黑体",c.FontSize=10,c.FontStyle="normal",c.FontWeight="normal",c.LineHeight=0,c.TextAlign="start",c.TextOverflow="clip",c.TextShadow=null,c.WebkitTextStroke=null,c.WhiteSpace="normal",c.WordWrap="normal",c.Direction="ltr",c.JsvTextEmoji=0,c.JsvTextLatex=0,c.JsvTextAlignMinWidth=0,c.JsvTextVerticalAlign="top",c.JsvTextLineAlign="middle",c.JsvTextInnerDirection="unset",c);class k{static FormatVariableName(e){return e.startsWith("--")?"var("+e+")":e.startsWith("var(--")?e:(w(!1,null),null)}static IsVariable(e){let t;if(e instanceof P){if(0==e.is(P.DataType.String))return!1;t=e.get()}else{if("string"!=typeof e)return!1;t=e}return t.startsWith("--")||t.startsWith("var(--")}constructor(){throw new Error("new StyleVariable() is forbidden.")}}class R{constructor(){throw new Error("new StyleGroup() is forbidden.")}}R.Layout=(T(u=class{constructor(){this.height=P.InvalidInt32,this.left=P.InvalidInt32,this.top=P.InvalidInt32,this.width=P.InvalidInt32}},"Layout"),u.Name="layout",u),R.Flex=(T(d=class{constructor(){this.flexDirection=P.InvalidInt32,this.flexWrap=P.InvalidInt32,this.justifyContent=P.InvalidInt32,this.alignItems=P.InvalidInt32,this.alignContent=P.InvalidInt32,this.alignSelf=P.InvalidInt32,this.flexGrow=P.InvalidFloat}},"Flex"),d.Name="flex",d),R.Background=(T(g=class{constructor(){this.backgroundColor=P.InvalidPointer,this.backgroundImage=P.InvalidPointer,this.borderRadius=P.InvalidPointer}},"Background"),g.Name="background",g),R.Effect=(T(f=class{constructor(){this.backfaceVisibility=P.InvalidPointer,this.borderImage=P.InvalidPointer,this.borderImageWidth=P.InvalidPointer,this.borderImageOutset=P.InvalidPointer,this.display=P.InvalidPointer,this.objectFit=P.InvalidPointer,this.opacity=P.InvalidFloat,this.overflow=P.InvalidPointer,this.perspective=P.InvalidInt32,this.perspectiveOrigin=P.InvalidPointer,this.transform=P.InvalidPointer,this.transformOrigin=P.InvalidPointer,this.transformStyle=P.InvalidPointer,this.visibility=P.InvalidPointer,this.zIndex=P.InvalidInt32}},"Effect"),f.Name="effect",f),R.Text=(T(m=class{constructor(){this.color=P.InvalidPointer,this.fontFamily=P.InvalidPointer,this.fontSize=P.InvalidInt32,this.fontStyle=P.InvalidPointer,this.fontWeight=P.InvalidPointer,this.lineHeight=P.InvalidInt32,this.textAlign=P.InvalidPointer,this.textOverflow=P.InvalidPointer,this.textShadow=P.InvalidPointer,this.webkitTextStroke=P.InvalidPointer,this.whiteSpace=P.InvalidPointer,this.wordWrap=P.InvalidPointer,this.direction=P.InvalidPointer,this.jsvTextEmoji=P.InvalidInt32,this.jsvTextLatex=P.InvalidInt32,this.jsvTextAlignMinWidth=P.InvalidInt32,this.jsvTextVerticalAlign=P.InvalidPointer,this.jsvTextLineAlign=P.InvalidPointer,this.jsvTextInnerDirection=P.InvalidPointer}},"Text"),m.Name="text",m),R.Motion=(T(p=class{constructor(){this.animation=P.InvalidPointer,this.transition=P.InvalidPointer,this.animationFillMode="none"}},"Motion"),p.Name="motion",p),void 0===window.ForgeFront&&(window.ForgeFront={},console.log("Define global ForgeFront browser"));let F=window.ForgeFront;const D=new class{constructor(){this._count=1}get count(){return this._count}update(){this._count<Number.MAX_SAFE_INTEGER?++this._count:this._count=1}};F.sFrameCount=D;class V{static getTextPixelWith(e,t){null===V.sCanvas&&(V.sCanvas=window.originDocument.createElement("canvas"));const i=V.sCanvas.getContext("2d");i.font=t;const n=i.measureText(e);return Math.ceil(n.width)}static GetOneLineTextDrawWidth(e,t,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<e.length;){const n=h+l;let s;if(h+l>=e.length)s=e.length-h;else{let t=e.lastIndexOf(" ",n);s=t>h?t-h+1:l}const u=e.slice(h,h+s),d=V.getTextPixelWith(u,`${a} ${o} ${i}px ${t}`);r.push(h),r.push(h+s),r.push(d),c+=d,h+=s}return r[0]=c,r}static GetTextWidth(e){let t="";e.bold&&(t="bold");let i="";return e.italic&&(i="italic"),this.getTextPixelWith(e.str,`${t} ${i} ${e.size}px ${e.font}`)}static GetTextRect(e,t,i,n,s){let r=Math.ceil(i.size*e.length/t.width)*s;r>t.height&&(r=t.height);return{width:t.width,height:r}}static GetCursorOffset(e,t,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(e,`${o} ${l} ${i.size}px ${i.font}`);(r-=t.width-n)<0&&(r=0)}let c=0;for(;r>=c&&h!==e.length;)c=this.getTextPixelWith(e.substr(0,h+1),`${o} ${l} ${i.size}px ${i.font}`),r>=c&&h++;return h}static GetCursorPosition(e,t,i,n,s,r){let a="";i.bold&&(a="bold");let o="";i.italic&&(o="italic");let l=0,h=e;if(r<e.length&&(h=h.substr(0,r)),l=this.getTextPixelWith(h,`${a} ${o} ${i.size}px ${i.font}`),"right"===i.alignment){const n=this.getTextPixelWith(e,`${a} ${o} ${i.size}px ${i.font}`);l=t.width-n+l}return{x:l,y:0}}}V.sCanvas=null,window.PlatformUtils=V;class O{constructor(e){this.state={},this.type=e,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(e){void 0!==e&&(this._AutoPlay=!0,this.Ele.paused&&setTimeout((()=>{this.play()}),0))}get currentTime(){return this.Ele.currentTime}set currentTime(e){this.Ele.currentTime=e,this.setState("seek",e,"number")}get duration(){return this.Ele.duration}set loop(e){this.Ele.loop="boolean"==typeof e||void 0!==e}get muted(){return this.getState("muted")}set muted(e){this.setState("muted",e,"boolean")}get paused(){return this.Ele.paused}get playbackRate(){return this.getState("playbackRate")}set playbackRate(e){this.setState("playbackRate",e,"number")}set src(e){this.setState("src",e,"string"),e&&this._AutoPlay&&setTimeout((()=>{this.play()}),0)}get style(){const e=this;return{set bottom(t){e.setState("style",`{"bottom":"${t}"}`,"string")},set left(t){e.setState("style",`{"left":"${t}"}`,"string")},set right(t){e.setState("style",`{"right":"${t}"}`,"string")},set top(t){e.setState("style",`{"top":"${t}"}`,"string")},set height(t){e.setState("style",`{"height":"${t}"}`,"string")},set width(t){e.setState("style",`{"width":"${t}"}`,"string")}}}get volume(){return this.getState("volume")}set volume(e){this.setState("volume",e,"number")}get playableDuration(){return this.Ele.playableDuration}addEventListener(e,t){this[`on${e}`]=t,this.Ele.addEventListener(e,(t=>{this[`on${e}`](t)}))}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(e,t,i){typeof t===i?("playbackRate"==e?this.Ele.playbackRate=t:"muted"==e?this.Ele.muted=t:this.Ele.setAttribute(e,t),this.state[e]=t,console.log(`set ${e} = ${t}`)):console.warn(`invalid paramter type to set ${e}. value is not ${i}`)}getState(e){let t=this.state[e];return console.log(`get ${e} = ${t}`),void 0===t&&(t=this.Ele.getAttribute(e),this.state[e]=t),t}onEnd(e){this.setState("paused",!0,"boolean"),this.hasOwnProperty("onended")&&this.onended()}onError(e){this.hasOwnProperty("onerror")&&this.onerror(e.currentTarget.error.code)}mediaHandler(){return this.Ele}static setDesignMapWidth(e){"number"==typeof e?O.prototype.designMapWidth=e:console.warn(`Invalid paramter type to set ${e}. It is not number.`)}}O.prototype.designMapWidth=0;class M extends O{constructor(e){super(e),super.buildPlatformInstance(e)}}class N extends M{constructor(){super("audio")}}window._ExtAudio=N;class G extends M{constructor(){super("video"),this.state.height=0,this.state.width=0,this.state.aspectRatiow="origin"}get height(){return this.getState("height")}set height(e){this.style.height=e,this.state.height=e}get poster(){return console.log("Video.poster() TODO"),null}set poster(e){console.log("Video.poster() TODO")}get videoAspectRatio(){return this.getState("aspectRatio")}set videoAspectRatio(e){this.setState("aspectRatio",e,"string")}get videoHeight(){return this.Ele.videoHeight}get videoWidth(){return this.Ele.videoWidth}get width(){return this.getState("width")}set width(e){this.style.width=e,this.state.width=e}onLoad(e){super.onLoad(e)}setRotation(e,t,i,n){let s=function(){let s=`rotate3d(0, 0, 1, ${e}deg)`;if(90==e||-90==e){let e,r;if(n?(e=i/t,r=t/i):(e=this.videoHeight/this.videoWidth,r=this.videoWidth/this.videoHeight),isNaN(e)||isNaN(r))return!1;s+=` scale3d(${e}, ${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=G;class B extends O{constructor(){super("video"),this._ReleaseCallbacks=[],this._ResourceTerminater=null,super.buildPlatformInstance()}setResourceTerminator(e){this._ResourceTerminater=e}hasTerminator(){return null!==this._ResourceTerminater}listenToRelease(e){this._ReleaseCallbacks.push(e)}unload(){super.unload(),null!==this._ResourceTerminater&&this._ResourceTerminater(),this._ResourceTerminater=null}releaseResource(){for(let e=0;e<this._ReleaseCallbacks.length;e++)this._ReleaseCallbacks[e]();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=B,window.Audio=N,window.Video=G,window.OffscreenVideoPlayer=B;class W{constructor(e,t){if(this.href="",this.origin="",this.protocol="",this.host="",this.hostname="",this.port="",this.pathname="",this.search="",this.hash="",!e)return;if(!0===e.startsWith("url")){const t=e.indexOf("(")+1,i=e.lastIndexOf(")");e=e.substring(t,i).trim()}if(!0===e.startsWith("data:"))return void(this.href=e);if(!0===e.startsWith("/")&&(e=document.location.origin+e),!0===e.startsWith("./")){const t=document.location.pathname.lastIndexOf("/");let i="";t>0&&(i=document.location.pathname.substring(0,t)),e=document.location.origin+i+e.substring(1)}if(this.href=e,!t)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(e){this.href=e}}const H=window.AudioContext||window.webkitAudioContext;if(H){const Qi=new H;let en=0,tn=0;class nn{constructor(e,t,i){this._Context=e,this._BufferSource=t,this._Gain=i,this._BufferSource.connect(this._Gain),this._Gain.connect(this._Context.destination)}start(e,t,i){this._BufferSource.start(e,t,i)}setVolume(e){this._Gain.gain.setValueAtTime(e,this._Context.currentTime)}stop(e){this._BufferSource.stop(e)}}class sn{constructor(){this._SoundBufferMap={},this._StreamMap={}}load(e,t,i,n){const s=new W(e).href,r=en++;return this._requestBuffer(s,((e,t)=>{0===e?Qi.decodeAudioData(t,(e=>{this._SoundBufferMap[r]=e,n(r,0)})):n(-1,-1)})),r}unload(e){delete this._SoundBufferMap[e]}autoPause(){}autoResume(){}play(e,t,i,n,s,r){if(this._SoundBufferMap[e]){const i=tn++,n=Qi.createBufferSource();n.buffer=this._SoundBufferMap[e],n.playbackRate.value=r,n.onended=e=>{this.stop(i)},s>0&&(n.loop=!0);const a=Qi.createGain();a.gain.setValueAtTime(t,Qi.currentTime);const o=new nn(Qi,n,a);return this._StreamMap[i]=o,console.log("loop test",(s+1)*this._SoundBufferMap[e].duration),o.start(0,0,(s+1)*this._SoundBufferMap[e].duration),i}return-1}pause(e){}resume(e){}stop(e){this._StreamMap[e]&&(this._StreamMap[e].stop(),delete this._StreamMap[e])}release(){this._SoundBufferMap={},this._StreamMap={}}setVolume(e,t,i){this._StreamMap[e]&&this._StreamMap[e].setVolume(t)}setPriority(e,t){}setRate(e,t){}setLoop(e,t){}_requestBuffer(e,t){const i=new XMLHttpRequest;i.open("GET",e,!0),i.responseType="arraybuffer",i.onload=()=>{200===i.status?(console.log("http request succeed"),t(0,i.response)):(console.error(`download audio ${e} failed.`,i.status),t(-1,null))},i.send()}}window.SoundPool=sn}else window.SoundPool=null;F.LogF=function(e){},F.LogE=function(e){},F.LogW=function(e){},F.LogI=function(e){},F.LogD=function(e){},F.LogM=function(e){},F.ThrowError=function(e){throw new Error(e)},F.Assert=function(e){if(!e)throw new Error("ASSERT!!!!!")},F.EnableLog=function(e){F.LogM=console.log.bind(console),e>0&&(F.LogF=console.error.bind(console)),e>1&&(F.LogE=console.error.bind(console)),e>2&&(F.LogW=console.warn.bind(console)),e>3&&(F.LogI=console.log.bind(console)),e>4&&(F.LogD=console.debug.bind(console))};class Y{constructor(e,t,i,n){this.x="number"==typeof e?e:0,this.y="number"==typeof t?t:0,("number"!=typeof i||i<0)&&(i=0),this.width=i,("number"!=typeof n||n<0)&&(n=0),this.height=n}Equals(e){return null!==e&&(e.x===this.x&&e.y===this.y&&e.width===this.width&&e.height===this.height)}}F.RectArea=Y;F.Coordinate=class{constructor(e,t){this.x=e,this.y=t}};F.Size=class{constructor(e,t){this.width=e,this.height=t}};F.RectUtils=class{FormatRectArea(e){let t=null;if(e instanceof F.RectArea)t=e;else if("object"==typeof e&&null!==e){if(isNaN(e.width)||isNaN(e.height))throw new Error("ERROR: target_size format should be {width:XXXX, height:XXXX}");t=new F.RectArea(0,0,e.width,e.height)}return t}},F.sRectUitls=new F.RectUtils,F.TextShaderType={LinearGradient:0,Image:1};F.TextShader=class{constructor(e,t){this.Type=e,this.Params=t}};class ${constructor(){const e=(new F.LayoutView).GetRenderer();this._Renderer=e,this.StringWithFont=F.sTextUtils.StringWithFont("",0,void 0,"center","middle",void 0,!1,!1,void 0,void 0,"top"),this.RectArea=new F.RectArea(0,0,0,0),this.TextAttr=F.sTextUtils.TextAttr("ellipsis","none"),this.Marquee=null,this.Shader=null,this.IsInstantLoad=!0,this.LineHeight=0,this.LatexMode=!1}SetInstantLoad(e){return this.IsInstantLoad=e,this}SetStringWithFont(e){return this.StringWithFont=e,this}SetLatexMode(e){return this.LatexMode=e,this}SetFontStyle(e,t,i,n,s,r,a,o,l,h){return this.StringWithFont="object"==typeof e?F.sTextUtils.StringWithFont("",void 0!==e.size?e.size:10,void 0!==e.font?e.font:"宋体",void 0!==e.hAlign?e.hAlign:"center",void 0!==e.vAlign?e.vAlign:"middle",void 0!==e.textColor?e.textColor:"#000000",void 0!==e.italic&&e.italic,void 0!==e.bold&&e.bold,void 0!==e.shadow?e.shadow:null,void 0!==e.strokeWidth?e.strokeWidth:null,void 0!==e.vAreaAlign?e.vAreaAlign:"top"):F.sTextUtils.StringWithFont("",e,t,i,n,s,r,a,o,l,h),this}SetRectArea(e){return e instanceof F.RectArea?this.RectArea=e:this.RectArea=new F.RectArea(e.x,e.y,e.width,e.height),this}SetViewSize(e){return e instanceof F.RectArea||(e=new F.RectArea(e.x,e.y,e.width,e.height)),this.SetRectArea(e),0===this.LineHeight&&0!==e.height&&(this.LineHeight=e.height),this}SetTextAttr(e){let t,i;return t=e.hasOwnProperty("textOverflow")?e.textOverflow:e.hasOwnProperty("text_overflow")?e.text_overflow:"clip",i=e.hasOwnProperty("wordWrap")?e.wordWrap:e.hasOwnProperty("word_wrap")?e.word_wrap:"none",this.TextAttr={word_wrap:i,text_overflow:t},this}SetMarquee(e){return e&&(this.Marquee={repetition:"infinite",direction:"left",speed:"normal"},e.repetition&&(this.Marquee.repetition=e.repetition),e.direction&&(this.Marquee.direction=e.direction),e.speed&&(this.Marquee.speed=e.speed)),this}SetShader(e){return this.Shader=e,this}SetLineHeight(e){return this.LineHeight=e,this}EnableDuplicateBuilder(){this.BuildCopyBag=!0}Clone(){const e=new $(null);return e.StringWithFont=this.StringWithFont,e.RectArea=this.RectArea,e.TextAttr=this.TextAttr,e.LineHeight=this.LineHeight,e}}F.TextViewParams=$,window.TextViewParams=F.TextViewParams;class U{constructor(e,t,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=t,this._NeedQuick=void 0!==n&&n,this._marquee=t.Marquee,this._rectArea=t.RectArea,this._DrawCount=0,this._ShowInterval=0,this._TextureManager=e,this._LatexMode=t.LatexMode,this._Shader=t.Shader,this._IsInstantLoad=t.IsInstantLoad?1:0,this._AutoHeight=!1,this._EnableTextureOnloadCallback=!!s,this._DuplicateBag=t.BuildCopyBag?{Set:null,Swf:null,Siz:null}:null;const r=this;let a=null;const o=t.RectArea.width,l=t.RectArea.height;let h=null,c=null;null!==this._marquee?(c=new F.ClipView,c.Init(),c.SetClipRect(0,0,o,l,!0),c.SetId("matrixClipLayoutview"),c.OnDettachFromSystem=function(){r._marqueeRunning=!1,F.ClipView.prototype.OnDettachFromSystem.call(this)}):(c=new F.LayoutView,c.OnDettachFromSystem=function(){this._TextureOnloadCallbacksTimer&&(clearTimeout(this._TextureOnloadCallbacksTimer),this._TextureOnloadCallbacksTimer=null)}),a=c.GetRenderer(),this._Renderer=a;let u=i;u||(u=t.StringWithFont.str),u=this._ConvertEscToString(u);let d=!1;t.StringWithFont.italic.length>0&&(d=!0);let g=!1;t.StringWithFont.bold.length>0&&(g=!0),h=F.sTextUtils.StringWithFont(u,t.StringWithFont.size,t.StringWithFont.font,t.StringWithFont.alignment,t.StringWithFont.vertical_align,t.StringWithFont.textColour,d,g,t.StringWithFont.shadow,t.StringWithFont.stroke_width,t.StringWithFont.vertical_area_align),void 0!==t.Marquee&&null!==t.Marquee?this._textWidth=F.sTextUtils.GetTextWidth(h):this._NeedQuick?this._textWidth=t.RectArea.width-2*t.RectArea.x:this._textWidth=F.sTextUtils.GetTextWidth(h),this.addTextView(c,h,t.TextAttr,t.RectArea,t.Marquee,t.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(e){let t=`${e}`;return-1!==t.indexOf(""")&&(t=t.replace(/"/gi,'"')),-1!==t.indexOf("&")&&(t=t.replace(/&/gi,"&")),-1!==t.indexOf("<")&&(t=t.replace(/</gi,">")),-1!==t.indexOf(">")&&(t=t.replace(/>/gi,"<")),-1!==t.indexOf(" ")&&(t=t.replace(/ /gi," ")),t}EnableAutoHeight(){this._AutoHeight=!0,this._textView.EnableAutoHeight()}addTextView(e,t,i,n,s,r){const a=n.height;let o;const l=F.Clone(n);let h=null;0!==t.str.length?(o=this._TextureManager.GetTextTextureByMultiRows(t,i,l,r,this._NeedQuick,this._Shader,this._IsInstantLoad,this._LatexMode,this._DuplicateBag),this._TextTexture=o.texture,this._textViewReahHeight=o.real_height,h=new F.LayoutView,h.Init(new F.TextureSetting(o.texture,null,null,!0)),h.SetId(`Text-${t.str}`),"middle"!==t.vertical_area_align&&"bottom"!==t.vertical_area_align||(h.Element.style.display="table-cell",h.Element.style.position="static",e.Element.style.display="table",e.Element.style.position="static"),e.AddView(h,0,0,l.width,a),this._textView=h):(this._textViewReahHeight=0,F.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(e){e&&null!==this._textView&&this._textView.StartAnimation(e)}}F.TextViewEx=U,F.TextViewControl=U;F.CopiedTextViewEx=class{constructor(e,t,i,n,s){const r={x:0,y:0,width:i.width,height:i.height};this._ContainerView=new F.LayoutView,this._TextView=this._AddTextView(e,t,r,this._ContainerView,n,s)}_AddTextView(e,t,i,n,s,r){let a=null;if(t&&0!==t.length){const o=e.GetCopiedTextTexture(t,i,s,r);a=new F.LayoutView,a.Init(new F.TextureSetting(o,null,null,!0)),t.length<15?a.SetId(`Text-${t}`):a.SetId(`Text-Long${t.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}},F.Clone=function(e){return JSON.parse(JSON.stringify(e))},window.Clone=F.Clone;F.PersistTimer=new class{constructor(){this._AlreadyExited=!1,window.PersistTimer&&(this._AlreadyExited=!0)}setTimeout(e,t){return this._AlreadyExited&&window.PersistTimer.setTimeout?window.PersistTimer.setTimeout(e,t):window.setTimeout(e,t)}clearTimeout(e){this._AlreadyExited&&window.PersistTimer.clearTimeout?window.PersistTimer.clearTimeout(e):window.clearTimeout(e)}setInterval(e,t){if(!this._AlreadyExited||!window.PersistTimer.setInterval)return window.setInterval(e,t);window.PersistTimer.setInterval(e,t)}clearInterval(e){this._AlreadyExited&&window.PersistTimer.clearInterval?window.PersistTimer.clearInterval(e):window.clearInterval(e)}};F.ForegroundTimer=new class{setTimeout(e,t){return window.setTimeout(e,t)}clearTimeout(e){window.clearTimeout(e)}setInterval(e,t){return window.setInterval(e,t)}clearInterval(e){window.clearInterval(e)}},F.EasingTypeIn=0,F.EasingTypeOut=1,F.EasingTypeInOut=2,F.EasingTypeBezier=3,F.EasingTypeBlink=4,F.EasingTypeDeceleration=5,F.EasingTypeSteps=6;F.EasingBase=class{constructor(){this.Pacakge=this.Package}Package(){}_GetBasePackage(e){return{T:e,St:null}}};class j extends F.EasingBase{Package(){return this._GetBasePackage(F.EasingTypeIn)}}F.EasingIn=j;class z extends F.EasingBase{Package(){return this._GetBasePackage(F.EasingTypeOut)}}F.EasingOut=z;class X extends F.EasingBase{Package(){return this._GetBasePackage(F.EasingTypeInOut)}}F.EasingInOut=X;class K extends F.EasingBase{Package(){return this._GetBasePackage(F.EasingTypeDeceleration)}}F.EasingDeceleration=K;class J extends F.EasingBase{Package(){return this._GetBasePackage(F.EasingTypeBlink)}}F.EasingBlink=J;class q extends F.EasingBase{constructor(e,t,i,n,s){super(),this._Inited=!1,this._X1=e,this._X2=i,this._Y1=t,this._Y2=n,this._Duration=s}Package(){const e=this._GetBasePackage(F.EasingTypeBezier);return e.St={X1:this._X1,X2:this._X2,Y1:this._Y1,Y2:this._Y2,Dur:this._Duration},e}}F.BezierEasing=q;class Z extends F.EasingBase{constructor(e,t){super(),this._Steps=e,this._Type=t}Package(){const e=this._GetBasePackage(F.EasingTypeSteps);return e.St={S:this._Steps,T:this._Type},e}}F.StepsEasing=Z,F.Easing={Circular:{In:new F.EasingIn,Out:new F.EasingOut,InOut:new F.EasingInOut,Deceleration:new F.EasingDeceleration}},window.Easing=F.Easing;let Q=null,ee=null,te=null;F.sCustomCanvasResProvider=new class{GetDataUrl(e){return JSON.parse(e).forEach(((e,t)=>{switch(e.cmd){case 1:Q=window.originDocument.createElement("canvas"),ee=Q.getContext("2d"),Q.setAttribute("width",`${e.w}px`),Q.setAttribute("height",`${e.h}px`);break;case 2:"stroke"==e.type?(ee.strokeStyle=e.clr,ee.lineWidth=e.lineWidth,ee.fillStyle=null,te="stroke"):(ee.fillStyle=e.clr,ee.strokeStyle=null,te="fill");break;case 3:ee.beginPath();break;case 30:this.myMoveTo(e.x,e.y);break;case 31:this.myLineTo(e.x,e.y);break;case 32:this.myArcTo(e);break;case 33:ee.closePath();break;case 14:"stroke"===te?ee.stroke():"fill"===te&&ee.fill();break;case 13:this.myRect(e);break;case 12:this.circleDraw(e);break;case 15:this.drawLine(e);break;case 16:this.drawLinearGradientRect(e);break;case 11:this.drawColor(e.clr);break;case 10:this.clearCanvas()}})),Q.toDataURL("image/png")}myMoveTo(e,t){void 0!==e&&void 0!==t&&ee.moveTo(e,t)}myLineTo(e,t){void 0!==e&&void 0!==t&&ee.lineTo(e,t)}myArcTo(e){let t=(e.left+e.right)/2,i=(e.top+e.bottom)/2,n=(e.right-e.left)/2,s=(e.bottom-e.top)/2;const r={x:t+n*Math.cos(e.startAngle*Math.PI/180),y:i-s*Math.sin(e.startAngle*Math.PI/180)};let a=e.startAngle*Math.PI/180,o=(e.startAngle+e.sweepAngle)*Math.PI/180,l=1!=Math.sign(e.sweepAngle);ee.moveTo(r.x,r.y),ee.ellipse(t,i,n,s,0,a,o,l)}circleDraw(e){void 0!==e.x&&void 0!==e.y&&void 0!==e.radius&&(ee.arc(e.x,e.y,e.radius,0,2*Math.PI),"stroke"===te?ee.stroke():"fill"===te&&ee.fill())}myRect(e){let t=e.right-e.left,i=e.bottom-e.top,n=e.left,s=e.top;ee.rect(n,s,t,i),"stroke"===te?ee.stroke():"fill"===te&&ee.fill()}drawLine(e){ee.moveTo(e.x0,e.y0),ee.lineTo(e.x1,e.y1),ee.lineWidth=e.lineWidth,ee.strokeStyle=e.clr,ee.stroke()}drawLinearGradientRect(e){const t=e.clrs,i=e.stops;if(!t||!i||t.length!==i.length)return void console.error("drawLinearGradientRect error: stopList size is not equal to colorList size.");const n=ee.createLinearGradient(e.x0,e.y0,e.x1,e.y1);for(let e=0;e<t.length;++e)n.addColorStop(i[e],t[e]);ee.fillStyle=n,ee.fillRect(0,0,Q.width,Q.height)}drawColor(e){let t=Q.getContext("2d");t.fillStyle=e,t.fillRect(0,0,Q.width,Q.height)}clearCanvas(){Q.getContext("2d").clearRect(0,0,Q.width,Q.height)}},F.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"},F.QRCodeLevel={L:1,M:0,Q:3,H:2},F.TextureInstantLoad={AUTO:0,SYNC:1,ASYNC:2};class ie{RenderTextureWrapper(){this.RenderTexture=null}GetTextureId(){return this.RenderTexture?.IdToken}}class ne extends ie{constructor(e,t,i){if(super(),this._Manager=e,i){F.sRenderTextureDelegateManager.CreateTextureStatus().SetResourceInfo(i)}this.RenderTexture=F.sRenderTextureDelegateManager.CreateTexture(),this.RenderTexture.SetResourceInfo(t),this._CallbackIdToken=0,de.set(this.RenderTexture.IdToken,this),this._OnLoadCallback=[],F.ForgeDebug.EnableTextureTracer&&(e._ImageTextureTracer.push(this),this._TracerDescript="")}get Unloaded(){return null===this.RenderTexture||this.RenderTexture.Unloaded}set Unloaded(e){}get LoadTime(){return null!==this.RenderTexture?this.RenderTexture.LoadTime:0}set LoadTime(e){}get Width(){return null!==this.RenderTexture?this.RenderTexture.Width:0}set Width(e){}get Height(){return null!==this.RenderTexture?this.RenderTexture.Height:0}set Height(e){}UnloadTex(){this._OnLoadCallback=[],null!==this.RenderTexture&&(this._CallbackIdToken>0&&(this.RenderTexture.UnregisterOnloadCallback(this._CallbackIdToken),this._CallbackIdToken=0),de.delete(this.RenderTexture.IdToken),this.RenderTexture.UndoRef(),this.RenderTexture=null),this._TracerDescript=""}RequestToUnload(){this.UnloadTex()}RegisterLoadImageCallback(e){if(this.IsLoaded()&&null!=e)return this.RenderTexture&&e(this.RenderTexture.Width,this.RenderTexture.Height),null;let t=null;return null!=e&&(t={callback:e},this._OnLoadCallback.push(t),0===this._CallbackIdToken&&(F.Assert(null!==this.RenderTexture),this._CallbackIdToken=this.RenderTexture.RegisterOnloadCallback(ne.prototype._InvokeOnLoadCallbacks.bind(this)))),t}UnregisterLoadImageCallback(e){e&&this._OnLoadCallback.some(((t,i,n)=>{if(t===e)return n.splice(i,1),!0}))}EnableBackgroundLoad(e){}DisableBackgroundLoad(e){}_InvokeOnLoadCallbacks(e,t){const i=this._OnLoadCallback;this._OnLoadCallback=[];for(let n=0;n<i.length;n++){i[n].callback(e,t)}this.RenderTexture&&this.RenderTexture.UnregisterOnloadCallback(this._CallbackIdToken)}IsLoaded(){return 0!==this.LoadTime&&!this.Unloaded}SetTextureTracerDescript(e){this._TracerDescript=e}ReallocRenderTexture(){}}F.ImageTexture=ne;class se extends F.ImageTexture{constructor(e,t,i,n,s,r){const a=F.sRenderTextureDelegateManager.CreateResourceInfo(e.GetId(),"IMG");a.Set={URL:t,Siz:n,Clr:s||"",IsF:i?1:0,NtS:r,ILd:0},super(e,a),this.Name="IMG",this.Source=t,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=t,this.RenderTexture.NeedCheckExpired=!0}_Loaded(){null!=this.RenderTexture&&(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))}UnloadTex(){super.UnloadTex(),this._ImageElement.onload=null,this._ImageElement.onerror=null}InstantLoad(e){if(this._InstantLoad=e?1:0,this.RenderTexture){const e=this.RenderTexture.GetResourceInfo();null!==e&&(e.Set.ILd=this._InstantLoad,this.RenderTexture.SetResourceInfo(e))}return this}ReallocRenderTexture(){if(this.IsForever)return void F.LogE("ReallocRenderTexture(): NOT need for forever texture");const e=this.Source,t=this.TargetSize,i=this.ColorSpace,n=this.IsForever,s=F.sRenderTextureDelegateManager.CreateResourceInfo(this._Manager.GetId(),this.Name);s.Set={URL:e,Siz:t,Clr:i,IsF:n,ILd:this._InstantLoad},this.RenderTexture=F.sRenderTextureDelegateManager.CreateTexture(),this.RenderTexture.SetResourceInfo(s),this._Manager.CachedTextureManager.CacheTheTexture(this)}}F.UrlImageTexture=se;class re extends F.ImageTexture{constructor(e,t,i,n,s){const r=F.sRenderTextureDelegateManager.CreateResourceInfo(e.GetId(),"GRAD");r.Set={URL:s},super(e,r),this.Gradient=s}}F.GradientTexture=re;class ae extends F.ImageTexture{constructor(e,t,i,n){const s=F.sRenderTextureDelegateManager.CreateResourceInfo(e.GetId(),"LGT");s.Set={L:t,S:i},super(e,s),this.Gradient=n}static StopPoint=class{constructor(){this.stopPosition=0,this.color=""}}}F.LinearGradientTexture=ae;class oe extends F.ImageTexture{constructor(e,t,i,n,s,r,a,o,l,h,c){const u=F.sRenderTextureDelegateManager.CreateResourceInfo(e.GetId(),"TST");let d=null;c&&(d={x:0,y:0,w:0,h:0},Object.assign(d,c)),u.Set={ST:t,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(e,u),this.Name="TST",this._TextStylePack=i,i.DoRef()}UnloadTex(){this._TextStylePack.UnRef(),super.UnloadTex()}}F.TextStyleTexture=oe;F.CachedTextureManager=class{constructor(e){this._TextureManager=e,this._Renderer=e.GetRenderer(),this._CachedTextureStack=[],this._LockedTextureStack=[],this._MemoryLimited=10485760,this._VisibleMark=1}SetMemoryLimited(e){this._MemoryLimited=1024*e*1024}_FindTexture(e,t,i){for(let n=this._CachedTextureStack.length-1;n>=0;n--){const s=this._CachedTextureStack[n];if(s.Source===e&&(t===s.TargetSize||null!==t&&t.Equals(s.TargetSize))&&i===s.ColorSpace){if(null===s.RenderTexture)continue;return s}}return null}CacheTheTexture(e){for(let t=this._CachedTextureStack.length-1;t>=0;t--)if(e===this._CachedTextureStack[t])return;this._CachedTextureStack.push(e)}_MarkVisibleViewTextures(e,t){e.TextureSetting&&e.TextureSetting.Texture&&(e.TextureSetting.Texture.VisibleMark=t);const i=e.ChildViews.length;for(let n=0;n<i;n++){const i=e.ChildViews[n];i&&"VISIBLE"!==i.Visibility||this._MarkVisibleViewTextures(i,t)}}ReduceInvisibleTexture(e){this._MarkVisibleViewTextures(e,++this._VisibleMark);for(let e=0;e<this._CachedTextureStack.length;e++){const t=this._CachedTextureStack[e];t.VisibleMark!==this._VisibleMark&&(t.UnloadTex(),this._CachedTextureStack.splice(e,1),e--)}}GetCacheSize(){return this._CachedTextureStack.length}};const le=new Map;let he=0;const ce=new Map;let ue=0,de=new Map;class ge{constructor(){this.CachedTextureManager=new F.CachedTextureManager(this),this._ForeverCachedTextureManager=new F.CachedTextureManager(this),this._AtlasDataInfo={atlas_data:[],buffer_data_offset:0,textures:[]},this._ClearTimer=-1,this._ImageTextureTracer=[],this._Id=ge.sTextureManagerToken++,this._CacheMaxSize=100,this.StartScavengerCachedTimer()}StartScavengerCachedTimer(){-1===this._ClearTimer&&(this._ClearTimer=F.ForegroundTimer.setInterval(this.ScavengerCached.bind(this),3e4))}GetId(){return this._Id}GetRenderer(){return F.sDeprecatedRenderer}GetGifImage(e,t,i){return this.GetImage(e,t,i)}GetImage(e,t,i){return e?this.GetImage2(e,t,null,F.ColorSpace.RGBA_8888,i,!1,!1):(F.LogI("GetImage, url is null!"),null)}GetImage2(e,t,i,n,s,r,a){if(!e)return F.LogI("GetImage2, url is null!"),null;if(0==e.indexOf("jsvtexturestore://")){const t=e.lastIndexOf("-");if(-1!==t){const i=e.substr(t+1),n=parseInt(i,10);if(!isNaN(n))return this.GetTextureById(n)}return console.error("Error: jsvtexturestore:// parse failed url="+e),null}let o=null;i&&(o=F.sRectUitls.FormatRectArea(i)),"string"!=typeof n&&(n=e.indexOf(".pkm")>=0?e.indexOf(".pkma")>=0?F.ColorSpace.RGBA_ETC1:F.ColorSpace.RGB_ETC1:F.ColorSpace.RGB_565);return this._GetImageInternal(e,o,n,t,!1,s)}CreateMiniGradientTexture(e,t,i,n){return new F.GradientTexture(this,e,t,i,n)}_GetImageInternal(e,t,i,n,s,r){if(n){const n=this._ForeverCachedTextureManager._FindTexture(e,t,i);if(n)return n}else{const n=this.CachedTextureManager._FindTexture(e,t,i);if(n)return n}const a=new F.UrlImageTexture(this,e,n,t,i,r);return a.IsForever?this._ForeverCachedTextureManager.CacheTheTexture(a):this.CachedTextureManager.CacheTheTexture(a),a}GetRoundCornerMask(e,t){return this.GetCustomCornerMask(e,t,t,t,t)}GetCustomCornerMask(e,t,i,n,s){const r=F.sRectUitls.FormatRectArea(e),a=Math.max(t,i,n,s);if(a>r.width/2||a>r.height/2)return F.LogE(`TextureManager.GetRoundCornerMask(): radius is too large, radius=${a} w=${r.width} h=${r.height}`),null;const o=F.sRenderTextureDelegateManager.CreateResourceInfo(this._Id,"CCM");o.Set={W:r.width,H:r.height,LT:t,RT:i,LB:n,RB:s};const l=new F.ImageTexture(this,o);return F.ForgeDebug.EnableTextureTracer&&l.SetTextureTracerDescript("CornerMask"),l}GetOneCornerMask(e){const t=F.sRenderTextureDelegateManager.CreateResourceInfo(this._Id,"OCM");t.Set={Rad:e};const i=new F.ImageTexture(this,t);return F.ForgeDebug.EnableTextureTracer&&i.SetTextureTracerDescript("OneCornerMask"),i}GetTextTextureFromStylePack(e,t,i,n,s,r,a,o,l,h){return e&&0!==e.length?new F.TextStyleTexture(this,e,t,i,n,s,r,a,o,l,h):null}_getParamsId(e,t,i){const n=e.font,s=e.size,r=e.italic,a=e.bold,o=e.alignment,l=e.vertical_align,h=e.vertical_area_align,c=e.textColour,u=e.backgroundColour,d=e.shadow;let g="";e.stroke_width&&(g=e.stroke_width);const f=t.text_overflow,m=t.word_wrap,p=[n,r,a,d,g].join(":"),y=[s,o,l,h,f,m].join(":");let T="",_="";return le.has(p)?T=le.get(p):(T=`TS${he}`,le.set(p,T),he++),ce.has(y)?_=ce.get(y):(_=`DS${ue}`,ce.set(y,_),ue++),[T,_,c,u]}GetTextTextureByMultiRows(e,t,i,n,s,r,a,o,l){const h=e.str;if(null===h||0===h.length)return null;const c=F.sRenderBridge.GetScreenInfo().scaleRatio,u=Object.assign(i);u.x*=c,u.y*=c,u.width*=c,u.height*=c;const d=Object.assign(e);d.size=Math.ceil(d.size*c),n*=c;const g={ST:e.str,AT:JSON.stringify({TO:t.text_overflow,WW:t.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 e=this._getParamsId(d,t,r);g.PI={FS:e[0],DS:e[1],TC:e[2],BC:e[3]}}const f=this._BuildTextTextureAndSerialStatus(g,d);if(null!==l){const e=Object.assign({},g);e.ST=null,e.TLC=0,l.Set=e,l.Swf=Object.assign({},d)}let m=u.height;if(void 0!==window.PlatformUtils&&!1===s){m=window.PlatformUtils.GetTextRect(h,u,d,t,n).height}if(m=Math.floor(m/c+.5),F.ForgeDebug.EnableTextureTracer){let t=e.str;t.length>8&&(t=`${e.str.substr(0,8)}...`),f.SetTextureTracerDescript(`[${t}]`)}return{texture:f,real_height:m}}GetCopiedTextTexture(e,t,i,n){const s=Object.assign({},i.Set);s.ST=e,s.TLC=void 0!==n&&n?1:0;const r=i.Swf,a=F.sRenderBridge.GetScreenInfo().scaleRatio;s.RA=JSON.stringify({X:parseInt(t.x*a+.5,10),Y:parseInt(t.y*a+.5,10),W:parseInt(t.width*a+.5,10),H:parseInt(t.height*a+.5,10)});const o=this._BuildTextTextureAndSerialStatus(s,r);if(F.ForgeDebug.EnableTextureTracer&&e){let t=e;t.length>8&&(t=`${e.substr(0,8)}...`),o.SetTextureTracerDescript(`[${t}]`)}return o}_BuildTextTextureAndSerialStatus(e,t){F.sRenderTextureDelegateManager.AppendFontStatusIfNeed(e,t);let i=null;e.FO&&(i={STA:{Nam:"T",Sta:e.FO}});const n=F.sRenderTextureDelegateManager.CreateResourceInfo(this._Id,"T");return n.Set=e,new F.ImageTexture(this,n,i)}GetCanvasTexture(e,t){return new F.UrlImageTexture(this,F.sCustomCanvasResProvider.GetDataUrl(e),!1,null,F.ColorSpace.RGBA_8888,null)}GetColorTexture(e){const t=F.sRenderTextureDelegateManager.CreateResourceInfo(this._Id,"CT");t.Set={Clr:e};const i=new F.ImageTexture(this,t);return F.ForgeDebug.EnableTextureTracer&&i.SetTextureTracerDescript(`Color[${e}]`),i}GetColorTextureCached(e){return this.GetColorTexture(e)}GetNamedCachedTexture(e){return null}CreateCssGradientColorTexture(e,t,i,n,s,r){let a=[];for(let e of r){let t={stop:e.stopPosition,color:e.color};a.push(t)}return new F.LinearGradientTexture(this,JSON.stringify({x0:t,y0:i,x1:n,y1:s}),JSON.stringify(a),e)}ScavengerCached(){this.CachedTextureManager.GetCacheSize()>=this._CacheMaxSize&&this.CachedTextureManager.ReduceInvisibleTexture(F.sRootView)}GetOffScreenMediaTexture(e){if(void 0===window.OffscreenVideoPlayer||!(e instanceof window.OffscreenVideoPlayer))return null;if(!e.hasTerminator()){const t=this._BuildVideoTexture(e);e.setResourceTerminator((()=>{t.UnloadTex()}))}return this._BuildVideoTexture(e)}_BuildVideoTexture(e){const t=F.sRenderTextureDelegateManager.CreateResourceInfo(this._Id,"VPLY");t.Set={Hdl:e.mediaHandler()};const i=new F.ImageTexture(this,t);return F.ForgeDebug.EnableTextureTracer&&i.SetTextureTracerDescript(`Video[${e.mediaHandler()}]`),i}GetTextureById(e){return de.has(e)?de.get(e):(console.error(`TextureManager: texture not found id=${e}`),null)}}ge.sTextureManagerToken=100,F.TextureManager=ge,window.TextureManager=F.TextureManager;F.LayoutViewDebugClass=class{SetTextureTracer(e){}GetTextureTracer(){return null}},F.ForgeDebug=new F.LayoutViewDebugClass,window.ForgeDebug=F.ForgeDebug;class fe{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(e,t,i){this.MarginTop=t,this.MarginLeft=e,i&&(this.Z=i)}SetSize(e,t){this.Width=e,this.Height=t}Clone(){const e=new fe(null);return e.Width=this.Width,e.Height=this.Height,e.MarginTop=this.MarginTop,e.MarginLeft=this.MarginLeft,e.MarginRight=this.MarginRight,e.MarginBottom=this.MarginBottom,e.Z=this.Z,e.SizeAdjust=this.SizeAdjust,e}Equals(e){return e.Width===this.Width&&e.Height===this.Height&&e.MarginTop===this.MarginTop&&e.MarginLeft===this.MarginLeft&&e.MarginRight===this.MarginRight&&e.MarginBottom===this.MarginBottom&&e.Z===this.Z}}F.LayoutParamsBase=fe;class me extends F.LayoutParamsBase{constructor(e){super(),e instanceof F.RectArea&&(e={x:e.x,y:e.y,width:e.width,height:e.height}),e&&(e.x?this.MarginLeft=e.x:e.marginLeft&&(this.MarginLeft=e.marginLeft),e.y?this.MarginTop=e.y:e.marginTop&&(this.MarginTop=e.marginTop),e.z&&(this.Z=e.z),e.width&&(this.Width=e.width),e.height&&(this.Height=e.height),isNaN(this.MarginTop)&&(F.LogE("isNaN(this.MarginTop)!"),this.MarginTop=0),isNaN(this.MarginLeft)&&(F.LogE("isNaN(this.MarginLeft)!"),this.MarginLeft=0),"MatchParent"!==this.Width?isNaN(this.Width)&&F.LogE("isNaN(this.Width)!"):this.SizeAdjust=!0,"MatchParent"!==this.Height?isNaN(this.Height)&&F.LogE("isNaN(this.Height)!"):this.SizeAdjust=!0)}}F.LayoutParams=me,window.LayoutParams=F.LayoutParams;F.RenderTextureDelegateManager=class{constructor(){this._IdTokenGenerator=66,F.sRenderTextureDelegateManager=this,this._CheckExpiredTime=0}CreateTextureHeadStatus(){const e=new F.RenderTextureDelegate(this,0);return e.DoRef(),e}CreateTextureStatus(){const e=new F.RenderTextureDelegate(this,0);return e.DoRef(),e}CreateTexture(){const e=new F.RenderTextureDelegate(this,this._IdTokenGenerator++);return e.DoRef(),e}RecycleTexture(e){}CreateResourceInfo(e,t){return{Id:0,Nam:t,Set:null,TmId:e,NdLd:0}}AppendFontStatusIfNeed(e,t){const i={};i.Fo=t.font,i.Si=t.size,i.It=t.italic,i.Bo=t.bold,i.Al=t.alignment,i.Ve=t.vertical_align,i.Vaa=t.vertical_area_align,i.Tx=t.textColour,i.Ba=t.backgroundColour,i.En=t.enableBlend,i.Sh=t.shadow,t.stroke_width?i.Stk=t.stroke_width:i.Stk=-1,e.FO=JSON.stringify(i)}},F.sRenderTextureDelegateManager=new F.RenderTextureDelegateManager;F.RenderTextureDelegate=class{constructor(e,t){this.IdToken=t,this._Manager=e,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(F.ForgeDebug.GetTextureTracer()){const e=new Error;this.Stack=e.stack}}DoRef(){this._Reference++}UndoRef(){this._Reference--,0===this._Reference&&(this._OnloadCallbacksSize>0&&(this._OnloadCallbacks={}),this._Manager.RecycleTexture(this))}SetResourceInfo(e){e.Id=this.IdToken,this._SyncingResourceInfo=e}GetResourceInfo(){return this._SyncingResourceInfo}ReadSyncInfo(){const e=this._SyncingResourceInfo;return this._SyncingResourceInfo=null,e}RegisterOnloadCallback(e){const t=this._OnloadCallbackIdGenerator++;return this._OnloadCallbacks[`${t}`]=e,this._OnloadCallbacksSize++,null!==this._SyncingResourceInfo&&(this._SyncingResourceInfo.NdLd=1),t}UnregisterOnloadCallback(e){delete this._OnloadCallbacks[`${e}`],this._OnloadCallbacksSize--}InvokeOnloadCallbacks(e,t){if(this._OnloadCallbacksSize>0)for(const i in this._OnloadCallbacks)this._OnloadCallbacks.hasOwnProperty(i)&&this._OnloadCallbacks[i](e,t)}IsLoaded(){return 0!==this.LoadTime&&!this.Unloaded}};F.DeprecatedRenderer=class{constructor(){F.sDeprecatedRenderer=this,this._SharedTextureManager=this.CreateTextureManager()}SetUserId(e){F.sRenderBridge.UpdateUserId(e)}GetScreenInfo(){return F.sRenderBridge.GetScreenInfo()}StringWithFont(){return F.sTextUtils.StringWithFont.apply(this,arguments)}GetTextWidth(){return F.sTextUtils.GetTextWidth.apply(this,arguments)}GetTextUtils(){return F.sTextUtils}RectArea(e,t,i,n){return new F.RectArea(e,t,i,n)}TextAttr(){return F.sTextUtils.TextAttr.apply(this,arguments)}GarbageCollect(){F.LogM("GarbageCollect called")}TriggerFrameDraw(){F.sRenderBridge.RequestSwap()}GetSharedTextureManager(){return this._SharedTextureManager}CreateTextureManager(){return new F.TextureManager}},F.sDeprecatedRenderer=null;const pe={STRING:Symbol("STRING"),FUNCTION:Symbol("FUNCTION"),LINE_FEED:Symbol("LINE_FEED"),LEFT_BRACE:Symbol("LEFT_BRACE"),RIGHT_BRACE:Symbol("RIGHT_BRACE")};const ye={},Te={BASE:Symbol("BASE"),COLOR:Symbol("COLOR"),BOLD:Symbol("BOLD"),ITALIC:Symbol("ITALIC"),DECORATION:Symbol("DECORATION"),SUPERSCRIPT:Symbol("SUPERSCRIPT"),SUBSCRIPT:Symbol("SUBSCRIPT")};class _e{constructor(){this.style,this.styleValue=""}}class xe{constructor(){this.textStyle=new _e,this.childNodes=[],this.parent}}class we extends xe{constructor(){super(),this.styleList=[],this.indexPair,this.lineFeedNode=!1,this.testValue}}function Se(e){if(null===e||0===e.length)return null;const t=function(e){const t=[];let i=0;for(;i<e.length;)if("\\"===e[i])if(i<e.length-1)if("\\"===e[i+1]||"{"===e[i+1]||"}"===e[i+1]){const e=[i+1,i+2],n={type:pe.STRING,indexPair:e};t.push(n),i+=2}else{++i;const n=i;let s=i,r=!1;for(;i<e.length&&"{"!==e[i]&&"}"!==e[i];)" "!==e[i]&&(r=!0)," "===e[i]&&r?++i:s=++i;const a=[n,s],o={type:pe.FUNCTION,indexPair:a};t.push(o)}else console.error("backslash at end.");else if("{"===e[i]){const e={type:pe.LEFT_BRACE,indexPair:null};t.push(e),++i}else if("}"===e[i]){const e={type:pe.RIGHT_BRACE,indexPair:null};t.push(e),++i}else if("\n"===e[i]){const e={type:pe.LINE_FEED,indexPair:null};t.push(e),++i}else{const n=i;let s=i;for(;i<e.length&&"\\"!==e[i]&&"{"!==e[i]&&"}"!==e[i]&&"\n"!==e[i];)++i,s=i;const r=[n,s],a={type:pe.STRING,indexPair:r};t.push(a)}for(let i=t.length-1;i>=0;i--){const n=t[i];if(n.type===pe.STRING){let s=!0;for(let t=n.indexPair[0];t<n.indexPair[1];t++)if(" "!==e[t]){s=!1;break}!(s&&i>0&&i<t.length-1)||t[i-1].type!==pe.LEFT_BRACE&&t[i-1].type!==pe.RIGHT_BRACE||t[i+1].type!==pe.RIGHT_BRACE&&t[i+1].type!==pe.LEFT_BRACE||t.splice(i,1)}}return t}(e),i=[],n=[];let s=0;for(;s<t.length;){const r=t[s];if(r.type===pe.STRING){const e=new we;n.push(e),e.indexPair=r.indexPair,e.textStyle.style=Te.BASE,i.push(e)}else if(r.type===pe.LINE_FEED){const e=new we;n.push(e),e.lineFeedNode=!0}else if(r.type===pe.LEFT_BRACE)i.push(ye);else if(r.type===pe.RIGHT_BRACE)if(i.length>0){const e=[];let t=i.pop();for(;t!==ye&&(e.push(t),i.length>0);)t=i.pop();if(i.length>0){const t=i[i.length-1];if(t.textStyle.style===Te.BASE)console.error("lack of function");else for(;e.length>0;){const i=e.pop();t.childNodes.push(i),i.parent=t}}else console.error("lack of function")}else console.error("extra }");else if(r.type===pe.FUNCTION){const n=e.substring(r.indexPair[0],r.indexPair[1]),a=new xe;switch(n){case"textcolor":if(s<t.length-3){a.textStyle.style=Te.COLOR;const i=t[s+1],n=t[s+2],r=t[s+3];i.type===pe.LEFT_BRACE&&n.type===pe.STRING&&r.type===pe.RIGHT_BRACE?(a.textStyle.styleValue=e.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=Te.BOLD;break;case"texti":a.textStyle.style=Te.ITALIC;break;case"textdecoration":if(s<t.length-3){a.textStyle.style=Te.DECORATION;const i=t[s+1],n=t[s+2],r=t[s+3];i.type===pe.LEFT_BRACE&&n.type===pe.STRING&&r.type===pe.RIGHT_BRACE?(a.textStyle.styleValue=e.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=Te.SUPERSCRIPT;break;case"textsub":a.textStyle.style=Te.SUBSCRIPT;break;default:console.error(`undefined style type: ${n}`)}i.push(a)}++s}return n.forEach(((e,t,i)=>{let n=e.parent;for(;n;)e.styleList.push(n.textStyle),n=n.parent})),{nodeList:n,text:e}}function ve(){this.positionQueue=[],this.timeQueue=[]}ve.prototype.reset=function(){this.positionQueue=[],this.timeQueue=[]},ve.prototype.pruneQueue=function(e){for(;this.timeQueue.length&&this.timeQueue[0]<Date.now()-e;)this.timeQueue.shift(),this.positionQueue.shift()},ve.prototype.updatePosition=function(e){this.positionQueue.push(e),this.timeQueue.push(Date.now()),this.pruneQueue(50)},ve.prototype.getVelocity=function(){this.pruneQueue(1e3);const e=this.timeQueue.length;if(e<2)return 0;const t=(this.timeQueue[e-1]-this.timeQueue[0])/1e3,i=this.positionQueue[e-1]-this.positionQueue[0];return console.log(`getVelocity distance:${i}, time:${t}, velocity:${i/t}, this.timeQueue[length-1]:${this.timeQueue[e-1]}, this.timeQueue[0]:${this.timeQueue[0]}`),i/t},window.gRootView=null,F.sRootView=null;class Ee{constructor(e,t,i,n){this.Texture=e,this._IsTextureExternal=!1,t instanceof F.ImageTexture?(t&&t.RenderTexture&&t.RenderTexture.NeedCheckExpired&&(t.RenderTexture.RequireTime=0),this.MaskSetting=new F.ViewTextureMask(t)):this.MaskSetting=t,e&&e.RenderTexture&&e.RenderTexture.NeedCheckExpired&&(e.RenderTexture.RequireTime=0),this._IsMaskTextureExternal=!1,this.TextureBeforeImageLoad=i,this._IsPreloadImageTextureExternal=!1,void 0===n&&(n=!0),this.HasAlpha=n}SetExternal(e,t,i){this._IsTextureExternal=e,this._IsMaskTextureExternal=t,this._IsPreloadImageTextureExternal=i}ReleaseInternalTexture(e,t){!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}`}}F.TextureSetting=Ee,window.TextureSetting=F.TextureSetting;class be extends F.TextureSetting{constructor(e,t,i,n){super(e,t,i,n),this.SetExternal(!0,!0,!0)}}F.ExternalTextureSetting=be,window.ExternalTextureSetting=F.ExternalTextureSetting;F.PackedLayout=class{constructor(e){const t=e.RectInfo;this.RectInfo={coordX:t.coordX,coordY:t.coordY,width:t.width,height:t.height},this.LayoutParams=JSON.parse(JSON.stringify(e.LayoutParams))}ApplyToView(e){const t=this.RectInfo;e.RectInfo={coordX:t.coordX,coordY:t.coordY,width:t.width,height:t.height},e.LayoutParams=JSON.parse(JSON.stringify(this.LayoutParams))}};class Ce{constructor(){this._MaskType="COMMON"}Type(){return this._MaskType}UnLoad(){}}F.ViewMask=Ce;class Ie extends F.ViewMask{constructor(e){super(),this._MaskType="TEXTURE",this.ImageTexture=e}UnLoad(){this.ImageTexture.UnloadTex()}}F.ViewTextureMask=Ie;class Ae extends F.ViewMask{constructor(e,t,i,n){super(),this._MaskType="CORNER",this._TopLeft=e,this._TopRight=isNaN(t)?e:t,this._BottomLeft=isNaN(i)?e:i,this._BottomRight=isNaN(n)?e:n,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(){}}F.ViewRoundCornerMask=Ae;class Pe{constructor(e,t,i,n,s,r){this.DragDirection=e||0,this.TriggerMovedDistance=t||0,this._EnableJsFling=i?1:0,this.SlidePile=n||new F.RectArea(0,0,1280,720),this.PageWidth=s>0?s:65535,this.EnableTabMode=s>0,this.PageEdge=r||1/4}}Pe.DIRECTION_DISABLE=0,Pe.DIRECTION_VERTICAL=1,Pe.DIRECTION_HORIZONTAL=2,Pe.DIRECTION_AUTO=Pe.DIRECTION_VERTICAL|Pe.DIRECTION_HORIZONTAL,F.DragSetting=Pe;class Le{constructor(){this.Settings=null,this.Listener=null,this.ListenerFlags=0,this.OverListener=null,this.OverListenerFlags=0,this.Formula=null,this.SyncString=null}SetListener(e){this.Listener=e}}Le.INFLEXION=.35,Le.DECELERATION_RATE=Math.log(.78)/Math.log(.9),Le.PHYSICAL_COEF=51890.2,F.DragInfo=Le,F.DragInfo.SCROLL_FRICTION=.06,F.DragInfo.EVENT_TYPE={OnDown:0,OnTap:1,OnLongPress:2,OnDragStart:3,OnMoved:4,OnDragEnd:5,OnRelease:6,OnFling:7};let ke=0;class Re{constructor(e,t){this.TextureSetting=e,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=++ke,this.childZIndexCount=0,this._IsChildOfRootView=!1,this._DetachFromSystemCallback=null,this.Element=null,this.InnerChildElement=null,"root"===t?(this.Element=window.originDocument.getElementById(t),this.Element||(this.Element=window.originDocument.getElementById("app"))):"svg"===t||"path"===t?this.Element=document.createElementNS("http://www.w3.org/2000/svg",t):"jsv-element-proxy"===t?this.Element=null:t&&(this.Element=window.originDocument.createElement(t),this.Element.style.position="absolute"),this.TransitionStore={},this.TransformAnimationObj=null,this._TextureAnimationObj=null,this._DragInfo=null,this.DragControl=null,this._Velocity={x:new ve,y:new ve},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,this._SizeFromChild=null,this._ChildrenFromChild0=!1,this._FlexAssignedCallback=null,this._MySizeObserver=null,this.FlexInfoPack=null,this.FlexInfoPackWeak=null}Init(e){this.ResetTexture(e)}SetElementProp(e,t,i){switch(t){case"innerview":{const e=F.sViewStore.get(i);if(e){const t=e.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}),t&&(null===this._ProxyView?this._InsertProxyLayer(t,i):t!==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:F.LogE(`Error: View Unknown prop name=${t}`)}}InsertView(e,t,i){this._InsertView(e,t,i)}AddView(e,t=0,i=0,n=0,s=0){this._InsertView(e,null,{x:t,y:i,width:n,height:s})}ReOrderChildView(e,t){if(null!=this._ProxyView&&child_view_to_move!=this._ProxyView)return void this._ProxyView.ReOrderChildView(e,t);let i=!1;for(var n=0;n<this.ChildViews.length;n++)if(this.ChildViews[n]==e){this.ChildViews.splice(n,1),i=!0;break}if(i||F.LogE("ReOrderChildView(): view is not in child list stack="),t){let i=this.ChildViews.indexOf(t);i<0&&(i=this.ChildViews.length),this.ChildViews.splice(i,0,e)}else this.ChildViews.push(e);this._ChildrenListDirty=!0}MoveChildView(e,t,i){if(null!=this._ProxyView&&e!=this._ProxyView)return void this._ProxyView.MoveChildView(e,t);let n=!1;for(var s=0;s<this.ChildViews.length;s++)if(this.ChildViews[s]==e){0!=e.zIndex&&this.childZIndexCount--,this.ChildViews.splice(s,1),e.ParentView=null,n=!0;break}n||F.LogE("MoveChildView(): view is not in child list stack="),t._InsertView(e,i,e.LayoutParams);let r=null;i&&(r=t.ChildViews[t.ChildViews.indexOf(i)+1]),r&&t.Element.contains(r.Element)?t.Element.insertBefore(e.Element,r.Element):t.Element.appendChild(e.Element)}IsVisibleInTree(){if(!this._IsChildOfRootView)return!1;let e=this,t=this;for(;t;){if("hidden"==t.Element?.style?.visibility)return!1;e=t,t=t.ParentView}return e instanceof F.RootView}_InsertView(e,t,i){if(i?i instanceof F.LayoutParamsBase?e.LayoutParams=i.Clone():e.LayoutParams=new F.LayoutParams(i):e.LayoutParams||(e.LayoutParams=new F.LayoutParams({x:0,y:0})),null!==e.LayoutParams&&(e.LayoutParams.MarginLeft&&(e.Element.style.left=`${e.LayoutParams.MarginLeft}px`),e.LayoutParams.MarginTop&&(e.Element.style.top=`${e.LayoutParams.MarginTop}px`),e.LayoutParams.Width&&(e.Element.style.width=`${e.LayoutParams.Width}px`),e.LayoutParams.Height?e.Element.style.height=`${e.LayoutParams.Height}px`:e.Element.style.height=""),e.ParentView=this,t){let i=this.ChildViews.indexOf(t);i<0&&(i=this.ChildViews.length),this.ChildViews.splice(i,0,e)}else this.ChildViews.push(e);this._ChildrenListDirty=!0,this._IsChildOfRootView&&e._OnAttachToSystem(),0!=e.zIndex&&this.childZIndexCount++,this.childZIndexCount>0&&this._RequestZIndexReorder()}SetZIndex(e){if(e!=this.zIndex){var t=this.zIndex;this.zIndex=e;var i=this.ParentView;i&&(0==t&&0!=e?i.childZIndexCount++:0!=t&&0==e&&i.childZIndexCount--,i.childZIndexCount<0&&F.ThrowError("ERROR: LayoutViewBase, child z-index count ERROR"),i._RequestZIndexReorder())}}_RequestZIndexReorder(){let e=[],t=[],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),e.push(this.ChildViews[s])):n>0&&t.push(this.ChildViews[s])}i=1e3*Math.floor(-i/1e3)+1e3;let r=e.length,a=t.length;if(r>0){e.sort(((e,t)=>e.zIndex-t.zIndex));for(s=0;s<r;s++)e[s].Element.style.zIndex=e[s].zIndex+i}if(this.ChildViews.length-e.length-t.length>0)for(s=0;s<n;s++)0==this.ChildViews[s].zIndex&&(this.ChildViews[s].Element.style.zIndex=i);if(a>0){t.sort(((e,t)=>e.zIndex-t.zIndex));for(s=0;s<a;s++)t[s].Element.style.zIndex=t[s].zIndex+i}}SetPerspective(e,t){this.Element.style.perspective=`${e}px`,this.Element.style.webkitPerspective=`${e}px`,this.Element.style.perspectiveOrigin=t,this.Element.style.webkitPerspectiveOrigin=t,this._Perspective=e,this._PerspectiveOrigin=t}SetBackfaceVisibility(e){this.Element.style.backfaceVisibility=e?"visible":"hidden",this.Element.style.webkitBackfaceVisibility=e?"visible":"hidden",console.log(`back face style ${this.Element.style.backfaceVisibility}`),this._BackfaceVisibility=e?1:0}SetTransformStyle(e){this.Element.style.transformStyle=e,this.Element.style.webkitTransformStyle=e,this._TransformStyle=e}EnableDivTouch(e,t){e.eventHandlers&&e.eventHandlers.onClick&&(this.Element.onclick=t=>{e.eventHandlers.onClick(),t.preventDefault&&t.preventDefault()},this.Element.style.pointerEvents="auto")}_DoDragPause(e){this._DragInfo.Settings.EnableTabMode||this.DragControl&&this.DragControl.pause(((t,i)=>{if(null!==this.Element.style.transform){let n=this.GetLayoutParams();n=this._GetMovedLayoutParams(t-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,e.viewX=t,e.viewY=i,this._DragInfo.Listener.OnFling(e)}}))}TouchEventProcess(e){let t=!1;switch(e.type){case F.DragInfo.EVENT_TYPE.OnDown:console.log("TouchEventProcess OnDown in"),this._DoDragPause(e),this._DragInfo.Listener&&this._DragInfo.Listener.OnDown&&(t=this._DragInfo.Listener.OnDown(e));break;case F.DragInfo.EVENT_TYPE.OnTap:this._DragInfo.Listener&&this._DragInfo.Listener.OnTap&&(t=this._DragInfo.Listener.OnTap(e));break;case F.DragInfo.EVENT_TYPE.OnLongPress:this._DragInfo.Listener&&this._DragInfo.Listener.OnLongPress&&(t=this._DragInfo.Listener.OnLongPress(e));break;case F.DragInfo.EVENT_TYPE.OnDragStart:this._DragMovedDistanceX=0,this._DragMovedDistanceY=0,this._DragInfo.Listener&&this._DragInfo.Listener.OnDragStart&&(t=this._DragInfo.Listener.OnDragStart(e));break;case F.DragInfo.EVENT_TYPE.OnMoved:this._DragInfo.Listener&&this._DragInfo.Listener.OnMoved&&(t=this._DoDragMove(e,!0));break;case F.DragInfo.EVENT_TYPE.OnDragEnd:if(this._DragInfo.Listener&&this._DragInfo.Listener.OnDragEnd){t=!!this._SlideIfEnableTabMod(e,-1)||this._DoDragEnd(e)}break;case F.DragInfo.EVENT_TYPE.OnRelease:this._DragInfo.Listener&&this._DragInfo.Listener.OnRelease&&(t=this._DragInfo.Listener.OnRelease(e));break;case F.DragInfo.EVENT_TYPE.OnFling:if(this._DragInfo.Listener&&this._DragInfo.Listener.OnFling){t=!!this._SlideIfEnableTabMod(e,-1)||this._DoFling(e)}break;default:console.log(`TouchEventProcess:${e}`)}return t}DisableDrag(){this._DragInfo=null}EnableDrag(e,t,i){e instanceof F.DragSetting||F.ThrowError("EnableDrag The setting is not Forge.DragSetting"),null===t&&F.ThrowError("EnableDrag The listener is null");const n=new F.DragInfo;n.Settings=e,n.SetListener(t),n.Formula=i,this._DragInfo=n,this.DragControl=null,this._AddEventListener(),F.sRenderBridge.RequestSwap()}RemoveView(e){for(let t=0;t<this.ChildViews.length;t++)if(this.ChildViews[t]===e){e.IsChildOfRootView()&&e._OnDetachFromSystem(),this.ChildViews.splice(t,1),e.ParentView=null;break}}_OnDetachFromSystem(){this._IsChildOfRootView=!1,this._DetachFromSystemCallback?(this._DetachFromSystemCallback.some(((e,t,i)=>{e()})),this._DetachFromSystemCallback=null):this.OnDettachFromSystem();for(let e=0;e<this.ChildViews.length;e++){this.ChildViews[e]._OnDetachFromSystem()}this.ParentView.Element.removeChild(this.Element),this._releaseViewResources()}RegisterDetachCallback(e){e&&(null==this._DetachFromSystemCallback&&(this._DetachFromSystemCallback=[]),this._DetachFromSystemCallback.push(e))}UnregisterDetachCallback(e){if(e&&this._DetachFromSystemCallback){let t=!1,i=this._DetachFromSystemCallback;for(let n=0;n<i.length;n++)if(i[n]===e){i.splice(n,1),t=!0;break}t?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 e=this.ChildViews.length;if(0!==e){for(let t=0;t<e;t++){const e=this.ChildViews[t];e&&e.IsChildOfRootView()&&e._OnDetachFromSystem()}this.ChildViews=[]}}_ResetTextStyle(e){this.Element.style.overflow="hidden";let t=F.sTextStyleCache.GetDsFromId(e.Set.IDS.DS).Describe,i=F.sTextStyleCache.GetFsFromId(e.Set.IDS.FS).Describe,n=F.sTextStyleCache.GetCsFromId(e.Set.IDS.CS).Describe,s=null;"DISABLE"!==e.Set.IDS.SS&&(s=F.sTextStyleCache.GetSsFromId(e.Set.IDS.SS).Describe),this.Element.style.fontFamily=i.font,this.Element.style.fontSize=`${e.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=t.alignment,this.Element.style.verticalAlign=t.vertical_area_align,this.Element.style.direction=t.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=`${e.Set.W}px`,this.Element.style.height=`${e.Set.H}px`;let o=parseInt(this.Element.style.fontSize);if(e.Set.LH&&(this.Element.style.lineHeight=`${e.Set.LH}px`,o=parseInt(this.Element.style.lineHeight)),e.Set.EA){let t=e.Set.EA,i=window.originDocument.createElement("div");i.style.float=t.x>0?"right":"left",i.style.width=t.w+"px",i.style.height=t.h-1+"px",i.style.backgroundColor="rgba(0,0,0,0)",i.style.position="relative",this.Element.appendChild(i)}this.Element.style.textOverflow=t.text_overflow,this.Element.style.wordBreak="normal";let l=!1,h=t.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"),e.Set.LA){const t=Se(e.Set.ST);!function(e,t){const i=t.text;for(const n of t.nodeList){if(n.lineFeedNode){e.appendChild(window.originDocument.createElement("br"));continue}const t=i.substring(n.indexPair[0],n.indexPair[1]),s=window.originDocument.createElement("span");let r,a=s;for(const e of n.styleList)switch(e.style){case Te.BASE:break;case Te.BOLD:r=window.originDocument.createElement("b"),a.appendChild(r),a=r;break;case Te.ITALIC:r=window.originDocument.createElement("i"),a.appendChild(r),a=r;break;case Te.COLOR:s.style.color=e.styleValue;break;case Te.DECORATION:s.style.textDecoration=e.styleValue;break;case Te.SUPERSCRIPT:r=window.originDocument.createElement("sup"),a.appendChild(r),a=r;break;case Te.SUBSCRIPT:r=window.originDocument.createElement("sub"),a.appendChild(r),a=r}a.textContent=t,e.appendChild(s)}}(this.Element,t)}else{let t=window.originDocument.createElement("span");t.textContent=e.Set.ST,this.Element.appendChild(t)}}_SetBorderRadius(e){(this.InnerChildElement?this.InnerChildElement:this.Element).style.borderRadius=`${e._TopLeft}px ${e._TopRight}px ${e._BottomRight}px ${e._BottomLeft}px`}_InsertProxyLayer(e,t){if(e.ParentView=this,this._IsChildOfRootView){for(let e of this.ChildViews)e._AdvanceDepthForProxyLayer();e._OnAttachToSystem()}e.ChildViews=e.ChildViews.concat(this.ChildViews),e._ChildrenListDirty=!0;for(let t=0;t<e.ChildViews.length;t++)e.ChildViews[t].ParentView=e,e._RequestLayoutForAddingView(e.ChildViews[t]);null!==t?t instanceof F.LayoutParamsBase?e.LayoutParams=t.Clone():e.LayoutParams=new F.LayoutParams(t):null===e.LayoutParams&&(e.LayoutParams=new F.LayoutParams({x:0,y:0})),e.ResetLayoutParams(e.LayoutParams),this.ChildViews=[e],this._ChildrenListDirty=!0,this._RequestLayoutForAddingView(e),this._ProxyView=e,this._IsChildOfRootView&&e._OnAttachToSystem()}_RequestLayoutForAddingView(e){this._RequestLayout()}ResetTexture(e,t){let i=null;if(e&&(i=new F.ExternalTextureSetting(e,t)),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%",this.Element.style.backgroundColor=null);else if(i.Texture.Gradient)this.Element.style.backgroundImage=i.Texture.Gradient,this.Element.style.backgroundColor=null;else if(i.Texture.RenderTexture&&i.Texture.RenderTexture._SyncingResourceInfo){const e=i.Texture.RenderTexture._SyncingResourceInfo;if("TST"===e.Nam)this._ResetTextStyle(e);else if("CT"===e.Nam)this.Element.style.backgroundColor=e.Set.Clr,this.Element.style.backgroundImage=null;else if("VPLY"===e.Nam){const t=e.Set.Hdl;t.style.width="100%",t.style.height="100%",t.style.objectFit="fill",this.Element.appendChild(t),this.InnerChildElement=t}}i.MaskSetting&&"CORNER"===i.MaskSetting._MaskType&&this._SetBorderRadius(i.MaskSetting)}else this.Element.style.backgroundColor="",this.Element.style.backgroundImage="",this.Element.style.borderRadius=""}SetVisibility(e){if("string"==typeof e){let t=e.toLocaleLowerCase();this.Element.style.visibility="visible"==t?"inherit":t}else this.Element.style.visibility="inherit"}SetViewOpacity(e){this.Element.style.opacity=e}_OnAttachToSystem(){"svg"!==this.Element.id&&"path"!==this.Element.id||console.log("_OnAttachToSystem appendChild");let e=this.ParentView.ChildViews[this.ParentView.ChildViews.indexOf(this)+1];e&&this.ParentView.Element.contains(e.Element)?this.ParentView.Element.insertBefore(this.Element,e.Element):this.ParentView.Element.appendChild(this.Element),this._IsChildOfRootView=!0;const t=this.ChildViews;let i;for(let e=0;e<t.length;e++)i=t[e],i._OnAttachToSystem();this._FlushFlexDiv()}IsChildOfRootView(){return this._IsChildOfRootView}StartAnimation(e,t,i){void 0!==this.TransformAnimationObj&&this.TransformAnimationObj&&(this.TransformAnimationObj.Cancel(e),this.TransformAnimationObj=null,window.jsvInAndroidWebView?this.Element.style.webkitAnimation=null:this.Element.style.animation=null),null==this._ProxyView?(this.TransformAnimationObj=e,!isNaN(i)&&i>0&&e.EnableDelay(i),e.Start(this)):this._ProxyView.StartAnimation(e,t,i)}ApplyStyleTransition(e){this.TransitionStore={...this.TransitionStore,...e};let t="";Object.values(this.TransitionStore).forEach((e=>{t&&(t+=","),t+=e})),window.jsvInAndroidWebView?this.Element.style.webkitTransition=t:this.Element.style.transition=t}StopAnimation(){void 0!==this.TransformAnimationObj&&this.TransformAnimationObj&&(this.TransformAnimationObj.Cancel(),this.TransformAnimationObj=null),null==this._ProxyView||this._ProxyView.StopAnimation()}StartTextureAnimation(e){void 0!==this._TextureAnimationObj&&this._TextureAnimationObj&&(this._TextureAnimationObj.Cancel(e),this._TextureAnimationObj=null),this._TextureAnimationObj=e,e.AsTextureAnimation(),e.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 e=0;e<this.ChildViews.length;e++)this.ChildViews[e].StopAllAnimations()}GetAnimation(){return this.TransformAnimationObj}DetachAnimation(e){this.TransformAnimationObj===e&&(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(e,t){if(e){const t=e.split("translate3d");for(let e=1;e<t.length;e++){let i=!1,n=t[e].replace(/\).*/,"");n=n.replace(/.*\(/,"");const s=n.split(",");for(let e=0;e<s.length;e++){const t=s[e].trim();t.match(/[0-9]$/)&&(s[e]=t+"px",i=!0)}i&&(n=s.join(","),t[e]=t[e].replace(/\(.*?\)/,"("+n+")"))}e=t.join("translate3d")}e===this._CssTransform&&t===this._CssTransformOrigin||(window.jsvInAndroidWebView?(this.Element.style.webkitTransform=e,this.Element.style.webkitTransformOrigin=t):(this.Element.style.transform=e,this.Element.style.transformOrigin=t),this._CssTransform=e,this._CssTransformOrigin=t)}ResetTextureCssTransform(e,t){this.ResetCssTransform(e,t)}SetId(e){this.Id=e}ResetLayoutParams(e){if(null==this._ProxyView)if(null!==e)if(e instanceof F.LayoutParamsBase?this.LayoutParams=e.Clone():this.LayoutParams=new F.LayoutParams(e),null==this.FlexInfoPackWeak)this.ParentView?.FlexInfoPackWeak?.container||(this.Element.style.left=`${this.LayoutParams.MarginLeft}px`,this.Element.style.top=`${this.LayoutParams.MarginTop}px`),isNaN(this.LayoutParams.Width)||this._SizeFromChild&&0==this.LayoutParams.Width||(this.Element.style.width=`${this.LayoutParams.Width}px`),isNaN(this.LayoutParams.Height)||this._SizeFromChild&&0==this.LayoutParams.Height||(this.Element.style.height=`${this.LayoutParams.Height}px`);else{this.ParentView.FlexInfoPackWeak||(this.Element.style.left=`${this.LayoutParams.MarginLeft}px`,this.Element.style.top=`${this.LayoutParams.MarginTop}px`);let e=this;for(;e._ChildrenFromChild0;)e=e.ChildViews[0];e._SizeFromChild||(e.Element.width=0==this.LayoutParams.Width?void 0:this.LayoutParams.Width+"px",e.Element.height=0==this.LayoutParams.Height?void 0:this.LayoutParams.Height+"px")}else F.ThrowError("ResetLayoutParams(): new params is null");else this._ProxyView.ResetLayoutParams(e)}GetRenderer(){return F.LayoutViewBase.sRenderer}GetLayoutParams(){return this.LayoutParams?this.LayoutParams.Clone():new F.LayoutParams}EnableAutoHeight(){this._AutoHeight=!0}WaitTextureToResize(e){}ApplyObjectFit(e,t,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===e&&r.objectFit===s&&r.frameHeight===t&&r.textureWidth===i&&r.textureHeight===n)return r.clipLayout;r.frameWidth=e,r.frameHeight=t,r.textureWidth=i,r.textureHeight=n,r.objectFit=s;let a={width:0,height:0},o=e/t;const l=i/n;if(!l)return console.warn("Warning:Texture size is 0!"),clip_layout;if(0===e||0===t){if(0===e&&0===t)return clip_layout;0===e?e=t*l:t=e/l,o=e/t}let h="";switch(s){case"fill":a.width=e,a.height=t,h="fill";break;case"none":a.width=i,a.height=n,h="none";break;case"cover":a=this._StretchSize(e,t,l,l<o),h="cover";break;case"scale-down":a=this._StretchSize(e,t,l,l>o),a.width>i&&(a.width=i,a.height=n),h="scale-down";break;case"contain":a=this._StretchSize(e,t,l,l>o),h="contain"}if(a.width=Math.floor(a.width),a.height=Math.floor(a.height),a.width!=e||a.height!=t){let i={};i.width=Math.min(a.width,e),i.height=Math.min(a.height,t),i.x=Math.floor((e-i.width)/2),i.y=Math.floor((t-i.height)/2),r.clipLayout=i;return(this.InnerChildElement?this.InnerChildElement:this.Element).style.objectFit=h,i}return null}_StretchSize(e,t,i,n){const s={width:0,height:0};return n?(s.width=e,s.height=e/i):(s.height=t,s.width=t*i),s}GetPositionOffset(e){let t=this,i=0,n=0;for(;e!==t;)i+=t.LayoutParams?t.LayoutParams.MarginLeft:0,n+=t.LayoutParams?t.LayoutParams.MarginTop:0,t=t.ParentView,t||F.ThrowError("ERROR: Target parent layoutview is not found in LayoutView tree");return new F.Coordinate(i,n)}_dispatchLongPress(){this._LongPressDelayRequestTaskId=0,this._InLongPress=!0;const e={type:F.DragInfo.EVENT_TYPE.OnLongPress,x:this._CurrentDownEvent.designX,y:this._CurrentDownEvent.designY};this.TouchEventProcess(e)}_onMouseDown(e,t,i){this._Velocity.x.reset(),this._Velocity.y.reset(),this._Velocity.x.updatePosition(e),this._Velocity.y.updatePosition(t),this._LastFocusX=e,this._DownFocusX=this._LastFocusX,this._LastFocusY=t,this._DownFocusY=this._LastFocusY,this._CurrentDownEvent={designX:e,designY:t,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:F.DragInfo.EVENT_TYPE.OnDown,x:e,y:t,deltaX:0,deltaY:0}}_onMouseMove(e,t,i){if(!this._CurrentDownEvent)return null;this._Velocity.x.updatePosition(e),this._Velocity.y.updatePosition(t);const n=parseInt(e-this._LastFocusX,10),s=parseInt(t-this._LastFocusY,10),r=parseInt(e-this._DownFocusX,10),a=parseInt(t-this._DownFocusY,10);let o=null;if(this._AlwaysInTapRegion){r*r+a*a>this._TouchSlopSquare&&(o={type:F.DragInfo.EVENT_TYPE.OnDragStart,x:e,y:t},this._LastFocusX=e,this._LastFocusY=t,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:F.DragInfo.EVENT_TYPE.OnMoved,x:e,y:t,deltaX:r,deltaY:a,_deltaX:n,_deltaY:s,timeStamp:parseInt((this._LastTimeStamp-i)/1e3,10)},this._LastFocusX=e,this._LastFocusY=t,this._LastTimeStamp=i);return o}_onMouseUp(e,t,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=e-this._CurrentDownEvent.designX,h=t-this._CurrentDownEvent.designY;const c=e-this._LastFocusX,u=t-this._LastFocusY;this._InLongPress||(this._AlwaysInTapRegion?n={type:F.DragInfo.EVENT_TYPE.OnTap,x:e,y:t,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:F.DragInfo.EVENT_TYPE.OnFling,x:e,y:t,velocityX:a,velocityY:o,deltaX:a<0?-l:l,deltaY:o<0?-h:h,_deltaX:c,_deltaY:u}):n={type:F.DragInfo.EVENT_TYPE.OnDragEnd,x:e,y:t,deltaX:l,deltaY:h,_deltaX:c,_deltaY:u},this.TouchEventProcess(n),n={type:F.DragInfo.EVENT_TYPE.OnRelease,x:e,y:t,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(e){const t=window.Forge.DesignMap(),i=Math.floor(t.displayScale*t.width),n=window.innerWidth/i,s=e.clientX/n,r=e.clientY/n;let a=null;switch(e.type){case"touchstart":case"mousedown":a=this._onMouseDown(s,r,e.timeStamp);break;case"touchmove":case"mousemove":a=this._onMouseMove(s,r,e.timeStamp);break;case"touchend":case"touchcancel":case"mouseup":a=this._onMouseUp(s,r,e.timeStamp)}return!!a&&this.TouchEventProcess(a)}_AddEventListener(){this.Element.style.pointerEvents="auto",this._ValidTouch=!1;"ontouchstart"in window?(this.Element.addEventListener("touchstart",(e=>{if(console.log("touchstart",e),this._ValidTouch=!0,e.touches&&e.touches.length>0){console.log(`touchstart event.touches[0].clientX:${e.touches[0].clientX}, event.touches[0].clientY:${e.touches[0].clientY}`);this._onTouchEvent({type:e.type,clientX:e.touches[0].clientX,clientY:e.touches[0].clientY,timeStamp:e.timeStamp})&&e.stopPropagation()}}),!0),this.Element.addEventListener("touchmove",(e=>{if(this._ValidTouch&&(console.log("touchmove",e),e.touches&&e.touches.length>0)){console.log(`touchmove event.touches[0].clientX:${e.touches[0].clientX}, event.touches[0].clientY:${e.touches[0].clientY}`);this._onTouchEvent({type:e.type,clientX:e.touches[0].clientX,clientY:e.touches[0].clientY,timeStamp:e.timeStamp})&&e.stopPropagation()}}),!0),this.Element.addEventListener("touchend",(e=>{if(console.log(`touchend event.touches.length:${e.touches.length}, event.clientX:${e.clientX}, event.pageX:${e.pageX}`),this._ValidTouch=!1,e.changedTouches&&e.changedTouches.length>0){console.log(`touchend event.changedTouches[0].clientX:${e.changedTouches[0].clientX}, event.changedTouches[0].pageX:${e.changedTouches[0].pageX}`);this._onTouchEvent({type:e.type,clientX:e.changedTouches[0].clientX,clientY:e.changedTouches[0].clientY,timeStamp:e.timeStamp})&&e.stopPropagation()}}),!0),this.Element.addEventListener("touchcancel",(e=>{if(this._ValidTouch=!1,console.log("touchcancel",e),e.changedTouches&&e.changedTouches.length>0){console.log(`touchcancel event.clientX:${e.clientX}, event.clientY:${e.clientY}`);this._onTouchEvent({type:e.type,clientX:e.touches[0].clientX,clientY:e.touches[0].clientY,timeStamp:e.timeStamp})&&e.stopPropagation()}}),!0)):(this.Element.addEventListener("mousedown",(e=>{console.log("mousedown",e),this._ValidTouch=!0;this._onTouchEvent(e)&&e.stopPropagation()}),!0),this.Element.addEventListener("mousemove",(e=>{if(this._ValidTouch){this._onTouchEvent(e)&&e.stopPropagation()}}),!0),this.Element.addEventListener("mouseup",(e=>{console.log("mouseup",e),this._ValidTouch=!1;this._onTouchEvent(e)&&e.stopPropagation()}),!0))}_GetSplineDeceleration(e){return Math.log(F.DragInfo.INFLEXION*Math.abs(e)/(F.DragInfo.SCROLL_FRICTION*F.DragInfo.PHYSICAL_COEF))}_GetSplineFlingDistance(e){const t=this._GetSplineDeceleration(e),i=F.DragInfo.DECELERATION_RATE-1;return F.DragInfo.SCROLL_FRICTION*F.DragInfo.PHYSICAL_COEF*Math.exp(F.DragInfo.DECELERATION_RATE/i*t)}_DoDragMove(e,t){let i=e._deltaX,n=e._deltaY;this._DragMovedDistanceX+=i,this._DragMovedDistanceY+=n,t||(i=e.deltaX,n=e.deltaY);const s=e.timeStamp/1e3;let r=`left ${s}s, top ${s}s`;this._DragInfo.Settings.DragDirection===F.DragSetting.DIRECTION_VERTICAL?(i=0,r=`top ${s}s`):this._DragInfo.Settings.DragDirection===F.DragSetting.DIRECTION_HORIZONTAL?(n=0,r=`left ${s}s`):this._DragInfo.Settings.DragDirection===F.DragSetting.DIRECTION_DISABLE&&(i=0,n=0);let a=this.GetLayoutParams();return a=this._GetMovedLayoutParams(i,n),t&&(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)&&(e.viewX=a.MarginLeft,e.viewY=a.MarginTop,this._DragInfo.Listener.OnMoved(e))}_GetMovedLayoutParams(e,t){const i=this.GetLayoutParams();let n=i.MarginLeft+e,s=i.MarginTop+t;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(e,t){if(!this._DragInfo.Settings.EnableTabMode)return!1;const i=e._deltaX,n=e._deltaY;let s=e.deltaX,r=e.deltaY,a=this._DragInfo.Settings.PageWidth*this._DragInfo.Settings.PageEdge;const o=this.GetLayoutParams(),l=o.MarginLeft+i,h=o.MarginTop+n;switch(e.type===F.DragInfo.EVENT_TYPE.OnFling&&(a=0),this._DragInfo.Settings.DragDirection){case F.DragSetting.DIRECTION_VERTICAL:if(s=0,r>=0){const e=this._DragInfo.Settings.PageWidth-Math.abs(h)%this._DragInfo.Settings.PageWidth;r=e>=a?this._DragInfo.Settings.PageWidth-e:-e}else{const e=Math.abs(h)%this._DragInfo.Settings.PageWidth;r=e>=a?-(this._DragInfo.Settings.PageWidth-e):e}break;case F.DragSetting.DIRECTION_HORIZONTAL:if(r=0,s>=0){const e=this._DragInfo.Settings.PageWidth-Math.abs(l)%this._DragInfo.Settings.PageWidth;s=e>=a?this._DragInfo.Settings.PageWidth-e:-e,console.log(`right, left_width:${e}, distance_x:${s}`)}else{const e=Math.abs(l)%this._DragInfo.Settings.PageWidth;s=e>=a?-(this._DragInfo.Settings.PageWidth-e):e,console.log(`left, left_width:${e}, distance_x:${s}`)}break;case F.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 e.deltaX=s,e.deltaY=r,this._DonFlingAnim(e,c),!0}_DoDragEnd(e){let t=e._deltaX,i=e._deltaY;this._DragInfo.Settings.DragDirection===F.DragSetting.DIRECTION_VERTICAL?t=0:this._DragInfo.Settings.DragDirection===F.DragSetting.DIRECTION_HORIZONTAL?i=0:this._DragInfo.Settings.DragDirection===F.DragSetting.DIRECTION_DISABLE&&(t=0,i=0),console.log("_DoDragEnd event:",e,this.Element.style);let n=this.GetLayoutParams();return n=this._GetMovedLayoutParams(t,i),this.ResetLayoutParams(n),e.viewX=n.MarginLeft,e.viewY=n.MarginTop,this._DragInfo.Listener.OnDragEnd(e)}_DragImactSensorRecycle(){console.log("_DragImactSensorRecycle this._DragImactSensor:",this._DragImactSensor),this._DragImactSensor&&this._DragImactSensor.Recycle()}_DonFlingAnim(e,t){const i=e.deltaX,n=e.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 F.DragTranslateControl,this.DragControl._SetView(this),this.DragControl.speed(t),console.log(`OnFling speed:${t}`);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(((t,r)=>{this.DragControl=null,s.SetPosition(t,r),this.ResetLayoutParams(s),this.Element.style.transform=null,this._DragImactSensorRecycle(),e.viewX=t,e.viewY=r,this._DragInfo.Listener.OnFling(e),console.log(`_DonFlingAnim end view_x:${t}, view_y:${r}, distance_x:${i}, distance_y:${n}`)}),(e=>{const t=i*e,s=n*e;if(console.log(`_DonFlingAnim progress:${e}, deltaX:${t}, deltaY:${s}`),Math.abs(t)>this._DragInfo.Settings.TriggerMovedDistance||Math.abs(s)>this._DragInfo.Settings.TriggerMovedDistance){const e={deltaX:r+t,deltaY:a+s,_deltaX:t,_deltaY:s,timeStamp:parseInt((Date.now()-u)/1e3,10)};this._DoDragMove(e,!1),u=Date.now()}}));const d=this.GetPositionOffset(this.ParentView);this._DragImactSensor=new F.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 F.sImpactSensorManager.Callback((t=>{this._DoDragPause(e),this._DragImactSensorRecycle()}),null))}_DoFling(e){let t=e.deltaX,i=e.deltaY,n=!0,s=0;switch(this._DragInfo.Settings.DragDirection){case F.DragSetting.DIRECTION_VERTICAL:t=0,0===i&&(n=!1),s=Math.abs(e.velocityY);break;case F.DragSetting.DIRECTION_HORIZONTAL:i=0,0===t&&(n=!1),s=Math.abs(e.velocityX);break;case F.DragSetting.DIRECTION_DISABLE:n=!1;break;default:s=Math.sqrt(e.velocityX**2,e.velocityY**2)}return n&&(e.deltaX=t,e.deltaY=i,this._DonFlingAnim(e,s)),!0}_FindFirstRectChild(){if(0!=this.Element.clientWidth&&0!=this.Element.clientHeight)return this;let e,t;if(this.ChildViews.length>0)for(let i=0;i<this.ChildViews.length;i++)if(t=this.ChildViews[i],t&&(e=t._FindFirstRectChild(),null!=e))return e;return null}GetBoundingClientRect(e){this.Element?setTimeout((()=>{let t=this,i=0;for(;t;)t.TransformAnimationObj&&t.TransformAnimationObj.repeatTimes>0&&(i++,t.TransformAnimationObj.AddAnimationListener(new F.AnimationListener(null,(t=>{if(i--,i<=0){let t=this._FindFirstRectChild();t||(t=this);const{left:i,top:n,width:s,height:r}=t.Element.getBoundingClientRect();e?.(JSON.stringify({status:0,data:{left:i,top:n,width:s,height:r}}))}})))),t=t.ParentView;if(0==i){let t=this._FindFirstRectChild();t||(t=this);const{left:i,top:n,width:s,height:r}=t.Element.getBoundingClientRect();e?.(JSON.stringify({status:0,data:{left:i,top:n,width:s,height:r}}))}}),1):e?.(JSON.stringify({status:-1,error:"BrowserError: dom element is null."}))}ChildViewsCount(){return this.ChildViews.length}MarkFlexSizeFromChild(e){this._ChildrenFromChild0&&console.error("Error: from child0 冲突 size"),this._SizeFromChild=e,this.Element.style.display="flex","0px"==this.Element.style.width&&(this.Element.style.width=""),"0px"==this.Element.style.height&&(this.Element.style.height=""),this._SizeFromChild?this._SizeFromChild.Element.style.position="relative":console.error("Error: Need insert child0 before mark")}MarkFlexChildrenFromChild0(){this._SizeFromChild&&console.error("Error: from child0 冲突 child"),this._ChildrenFromChild0=!0}TransChildFlexInfoPack(e){e.FlexInfoPack?(this.FlexInfoPack=e.FlexInfoPack,e.FlexInfoPack=null):this.FlexInfoPack!=e.FlexInfoPackWeak&&console.error("Error: TransChildFlexInfoPack dismatch")}RegisterFlexAssigned(e){this._FlexAssignedCallback=e,null==this._MySizeObserver&&(this._MySizeObserver=new ResizeObserver((t=>{for(let i of t)i.target==this.Element&&e?.(0,0,i.contentRect.width,i.contentRect.height)}))),e?(this._MySizeObserver.disconnect(),this._MySizeObserver.observe(this.Element)):this._MySizeObserver.disconnect()}ResetFlexContainerCell(e){e?(this._EnsureFlexInfoPack(),this.FlexInfoPackWeak.container=e,this._FlushFlexDiv()):console.error("Error: Can NOT cancel flex container")}ResetFlexItemCell(e){this._EnsureFlexInfoPack(),this.FlexInfoPackWeak.item=e,this._FlushFlexDiv()}_EnsureFlexInfoPack(){null==this.FlexInfoPackWeak&&(this.FlexInfoPack={container:null,item:null},this.FlexInfoPackWeak=this.FlexInfoPack)}_FlushFlexDiv(){if(this._IsChildOfRootView){if(null!=this.FlexInfoPackWeak){if(null!=this.FlexInfoPackWeak.container)if(this._ChildrenFromChild0)this.Element.style.width="",this.Element.style.height="",this.Element.style.display="flex";else{this.Element.style.display="flex";let e=this.FlexInfoPackWeak.container;this.Element.style.flexDirection=this._ConvertFlexSetToString(e.flexDirection),this.Element.style.flexWrap=this._ConvertFlexSetToString(e.flexWrap),this.Element.style.justifyContent=this._ConvertFlexSetToString(e.justifyContent),this.Element.style.alignItems=this._ConvertFlexSetToString(e.alignItems),this.Element.style.alignContent=this._ConvertFlexSetToString(e.alignContent);let t=this;for(;t.ParentView._ChildrenFromChild0;)t=t.ParentView;this.Element.style.width=t.LayoutParams.Width>0?t.LayoutParams.Width+"px":"",this.Element.style.height=t.LayoutParams.Height>0?t.LayoutParams.Height+"px":"";for(let e=0;e<this.ChildViews.length;e++){let t=this.ChildViews[e].Element;t.style.position="relative",t.style.left="",t.style.top=""}}else this.Element.style.flexDirection="",this.Element.style.flexWrap="",this.Element.style.justifyContent="",this.Element.style.alignItems="",this.Element.style.alignContent="";if(this.FlexInfoPack&&this.FlexInfoPack.item){let e=this.FlexInfoPack.item;this.Element.style.alignSelf=this._ConvertFlexSetToString(e.alignSelf),this.Element.style.flexGrow=e.flexGrow}}this.ParentView.FlexInfoPackWeak?.container?this.Element.style.position="relative":this.ParentView._SizeFromChild||(this.Element.style.position="absolute")}}_ConvertFlexSetToString(e){switch(e){case F.FlexSetNames.NoSet:return"";case F.FlexSetNames.Auto:return"auto";case F.FlexSetNames.Row:return"row";case F.FlexSetNames.RowReverse:return"row-reverse";case F.FlexSetNames.Column:return"column";case F.FlexSetNames.ColumnReverse:return"column-reverse";case F.FlexSetNames.NoWrap:return"nowrap";case F.FlexSetNames.Wrap:return"wrap";case F.FlexSetNames.FlexStart:return"flex-start";case F.FlexSetNames.FlexEnd:return"flex-end";case F.FlexSetNames.Center:return"center";case F.FlexSetNames.Stretch:return"stretch";default:return console.error("No support flex set, value="+e),""}}}Re.DivId=0,F.LayoutViewBase=Re;class Fe extends Re{constructor(e,t){!e||e instanceof F.TextureSetting||F.ThrowError("ERROR:LayoutView need TextureSetting as parameter"),super(e,t=t||"div")}HtmlCanAccessElement(){return!0}HtmlGetElement(){return this.Element}}F.LayoutView=Fe,window.LayoutView=F.LayoutView;class De extends F.LayoutView{constructor(){super(void 0,"root"),this._ViewType=1,this._IsChildOfRootView=!0,window.gRootView=this,F.sRootView=this}Init(e,t,i,n,s){this.InitLayoutViewStaticValues(e),this.ResetLayoutParams({x:0,y:0,width:1280,height:720})}InitLayoutViewStaticValues(e){F.LayoutViewBase.sRenderer=e,F.LayoutViewBase.sInternalTextureManager=e.GetSharedTextureManager(),F.LayoutViewBase.sIdentityMat4=new F.Mat4,F.LayoutViewBase.sNullDirectParentMat4=new F.Mat4,F.LayoutViewBase.sBakeFlipYMat4=(new F.Mat4).rotatex(180)}}F.RootView=De,window.RootView=F.RootView;class Ve{constructor(e,t,i,n,s){this.coordX=e,this.coordY=t,this.width=i,this.height=n,this.useScissors=s,this.maskStencil=null}updateInfo(e,t,i,n,s){this.coordX=e,this.coordY=t,this.width=i,this.height=n,this.useScissors=s}setMaskStencil(e){this.maskStencil=e}}class Oe extends F.LayoutView{constructor(e){super(e,"div"),this._ClipRectInfo=null,this.Id="ClipView",this.TextureSetting=null}SetId(e){this.Id=`${e}_ClipView`}SetClipRect(e,t,i,n,s){null===this._ClipRectInfo?this._ClipRectInfo=new Ve(e,t,i,n,s):this._ClipRectInfo.updateInfo(e,t,i,n,s);const r=e,a=t,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(e,t){this.Element.style.overflow=e&&t?"hidden":"visible"}}F.ClipView=Oe,window.ClipView=F.ClipView;class Me extends F.LayoutView{constructor(e){super(e,"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(e,t){let i=null;e&&(i=new F.ExternalTextureSetting(e,t)),this.TextureSetting=i,this._ApplyChanges()}SetRepeat(e,t){F.Assert(e.length<=2),F.Assert(t.length<=2);for(let i=0;i<2;i++)i<e.length?(this._HorizontalRepeats[2*i]=e[i].start,this._HorizontalRepeats[2*i+1]=e[i].width):(this._HorizontalRepeats[2*i]=0,this._HorizontalRepeats[2*i+1]=0),i<t.length?(this._VerticalRepeats[2*i]=t[i].start,this._VerticalRepeats[2*i+1]=t[i].width):(this._VerticalRepeats[2*i]=0,this._VerticalRepeats[2*i+1]=0);return this._ApplyChanges(),this}SetPadding(e,t){return F.Assert(null!==e),F.Assert(null!==t),this._VerticalPadding[0]=t.start,this._VerticalPadding[1]=t.width,this._HorizontalPadding[0]=e.start,this._HorizontalPadding[1]=e.width,this._ApplyChanges(),this}SetImageDspSize(e,t){this._ImageDspWidth=e,this._ImageDspHeight=t}_ApplyChanges(){let e=this.TextureSetting;if(e){if(e.MaskSetting&&"CORNER"===e.MaskSetting._MaskType&&this._SetBorderRadius(e.MaskSetting),e.Texture.Source){const t=e.Texture.RenderTexture.Width,i=e.Texture.RenderTexture.Height,n=t/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=t-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>=t&&(h-=1,c-=1),u+d>=i&&(u-=1,d-=1);const g=`${u} ${c} ${d} ${h}`;this.Element.style.borderImage=`url(${e.Texture.Source}) ${g} fill`;const f=this._HorizontalPadding[0],m=this._ImageDspWidth-this._HorizontalPadding[1]-f,p=this._VerticalPadding[0],y=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 ${y}px ${f}px`}}else this.Element.style.borderRadius="",this.Element.style.borderImage=""}}F.NinePatchView=Me;class Ne extends F.LayoutView{constructor(e){let t;t=e.startsWith("jsve-")?e.substr(5):e.substr(3),super(void 0,t)}setAttribute(e,t){this.Element.setAttribute(e,t)}removeAttribute(e){this.Element.removeAttribute(e)}getAttribute(e){return this.Element.getAttribute(e)}hasAttribute(e){return this.Element.hasAttribute(e)}get textContent(){return this.Element.textContent}set textContent(e){this.Element.textContent=e}}F.JsvElementView=Ne;F.VideoView=class extends Fe{constructor(e,t){super(t),this._ViewType=8,this.Element=e,this.Id="VideoView"}SetId(e){this.Id=`${e}_VideoView`}ResetLayoutParams(e){null!==e?(e instanceof F.LayoutParamsBase?this.LayoutParams=e.Clone():this.LayoutParams=new F.LayoutParams(e),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`)):F.ThrowError("ResetLayoutParams(): new params is null")}_OnAttachToSystem(){console.log("Video attach"),super._OnAttachToSystem()}_OnDetachFromSystem(){super._OnDetachFromSystem()}};class Ge extends F.LayoutView{constructor(){super(null,"input"),this._ViewType=5,this._InputType=F.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",(e=>{e=e||window.event;let t=this.Element.selectionStart;console.log(`keydown cur_offset:${t}`),37===e.keyCode?(--t,t<0&&(t=0),t!==this.Element.selectionStart?(this.OnTextChanged(this.Element.value,t,!0),e.stopPropagation&&e.stopPropagation()):this.Element.blur()):39===e.keyCode?(++t,t>this.Element.value.length&&(t=this.Element.value.length),t!==this.Element.selectionStart?(this.OnTextChanged(this.Element.value,t,!0),e.stopPropagation&&e.stopPropagation()):this.Element.blur()):38===e.keyCode||40===e.keyCode?this.Element.blur():27!==e.keyCode&&1e4!==e.keyCode||this.Element.blur()})),this.Element.onfocus=e=>{console.log("onfocus in"),this.OnStatusChanged(1)},this.Element.onblur=e=>{console.log("onblur in"),this.OnStatusChanged(0)};this.Element.oninput=e=>{if(console.log("oninput:",e),e.target.value.length>0&&e.target.selectionStart>0){const i=e.target.selectionStart-1,n=e.target.selectionStart,s=e.target.value.slice(i,n);t=s,"0".charCodeAt()<=t.charCodeAt()&&t.charCodeAt()<="9".charCodeAt()||this._InputType!==F.TextInputType.NUMBER||(e.target.value=e.target.value.substr(0,i)+e.target.value.substr(n),e.target.selectionStart=i)}var t;const i=e.target.value,n=e.target.selectionStart;this.OnTextChanged(decodeURIComponent(i),n)}}SetId(e){this.Id=`${e}_EditControlView`}showIme(e,t,i){this.Element?e!==F.TextInputType.NONE?(null==i&&(i=t.length>0?t.length:0),i<0?i=0:i>t.length&&(i=t.length>0?t.length:0),this._InputType=e,this.Element.type="text",this.Element.value=t,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(e,t){this.Element?(this.Element.selectionStart=t,this.Element.selectionEnd=t,this.Element.value=e):console.log("updateCursorOffset, but ele is null!")}OnTextChanged(e,t,i){console.log(`OnTextChanged value:${e}`)}OnStatusChanged(e){}OnEditAction(e){}}class Be extends F.LayoutView{constructor(e,t=1){super(e),this._ViewType=10,this._FilterType=t,this.Id="FilterView",this._Type=t,t==Be.Type.GRAY_DOWN?this.Element.style.filter="grayscale(100%)":t==Be.Type.WAVE&&console.warn("FilterView: ripple effect has not been implemented on the browser side.")}FilterSwitch(e){this.Element&&this._Type==Be.Type.GRAY_DOWN&&(this.Element.style.filter=e?"grayscale(100%)":"")}SetId(e){this.Id=e+"_FilterView"}AddWaveSourceList(){}AddWaveSourceSingle(){}RemoveSource(){}DispatchCommand(){}}Be.Type={GRAY_DOWN:1,WAVE:2},Be.WAVE={CIRCLE_WAVE:1,RECTANGLE_WAVE:2},F.FilterView=Be;class We extends F.LayoutView{constructor(){super(null,"div"),this._Iframe=window.originDocument.createElement("iframe"),this._Iframe.style.border="none",this._Iframe.style.margin="0px",this._Iframe.style.padding="0px",this._Iframe.scrolling="no",this._IframeWidth=0,this._IframeHeight=0,this.Element.appendChild(this._Iframe)}SetIframeSize(e,t){isNaN(e)||(this._IframeWidth=e,this._Iframe.width=e),isNaN(t)||(this._IframeHeight=t,this._Iframe.height=t)}SetInnerHtml(e){this._Iframe.srcdoc=e,this._Iframe.onload=()=>{0==this._IframeHeight&&(this._Iframe.height=this._Iframe.contentDocument.body.clientHeight)}}}F.IFrameView=We;let He={NONE:0,TEXT:1,PASSWORD:2,TEXT_AREA:3,CONTENT_EDITABLE:4,SEARCH:5,URL:6,EMAIL:7,TELEPHONE:8,NUMBER:9};F.TextInputType=He,F.EditControlView=Ge;class Ye{constructor(e){this._Current=new Array(e).fill(0),this._Target=new Array(e).fill(0),this._RepeatStart=new Array(e).fill(0),this._JumpTarget=null,this._Jumping=!1,this._ParameterCount=e,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(e,t){return this._Repeat=e,this._OnRepeatCallback=e?t:null,this}start(e,t){this._NextEndCallback=e,this._EndCallback=null,this._AdvanceCallback=t,this._StartSwitcher=!0,this._Jumping=!1,this._StateMachineNext()}pause(e){this._AdvanceCallback=null,null===this._EndCallback&&null===this._NextEndCallback||(this._EndCallback=null,this._NextEndCallback=null),0===this._StateIndex?e&&this._CallbackWithCatch(this._Current,e):(e&&(this._PausedCallback=e),this._StateMachineNext())}jump(){this._JumpTarget=[...this._Target],this._Jumping=!0,this._StartSwitcher=!0,this._StateMachineNext()}jumpSilent(){this._JumpTarget=[...this._Target]}startFpsTesting(){F.sRenderBridge.SetStepFpsSwitch(!0)}stopFpsTesting(){F.sRenderBridge.SetStepFpsSwitch(!1)}_WrapBuildAnimation(e,t,i,n){console.warn("Should Override")}_WrapCallback(e,t){console.warn("Should Override")}_CallbackWithCatch(e,t){try{this._WrapCallback(e,t)}catch(e){console.error("Error:in callback"),console.error(e)}}_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 e=this._JumpTarget?[...this._JumpTarget]:[...this._Current],t=this._Target,i=this._Repeat?[...this._RepeatStart]:null,n=this._WrapBuildAnimation(i,e,t,this._Jumping);if(this._JumpTarget=null,this._Jumping=!1,null===n)return;const s=[...t],r=this,a=(new F.AnimationListener).OnFinalProgress((t=>{r._OnPaused(null!==i?i:e,s,t)})).OnAdvance((e=>{this._AdvanceCallback&&this._AdvanceCallback(e)}));return this._OnRepeatCallback&&a.OnRepeat((e=>{r._OnRepeatCallback&&r._OnRepeatCallback(e)})),n.AddAnimationListener(a),n.Enable(F.AnimationEnable.KeepTransform),this._Repeat&&n.EnableInfinite(),this._SpriteView.StartAnimation(n),!0}_StopAnimation(){this._SpriteView.StopAnimation()}_OnPaused(e,t,i){for(let n=0;n<this._ParameterCount;n++)this._Current[n]=Math.floor((t[n]-e[n])*i+e[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(e){this._SpriteView=e}}F.DragTranslateControl=class extends Ye{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(e){return this._AllowFrameStep=e,this}selectMode(e){switch(e){case"UniformMotion":this._Mode=0;break;case"AcceleratedMotion":this._Mode=1,this.setRepeat(!1);break;default:console.error(`Unsupported input=${e}`)}return this}targetX(e){return this._Target[0]=e,this}targetY(e){return this._Target[1]=e,this}target(e,t){return this._Target[0]=e,this._Target[1]=t,this}enableRepeatFrom(e,t,i){if(this._ComfirmMode(0))return this.setRepeat(!0,i),this._RepeatStart[0]=e,this._RepeatStart[1]=t,this}speed(e){if(console.log(`speed, pixel_per_second:${e}`),this._ComfirmMode(0))return this._Speed=e,this}accelerateX(e,t){if(this._ComfirmMode(1))return this._Target[0]=t,this._VerlocityAcc=e,this._VerlocityInit=0,this._AccAlongX=!0,this}accelerateY(e,t){if(this._ComfirmMode(1))return this._Target[1]=t,this._VerlocityAcc=e,this._VerlocityInit=0,this._AccAlongX=!1,this}decelerateX(e,t){if(this._ComfirmMode(1))return this._VerlocityAcc=e,this._VerlocityInit=t,this._AccAlongX=!0,this}decelerateY(e,t){if(this._ComfirmMode(1))return this._VerlocityAcc=e,this._VerlocityInit=t,this._AccAlongX=!1,this}decelerate(e,t,i,n){if(1===this._Mode)return this._VerlocityAcc[0]=e,this._VerlocityAcc[1]=t,this._VerlocityInit[0]=i,this._VerlocityInit[1]=n,this;console.error("Error: mode error")}_ComfirmMode(e){return this._Mode===e||(console.error("Error: mode error"),!1)}_WrapBuildAnimation(e,t,i,n){return n?this._AnimationRef=this._UniformMove(null,t,i,n):0===this._Mode?this._AnimationRef=this._UniformMove(e,t,i,!1):1===this._Mode&&(this._AnimationRef=this._AccelerMove(t,i)),this._AnimationRef}_UniformMove(e,t,i,n){let s=0,r=0,a=0,o=1;const l=t[0],h=t[1],c=i[0],u=i[1];if(null!==e){s=e[0],r=e[1];const t=this._Distance(l,h,c,u),i=this._Distance(s,r,c,u);a=(i-t)/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 F.TranslateAnimation(s,c,r,u,o,null);else{console.log("Using frame translate animation");let e=0,t=0,i=!0;s!==c?(e=s,t=c,i=!0):(e=r,t=u,i=!1),d=new F.TranslateFrameAnimation(e,t,this._Speed,i)}return 0!==a&&(a<0?console.warn("Warning: start position out of repeating range"):d.SetStartPos(a)),d}_AccelerMove(e,t){const i=this._AccAlongX?e[0]:e[1],n=this._VerlocityInit,s=this._VerlocityAcc;let r,a,o,l,h=!0;if(0!==s)return 0===n?(r=this._AccAlongX?t[0]:t[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 F.TranslateAnimation(e[0],o,e[1],l,a,h?F.Easing.Circular.In:F.Easing.Circular.Out);console.error("Error: no found acceleration")}_Distance(e,t,i,n){const s=i-e,r=n-t;return Math.sqrt(s*s+r*r)}_WrapCallback(e,t){this._AnimationRef=null,t&&t(e[0],e[1])}};F.LayoutView;class $e{StringWithFont(e,t,i,n,s,r,a,o,l,h,c){t||(t=$e._sDefaultFontSize),i||(i=$e._sDefaultFont);let u="";!0===a&&(u="italic");let d="";return!0===o&&(d="bold"),n||(n="left"),s||(s="middle"),r||(r=$e._sDefaultFontColor),l||(l=null),c||(c="top"),h||(h=-1),{str:`${e}`,font:i,size:t,italic:u,bold:d,stroke_width:h,alignment:n,vertical_align:s,textColour:r,backgroundColour:$e._sDefaultBackgroundColor,enableBlend:!0,shadow:l,vertical_area_align:c}}TextAttr(e,t){return e||(e="none"),t||(t="none"),{text_overflow:e,word_wrap:t}}GetTextWidth(...e){if(e.length<=1){let t=e[0];return void 0!==window.PlatformUtils?window.PlatformUtils.GetTextWidth(t):t.str.length*t.size+1}{let t=e[0];if(void 0!==window.PlatformUtils){let i={str:t,font:e[1]?e[1]:"黑体",size:e[2],bold:e[3],italic:e[4]};return window.PlatformUtils.GetTextWidth(i)}return t.length*t.size+1}}GetOneLineTextDrawWidth(e,t,i,n,s,r){if(void 0!==window.PlatformUtils){let a=window.PlatformUtils.GetOneLineTextDrawWidth(e,t??"黑体",i,n,s);r.push(...a)}else console.error("GetOneLineTextDrawWidth: window.PlatformUtils undefined.")}GetTextRect(e,t,i,n,s){return void 0!==window.PlatformUtils?window.PlatformUtils.GetTextRect(e,t,i,n,s):{width:t.width,height:t.height}}GetTextInfo(e,t,i,n,s){return void 0!==window.PlatformUtils?window.PlatformUtils.GetTextInfo(e,t,i,n,s):{start:0,end:e.length,width:t.width,height:t.height}}GetCursorOffset(e,t,i,n,s,r,a){return void 0!==window.PlatformUtils?window.PlatformUtils.GetCursorOffset(e,t,i,n,s,r,a):0}GetCursorPosition(e,t,i,n,s,r){return void 0!==window.PlatformUtils?window.PlatformUtils.GetCursorPosition(e,t,i,n,s,r):{x:0,y:0}}BuildTextView(e,t,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 F.LayoutView;const d=e.GetTextTextureFromStylePack(t,i,!!n,s,r,a,2!=o,l,h,c);return n&&setTimeout((()=>{n(u.Element.clientWidth,u.Element.clientHeight)})),null===d?(console.error("Error: Build text texture failed!"),null):(u.ResetTexture(d),t.length<10?u.SetId("Text-"+t):u.SetId("Text-Long-"+t.length),u.ResetLayoutParams({x:0,y:0,width:s.width,height:s.height}),u)}}$e._sDefaultFont="黑体",$e._sDefaultFontSize=30,$e._sDefaultFontColor="#FFFFFF",$e._sDefaultBackgroundColor="rgba(0, 0, 0, 0)",F.TextUtils=$e,F.sTextUtils=new F.TextUtils;class Ue{constructor(){this._InnerViews={},this._ViewToken=1}add(e){const t=++this._ViewToken;return this._InnerViews[`${t}`]=e,t}remove(e){this._InnerViews[e]&&delete this._InnerViews[e]}get(e){return this._InnerViews[e]}clear(){this._InnerViews={},this._ViewToken=1}}F.ViewStore=Ue;let je=new Ue;F.sViewStore=je;class ze{constructor(e,t){this.view=e,this.layout_params=t}}F.ViewInfo=ze;let Xe=0;F.AnimationBase=class{constructor(){this.IdToken=Xe++,this._AttachedGroup=null,this.AnimationListenerObj=null,this._AnimationClose=!1,this._LayoutViewRef=null,this._IsTextureAnim=!1}SetAnimationListener(e){this.AnimationListenerObj=e,this.OnNewListener(e)}AddAnimationListener(e){this.AnimationListenerObj&&e.AddInherit(this.AnimationListenerObj),this.AnimationListenerObj=e,this.OnNewListener(e)}RemoveAnimationListener(){this.AnimationListenerObj=null}OnNewListener(e){}GetAnimationListener(){return this.AnimationListenerObj}Cancel(e){this._LayoutViewRef&&this._LayoutViewRef.DetachAnimation(this);const t=this.AnimationListenerObj;if(t&&t.OnAnimationEnd&&!this._AnimationClose&&(this._AnimationClose=!0,t.OnAnimationEnd(!1)),this._AttachedGroup){let t=!0;e&&(t=e._AttachedGroup!==this._AttachedGroup),t&&(this._AttachedGroup.CancelFromInternalAnimation(this),this._AttachedGroup=null)}}AttachToGroup(e){null!==this._AttachedGroup&&F.ThrowError("ERROR: In TransformAnimation.AttachToGroup(), animation already attached to other group"),this._AttachedGroup=e}RemoveFromGroup(){this._AttachedGroup=null}AsTextureAnimation(){this._IsTextureAnim=!0}Start(e){this._LayoutViewRef=e}SetCannotDisable(e){}OnStart(){const e=this.AnimationListenerObj;e&&e.OnAnimationStart&&e.OnAnimationStart()}OnEnd(e){this._LayoutViewRef&&!e&&(this._LayoutViewRef.DetachAnimation(this),this._LayoutViewRef=null);const t=this.AnimationListenerObj;t&&t.OnAnimationEnd&&!this._AnimationClose&&(this._AnimationClose=!0,t.OnAnimationEnd(!0))}OnRepeatEvent(){const e=this.AnimationListenerObj;e&&e.OnAnimRepeat&&e.OnAnimRepeat()}OnViewHide(){const e=this.AnimationListenerObj;e&&e.OnViewNoVisible&&e.OnViewNoVisible()}OnFinalProgress(e){const t=this.AnimationListenerObj;t&&t.OnAnimFinal&&t.OnAnimFinal(e)}OnAnimAdvance(e){const t=this.AnimationListenerObj;t&&t.OnAnimAdvance&&t.OnAnimAdvance(e)}};class Ke{constructor(e,t,i){this.OnAnimationStart=e,this._OnAnimationStart=e,this.OnAnimationEnd=t,this._OnAnimationEnd=t,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(e){return this._OnAnimationStart=e,this.OnAnimationStart=e,this}OnEnd(e){return this._OnAnimationEnd=e,this.OnAnimationEnd=e,this}OnAdvance(e){return this._OnAnimAdvance=e,this.OnAnimAdvance=e,this}OnFinalProgress(e){return this._OnAnimFinal=e,this.OnAnimFinal=e,this}OnRepeat(e){return this._OnAnimRepeat=e,this.OnAnimRepeat=e,this}AddInherit(e){if(e){if(0===this._InheritListener.length){const e=this;this.OnAnimationStart=function(){e._OnAnimationStart&&e._OnAnimationStart();for(let t=0;t<e._InheritListener.length;t++)e._InheritListener[t].OnAnimationStart&&e._InheritListener[t].OnAnimationStart()},this.OnAnimationEnd=function(t){e._OnAnimationEnd&&e._OnAnimationEnd(t);for(let i=0;i<e._InheritListener.length;i++)e._InheritListener[i].OnAnimationEnd&&e._InheritListener[i].OnAnimationEnd(t)},this.OnViewNoVisible=function(){e._OnViewNoVisible&&e._OnViewNoVisible();for(let t=0;t<e._InheritListener.length;t++)e._InheritListener[t].OnViewNoVisible&&e._InheritListener[t].OnViewNoVisible()},this.OnAnimFinal=function(t){e._OnAnimFinal&&e._OnAnimFinal(t);for(let i=0;i<e._InheritListener.length;i++)e._InheritListener[i].OnAnimFinal&&e._InheritListener[i].OnAnimFinal(t)},this.OnAnimRepeat=function(){e._OnAnimRepeat&&e._OnAnimRepeat();for(let t=0;t<e._InheritListener.length;t++)e._InheritListener[t].OnAnimRepeat&&e._InheritListener[t].OnAnimRepeat()},this.OnAnimAdvance=function(){e._OnAnimAdvance&&e._OnAnimAdvance();for(let t=0;t<e._InheritListener.length;t++)e._InheritListener[t].OnAnimAdvance&&e._InheritListener[t].OnAnimAdvance()}}this._InheritListener.push(e)}}}F.AnimationListener=Ke;class Je{constructor(e){this._SS=e}insertRule(e){window.jsvInAndroidWebView&&(e=(e=e.replace(/@keyframes/,"@-webkit-keyframes")).replace(/transform/g,"-webkit-transform"));const t=this._SS.cssRules.length;this._SS.insertRule(e,t)}removeRule(e){this.removeMultiRules([e])}hasRule(e){const t=this._SS.cssRules;for(let i=t.length-1;i>=0;i--)if(t[i].name===e)return!0;return!1}removeMultiRules(e){const t=this._SS,i=this._SS.cssRules;for(let n=i.length-1;n>=0;n--)for(const s in e)if(i[n].name===e[s]){e.splice(s,1),t.deleteRule(n);break}}}let qe=null;function Ze(){return null===qe&&(qe=function(e){let t=null;const i=document.styleSheets;if(!i||0===i.length)return console.error("Error: styleSheet empty"),null;if(e){for(let n=0;n<i.length;++n){const s=i[n];if(s.cssRules[0]&&s.cssRules[0].name&&s.cssRules[0].name===e){t=s;break}}if(null===t)return console.error(`Error: no found tag=${e}`),null}else t=i[i.length-1];return new Je(t)}()),qe}function Qe(e){let t="linear";if(e&&void 0!==e.T)switch(e.T){case F.EasingTypeIn:t="ease-in";break;case F.EasingTypeOut:t="ease-out";break;case F.EasingTypeInOut:t="ease-in-out";break;case F.EasingTypeBezier:t=`cubic-bezier(${e.St.X1},${e.St.Y1},${e.St.X2},${e.St.Y2})`;break;case F.EasingTypeSteps:t=`steps(${e.St.S},${0===e.St.T?"start":"end"})`;case F.EasingTypeBlink:case F.EasingTypeDeceleration:}return t}function et(e,t){const i=-1===e.repeatTimes?"infinite":e.repeatTimes;let n="linear";e.easing&&(n=Qe(e.easing));return`${t} ${e.duration/1e3}s ${n} ${e.delayedTime/1e3}s ${i}`}const tt=(e,t,i)=>{e.hasOwnProperty("__jsvHookListeners")||(e.__jsvHookListeners=new Map);const n=e.__jsvHookListeners;n.has(t)&&n.forEach((i=>{e.removeEventListener(t,i),e.__jsvHookListeners.delete(t)})),e.addEventListener(t,i),e.__jsvHookListeners.set(t,i)},it=e=>e>=65&&e<=90||e>=97&&e<=122,nt=e=>e>=48&&e<=57,st=e=>{if(!e)return null;let t="",i="",n=[],s=0;for(let r=0;r<e.length;r++){const a=e.charCodeAt(r);if(0===s?(it(a)||nt(a))&&(t+=e[r]):(nt(a)||46===a||45===a||101===a)&&(i+=e[r]),40===a)s=1,i="",n=[];else{if(41===a)return n.push(parseFloat(i)),{name:t,params:n};44===a&&(n.push(parseFloat(i)),i="")}}return console.error("transform error",e),null};function rt(e){const t=e.Element.children;let i=null;for(let e=0;e<t.length;e++)if("_AnimateProgressTracer"===t[e].id){i=t[e];break}return null===i&&(i=window.originDocument.createElement("div"),i.id="_AnimateProgressTracer",e.Element.appendChild(i)),i}let at=0;class ot{constructor(e){this._TracerDiv=rt(e),this._IdToken=at++,this._KeyFrameName=null,this._AdvanceTimer=null,this._AdvanceListener=null,this._TracerDiv.hasOwnProperty("_ForgeProgressToken")||(this._TracerDiv._ForgeProgressToken=0),this._OnEndListener=e=>{e.stopPropagation()},tt(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 e=this.GetProgress();this._AdvanceListener(e),1===e&&this._ClearAdvanceTimer()}),100))}Start(e,t,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(t,this._IdToken,this._TracerDiv._ForgeProgressToken),this._TracerDiv.style.animation=et(e,this._KeyFrameName),tt(this._TracerDiv,"animationend",this._OnEndListener),this._NotifyAdvance()}Stop(){const e=this.GetProgress();return this._TracerDiv.style.animation=null,this._KeyFrameName&&(this._RemoveTraceKeyFrame(this._KeyFrameName),this._KeyFrameName=null),this._AdvanceListener&&(this._ClearAdvanceTimer(),this._AdvanceListener(e),this._AdvanceListener=null),e}GetProgress(){const e=window.getComputedStyle(this._TracerDiv);if(0===e.transform.length);else if(e.transform.length>0&&"none"!==e.transform){const t=st(e.transform);return null!==t?t.params[4]/1e3:(console.error("Error:internal error"),0)}return 1}_BuildTraceKeyFrame(e,t,i){const n=`_AnimateProgress_${t}_${i}`,s=Ze(),r=`@keyframes ${n}\n {0%{transform:translate3d(${Math.floor(1e3*e)}px,0,0)}\n 100%{transform:translate3d(1000px,0,0)}}`;return s.insertRule(r),n}_RemoveTraceKeyFrame(e){Ze().removeRule(e)}}class lt{constructor(e,t){this._TracerDiv=rt(e),this._IdToken=at++,this._KeyFrameNameArray=null,this._StepsTotal=t,this._RunAnimList=null,this._TracerDiv.hasOwnProperty("_ForgeProgressToken")||(this._TracerDiv._ForgeProgressToken=0),this._OnEndListener=e=>{e.stopPropagation()},this._TracerDiv.addEventListener("animationend",this._OnEndListener)}Start(e){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(e),this._TracerDiv.style.animation=this._RunAnimList[0]}TriggerNextStep(e){this._TracerDiv.style.animation=this._RunAnimList[e]}Stop(){const e=this.GetProgress();return this._TracerDiv.style.animation=null,null!==this._KeyFrameNameArray&&(this._RemoveTraceKeyFrameGroup(),this._KeyFrameNameArray=null),e}GetProgress(){const e=window.getComputedStyle(this._TracerDiv);if(0===e.transform.length);else if("none"!==e.transform){const t=st(e.transform);if(null!==t){return t.params[4]/(100*this._StepsTotal)}return console.error("Error:internal error"),0}return 1}_BuildTraceKeyFrameGroup(e,t){this._KeyFrameNameArray=new Array(this._StepsTotal);const i=Ze();for(let n=0;n<this._KeyFrameNameArray.length;n++){const s=`_AnimateGroupProgress_${e}_${t}_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 e=Ze();this._KeyFrameNameArray.forEach((t=>{e.removeRule(t)}))}_ConvertToAnimationStyle(e){const t=[];for(let i=0;i<e.length;i++){let n="linear";const s=e[i];s.easing&&(n=Qe(s.easing)),t.push(`${this._KeyFrameNameArray[i]} ${s.duration/1e3}s ${n}`)}return t}}let ht=0;F.AnimationDelegate=class extends F.AnimationBase{constructor(e,t,i){super();let n=null;i&&(n=i.Package()),this.typeName=e,this.duration=t,this.easing=n,this.repeatTimes=1,this.delayedTime=0,this.enableFlags=0,this.enableStartPos=0,this._Progress=null}EnableDelay(e){return this.delayedTime=e,this}SetStartPos(e){this.enableStartPos=e}EnableInfinite(){return this.repeatTimes=-1,this}SetRepeat(e){return this.repeatTimes=e,this}Enable(e){return this._EnableFlagsInner(e),this}OnNewListener(e){let t=0;e.OnAnimFinal&&(t|=F.AnimationEnable.AckFinalProgress),e.OnAnimRepeat&&(t|=F.AnimationEnable.AckRepeat),0!==t&&this._EnableFlagsInner(t)}_EnableFlagsInner(e){-1!==this.enableFlags?this.enableFlags|=e:this.enableFlags=e}_GetCSSKeyframesRule(e){let t=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===e){t=i[n].cssRules[s];break}if(t)break}return t}CheckCssAnimationFormat(e){const t=this._GetCSSKeyframesRule(e);if(t&&t.cssRules)for(const i in t.cssRules){if(!t.cssRules[i]||!t.cssRules[i].style)continue;if(!t.cssRules[i].style.opacity&&!t.cssRules[i].style.transform)continue;const n=t.cssRules[i].style.transform;n&&(-1!==n.indexOf("rotate(")?console.error(`@keyframe ${e}, only support rotate3d, current transform:${n}`):-1!==n.indexOf("translate(")?console.error(`@keyframe ${e}, only support translate3d, current transform:${n}`):-1!==n.indexOf("scale(")&&console.error(`@keyframe ${e}, only support scale3d, current transform:${n}`))}}},F.KeyFrameAnimation=class extends F.AnimationDelegate{constructor(e,t,i){super(e,t,i),this._KeyFrameNameToRecycle=null,this._TestRepeat=this._TestRepeat.bind(this),this._LatestProgressValue=0;const n=this;this._OnEndEvent=e=>{e.stopPropagation(),n._PerformAnimationEnd(!0)},this._CurrentEndEventFunc=null}Start(e){super.Start(e),e.ResetCssTransform(null,null),e.Element&&(e.Element.style.pointerEvents="auto"),this.enableStartPos>0?this._EnableStarterAnimation():this._EnableCssAnimation(this._BuildKeyFrame(),this._OnEndEvent,0)}Cancel(){super.Cancel(),this._PerformAnimationEnd(!1)}_EnableStarterAnimation(){let e=this._OnEndEvent;if(1!==this.repeatTimes){const t=this;e=e=>{e.stopPropagation(),null!==t._Progress&&t._Progress.Stop(),t.delayedTime=0,t.repeatTimes>0&&(t.repeatTimes-=1),this.OnRepeatEvent(),t._EnableCssAnimation(t._BuildKeyFrame(),t._OnEndEvent,0)}}const t=this.repeatTimes,i=this.duration;this.repeatTimes=1,this.duration*=1-this.enableStartPos,this._EnableCssAnimation(this._BuildStarterKeyFrame(),e,this.enableStartPos),this.repeatTimes=t,this.duration=i}_CreateAnimation(e){const t=Ze();t.removeRule(e.name),t.insertRule(e.keyFrameString)}_EnableCssAnimation(e,t,i){if(null===e)return;e.tmp?null!==e.keyFrameString&&(Ze().insertRule(e.keyFrameString),this._KeyFrameNameToRecycle=e.name):this._CreateAnimation(e);const n=e.name;this.CheckCssAnimationFormat(n);const s=this._LayoutViewRef.Element;0==(this.enableFlags&F.AnimationEnable.AckFinalProgress)&&0==(this.enableFlags&F.AnimationEnable.KeepTransform)&&0==(this.enableFlags&F.AnimationEnable.AckRepeat)||(this._Progress=new ot(this._LayoutViewRef),this._Progress.Start(this,i,(e=>{this.OnAnimAdvance(e)})),0!=(this.enableFlags&F.AnimationEnable.AckRepeat)&&(this._LatestProgressValue=0,F.sRenderBridge.RegisterPerFrameCallback(this._TestRepeat)));const r=et(this,n);window.jsvInAndroidWebView?(s.style.webkitAnimation=r,s.addEventListener("webkitAnimationEnd",t)):(s.style.animation=r,s.addEventListener("animationend",t)),this._CurrentEndEventFunc=t}_PerformAnimationEnd(e){if(null!==this._CurrentEndEventFunc){const e=this._LayoutViewRef.Element,t=this._CurrentEndEventFunc;setTimeout((()=>{window.jsvInAndroidWebView?e.removeEventListener("webkitAnimationEnd",t):e.removeEventListener("animationend",t)}),0),this._CurrentEndEventFunc=null}if(null===this._Progress)return void(e&&this.OnEnd());0!=(this.enableFlags&F.AnimationEnable.AckRepeat)&&F.sRenderBridge.UnregisterPerFrameCallback(this._TestRepeat);let t=this._Progress.Stop();if(e&&(t=1),0!=(this.enableFlags&F.AnimationEnable.KeepTransform)){const e=this._GetFrozenTransform(t);this._LayoutViewRef?.ResetCssTransform(e.transform,e.transformOrigin)}e&&this.OnEnd(),0!=(this.enableFlags&F.AnimationEnable.AckFinalProgress)&&window.setTimeout((()=>{this.OnFinalProgress(t)}),0),null!==this._KeyFrameNameToRecycle&&(Ze().removeRule(this._KeyFrameNameToRecycle),this._KeyFrameNameToRecycle=null)}_TestRepeat(){const e=this._Progress.GetProgress();this._LatestProgressValue>e&&this.OnRepeatEvent(),this._LatestProgressValue=e}_BuildStarterKeyFrame(){console.warn("Warning:Should override and return keyframe name")}_BuildKeyFrame(){console.warn("Warning:Should override and return keyframe name")}_GetFrozenTransform(e){console.warn("Warning:Should override and keep view transform by ResetCssTransform()")}};let ct=class extends F.KeyFrameAnimation{constructor(e,t,i,n,s,r){super("TL",s,r),this.startX=e,this.startY=i,this.endX=t,this.endY=n}_BuildStarterKeyFrame(){if(this.enableStartPos>0){const e=(this.endX-this.startX)*this.enableStartPos+this.startX,t=(this.endY-this.startY)*this.enableStartPos+this.startY,i="_ForgeAnim_TL_"+ht++;return{name:i,keyFrameString:`@keyframes ${i} {0%{transform:translate3d(${e}px,${t}px,0);}100%{transform:translate3d(${this.endX}px,${this.endY}px,0);}}`}}console.error("Error: no enabled starter position")}_BuildKeyFrame(){const e="_ForgeAnim_TL_"+ht++;return{name:e,keyFrameString:`@keyframes ${e} {0%{transform:translate3d(${this.startX}px,${this.startY}px,0);}100%{transform:translate3d(${this.endX}px,${this.endY}px,0);}}`,tmp:!0}}_GetFrozenTransform(e){return{transform:`translate3d(${Math.floor((this.endX-this.startX)*e+this.startX)}px,${Math.floor((this.endY-this.startY)*e+this.startY)}px,0)`,transformOrigin:null}}};F.FuncAnimation=class extends F.AnimationDelegate{constructor(e,t,i){super("FC2",t,i),this.formula=e,console.warn("NO implemented")}},F.TranslateAnimation=ct;let ut=class extends F.AnimationDelegate{constructor(e,t,i,n,s,r){super("RO",s,r),i instanceof F.Vec3||(i=new F.Vec3(i)),n instanceof F.Vec3||(n=new F.Vec3(n)),this.startAngle=e,this.offsetAngle=t,this.anchorVec3=i,this.axisVec3=n,console.warn("NO implemented")}};F.RotateAnimation=ut,F.BasicScaleAnimation=class extends F.AnimationDelegate{constructor(e,t,i,n,s,r,a,o,l,h){super("SC",a,o),console.warn("NO implemented")}};let dt=class extends F.BasicScaleAnimation{constructor(e,t,i,n,s,r){const a=200;super(e*a,e*a,t*a,t*a,i,n,s,r,200,200)}};F.ScaleAnimation=dt,F.OpacityAnimation=class extends F.AnimationDelegate{constructor(e,t,i,n){super("OP",i,n),console.warn("NO implemented")}},F.CssKeyframeAnimation=class extends F.KeyFrameAnimation{constructor(e,t,i,n,s){super("CK",t,i),this._keyFramesSet=e}_BuildKeyFrame(){let e=this._keyFramesSet.replaceAll("\n","");if(e.indexOf("@keyframes")<0&&e.indexOf("@-webkit-keyframes")<0)return console.warn("Warning:keyframes array empty"),null;let t=e.split(" ")[1];t.indexOf("{")>=0&&(t=t.substr(0,t.indexOf("{"))),e=e.replaceAll(/([left|top|width|height]:\s+\d+)/g,"$1px");const i=e.split("translate3d");for(let e=1;e<i.length;e++){let t=!1,n=i[e].replace(/\).*/,"");n=n.replace(/.*\(/,"");const s=n.split(",");for(let e=0;e<s.length;e++){const i=s[e].trim();i.match(/[0-9]$/)&&(s[e]=i+"px",t=!0)}t&&(n=s.join(","),i[e]=i[e].replace(/\(.*?\)/,"("+n+")"))}return{name:t,keyFrameString:i.join("translate3d"),tmp:!1}}_GetLastKeyframeTransform(e){let t=e.indexOf("to");if(t<0&&(t=e.indexOf("100%")),t<0)return"";{let i=e.indexOf("transform:",t);return i<0?"":e.substring(i+10,e.indexOf(";",i))}}_GetFrozenTransform(e){let t={transform:"",transformOrigin:null};return 1===e?t={transform:this._GetLastKeyframeTransform(this._keyFramesSet),transformOrigin:null}:console.warn("CssKeyframeAnimation can not get transform whill progress is not 1"),t}},F.CssTransitionAnimation=class extends F.AnimationDelegate{constructor(e){super("CT",null,null),this._transArray=e}Start(e){super.Start(e);const t=this,i=this._transArray,n={};if(0===i.length)return void console.warn("Warning:transition empty");let s="";for(let e=0;e<i.length;e++){let t="linear";const r=i[e];r.tf&&(t=Qe(r.tf)),s=`${r.name} ${r.dur/1e3}s ${t} ${r.dly/1e3}s`,n[r.name]=s}e.ApplyStyleTransition(n),s&&(e.Element.addEventListener("transitionend",(e=>{e.stopPropagation(),t.OnEnd(!0)})),e.Element.addEventListener("webkitTransitionEnd",(e=>{e.stopPropagation(),t.OnEnd(!0)})))}},F.KeyFrameGroupAnimation=class extends F.AnimationDelegate{constructor(e){super(e,0,null),this._KeyFrameArray=null,this._LatestProgressValue=0,this._CurrentEndEventFunc=null,this._Progress=null,this._AnimRunList=null,this._AnimationRunIndex=0;const t=this;this._OnEndEvent=e=>{e.stopPropagation(),this._TestFinalKeyFrame(e)?t._PerformAnimationEnd(!0):(this._AnimationRunIndex++,this._LayoutViewRef.Element.style.animation=this._AnimRunList[this._AnimationRunIndex],this._Progress.TriggerNextStep(this._AnimationRunIndex),t._OnSubKeyFrameDone(e))}}Start(e){super.Start(e),e.ResetCssTransform(null,null),e.Element&&(e.Element.style.pointerEvents="auto"),this._EnableCssAnimation(this._BuildKeyFrameGroup(),this._OnEndEvent)}Cancel(){super.Cancel(),this._PerformAnimationEnd(!1)}_EnableCssAnimation(e,t){if(null===e)return;this._KeyFrameArray=new Array(e.length);const i=Ze();for(let t=0;t<e.length;t++){const n=e[t];this.CheckCssAnimationFormat(n.name),this._KeyFrameArray[t]={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&F.AnimationEnable.AckFinalProgress)&&0==(this.enableFlags&F.AnimationEnable.KeepTransform)||(this._Progress=new lt(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",t)):(n.style.animation=this._AnimRunList[0],n.addEventListener("animationend",t)),this._CurrentEndEventFunc=t}_PerformAnimationEnd(e){if(null!==this._CurrentEndEventFunc){const e=this._LayoutViewRef.Element,t=this._CurrentEndEventFunc;setTimeout((()=>{window.jsvInAndroidWebView?e.removeEventListener("webkitAnimationEnd",t):e.removeEventListener("animationend",t)}),0),this._CurrentEndEventFunc=null}if(null===this._Progress)return void(e&&this.OnEnd());let t=this._Progress.Stop();if(e&&(t=1),0!=(this.enableFlags&F.AnimationEnable.KeepTransform)){const e=this._GetFrozenTransform(t);this._LayoutViewRef.ResetCssTransform(e.transform,e.transformOrigin)}e&&this.OnEnd(),0!=(this.enableFlags&F.AnimationEnable.AckFinalProgress)&&window.setTimeout((()=>{this.OnFinalProgress(t)}),0);const i=Ze();for(const e of this._KeyFrameArray)e.needRecycle&&i.removeRule(e.name);this._KeyFrameArray=null}_ConvertToAnimationStyle(e){const t=[];for(let i=0;i<e.length;i++){let n="linear";const s=e[i];s.easing&&(n=Qe(s.easing)),t.push(`${s.name} ${s.duration/1e3}s ${n}`)}return t}_BuildKeyFrameGroup(){console.warn("Warning:Should override and return keyframe name")}_GetFrozenTransform(e){console.warn("Warning:Should override and keep view transform by ResetCssTransform()")}_TestFinalKeyFrame(e){console.warn("Warning:Should override")}_OnSubKeyFrameDone(e){console.warn("Warning:Should override")}};let gt=class extends F.TranslateAnimation{constructor(e,t,i,n,s,r){let a=s,o=r,l=s,h=r;n?(a=e,l=t):(o=e,h=t);super(a,l,o,h,Math.abs(Math.floor((t-e)/i*1e3)),null)}};F.TranslateFrameAnimation=gt;let ft=class extends F.KeyFrameGroupAnimation{constructor(e,t,i,n,s,r,a,o){super("Thr"),this._FromX=e,this._FromY=t,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(e){this._PoleCallback=e}_MakeTranslateString(e,t,i){return`@keyframes ${e} {0%{transform:translate3d(${t.x.value}px,${t.y.value}px,0);}100%{transform:translate3d(${i.x.value}px,${i.y.value}px,0);}}`}_BuildKeyFrameGroup(){const e=""+ht++,t=[],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_${e}`;r.value=this._PolePosition;let o=this._MakeTranslateString(a,i,n);t.push({name:a,keyFrameString:o,ease:F.Easing.Circular.Out,duration:Math.floor(-this._InitV/this._Acc*1e3)}),a=`_ForgeAnim_Thr_Backw_${e}`,s.value=this._PolePosition,r.value=this._To,o=this._MakeTranslateString(a,i,n),t.push({name:a,keyFrameString:o,ease:F.Easing.Circular.In,duration:Math.floor(1e3*Math.sqrt(2*(this._To-this._PolePosition)/this._Acc))})}else{const a=`_ForgeAnim_Thr_Forw_${e}`;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;t.push({name:a,keyFrameString:o,ease:h>0?F.Easing.Circular.In:F.Easing.Circular.Out,duration:Math.floor((Math.sqrt(l*l+2*h*c)-l)/h*1e3)})}return t}_GetFrozenTransform(e){const t={x:{value:this._FromX},y:{value:this._FromY}};let i=0===this._XorY?t.x.value:t.y.value;const n=0===this._XorY?t.x:t.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 t=(2*a-i-r)*e;s=t>a-i?a-(t-(a-i)):i+t}else s=i+(r-i)*e;n.value=Math.floor(this._IsPositiveMove?s:-s);return{transform:`translate3d(${t.x.value}px,${t.y.value}px,0)`,transformOrigin:null}}_TestFinalKeyFrame(e){return this._HasPole?e.animationName.indexOf("_ForgeAnim_Thr_Backw_")>=0:e.animationName.indexOf("_ForgeAnim_Thr_Forw_")>=0}_OnSubKeyFrameDone(e){this._HasPole&&this._PoleCallback&&this._PoleCallback()}};F.ThrowAnimation=ft;let mt={ReleaseAfterEndCallback:1,KeepTransform:2,AckFinalProgress:4,AckRepeat:8};F.AnimationEnable=mt,F.AnimFireCommand={AltSpeed:(e,t,i)=>{},RunFreeMoveCmdPacks:(e,t)=>{e.TransformAnimationObj.doCommand(t)}},F.FreeMoveActEvtType={ActEvent_ActFinish:1,ActEvent_Speed_X_Revert:2,ActEvent_Speed_Y_Revert:3,ActEvent_ActReject:4};let pt=0;class yt extends F.AnimationDelegate{constructor(e,t){super(e,t,null),this._StepsCount=1,this._Running=!1,this._NextStepIndex=0;const i=this;this._OnStepEnd=()=>{i._NextStep()}}SetStepsCount(e){this._StepsCount=e,this._SplitSteps()}Start(e){super.Start(e),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&&(Ze().removeRule(this._KeyFrameName),this._KeyFrameName=null);const e=this._NextStepIndex===this._StepsCount;if(!this._Running||e)return void this._PerformAnimationEnd(e);const t=this._CreateOneStepKeyFrame(this._NextStepIndex);this._KeyFrameName=t.name,Ze().insertRule(t.keyFrameString);const i=et({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(e){window.jsvInAndroidWebView?this._LayoutViewRef.Element.removeEventListener("webkitAnimationEnd",this._OnStepEnd):this._LayoutViewRef.Element.removeEventListener("animationend",this._OnStepEnd);const t=this._NextStepIndex/this._StepsCount;if(0!=(this.enableFlags&F.AnimationEnable.KeepTransform)){const e=this._GetFrozenTransform(this._NextStepIndex-1);this._LayoutViewRef.ResetCssTransform(e.transform,e.transformOrigin)}e&&this.OnEnd(),window.setTimeout((()=>{this.OnFinalProgress(t)}),0)}_GetFrozenTransform(e){console.warn("Warning:Should override and keep view transform by ResetCssTransform()")}_SplitSteps(){console.warn("Warning: should be override by child class")}_CreateOneStepKeyFrame(e){console.warn("Warning: should be override by child class")}}F.TranslateStepAnimation=class extends yt{constructor(e,t,i,n,s){super("TL-S",s),this.startX=e,this.startY=i,this.endX=t,this.endY=n,this._StepsArray=null}_SplitSteps(){const e=this._StepsCount,t=(this.endX-this.startX)/e,i=(this.endY-this.startY)/e;this._StepsArray=new Array(e);let n=this.startX,s=this.startY;for(let r=0;r<e-1;r++)n+=t,s+=i,this._StepsArray[r]={targetX:Math.floor(n),targetY:Math.floor(s)};this._StepsArray[e-1]={targetX:this.endX,targetY:this.endY}}_CreateOneStepKeyFrame(e){let t=0,i=0;0===e?(t=this.startX,i=this.startY):(t=this._StepsArray[e-1].targetX,i=this._StepsArray[e-1].targetY);const n=this._StepsArray[e].targetX,s=this._StepsArray[e].targetY,r="_ForgeStepAnim_TL_"+pt++;return{name:r,keyFrameString:`@keyframes ${r} {\n 0%{transform:translate3d(${t}px,${i}px,0);}\n 100%{transform:translate3d(${n}px,${s}px,0);}}`}}_GetFrozenTransform(e){return{transform:`translate3d(${this._StepsArray[e].targetX}px,${this._StepsArray[e].targetY}px,0)`,transformOrigin:null}}};F.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 e=!1;if(F.sViewSensorManager.HtmlHasActiveSensor()&&(F.sViewSensorManager.HtmlDoWorkOnFrame(),F.sViewSensorManager.HtmlHasActiveSensor()&&(e=!0)),this._CallbacksPerFrame.size>0){for(const e of this._CallbacksPerFrame)e();this._CallbacksPerFrame.size>0&&(e=!0)}e?window.requestAnimationFrame(this._FrameLoopFunc):this._FrameLoopFunc=null}GetScreenInfo(){return this._ScreenInfo}InitScreenBuffer(e,t){isNaN(e)&&(e=1),isNaN(t)&&(t=1280);const i=t*e,n=i/16*9;this._ScreenInfo.width=Math.floor(i),this._ScreenInfo.height=Math.floor(n),this._ScreenInfo.x=2/this._ScreenInfo.width,this._ScreenInfo.y=2/this._ScreenInfo.height,this._ScreenInfo.perspective=this._ScreenInfo.x,this._ScreenInfo.scaleRatio=e,this._ScreenInfo.designedWidth=t}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(e){}AddWillSwapListener(e,t){this._WillSwapCallbacks.set(e,t)}AddAfterSwapListener(e,t){this._AfterSwapCallbacks.set(e,t)}_DoRequestSwap(){this._WillSwapCallbacks.size>0&&this._WillSwapCallbacks.forEach(this._DoWillSwapCallback),this._AfterSwapCallbacks.size>0&&this._AfterSwapCallbacks.forEach(this._DoAfterSwapCallback),this._OnRequesting=!1,F.sFrameCount.update()}GetSwapCount(){return F.sFrameCount.count}InstantPerformSwap(){this._OnRequesting&&(this._OnRequesting=!1,this._DoRequestSwap(!1))}_OnWillSwap(e){e()}_OnAfterSwap(e){e()}RegisterPerFrameCallback(e){this._CallbacksPerFrame.add(e),this.BeginHtmlFrameLoop()}UnregisterPerFrameCallback(e){this._CallbacksPerFrame.delete(e)}HasPendingRenderBreak(){return!1}FinishRenderBreak(){}};let Tt=new F.RenderBridge;F.sRenderBridge=Tt;class _t{constructor(e,t,i){this._TextureManager=e,this._GL=t,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)}}_t.IMAGE=Symbol("Texture.IMAGE"),_t.COLOR=Symbol("Texture.COLOR");class xt extends _t{constructor(e,t,i,n){if(super(e,t,i),n){const e=n.trim();if(0===e.indexOf("http"))this.Url=e;else if(0===e.indexOf("url")){const t=e.indexOf("("),i=e.indexOf(")");this.Url=e.substring(t+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,this._TextureSource.crossOrigin="*",this._TextureSource.crossOrigin="Anonymous"}}}class wt{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(e,t,i,n){const s=this._GL.createImageData(1,1);return s.data[0]=e,s.data[1]=t,s.data[2]=i,s.data[3]=n,s}}let St=null;class vt extends _t{constructor(e,t,i,n){super(e,t,i),null===St&&(St=new wt),this.Color=n;const s=(e=>{if(!e)return null;if(0===(e=e.trim()).indexOf("rgba")){const t=e.indexOf("("),i=e.indexOf(")");return e.substr(t+1,i-t-1).split(",").map(((e,t)=>3===t?Math.ceil(255*parseFloat(e)):parseInt(e,10)))}if(0===e.indexOf("#")){let t=e.substr(1);const i=t.length;if(6===i||8===i){6===i&&(t+="FF");const e=parseInt(`0x${t}`,10);return[e>>24&255,e>>16&255,e>>8&255,255&e]}return null}return null})(this.Color);this._TextureSource=St.getColorImageData(...s),this._setGLTexture(),this._Loaded=!0,this._OnLoad&&this._OnLoad()}}const Et=new class{constructor(){this._TextureMap={}}getTexture(e,t,i,n){let s;if(this._TextureMap[n])s=this._TextureMap[n].texture,this._TextureMap[n].useCount++;else{switch(e){case _t.IMAGE:s=new xt(this,t,i,n);break;case _t.COLOR:s=new vt(this,t,i,n);break;default:console.log(`getTexture type is error:${e}`)}this._TextureMap[n]={texture:s,useCount:1}}return s}recycle(e){this._TextureMap[e]&&(this._TextureMap[e].useCount--,this._TextureMap[e].useCount<0&&delete this._TextureMap[e])}},bt=(e,t)=>Math.random()*(t-e)+e;class Ct{constructor(e,t,i,n,s){this._ViewId=e,this._Type=t.type,this._ParticleNum=t.particleNum,this._DeltaAngle=t.deltaAngle/180*Math.PI,this._DeltaWidthFact=t.deltaWidth/n.width,this._DeltaHeightFact=t.deltaHeight/n.height,this._PointSizeMin=t.pointSizeMin,this._PointSizeMax=t.pointSizeMax,this._SpeedMin=t.speedMin,this._SpeedMax=t.speedMax,this._LifeMin=t.lifeMin/1e3,this._LifeMax=t.lifeMax/1e3,this._AddNumSpeed=t.addNumSpeed,this._AcceletateX=t.accelerateX,this._AcceletateY=t.accelerateY,this._EnableFade=t.enableFade,this._EnableShrink=t.enableShrink,this._AngularVelocityMin=0,this._AngularVelocityMax=0,"number"==typeof t.angularVelocityMin&&"number"==typeof t.angularVelocityMax&&(this._AngularVelocityMin=t.angularVelocityMin,this._AngularVelocityMax=t.angularVelocityMax),this._AlphaMin=1,this._AlphaMax=1,"number"==typeof t.alphaMin&&"number"==typeof t.alphaMax&&(this._AlphaMin=t.alphaMin,this._AlphaMax=t.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 e=this._DomProxyView.HtmlGetElement();const t=Pt(e.style.width),i=Pt(e.style.height);let n=new window.WebKitCSSMatrix;for(;e.parentNode;){const t=getComputedStyle(e);if(t.transform){const i=t.transformOrigin?t.transformOrigin:t.webkitTransformOrigin;if(i){const s=Pt(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(${e.offsetLeft}px,${e.offsetTop}px)`),l=new window.WebKitCSSMatrix(t.transform);n=o.multiply(a.multiply(l.multiply(r.multiply(n))))}else n=new window.WebKitCSSMatrix(t.transform).multiply(n)}e=e.parentNode}const s=new window.WebKitCSSMatrix;s.m11=0,s.m12=0,s.m14=1,s.m21=t,s.m22=0,s.m24=1,s.m31=0,s.m32=i,s.m34=1,s.m41=t,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(e,t,i,n,s,r){const a=bt(0,2*this._DeltaWidthFact),o=bt(0,2*this._DeltaHeightFact);this._Buffer[9*e]=a*i[0]+o*n[0]+t[0],this._Buffer[9*e+1]=a*i[1]+o*n[1]+t[1],this._Buffer[9*e+2]=s+bt(-this._DeltaAngle,this._DeltaAngle),this._Buffer[9*e+3]=bt(this._SpeedMin,this._SpeedMax),this._Buffer[9*e+4]=r,this._Buffer[9*e+5]=bt(this._LifeMin,this._LifeMax),this._Buffer[9*e+6]=bt(this._PointSizeMin,this._PointSizeMax),this._Buffer[9*e+7]=bt(this._AngularVelocityMin,this._AngularVelocityMax),this._Buffer[9*e+8]=bt(this._AlphaMin,this._AlphaMax)}onDrawFrame(e,t,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 e=0;e<n.length;e++)n[e]=e%2==0?2*n[e]/window.innerWidth-1:1-2*n[e]/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 e=0;e<this._ParticleNum;e++)this._updateParticleInfo(e,r,a,o,c,s);this._AddedParticleNum=this._ParticleNum}else{let e=!0;for(let t=0;t<this._ParticleNum;t++)if(this._Buffer[9*t+4]+this._Buffer[9*t+5]>s){e=!1;break}e&&(this._Stopped=!0)}else if(this._AddedParticleNum<this._ParticleNum){let e=Math.round((Date.now()-this._LastFrameTime)*this._AddNumSpeed);this._AddedParticleNum+e>this._ParticleNum&&(e=this._ParticleNum-this._AddedParticleNum);for(let t=0;t<e;t++)this._updateParticleInfo(this._AddedParticleNum+t,r,a,o,c,s);this._AddedParticleNum+=e}else for(let e=0;e<this._ParticleNum;e++)this._Buffer[9*e+4]+this._Buffer[9*e+5]<s&&this._updateParticleInfo(e,r,a,o,c,s);const u=e.getUniformLocation(t,"uTime");e.uniform1f(u,s);const d=e.getUniformLocation(t,"uAccelerate");e.uniform2f(d,this._AcceletateX,this._AcceletateY);const g=e.getUniformLocation(t,"uEnableFade");e.uniform1i(g,this._EnableFade?1:0);const f=e.getUniformLocation(t,"uEnableShrink");e.uniform1i(f,this._EnableShrink?1:0),e.bindBuffer(e.ARRAY_BUFFER,i),e.activeTexture(e.TEXTURE0),e.bindTexture(e.TEXTURE_2D,this._Texture.TextureId),e.bufferSubData(e.ARRAY_BUFFER,0,this._Buffer);const m=this._Buffer.BYTES_PER_ELEMENT,p=e.getAttribLocation(t,"aPosition");e.vertexAttribPointer(p,2,e.FLOAT,!1,9*m,0),e.enableVertexAttribArray(p);const y=e.getAttribLocation(t,"aSpeed");e.vertexAttribPointer(y,2,e.FLOAT,!1,9*m,2*m),e.enableVertexAttribArray(y);const T=e.getAttribLocation(t,"aLife");e.vertexAttribPointer(T,2,e.FLOAT,!1,9*m,4*m),e.enableVertexAttribArray(T);const _=e.getAttribLocation(t,"aPointSize");e.vertexAttribPointer(_,1,e.FLOAT,!1,9*m,6*m),e.enableVertexAttribArray(_);const x=e.getAttribLocation(t,"aAngularVelocity");e.vertexAttribPointer(x,1,e.FLOAT,!1,9*m,7*m),e.enableVertexAttribArray(x);const w=e.getAttribLocation(t,"aAlpha");e.vertexAttribPointer(w,1,e.FLOAT,!1,9*m,8*m),e.enableVertexAttribArray(w),e.drawArrays(e.POINTS,0,this._AddedParticleNum)}recycle(){this._Buffer=null,this._Texture.recycle(),this._Stopped=!0}}let It=0;let At=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 e=this._GL.createShader(this._GL.VERTEX_SHADER);this._GL.shaderSource(e,"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(e);const t=this._GL.createShader(this._GL.FRAGMENT_SHADER);this._GL.shaderSource(t,"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(t),this._GLProgram=this._GL.createProgram(),this._GL.attachShader(this._GLProgram,e),this._GL.attachShader(this._GLProgram,t),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 e in this._ParticleViewMap)this._ParticleViewMap.hasOwnProperty(e)&&this._ParticleViewMap[e].onDrawFrame(this._GL,this._GLProgram,this._VBO);window.requestAnimationFrame(this._onDrawFrame)}addParticle(e,t,i,n){this._Inited||this._initCanvas();const s=It++;let r;return r=0===t.indexOf("rgba")||0===t.indexOf("#")?Et.getTexture(_t.COLOR,this._GL,null,t):Et.getTexture(_t.IMAGE,this._GL,null,t),this._ParticleViewMap[s]=new Ct(s,e,r,i,n),this._LoopStarted||(this._LoopStarted=!0,window.requestAnimationFrame(this._onDrawFrame)),s}recycleView(e){this._ParticleViewMap[e]&&(this._ParticleViewMap[e].recycle(),delete this._ParticleViewMap[e])}};F.sParticleManager=At;let Pt=e=>{if(e.indexOf(" ")>=0){return e.split(" ").map((e=>parseInt(e.substr(0,e.length-2),10)))}return parseInt(e.substr(0,e.length-2),10)};F.ReactUtils={StyleClassMap:{}};{let rn=0;class an{constructor(e,t){this._ID=t||e+rn++,this.Describe={},this._RefCount=0,this._Recycled=!1}ManualSetId(e){this._ID=e}GetId(){return this._ID}DoRef(){this._RefCount++}UnRef(){this._RefCount>0?this._RefCount--:console.warn("Already 0...")}}class on extends an{constructor(e){super(null,e)}}const ln=new on("DISABLE"),hn={alignment:"left",vertical_align:"top",vertical_area_align:"top",text_overflow:"clip",word_wrap:"normal",direction:"ltr"},cn=["alignment","vertical_align","vertical_area_align","text_overflow","word_wrap","direction"];class un extends an{constructor(e,t,i,n,s,r){super("DS",null),this.Describe.alignment=e,this.Describe.vertical_align=t,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 dn={font:"黑体",italic:!1,bold:!1},gn=["font","italic","bold"];class fn extends an{constructor(e,t,i){super("FS",null),this.Describe.font=e,this.Describe.italic=t,this.Describe.bold=i}GetSyncData(){return{T:1,ID:this._ID,F:this.Describe.font,I:this.Describe.italic,B:this.Describe.bold}}}const mn={text_color:"#000000",bg_color:"#FFFFFF00"},pn=["text_color","bg_color"];class yn extends an{constructor(e,t){super("CS",null),this.Describe.text_color=e,this.Describe.bg_color=t}GetSyncData(){return{T:2,ID:this._ID,TC:this.Describe.text_color,BC:this.Describe.bg_color}}}const Tn=["shadow_offset_x","shadow_offset_y","shadow_blur","shadow_color","stroke_width","stroke_color"];class _n extends an{constructor(e,t,i,n,s,r){super("SS",null),this.Describe.shadow_offset_x=e,this.Describe.shadow_offset_y=t,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 xn{constructor(e){this.DS=F.sTextStyleCache.GetDisplayStyle(e),this.FS=F.sTextStyleCache.GetFontStyle(e),this.CS=F.sTextStyleCache.GetColorStyle(e),this.SS=F.sTextStyleCache.GetSpecialStyle(e),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 wn{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(e){let t={alignment:void 0!==e.hAlign?e.hAlign:hn.alignment,vertical_align:void 0!==e.vAlign?e.vAlign:hn.vertical_align,vertical_area_align:void 0!==e.vAreaAlign?e.vAreaAlign:hn.vertical_area_align,text_overflow:void 0!==e.textOverflow?e.textOverflow:hn.text_overflow,word_wrap:void 0!==e.wordWrap?e.wordWrap:hn.word_wrap,font:void 0!==e.font?e.font:dn.font,italic:void 0!==e.italic?e.italic:dn.italic,bold:void 0!==e.bold?e.bold:dn.bold,text_color:void 0!==e.textColor?e.textColor:mn.text_color,bg_color:void 0!==e.backgroundColor?e.backgroundColor:mn.bg_color,direction:void 0!==e.direction?e.direction:"ltr",shadow_offset_x:0,shadow_offset_y:0,shadow_blur:0,shadow_color:null,stroke_width:0,stroke_color:null};if(e.shadow){const i=e.shadow;t.shadow_offset_x=i.shadowOffsetX,t.shadow_offset_y=i.shadowOffsetY,t.shadow_blur=i.shadowBlur,t.shadow_color=i.shadowColor}if(e.stroke){const i=e.stroke;t.stroke_width=i.strokeWidth,t.stroke_color=i.strokeColor}return new xn(t)}PrepareSyncNewStyles(){if(this._NewStyleList.length>0){let e=[];for(let t of this._NewStyleList)e.push(t.GetSyncData());F.sRenderTextureDelegateManager.CreateTextureHeadStatus().SetResourceInfo({STA:{Nam:"TST",Sta:e}}),this._NewStyleList=[]}}GetDisplayStyle(e){return this._GetStyle(e,cn,un,this._DisplayStyleMap,this._DisplayStyleIds)}GetFontStyle(e){return this._GetStyle(e,gn,fn,this._FontStyleMap,this._FontStyleIds)}GetColorStyle(e){return this._GetStyle(e,pn,yn,this._ColorStyleMap,this._ColorStyleIds)}GetSpecialStyle(e){return 0===e.shadow_blur&&0===e.stroke_width?ln:this._GetStyle(e,Tn,_n,this._SpecialStyleMap,this._SpecialStyleIds)}GetDsFromId(e){return this._DisplayStyleIds.get(e)}GetFsFromId(e){return this._FontStyleIds.get(e)}GetCsFromId(e){return this._ColorStyleIds.get(e)}GetSsFromId(e){return this._SpecialStyleIds.get(e)}_GetStyle(e,t,i,n,s){let r=[];for(let i of t)r.push(e[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}}F.TextStyleObjectBase=an,F.TextStylePack=xn,F.sTextStyleCache=new wn}{let Sn=1,vn=2,En=3;class bn{constructor(e,t){this.IdToken=F.sViewSensorManager.IdTokenGenerator++,this.Type=e,this.Manager=null,this._OnAnyViewLostList=null,this._AnyViewLostMark=null,this._OnWholeViewLostList=null,this._WholeViewLostMark=null,this._HtmlStatusInfo={target:null==t?Sn:vn}}OnManaged(e){return this._HtmlStatusInfo.target!=En&&(this.Manager?(console.error("manage duplicated"),!1):(this._RegisterViewLostCallbacks(),this.Manager=e,!0))}ResetAutoRecycleViewsRef(e,t){e instanceof Array&&t instanceof Array?this._HtmlStatusInfo.target!=En&&(this._UnregisterViewCallbacks(),this._OnAnyViewLostList=e,this._OnWholdViewLostList=t,this.Manager&&this._RegisterViewLostCallbacks()):console.error("need array ",e,t)}Expired(){return this._HtmlStatusInfo.target==En}Recycle(){this._HtmlStatusInfo.target!=En&&this.Manager&&(this._HtmlStatusInfo.target=En,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(e){console.log("Need be override")}OnSelfRecycle(){}_RegisterViewLostCallbacks(){let e=this;if(this._OnAnyViewLostList?.length>0){let t=this._OnAnyViewLostList.length;this._AnyViewLostMark={callbacks:new Array(t).fill(null)};for(let i=0;i<t;i++){let t=this._OnAnyViewLostList[i];if(t.HtmlCanAccessElement()&&t.Expired)this._OnAnyViewLostList[i]=null;else{let n=()=>{e.Recycle()};this._AnyViewLostMark.callbacks[i]=n,t.RegisterDetachCallback(n)}}}else this._AnyViewLostMark=null;if(this._OnWholeViewLostList?.length>0){let t=this._OnWholeViewLostList.length;this._WholeViewLostMark={list:new Array(t).fill({callback:null,lost:!1}),lostCount:0};for(let i=0;i<t;i++){let t=this._OnWholeViewLostList[i];if(t.HtmlCanAccessElement()&&t.Expired)this._OnWholeViewLostList[i]=null,this._WholeViewLostMark.list[i].lost=!0,this._WholeViewLostMark.lostCount++;else{let n=()=>{e._OnViewOfWholeListLost(i)};this._WholeViewLostMark.list[i].callback=n,t.RegisterDetachCallback(n)}}}else this._WholeViewLostMark=null}_UnregisterViewCallbacks(){if(this._AnyViewLostMark){let e=this._OnAnyViewLostList.length;for(let t=0;t<e;t++){this._OnAnyViewLostList[t]&&this._OnAnyViewLostList[t].UnregisterDetachCallback(this._AnyViewLostMark.callbacks[t])}this._AnyViewLostMark=null}if(this._WholeViewLostMark){let e=this._OnWholdViewLostList.length;for(let t=0;t<e;t++){this._OnWholdViewLostList[t]&&this._OnWholdViewLostList[t].UnregisterDetachCallback(this._WholeViewLostMark.list[t].callback)}this._WholeViewLostMark=null}}_OnViewOfWholeListLost(e){this._WholeViewLostMark.list[e].lost||(this._WholeViewLostMark.lostCount++,this._WholeViewLostMark.list[e].lost=!0,this._WholeViewLostMark.list[view_idx].callback=null,this._OnWholdViewLostList[e]=null),this._WholeViewLostMark.lostCount==this._OnWholeViewLostList.length&&this.Recycle()}}bn.TypeDefines={TYPE_IMPACT:1,TYPE_FROZE_SET:2,TYPE_ON_SCREEN:3,TYPE_ENV_BLOCK:3,TYPE_DRAG_IMPACT:101},F.ViewSensor=bn}{class Cn{constructor(){this._SensorMaps={},this.IdTokenGenerator=77}HtmlDoWorkOnFrame(){for(let e in this._SensorMaps){let t=this._SensorMaps[e];t.Expired()?delete this._SensorMaps[e]:t.HtmlDoWorkOnFrame()}}HtmlHasActiveSensor(){for(let e in this._SensorMaps)if(this._SensorMaps[e].HtmlNeedWorkOnFrame())return!0;return!1}AddSensor(e){if(e){e.OnManaged(this)&&(this._SensorMaps[e.IdToken]=e),this.RequestSwap()}}AddToSyncList(e){this._SensorMaps.hasOwnProperty(e.IdToken)||console.error("Error: (Add)No in map",this._SensorMaps,e)}RecycleSensor(e){this._SensorMaps.hasOwnProperty(e.IdToken)?(delete this._SensorMaps[e.IdToken],this.RequestSwap()):console.error("Error: (del)No in map",this._SensorMaps,e)}RequestSwap(){F.sRenderBridge.BeginHtmlFrameLoop()}}F.sViewSensorManager=new Cn}class Lt{constructor(e,t,i){this.element=i,this.row=e,this.column=t}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(e){if(this.column!==e.row)throw new Error("matrix multiply error");const t=[];for(let i=0;i<this.row;i++)for(let n=0;n<e.column;n++){t[i+n*e.column]=0;for(let s=0;s<this.column;s++)t[i+n*e.column]+=this.element[i+s*this.column]*e.element[s+n*e.column]}return new Lt(this.row,e.column,t)}static identity(){return new Lt(4,4,[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])}static translate(e,t,i){return new Lt(4,4,[1,0,0,0,0,1,0,0,0,0,1,0,e,t,i,1])}static scale(e,t,i){return new Lt(4,4,[e,0,0,0,0,t,0,0,0,0,i,0,0,0,0,1])}static rotate(e,t,i,n){const s=Math.cos(n/180*Math.PI),r=Math.sin(n/180*Math.PI),a=Math.sqrt(e*e+t*t+i*i);if(1!==a){const n=1/a;e*=n,t*=n,i*=n}const o=1-s,l=e*t,h=t*i,c=i*e,u=e*r,d=t*r,g=i*r,f=[];return f[0]=e*e*o+s,f[1]=l*o+g,f[2]=c*o-d,f[3]=0,f[4]=l*o-g,f[5]=t*t*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 Lt(4,4,f)}static skew(e,t){const i=new Array(16).fill(0),n=2*Math.PI*(t/360),s=-2*Math.PI*(e/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 Lt(4,4,i)}static transform2d(e,t,i,n,s,r){return new Lt(4,4,[e,t,0,0,i,n,0,0,0,0,1,0,s,r,0,1])}}const kt=e=>e>=65&&e<=90||e>=97&&e<=122,Rt=e=>e>=48&&e<=57,Ft=(e,t)=>{switch(e){case"translate3d":return Lt.translate(t[0],t[1],t[2]);case"scale3d":return Lt.scale(t[0],t[1],t[2]);case"rotate3d":return Lt.rotate(t[0],t[1],t[2],t[3]);case"skew":return Lt.skew(t[0],t[1]);case"matrix":return Lt.transform2d(t[0],t[1],t[2],t[3],t[4],t[5]);case"matrix3d":return new Lt(4,4,t);default:throw new Error(`no support type ${e}`)}},Dt=e=>{let t=Lt.identity();if(!e)return t;let i="",n="",s=[],r=0;for(let a=0;a<e.length;a++){const o=e.charCodeAt(a);0===r?(kt(o)||Rt(o))&&(i+=e[a]):(Rt(o)||46===o||45===o||101===o)&&(n+=e[a]),40===o?(r=1,n="",s=[]):41===o?(s.push(parseFloat(n)),t=t.multiply(Ft(i,s)),i="",r=0):44===o&&(s.push(parseFloat(n)),n="")}return t},Vt=e=>{if(e.indexOf(" ")>=0){return e.split(" ").map((e=>parseInt(e.substr(0,e.length-2),10)))}return parseInt(e.substr(0,e.length-2),10)},Ot=e=>{let t=e;const i=Vt(t.style.width),n=Vt(t.style.height);let s=Lt.identity();for(;t.parentNode;){const e=getComputedStyle(t),i=e.transform?e.transform:e.webkitTransform;if(i){const n=e.transformOrigin?e.transformOrigin:e.webkitTransformOrigin,r=Dt(i);if(n){const e=Vt(n),i=Lt.translate(-e[0],-e[1],0),a=Lt.translate(e[0],e[1],0);s=Lt.translate(t.offsetLeft,t.offsetTop,0).multiply(a.multiply(r.multiply(i.multiply(s))))}else s=r.multiply(s)}t=t.parentNode}const r=new Lt(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 Mt(e){let t=Ot(e),i=Math.min(t[0],t[2],t[4],t[6]),n=Math.max(t[0],t[2],t[4],t[6]);return[Math.min(t[1],t[3],t[5],t[7]),Math.max(t[1],t[3],t[5],t[7]),i,n]}class Nt{constructor(e,t){this.set(e,t)}add(e,t){return e instanceof Nt?(this.x+=e.x,this.y+=e.y):(this.x+=e||0,this.y+=t||0),this}angle(e){if(void 0!==e)return this.set(this.length(),0).rotate(e);let t=Math.atan2(this.y,this.x);return t<0&&(t+=2*Math.PI),t}angleDeg(e){return void 0!==e?this.angle(e/180*Math.PI):180*this.angle()/Math.PI}clone(){return new Nt(this.x,this.y)}cross(e,t){return e instanceof Nt?this.x*e.y-this.y*e.x:this.x*t-this.y*e}distance(e,t){const i=this.distanceSq(e,t);if(void 0!==i)return Math.sqrt(i)}distanceSq(e,t){let i,n;if(e instanceof Nt)i=e.x-this.x,n=e.y-this.y;else{if(void 0===t)return;i=e-this.x,n=t-this.y}return i*i+n*n}dot(e,t){return e instanceof Nt?this.x*e.x+this.y*e.y:this.x*e+this.y*t}equals(e,t,i){return e instanceof Nt?(t=t||0,Math.abs(this.x-e.x)<=t&&Math.abs(this.y-e.y)<=t):void 0!==t&&(i=i||0,Math.abs(this.x-e)<=i&&Math.abs(this.y-t)<=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(e){const t=Math.cos(e),i=Math.sin(e);return this.set(this.x*t-this.y*i,this.x*i+this.y*t)}rotateDeg(e){return this.rotate(e/180*Math.PI)}scale(e,t){return this.x*=e,this.y*=t||e,this}set(e,t){return e instanceof Nt?(this.x=e.x,this.y=e.y):(this.x=e||0,this.y=t||0),this}setPolar(e,t){return this.set(t,0).rotate(e)}setPolarDeg(e,t){return this.setPolar(e/180*Math.PI,t)}sub(e,t){return void 0!==t?(this.x-=e,this.y-=t):(this.x-=e.x,this.y-=e.y),this}toString(){return`(${this.x}, ${this.y})`}}function Gt(e,t,i){return i=i||0,Math.abs(e-t)<Math.abs(i)}const Bt={isEqual:Gt,isZero:(e,t)=>Gt(e,0,t),clamp:(e,t,i)=>e>t?e<i?e:i:t},Wt=Bt.isZero,Ht=Bt.clamp,Yt=1/3,$t=new Nt(0,0),Ut=1e-4;function jt(e){return"[object Array]"===Object.prototype.toString.call(e)}function zt(e){if(!jt(e))throw new Error("Polygon must be an array of points");switch(typeof e[0]){case"number":{if(e.length%2!=0)throw new Error("Polygon that contains array of numbers must has even length ([x0, y0, x1, y1, ...., xn, yn])");const t=[];for(let i=0;i<e.length;i+=2)t.push(new Nt(e[i],e[i+1]));return t}case"object":return e.map(jt(e[0])?e=>new Nt(e[0],e[1]):e=>new Nt(e.x,e.y));default:throw new Error("Passed polygon is not an array of 2D coordinates")}}function Xt(e){if(1===e.length)return new Nt(e[0]);const t=new Nt(0,0);e.forEach((e=>t.add(e))),t.scale(1/e.length);const i=new Nt;let n=0;return e.forEach(((s,r)=>{const a=new Nt(s),o=new Nt(r+1===e.length?e[0]:e[r+1]);a.add(-t.x,-t.y),o.add(-t.x,-t.y);const l=.5*a.cross(o);n+=l,i.add(a.add(o).scale(Yt).scale(l))})),Wt(n,Ut)?i.set(e[0]):i.scale(1/n).add(t)}function Kt(e,t){let i=e[0],n=t.dot(e[0]),s=0;for(let r=1;r<e.length;r++)s=t.dot(e[r]),s>n&&(n=s,i=e[r]);return new Nt(i)}function Jt(e,t,i){const n=Kt(e,i),s=Kt(t,i.negate());return new Nt(n.sub(s))}function qt(e,t){const i=new Nt(0,0),n=new Nt(e).negate(),s=new Nt(t).sub(e),r=s.dot(s);if(Wt(r,Ut))return i.set(e);let a=n.dot(s)/r;return a=Ht(a,0,1),i.set(s.scale(a).add(e))}function Zt(e,t){e=zt(e),t=zt(t);const i=Xt(e),n=Xt(t).add(i.negate());let s,r,a;s=Jt(e,t,n),r=Jt(e,t,n.negate());for(let i=0;i<30;i++){const i=qt(s,r);if(Wt(i.length(),Ut))return 0;n.set(i.negate().normalize()),a=Jt(e,t,n);const o=a.dot(n),l=s.dot(n);if(Wt(o-l,Ut))return o;s.distanceSq($t)<r.distanceSq($t)?r=a:s=a}return 0}const Qt={intersect:(e,t)=>Wt(Zt(e,t),Ut),distance:Zt};class ei extends F.ViewSensor{constructor(e,t,i,n){super(F.ViewSensor.TypeDefines.TYPE_IMPACT),this._HtmlConfig={view1:e,view2:t,frozeSetId:n?n.IdToken:0,status:{contacted:!1}},this._Callback=i,this._FrozeViewsSet=n,n&&n.DoRef(),this.ResetAutoRecycleViewsRef([e,t],[]),F.sViewSensorManager.AddSensor(this)}HtmlDoWorkOnFrame(){if(!this.Expired()&&this._HtmlConfig.view1&&this._HtmlConfig.view2&&this._HtmlConfig.view1.HtmlCanAccessElement()&&this._HtmlConfig.view1.HtmlCanAccessElement()){(e=this._HtmlConfig.view1.HtmlGetElement(),t=this._HtmlConfig.view2.HtmlGetElement(),Qt.intersect(Ot(e),Ot(t)))?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 e,t}OnCallback(e){this._Callback&&(1==e&&this._Callback.OnBeginContact?this._Callback.OnBeginContact():2==e&&this._Callback.OnEndContact&&this._Callback.OnEndContact())}OnSelfRecycle(){this._FrozeViewsSet&&(this._FrozeViewsSet.UnRef(),this._FrozeViewsSet=null),this._HtmlConfig=null}}F.ImpactSensor=ei;class ti extends F.ViewSensor{constructor(e,t){super(F.ViewSensor.TypeDefines.TYPE_FROZE_SET),this._PreImpactViewList=null,this._OnImpactViewList=null,this._UpdateAutoRecycleRef(e,!0,t,!0),F.sViewSensorManager.AddSensor(this)}HtmlDoWorkOnFrame(){}HtmlNeedWorkOnFrame(){return!1}UpdatePreImpactList(e){this._UpdateAutoRecycleRef(e,!0,null,!1)}UpdateOnImpactList(e){this._UpdateAutoRecycleRef(null,!1,e,!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(e,t,i,n){t&&(this._PreImpactViewList=e instanceof Array?e:[]),n&&(this._OnImpactViewList=i instanceof Array?i:[]),this.ResetAutoRecycleViewsRef([],[...this._PreImpactViewList,...this._OnImpactViewList])}}class ii{constructor(e,t){this.Start=e,this.End=t}Merge(e){return this.IsInterAct(e)?(this.Start>e.Start&&(this.Start=e.Start),this.End<e.End&&(this.End=e.End),!0):this.End+1==e.Start?(this.End=e.End,!0):this.Start==e.End+1&&(this.Start=e.Start,!0)}IsInterAct(e){return e.Start<this.Start?!(e.End<this.Start):e.Start<=this.End}IsInclude(e){return this.Start<=e.Start&&this.End>=e.End}Exclude(e){var t={success:!1,newSplitedRange:null};return this.IsInterAct(e)?(e.Start<=this.Start?e.End<this.End?this.Start=e.End+1:this.Clear():(e.End<this.End&&(t.newSplitedRange=new ii(e.End+1,this.End),t.newSplitedRange=t.newSplitedRange),this.End=e.Start-1),t.success=!0,t.success=t.success,t):t}IsEmpty(){return this.Start>this.End}Clear(){this.End=this.Start-1}Clone(){return new ii(this.Start,this.End)}}const ni="OV",si="NV",ri="OH",ai="NH";class oi extends F.ViewSensor{constructor(e,t){super(F.ViewSensor.TypeDefines.TYPE_ON_SCREEN),this._HtmlConfig={view:e,container:null,enable:!1,testRange:null,status:{horizonVisible:!1,verticalVisible:!1}},this._Callback=t,this.ResetAutoRecycleViewsRef([e],[]),F.sViewSensorManager.AddSensor(this)}HtmlDoWorkOnFrame(){if(!this.Expired()&&this._HtmlConfig.enable&&this._HtmlConfig.testRange&&this._HtmlConfig.view&&this._HtmlConfig.view.HtmlCanAccessElement()){let e=F.sRenderBridge.GetScreenInfo().designedWidth,t=Math.floor(9*e/16);if(!this._HtmlConfig.view.IsVisibleInTree()){if(this._HtmlConfig.status.horizonVisible||this._HtmlConfig.status.verticalVisible){let e={};e[ri]=this._HtmlConfig.status.horizonVisible,e[ai]=!1,e[ni]=this._HtmlConfig.status.verticalVisible,e[si]=!1,this._HtmlConfig.status.horizonVisible=!1,this._HtmlConfig.status.verticalVisible=!1,this.OnCallback(e)}return}let i={top:0,bottom:0,left:0,right:0},n=Mt(this._HtmlConfig.view.HtmlGetElement());[i.top,i.bottom,i.left,i.right]=n;let s,r,a={top:0,bottom:t,left:0,right:e},o=!0;if(this._HtmlConfig.container&&this._HtmlConfig.container.HtmlCanAccessElement()){let i=Mt(this._HtmlConfig.container.HtmlGetElement());[a.top,a.bottom,a.left,a.right]=i,s=new ii(a.left,a.right),r=new ii(a.top,a.bottom);let n=new ii(0,e),l=new ii(0,t);o=n.IsInterAct(s)&&l.IsInterAct(r)}else s=new ii(a.left,a.right),r=new ii(a.top,a.bottom);let l,h,c,u,d=new ii(i.left,i.right),g=new ii(i.top,i.bottom),f=this._HtmlConfig.testRange;{let e=Math.floor((i.right-i.left)*f.horizon);l=new ii(i.left,i.left+e),h=new ii(i.right-e,i.right)}{let e=Math.floor((i.bottom-i.top)*f.vertical);c=new ii(i.top,i.top+e),u=new ii(i.bottom-e,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 e={};e[ri]=this._HtmlConfig.status.horizonVisible,e[ai]=m,e[ni]=this._HtmlConfig.status.verticalVisible,e[si]=p,this._HtmlConfig.status.horizonVisible=m,this._HtmlConfig.status.verticalVisible=p,this.OnCallback(e)}}}HtmlNeedWorkOnFrame(){return this._HtmlConfig.enable}HtmlRequestSync(){F.sRenderBridge.BeginHtmlFrameLoop()}ResetArea(e){"number"!=typeof e.horizon&&(e.horizon=1),"number"!=typeof e.vertical&&(e.vertical=1),this._HtmlConfig.testRange=e,this.HtmlRequestSync()}Enable(e){this._HtmlConfig.enable=e,this._HtmlConfig.status.horizonVisible=!1,this._HtmlConfig.status.verticalVisible=!1,this.HtmlRequestSync()}ResetContainer(e){this._HtmlConfig.container=e,this.HtmlRequestSync()}OnCallback(e){this._Callback&&this._Callback(e[ri],e[ai],e[ni],e[si])}OnSelfRecycle(){this._HtmlConfig=null}}F.VisibleSensor=oi;const li=new class{constructor(){this.allEnvBlockList=[]}getSensor(e){const t=[];for(let i=0;i<this.allEnvBlockList.length;i++)this.allEnvBlockList[i].topGID==e&&t.push({direction:"top",start:{x:parseInt(this.allEnvBlockList[i]._HtmlConfig.view.HtmlGetElement().getBoundingClientRect().left),y:parseInt(this.allEnvBlockList[i]._HtmlConfig.view.HtmlGetElement().getBoundingClientRect().top)},end:{x:parseInt(this.allEnvBlockList[i]._HtmlConfig.view.HtmlGetElement().getBoundingClientRect().right),y:parseInt(this.allEnvBlockList[i]._HtmlConfig.view.HtmlGetElement().getBoundingClientRect().top)}}),this.allEnvBlockList[i].bottomGID==e&&t.push({direction:"bottom",start:{x:parseInt(this.allEnvBlockList[i]._HtmlConfig.view.HtmlGetElement().getBoundingClientRect().left),y:parseInt(this.allEnvBlockList[i]._HtmlConfig.view.HtmlGetElement().getBoundingClientRect().bottom)},end:{x:parseInt(this.allEnvBlockList[i]._HtmlConfig.view.HtmlGetElement().getBoundingClientRect().right),y:parseInt(this.allEnvBlockList[i]._HtmlConfig.view.HtmlGetElement().getBoundingClientRect().bottom)}}),this.allEnvBlockList[i].leftGID==e&&t.push({direction:"left",start:{x:parseInt(this.allEnvBlockList[i]._HtmlConfig.view.HtmlGetElement().getBoundingClientRect().left),y:parseInt(this.allEnvBlockList[i]._HtmlConfig.view.HtmlGetElement().getBoundingClientRect().top)},end:{x:parseInt(this.allEnvBlockList[i]._HtmlConfig.view.HtmlGetElement().getBoundingClientRect().left),y:parseInt(this.allEnvBlockList[i]._HtmlConfig.view.HtmlGetElement().getBoundingClientRect().bottom)}}),this.allEnvBlockList[i].rightGID===e&&t.push({direction:"right",start:{x:parseInt(this.allEnvBlockList[i]._HtmlConfig.view.HtmlGetElement().getBoundingClientRect().right),y:parseInt(this.allEnvBlockList[i]._HtmlConfig.view.HtmlGetElement().getBoundingClientRect().top)},end:{x:parseInt(this.allEnvBlockList[i]._HtmlConfig.view.HtmlGetElement().getBoundingClientRect().right),y:parseInt(this.allEnvBlockList[i]._HtmlConfig.view.HtmlGetElement().getBoundingClientRect().bottom)}});return t}addSensor(e){this.allEnvBlockList.push(e)}deleteSensor(e){for(let t=0;t<this.allEnvBlockList.length;t++)this.allEnvBlockList[t]===e&&this.allEnvBlockList.splice(t,1)}};class hi extends F.ViewSensor{constructor(e){super(F.ViewSensor.TypeDefines.TYPE_ENV_BLOCK),this._HtmlConfig={view:e,enable:!0},this.topGID=0,this.bottomGID=0,this.leftGID=0,this.rightGID=0}HtmlNeedWorkOnFrame(){return this._HtmlConfig.enable}ResetTopGID(e){if(null==e||0==e)return!1;this.topGID=e}ResetBottomGID(e){if(null==e||0==e)return!1;this.bottomGID=e}ResetLeftGID(e){if(null==e||0==e)return!1;this.leftGID=e}ResetRightGID(e){if(null==e||0==e)return!1;this.rightGID=e}Enable(e){this._HtmlConfig.enable=e,e?li.addSensor(this):li.deleteSensor(this)}OnSelfRecycle(){this._HtmlConfig=null}}function ci(e){if(!e)throw Error("assert :P")}function ui(e,t,i){for(var n=0;4>n;n++)if(e[t+n]!=i.charCodeAt(n))return!0;return!1}function di(e,t,i,n,s){for(var r=0;r<s;r++)e[t+r]=i[n+r]}function gi(e,t,i,n){for(var s=0;s<n;s++)e[t+s]=i}function fi(e){return new Int32Array(e)}function mi(e,t){for(var i=[],n=0;n<e;n++)i.push(new t);return i}function pi(e,t){var i=[];return function e(i,n,s){for(var r=s[n],a=0;a<r&&(i.push(s.length>n+1?[]:new t),!(s.length<n+1));a++)e(i[a],n+1,s)}(i,0,e),i}function yi(e,t){for(var i="",n=0;n<4;n++)i+=String.fromCharCode(e[t++]);return i}function Ti(e,t){return(e[t+0]<<0|e[t+1]<<8|e[t+2]<<16)>>>0}function _i(e,t){return(e[t+0]<<0|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0}F.EnvBlockerSensor=hi,window.WebPDecoder=function(){function e(e,t){for(var i=1<<t-1>>>0;e&i;)i>>>=1;return i?(e&i-1)+i:e}function t(e,t,i,n,s){ci(!(n%i));do{e[t+(n-=i)]=s}while(0<n)}function i(i,s,r,a,o){if(ci(2328>=o),512>=o)var l=fi(512);else if(null==(l=fi(o)))return 0;return function(i,s,r,a,o,l){var h,c,u=s,d=1<<r,g=fi(16),f=fi(16);for(ci(0!=o),ci(null!=a),ci(null!=i),ci(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],t(i,u,1,d,a),d;var m,p=-1,y=d-1,T=0,_=1,x=1,w=1<<r;for(c=0,h=1,o=2;h<=r;++h,o<<=1){if(_+=x<<=1,0>(x-=g[h]))return 0;for(;0<g[h];--g[h])(a=new n).g=h,a.value=l[c++],t(i,u+T,o,w,a),T=e(T,h)}for(h=r+1,o=2;15>=h;++h,o<<=1){if(_+=x<<=1,0>(x-=g[h]))return 0;for(;0<g[h];--g[h]){if(a=new n,(T&y)!=p){for(u+=w,m=1<<(p=h)-r;15>p&&!(0>=(m-=g[p]));)++p,m<<=1;d+=w=1<<(m=p-r),i[s+(p=T&y)].g=m+r,i[s+p].value=u-s-p}a.g=h-r,a.value=l[c++],t(i,u+(T>>r),o,w,a),T=e(T,h)}}return _!=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=mi(5,n),this.H=fi(5),this.jc=this.Qb=this.qb=this.nd=0,this.pd=mi(Mi,s)}function a(e,t,i,n){ci(null!=e),ci(null!=t),ci(2147483648>n),e.Ca=254,e.I=0,e.b=-8,e.Ka=0,e.oa=t,e.pa=i,e.Jd=t,e.Yc=i+n,e.Zc=4<=n?i+n-4+1:i,T(e)}function o(e,t){for(var i=0;0<t--;)i|=x(e,128)<<t;return i}function l(e,t){var i=o(e,t);return _(e)?-i:i}function h(e,t,i,n){var s,r=0;for(ci(null!=e),ci(null!=t),ci(4294967288>n),e.Sb=n,e.Ra=0,e.u=0,e.h=0,4<n&&(n=4),s=0;s<n;++s)r+=t[i+s]<<8*s;e.Ra=r,e.bb=n,e.oa=t,e.pa=i}function c(e){for(;8<=e.u&&e.bb<e.Sb;)e.Ra>>>=8,e.Ra+=e.oa[e.pa+e.bb]<<Bi-8>>>0,++e.bb,e.u-=8;m(e)&&(e.h=1,e.u=0)}function u(e,t){if(ci(0<=t),!e.h&&t<=Gi){var i=f(e)&Ni[t];return e.u+=t,c(e),i}return e.h=1,e.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(e){return e.Ra>>>(e.u&Bi-1)>>>0}function m(e){return ci(e.bb<=e.Sb),e.h||e.bb==e.Sb&&e.u>Bi}function p(e,t){e.u=t,e.h=m(e)}function y(e){e.u>=Wi&&(ci(e.u>=Wi),c(e))}function T(e){ci(null!=e&&null!=e.oa),e.pa<e.Zc?(e.I=(e.oa[e.pa++]|e.I<<8)>>>0,e.b+=8):(ci(null!=e&&null!=e.oa),e.pa<e.Yc?(e.b+=8,e.I=e.oa[e.pa++]|e.I<<8):e.Ka?e.b=0:(e.I<<=8,e.b+=8,e.Ka=1))}function _(e){return o(e,1)}function x(e,t){var i=e.Ca;0>e.b&&T(e);var n=e.b,s=i*t>>>8,r=(e.I>>>n>s)+0;for(r?(i-=s,e.I-=s+1<<n>>>0):i=s+1,n=i,s=0;256<=n;)s+=8,n>>=8;return n=7^s+Hi[n],e.b-=n,e.Ca=(i<<n)-1,r}function w(e,t,i){e[t+0]=i>>24&255,e[t+1]=i>>16&255,e[t+2]=i>>8&255,e[t+3]=i>>0&255}function S(e,t){return e[t+0]<<0|e[t+1]<<8}function v(e,t){return S(e,t)|e[t+2]<<16}function E(e,t){return S(e,t)|S(e,t+2)<<16}function b(e,t){var i=1<<t;return ci(null!=e),ci(0<t),e.X=fi(i),null==e.X?0:(e.Mb=32-t,e.Xa=t,1)}function C(e,t){ci(null!=e),ci(null!=t),ci(e.Xa==t.Xa),di(t.X,0,e.X,0,1<<t.Xa)}function I(){this.X=[],this.Xa=this.Mb=0}function A(e,t,i,n){ci(null!=i),ci(null!=n);var s=i[0],r=n[0];return 0==s&&(s=(e*r+t/2)/t),0==r&&(r=(t*s+e/2)/e),0>=s||0>=r?0:(i[0]=s,n[0]=r,1)}function P(e,t){return e+(1<<t)-1>>>t}function L(e,t){return((4278255360&e)+(4278255360&t)>>>0&4278255360)+((16711935&e)+(16711935&t)>>>0&16711935)>>>0}function k(e,t){self[t]=function(t,i,n,s,r,a,o){var l;for(l=0;l<r;++l){var h=self[e](a[o+l-1],n,s+l);a[o+l]=L(t[i+l],h)}}}function R(){this.ud=this.hd=this.jd=0}function F(e,t){return((4278124286&(e^t))>>>1)+(e&t)>>>0}function D(e){return 0<=e&&256>e?e:0>e?0:255<e?255:void 0}function V(e,t){return D(e+(e-t+.5>>1))}function O(e,t,i){return Math.abs(t-i)-Math.abs(e-i)}function M(e,t,i,n,s,r,a){for(n=r[a-1],i=0;i<s;++i)r[a+i]=n=L(e[t+i],n)}function N(e,t,i,n,s){var r;for(r=0;r<i;++r){var a=e[t+r],o=a>>8&255,l=16711935&(l=(l=16711935&a)+((o<<16)+o));n[s+r]=(4278255360&a)+l>>>0}}function G(e,t){t.jd=e>>0&255,t.hd=e>>8&255,t.ud=e>>16&255}function B(e,t,i,n,s,r){var a;for(a=0;a<n;++a){var o=t[i+a],l=o>>>8,h=o,c=255&(c=(c=o>>>16)+((e.jd<<24>>24)*(l<<24>>24)>>>5));h=255&(h=(h=h+((e.hd<<24>>24)*(l<<24>>24)>>>5))+((e.ud<<24>>24)*(c<<24>>24)>>>5));s[r+a]=(4278255360&o)+(c<<16)+h}}function W(e,t,i,n,s){self[t]=function(e,t,i,r,a,o,l,h,c){for(r=l;r<h;++r)for(l=0;l<c;++l)a[o++]=s(i[n(e[t++])])},self[e]=function(e,t,r,a,o,l,h){var c=8>>e.b,u=e.Ea,d=e.K[0],g=e.w;if(8>c)for(e=(1<<e.b)-1,g=(1<<c)-1;t<r;++t){var f,m=0;for(f=0;f<u;++f)f&e||(m=n(a[o++])),l[h++]=s(d[m&g]),m>>=c}else self["VP8LMapColor"+i](a,o,d,g,l,h,t,r,u)}}function H(e,t,i,n,s){for(i=t+i;t<i;){var r=e[t++];n[s++]=r>>16&255,n[s++]=r>>8&255,n[s++]=r>>0&255}}function Y(e,t,i,n,s){for(i=t+i;t<i;){var r=e[t++];n[s++]=r>>16&255,n[s++]=r>>8&255,n[s++]=r>>0&255,n[s++]=r>>24&255}}function $(e,t,i,n,s){for(i=t+i;t<i;){var r=(a=e[t++])>>16&240|a>>12&15,a=a>>0&240|a>>28&15;n[s++]=r,n[s++]=a}}function U(e,t,i,n,s){for(i=t+i;t<i;){var r=(a=e[t++])>>16&248|a>>13&7,a=a>>5&224|a>>3&31;n[s++]=r,n[s++]=a}}function j(e,t,i,n,s){for(i=t+i;t<i;){var r=e[t++];n[s++]=r>>0&255,n[s++]=r>>8&255,n[s++]=r>>16&255}}function z(e,t,i,n,s,r){if(0==r)for(i=t+i;t<i;)w(n,((r=e[t++])[0]>>24|r[1]>>8&65280|r[2]<<8&16711680|r[3]<<24)>>>0),s+=32;else di(n,s,e,t,i)}function X(e,t){self[t][0]=self[e+"0"],self[t][1]=self[e+"1"],self[t][2]=self[e+"2"],self[t][3]=self[e+"3"],self[t][4]=self[e+"4"],self[t][5]=self[e+"5"],self[t][6]=self[e+"6"],self[t][7]=self[e+"7"],self[t][8]=self[e+"8"],self[t][9]=self[e+"9"],self[t][10]=self[e+"10"],self[t][11]=self[e+"11"],self[t][12]=self[e+"12"],self[t][13]=self[e+"13"],self[t][14]=self[e+"0"],self[t][15]=self[e+"0"]}function K(e){return e==Hn||e==Yn||e==$n||e==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 ee(){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 te(e){return alert("todo:WebPSamplerProcessPlane"),e.T}function ie(e,t){var i=e.T,n=t.ba.f.RGBA,s=n.eb,r=n.fb+e.ka*n.A,a=ps[t.ba.S],o=e.y,l=e.O,h=e.f,c=e.N,u=e.ea,d=e.W,g=t.cc,f=t.dc,m=t.Mc,p=t.Nc,y=e.ka,T=e.ka+e.T,_=e.U,x=_+1>>1;for(0==y?a(o,l,null,null,h,c,u,d,h,c,u,d,s,r,null,null,_):(a(t.ec,t.fc,o,l,g,f,m,p,h,c,u,d,s,r-n.A,s,r,_),++i);y+2<T;y+=2)g=h,f=c,m=u,p=d,c+=e.Rc,d+=e.Rc,r+=2*n.A,a(o,(l+=2*e.fa)-e.fa,o,l,g,f,m,p,h,c,u,d,s,r-n.A,s,r,_);return l+=e.fa,e.j+T<e.o?(di(t.ec,t.fc,o,l,_),di(t.cc,t.dc,h,c,x),di(t.Mc,t.Nc,u,d,x),i--):1&T||a(o,l,null,null,h,c,u,d,h,c,u,d,s,r+n.A,null,null,_),i}function ne(e,t,i){var n=e.F,s=[e.J];if(null!=n){var r=e.U,a=t.ba.S,o=a==Gn||a==$n;t=t.ba.f.RGBA;var l=[0],h=e.ka;l[0]=e.T,e.Kb&&(0==h?--l[0]:(--h,s[0]-=e.width),e.j+e.ka+e.T==e.o&&(l[0]=e.o-e.j-h));var c=t.eb;h=t.fb+h*t.A;e=En(n,s[0],e.width,r,l,c,h+(o?0:3),t.A),ci(i==l),e&&K(a)&&Sn(c,h,o,r,l,t.A)}return 0}function se(e){var t=e.ma,i=t.ba.S,n=11>i,s=i==On||i==Nn||i==Gn||i==Bn||12==i||K(i);if(t.memory=null,t.Ib=null,t.Jb=null,t.Nd=null,!Di(t.Oa,e,s?11:12))return 0;if(s&&K(i)&&yi(),e.da)alert("todo:use_scaling");else{if(n){if(t.Ib=te,e.Kb){if(i=e.U+1>>1,t.memory=fi(e.U+2*i),null==t.memory)return 0;t.ec=t.memory,t.fc=0,t.cc=t.ec,t.dc=t.fc+e.U,t.Mc=t.cc,t.Nc=t.dc+i,t.Ib=ie,yi()}}else alert("todo:EmitYUV");s&&(t.Jb=ne,n&&li())}if(n&&!Ls){for(e=0;256>e;++e)ks[e]=89858*(e-128)+bs>>Es,Ds[e]=-22014*(e-128)+bs,Fs[e]=-45773*(e-128),Rs[e]=113618*(e-128)+bs>>Es;for(e=Cs;e<Is;++e)t=76283*(e-16)+bs>>Es,Vs[e-Cs]=Me(t,255),Os[e-Cs]=Me(t+8>>4,15);Ls=1}return 1}function re(e){var t=e.ma,i=e.U,n=e.T;return ci(!(1&e.ka)),0>=i||0>=n?0:(i=t.Ib(e,t),null!=t.Jb&&t.Jb(e,t,i),t.Dc+=i,1)}function ae(e){e.ma.memory=null}function oe(e,t,i,n){return 47!=u(e,8)?0:(t[0]=u(e,14)+1,i[0]=u(e,14)+1,n[0]=u(e,1),0!=u(e,3)?0:!e.h)}function le(e,t){if(4>e)return e+1;var i=e-2>>1;return(2+(1&e)<<i)+u(t,i)+1}function he(e,t){return 120<t?t-120:1<=(i=((i=qn[t-1])>>4)*e+(8-(15&i)))?i:1;var i}function ce(e,t,i){var n=f(i),s=e[t+=255&n].g-8;return 0<s&&(p(i,i.u+8),n=f(i),t+=e[t].value,t+=n&(1<<s)-1),p(i,i.u+e[t].g),e[t].value}function ue(e,t,i){return i.g+=e.g,i.value+=e.value<<t>>>0,ci(8>=i.g),e.g}function de(e,t,i){var n=e.xc;return ci((t=0==n?0:e.vc[e.md*(i>>n)+(t>>n)])<e.Wb),e.Ya[t]}function ge(e,t,i,n){var s=e.ab,r=e.c*t,a=e.C;t=a+t;var o=i,l=n;for(n=e.Ta,i=e.Ua;0<s--;){var h=e.gc[s],c=a,u=t,d=o,g=l,f=(l=n,o=i,h.Ea);switch(ci(c<u),ci(u<=h.nc),h.hc){case 2:Ui(d,g,(u-c)*f,l,o);break;case 0:var m=c,p=u,y=l,T=o,_=(E=h).Ea;0==m&&(Yi(d,g,null,null,1,y,T),M(d,g+1,0,0,_-1,y,T+1),g+=_,T+=_,++m);for(var x=1<<E.b,w=x-1,S=P(_,E.b),v=E.K,E=E.w+(m>>E.b)*S;m<p;){var b=v,C=E,I=1;for($i(d,g,y,T-_,1,y,T);I<_;){var A=(I&~w)+x;A>_&&(A=_),(0,Ji[b[C++]>>8&15])(d,g+ +I,y,T+I-_,A-I,y,T+I),I=A}g+=_,T+=_,++m&w||(E+=S)}u!=h.nc&&di(l,o-f,l,o+(u-c-1)*f,f);break;case 1:for(f=d,p=g,_=(d=h.Ea)-(T=d&~(y=(g=1<<h.b)-1)),m=P(d,h.b),x=h.K,h=h.w+(c>>h.b)*m;c<u;){for(w=x,S=h,v=new R,E=p+T,b=p+d;p<E;)G(w[S++],v),qi(v,f,p,g,l,o),p+=g,o+=g;p<b&&(G(w[S++],v),qi(v,f,p,_,l,o),p+=_,o+=_),++c&y||(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,y=o,m=[],T=(_=T)-1;0<=T;--T)m[T]=g[y+T];for(T=_-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&&di(n,i,o,l,r)}function fe(e,t){var i=e.V,n=e.Ba+e.c*e.C,s=t-e.C;if(ci(t<=e.l.o),ci(16>=s),0<s){var r=e.l,a=e.Ta,o=e.Ua,l=r.width;if(ge(e,s,i,n),s=o=[o],ci((i=e.C)<(n=t)),ci(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=e.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+e.Ma*c.A;0<d--;){var g=a,f=o,m=s,p=h,y=c;switch(n){case Vn:Zi(g,f,m,p,y);break;case On:Qi(g,f,m,p,y);break;case Hn:Qi(g,f,m,p,y),Sn(p,y,0,m,1,0);break;case Mn:nn(g,f,m,p,y);break;case Nn:z(g,f,m,p,y,1);break;case Yn:z(g,f,m,p,y,1),Sn(p,y,0,m,1,0);break;case Gn:z(g,f,m,p,y,0);break;case $n:z(g,f,m,p,y,0),Sn(p,y,1,m,1,0);break;case Bn:en(g,f,m,p,y);break;case Un:en(g,f,m,p,y),vn(p,y,m,1,0);break;case Wn:tn(g,f,m,p,y);break;default:ci(0)}o+=l,c+=u}e.Ma+=r}else alert("todo:EmitRescaledRowsYUVA");ci(e.Ma<=i.height)}}e.C=t,ci(e.C<=e.i)}function me(e){var t;if(0<e.ua)return 0;for(t=0;t<e.Wb;++t){var i=e.Ya[t].G,n=e.Ya[t].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 pe(e,t,i,n,s,r){if(0!=e.Z){var a=e.qd,o=e.rd;for(ci(null!=ms[e.Z]);t<i;++t)ms[e.Z](a,o,n,s,n,s,r),a=n,o=s,s+=r;e.qd=a,e.rd=o}}function ye(e,t){var i=e.l.ma,n=0==i.Z||1==i.Z?e.l.j:e.C;n=e.C<n?n:e.C;if(ci(t<=e.l.o),t>n){var s=e.l.width,r=i.ca,a=i.tb+s*n,o=e.V,l=e.Ba+e.c*n,h=e.gc;ci(1==e.ab),ci(3==h[0].hc),Xi(h[0],n,t,o,l,r,a),pe(i,n,t,r,a,s)}e.C=e.Ma=t}function Te(e,t,i,n,s,r,a){var o=e.$/n,l=e.$%n,h=e.m,c=e.s,u=i+e.$,d=u;s=i+n*s;var g=i+n*r,T=280+c.ua,_=e.Pb?o:16777216,x=0<c.ua?c.Wa:null,w=c.wc,S=u<g?de(c,l,o):null;ci(e.C<r),ci(g<=s);var v=!1;e:for(;;){for(;v||u<g;){var E=0;if(o>=_){var b=u-i;ci((_=e).Pb),_.wd=_.m,_.xd=b,0<_.s.ua&&C(_.s.Wa,_.s.vb),_=o+Qn}if(l&w||(S=de(c,l,o)),ci(null!=S),S.Qb&&(t[u]=S.qb,v=!0),!v)if(y(h),S.jc){E=h,b=t;var I=u,A=S.pd[f(E)&Mi-1];ci(S.jc),256>A.g?(p(E,E.u+A.g),b[I]=A.value,E=0):(p(E,E.u+A.g-256),ci(256<=A.value),E=A.value),0==E&&(v=!0)}else E=ce(S.G[0],S.H[0],h);if(h.h)break;if(v||256>E){if(!v)if(S.nd)t[u]=(S.qb|E<<8)>>>0;else{if(y(h),v=ce(S.G[1],S.H[1],h),y(h),b=ce(S.G[2],S.H[2],h),I=ce(S.G[3],S.H[3],h),h.h)break;t[u]=(I<<24|v<<16|E<<8|b)>>>0}if(v=!1,++u,++l>=n&&(l=0,++o,null!=a&&o<=r&&!(o%16)&&a(e,o),null!=x))for(;d<u;)E=t[d++],x.X[(506832829*E&4294967295)>>>x.Mb]=E}else if(280>E){if(E=le(E-256,h),b=ce(S.G[4],S.H[4],h),y(h),b=he(n,b=le(b,h)),h.h)break;if(u-i<b||s-u<E)break e;for(I=0;I<E;++I)t[u+I]=t[u+I-b];for(u+=E,l+=E;l>=n;)l-=n,++o,null!=a&&o<=r&&!(o%16)&&a(e,o);if(ci(u<=s),l&w&&(S=de(c,l,o)),null!=x)for(;d<u;)E=t[d++],x.X[(506832829*E&4294967295)>>>x.Mb]=E}else{if(!(E<T))break e;for(v=E-280,ci(null!=x);d<u;)E=t[d++],x.X[(506832829*E&4294967295)>>>x.Mb]=E;E=u,ci(!(v>>>(b=x).Xa)),t[E]=b.X[v],v=!0}v||ci(h.h==m(h))}if(e.Pb&&h.h&&u<s)ci(e.m.h),e.a=5,e.m=e.wd,e.$=e.xd,0<e.s.ua&&C(e.s.vb,e.s.Wa);else{if(h.h)break e;null!=a&&a(e,o>r?r:o),e.a=0,e.$=u-i}return 1}return e.a=3,0}function _e(e){ci(null!=e),e.vc=null,e.yc=null,e.Ya=null;var t=e.Wa;null!=t&&(t.X=null),e.vb=null,ci(null!=e)}function xe(){var e=new Zt;return null==e?null:(e.a=0,e.xb=fs,X("Predictor","VP8LPredictors"),X("Predictor","VP8LPredictors_C"),X("PredictorAdd","VP8LPredictorsAdd"),X("PredictorAdd","VP8LPredictorsAdd_C"),Ui=N,qi=B,Zi=H,Qi=Y,en=$,tn=U,nn=j,self.VP8LMapColor32b=zi,self.VP8LMapColor8b=Ki,e)}function we(e,t,s,a,o){var l=1,h=[e],c=[t],d=a.m,g=a.s,m=null,T=0;e:for(;;){if(s)for(;l&&u(d,1);){var _=h,x=c,w=a,S=1,v=w.m,E=w.gc[w.ab],C=u(v,2);if(w.Oc&1<<C)l=0;else{switch(w.Oc|=1<<C,E.hc=C,E.Ea=_[0],E.nc=x[0],E.K=[null],++w.ab,ci(4>=w.ab),C){case 0:case 1:E.b=u(v,3)+2,S=we(P(E.Ea,E.b),P(E.nc,E.b),0,w,E.K),E.K=E.K[0];break;case 3:var I,A=u(v,8)+1,k=16<A?0:4<A?1:2<A?2:3;if(_[0]=P(E.Ea,k),E.b=k,I=S=we(A,1,0,w,E.K)){var R,F=A,D=E,V=1<<(8>>D.b),O=fi(V);if(null==O)I=0;else{var M=D.K[0],N=D.w;for(O[0]=D.K[0][0],R=1;R<1*F;++R)O[R]=L(M[N+R],O[R-1]);for(;R<4*V;++R)O[R]=0;D.K[0]=null,D.K[0]=O,I=1}}S=I;break;case 2:break;default:ci(0)}l=S}}if(h=h[0],c=c[0],l&&u(d,1)&&!(l=1<=(T=u(d,4))&&11>=T)){a.a=3;break e}var G;if(G=l)t:{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 ee=u(X,3)+2,te=P($,ee),ie=P(U,ee),ne=te*ie;if(!we(te,ie,0,Y,J))break i;for(J=J[0],K.xc=ee,B=0;B<ne;++B){var se=J[B]>>8&65535;J[B]=se,se>=q&&(q=se+1)}}if(X.h)break i;for(W=0;5>W;++W){var re=Xn[W];!W&&0<j&&(re+=1<<j),Z<re&&(Z=re)}var ae=mi(q*Q,n),oe=q,le=mi(oe,r);if(null==le)var he=null;else ci(65536>=oe),he=le;var ce=fi(Z);if(null==he||null==ce||null==ae){Y.a=1;break i}var de=ae;for(B=H=0;B<q;++B){var ge=he[B],fe=ge.G,me=ge.H,pe=0,ye=1,xe=0;for(W=0;5>W;++W){re=Xn[W],fe[W]=de,me[W]=H,!W&&0<j&&(re+=1<<j);n:{var Se,ve=re,Ee=Y,be=ce,Ce=de,Ie=H,Ae=0,Pe=Ee.m,Le=u(Pe,1);if(gi(be,0,0,ve),Le){var ke=u(Pe,1)+1,Re=u(Pe,1),Fe=u(Pe,0==Re?1:8);be[Fe]=1,2==ke&&(be[Fe=u(Pe,8)]=1);var De=1}else{var Ve=fi(19),Oe=u(Pe,4)+4;if(19<Oe){Ee.a=3;var Me=0;break n}for(Se=0;Se<Oe;++Se)Ve[Jn[Se]]=u(Pe,3);var Ne=void 0,Ge=void 0,Be=Ee,We=Ve,He=ve,Ye=be,$e=0,Ue=Be.m,je=8,ze=mi(128,n);s:for(;i(ze,0,7,We,19);){if(u(Ue,1)){var Xe=2+2*u(Ue,3);if((Ne=2+u(Ue,Xe))>He)break s}else Ne=He;for(Ge=0;Ge<He&&Ne--;){y(Ue);var Ke=ze[0+(127&f(Ue))];p(Ue,Ue.u+Ke.g);var Je=Ke.value;if(16>Je)Ye[Ge++]=Je,0!=Je&&(je=Je);else{var qe=16==Je,Ze=Je-16,Qe=zn[Ze],et=u(Ue,jn[Ze])+Qe;if(Ge+et>He)break s;for(var tt=qe?je:0;0<et--;)Ye[Ge++]=tt}}$e=1;break s}$e||(Be.a=3),De=$e}(De=De&&!Pe.h)&&(Ae=i(Ce,Ie,8,be,ve)),De&&0!=Ae?Me=Ae:(Ee.a=3,Me=0)}if(0==Me)break i;if(ye&&1==Kn[W]&&(ye=0==de[H].g),pe+=de[H].g,H+=Me,3>=W){var it,nt=ce[0];for(it=1;it<re;++it)ce[it]>nt&&(nt=ce[it]);xe+=nt}}if(ge.nd=ye,ge.Qb=0,ye&&(ge.qb=(fe[3][me[3]+0].value<<24|fe[1][me[1]+0].value<<16|fe[2][me[2]+0].value)>>>0,0==pe&&256>fe[0][me[0]+0].value&&(ge.Qb=1,ge.qb+=fe[0][me[0]+0].value<<8)),ge.jc=!ge.Qb&&6>xe,ge.jc){var st,rt=ge;for(st=0;st<Mi;++st){var at=st,ot=rt.pd[at],lt=rt.G[0][rt.H[0]+at];256<=lt.value?(ot.g=lt.g+256,ot.value=lt.value):(ot.g=0,ot.value=0,at>>=ue(lt,8,ot),at>>=ue(rt.G[1][rt.H[1]+at],16,ot),at>>=ue(rt.G[2][rt.H[2]+at],0,ot),ue(rt.G[3][rt.H[3]+at],24,ot))}}}K.vc=J,K.Wb=q,K.Ya=he,K.yc=ae,G=1;break t}G=0}if(!(l=G)){a.a=3;break e}if(0<T){if(g.ua=1<<T,!b(g.Wa,T)){a.a=1,l=0;break e}}else g.ua=0;var ht=a,ct=h,ut=c,dt=ht.s,gt=dt.xc;if(ht.c=ct,ht.i=ut,dt.md=P(ct,gt),dt.wc=0==gt?-1:(1<<gt)-1,s){a.xb=gs;break e}if(null==(m=fi(h*c))){a.a=1,l=0;break e}l=(l=Te(a,m,0,h,c,c,null))&&!d.h;break e}return l?(null!=o?o[0]=m:(ci(null==m),ci(s)),a.$=0,s||_e(g)):_e(g),l}function Se(e,t){var i=e.c*e.i,n=i+t+16*t;return ci(e.c<=t),e.V=fi(n),null==e.V?(e.Ta=null,e.Ua=0,e.a=1,0):(e.Ta=e.V,e.Ua=e.Ba+i+t,1)}function ve(e,t){var i=e.C,n=t-i,s=e.V,r=e.Ba+e.c*i;for(ci(t<=e.l.o);0<n;){var a=16<n?16:n,o=e.l.ma,l=e.l.width,h=l*a,c=o.ca,u=o.tb+l*i,d=e.Ta,g=e.Ua;ge(e,a,s,r),bn(d,g,c,u,h),pe(o,i,i+a,c,u,l),n-=a,s+=a*e.c,i+=a}ci(i==t),e.C=e.Ma=t}function Ee(){this.ub=this.yd=this.td=this.Rb=0}function be(){this.Kd=this.Ld=this.Ud=this.Td=this.i=this.c=0}function Ce(){this.Fb=this.Bb=this.Cb=0,this.Zb=fi(4),this.Lb=fi(4)}function Ie(){this.Yb=function(){var e=[];return function e(t,i,n){for(var s=n[i],r=0;r<s&&(t.push(n.length>i+1?[]:0),!(n.length<i+1));r++)e(t[r],i+1,n)}(e,0,[3,11]),e}()}function Ae(){this.jb=fi(3),this.Wc=pi([4,8],Ie),this.Xc=pi([4,17],Ie)}function Pe(){this.Pc=this.wb=this.Tb=this.zd=0,this.vd=new fi(4),this.od=new fi(4)}function Le(){this.ld=this.La=this.dd=this.tc=0}function ke(){this.Na=this.la=0}function Re(){this.Sc=[0,0],this.Eb=[0,0],this.Qc=[0,0],this.ia=this.lc=0}function Fe(){this.ad=fi(384),this.Za=0,this.Ob=fi(16),this.$b=this.Ad=this.ia=this.Gc=this.Hc=this.Dd=0}function De(){this.uc=this.M=this.Nb=0,this.wa=Array(new Le),this.Y=0,this.ya=Array(new Fe),this.aa=0,this.l=new Ne}function Ve(){this.y=fi(16),this.f=fi(8),this.ea=fi(8)}function Oe(){this.cb=this.a=0,this.sc="",this.m=new d,this.Od=new Ee,this.Kc=new be,this.ed=new Pe,this.Qa=new Ce,this.Ic=this.$c=this.Aa=0,this.D=new De,this.Xb=this.Va=this.Hb=this.zb=this.yb=this.Ub=this.za=0,this.Jc=mi(8,d),this.ia=0,this.pb=mi(4,Re),this.Pa=new Ae,this.Bd=this.kc=0,this.Ac=[],this.Bc=0,this.zc=[0,0,0,0],this.Gd=Array(new Ve),this.Hd=0,this.rb=Array(new ke),this.sb=0,this.wa=Array(new Le),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 Fe),this.L=this.aa=0,this.gd=pi([4,2],Le),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 Me(e,t){return 0>e?0:e>t?t:e}function Ne(){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 Ge(){var e=new Oe;return null!=e&&(e.a=0,e.sc="OK",e.cb=0,e.Xb=0,is||(is=Ye)),e}function Be(e,t,i){return 0==e.a&&(e.a=t,e.sc=i,e.cb=0),0}function We(e,t,i){return 3<=i&&157==e[t+0]&&1==e[t+1]&&42==e[t+2]}function He(e,t){if(null==e)return 0;if(e.a=0,e.sc="OK",null==t)return Be(e,2,"null VP8Io passed to VP8GetHeaders()");var i=t.data,n=t.w,s=t.ha;if(4>s)return Be(e,7,"Truncated header.");var r=i[n+0]|i[n+1]<<8|i[n+2]<<16,h=e.Od;if(h.Rb=!(1&r),h.td=r>>1&7,h.yd=r>>4&1,h.ub=r>>5,3<h.td)return Be(e,3,"Incorrect keyframe parameters.");if(!h.yd)return Be(e,4,"Frame not displayable.");n+=3,s-=3;var c=e.Kc;if(h.Rb){if(7>s)return Be(e,7,"cannot parse picture header");if(!We(i,n,s))return Be(e,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,e.za=c.c+15>>4,e.Ub=c.i+15>>4,t.width=c.c,t.height=c.i,t.Da=0,t.j=0,t.v=0,t.va=t.width,t.o=t.height,t.da=0,t.ib=t.width,t.hb=t.height,t.U=t.width,t.T=t.height,gi((r=e.Pa).jb,0,255,r.jb.length),ci(null!=(r=e.Qa)),r.Cb=0,r.Bb=0,r.Fb=1,gi(r.Zb,0,0,r.Zb.length),gi(r.Lb,0,0,r.Lb)}if(h.ub>s)return Be(e,7,"bad partition length");a(r=e.m,i,n,h.ub),n+=h.ub,s-=h.ub,h.Rb&&(c.Ld=_(r),c.Kd=_(r)),c=e.Qa;var u,d=e.Pa;if(ci(null!=r),ci(null!=c),c.Cb=_(r),c.Cb){if(c.Bb=_(r),_(r)){for(c.Fb=_(r),u=0;4>u;++u)c.Zb[u]=_(r)?l(r,7):0;for(u=0;4>u;++u)c.Lb[u]=_(r)?l(r,6):0}if(c.Bb)for(u=0;3>u;++u)d.jb[u]=_(r)?o(r,8):255}else c.Bb=0;if(r.Ka)return Be(e,3,"cannot parse segment header");if((c=e.ed).zd=_(r),c.Tb=o(r,6),c.wb=o(r,3),c.Pc=_(r),c.Pc&&_(r)){for(d=0;4>d;++d)_(r)&&(c.vd[d]=l(r,6));for(d=0;4>d;++d)_(r)&&(c.od[d]=l(r,6))}if(e.L=0==c.Tb?0:c.zd?1:2,r.Ka)return Be(e,3,"cannot parse filter header");var g=s;if(s=u=n,n=u+g,c=g,e.Xb=(1<<o(e.m,2))-1,g<3*(d=e.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(e.Jc[+g],i,u,f),u+=f,c-=f,s+=3}a(e.Jc[+d],i,u,c),i=u<n?0:5}if(0!=i)return Be(e,i,"cannot parse partitions");for(i=o(u=e.m,7),s=_(u)?l(u,4):0,n=_(u)?l(u,4):0,c=_(u)?l(u,4):0,d=_(u)?l(u,4):0,u=_(u)?l(u,4):0,g=e.Qa,f=0;4>f;++f){if(g.Cb){var m=g.Zb[f];g.Fb||(m+=i)}else{if(0<f){e.pb[f]=e.pb[0];continue}m=i}var p=e.pb[f];p.Sc[0]=es[Me(m+s,127)],p.Sc[1]=ts[Me(m+0,127)],p.Eb[0]=2*es[Me(m+n,127)],p.Eb[1]=101581*ts[Me(m+c,127)]>>16,8>p.Eb[1]&&(p.Eb[1]=8),p.Qc[0]=es[Me(m+d,117)],p.Qc[1]=ts[Me(m+u,127)],p.lc=m+u}if(!h.Rb)return Be(e,4,"Not a key frame.");for(_(r),h=e.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=x(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 e.kc=_(r),e.kc&&(e.Bd=o(r,8)),e.cb=1}function Ye(e,t,i,n,s,r,a){var o=t[s].Yb[i];for(i=0;16>s;++s){if(!x(e,o[i+0]))return s;for(;!x(e,o[i+1]);)if(o=t[++s].Yb[0],i=0,16==s)return 16;var l=t[s+1].Yb;if(x(e,o[i+2])){var h=e,c=0;if(x(h,(d=o)[(u=i)+3]))if(x(h,d[u+6])){for(o=0,u=2*(c=x(h,d[u+8]))+(d=x(h,d[u+9+c])),c=0,d=ns[u];d[o];++o)c+=c+x(h,d[o]);c+=3+(8<<u)}else x(h,d[u+7])?(c=7+2*x(h,165),c+=x(h,145)):c=5+x(h,159);else c=x(h,d[u+4])?3+x(h,d[u+5]):2;o=l[2]}else c=1,o=l[1];l=a+ss[s],0>(h=e).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 $e(e){var t=e.rb[e.sb-1];t.la=0,t.Na=0,gi(e.zc,0,0,e.zc.length),e.ja=0}function Ue(e,t){if(null==e)return 0;if(null==t)return Be(e,2,"NULL VP8Io parameter in VP8Decode().");if(!e.cb&&!He(e,t))return 0;if(ci(e.cb),null==t.ac||t.ac(t)){t.ob&&(e.L=0);var i=Ns[e.L];if(2==e.L?(e.yb=0,e.zb=0):(e.yb=t.v-i>>4,e.zb=t.j-i>>4,0>e.yb&&(e.yb=0),0>e.zb&&(e.zb=0)),e.Va=t.o+15+i>>4,e.Hb=t.va+15+i>>4,e.Hb>e.za&&(e.Hb=e.za),e.Va>e.Ub&&(e.Va=e.Ub),0<e.L){var n=e.ed;for(i=0;4>i;++i){var s;if(e.Qa.Cb){var r=e.Qa.Lb[i];e.Qa.Fb||(r+=n.Tb)}else r=n.Tb;for(s=0;1>=s;++s){var a=e.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 Be(e,6,"Frame setup failed"),i=e.a;if(i=0==i){if(i){e.$c=0,0<e.Aa||(e.Ic=Bs);e:{i=e.Ic;n=4*(l=e.za);var h=32*l,c=l+1,u=0<e.L?l*(0<e.Aa?2:1):0,d=(2==e.Aa?2:1)*l;if((a=n+832+(s=3*(16*i+Ns[e.L])/2*h)+(r=null!=e.Fa&&0<e.Fa.length?e.Kc.c*e.Kc.i:0))!=a)i=0;else{if(a>e.Vb){if(e.Vb=0,e.Ec=fi(a),e.Fc=0,null==e.Ec){i=Be(e,1,"no memory during frame initialization.");break e}e.Vb=a}a=e.Ec,o=e.Fc,e.Ac=a,e.Bc=o,o+=n,e.Gd=mi(h,Ve),e.Hd=0,e.rb=mi(c+1,ke),e.sb=1,e.wa=u?mi(u,Le):null,e.Y=0,e.D.Nb=0,e.D.wa=e.wa,e.D.Y=e.Y,0<e.Aa&&(e.D.Y+=l),ci(!0),e.oc=a,e.pc=o,o+=832,e.ya=mi(d,Fe),e.aa=0,e.D.ya=e.ya,e.D.aa=e.aa,2==e.Aa&&(e.D.aa+=l),e.R=16*l,e.B=8*l,l=(h=Ns[e.L])*e.R,h=h/2*e.B,e.sa=a,e.ta=o+l,e.qa=e.sa,e.ra=e.ta+16*i*e.R+h,e.Ha=e.qa,e.Ia=e.ra+8*i*e.B+h,e.$c=0,o+=s,e.mb=r?a:null,e.nb=r?o:null,ci(o+r<=e.Fc+e.Vb),$e(e),gi(e.Ac,e.Bc,0,n),i=1}}if(i){if(t.ka=0,t.y=e.sa,t.O=e.ta,t.f=e.qa,t.N=e.ra,t.ea=e.Ha,t.Vd=e.Ia,t.fa=e.R,t.Rc=e.B,t.F=null,t.J=0,!Ln){for(i=-255;255>=i;++i)Cn[255+i]=0>i?-i:i;for(i=-1020;1020>=i;++i)In[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=tt,rn=qe,on=Ze,ln=Qe,hn=et,an=Je,cn=Bt,un=Wt,dn=$t,gn=Ut,fn=Ht,mn=Yt,pn=jt,yn=zt,Tn=Dt,_n=Vt,xn=Ot,wn=Mt,us[0]=pt,us[1]=nt,us[2]=ft,us[3]=mt,us[4]=yt,us[5]=_t,us[6]=Tt,us[7]=xt,us[8]=St,us[9]=wt,cs[0]=ht,cs[1]=rt,cs[2]=at,cs[3]=ot,cs[4]=ct,cs[5]=ut,cs[6]=dt,ds[0]=Ct,ds[1]=st,ds[2]=vt,ds[3]=Et,ds[4]=At,ds[5]=It,ds[6]=Pt,i=1}else i=0}i&&(i=function(e,t){for(e.M=0;e.M<e.Va;++e.M){var i,n=e.Jc[e.M&e.Xb],s=e.m,r=e;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=x(a,o.Pa.jb[0])?2+x(a,o.Pa.jb[2]):x(a,o.Pa.jb[1]):u.$b=0,o.kc&&(u.Ad=x(a,o.Bd)),u.Za=!x(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[x(a,m[0])];0<p;)p=rs[2*p+x(a,m[p])];m=-p,l[h+f]=m}di(d,g,l,h,4),g+=4,c[0+o]=m}}else m=x(a,156)?x(a,128)?1:3:x(a,163)?2:0,u.Ob[0]=m,gi(l,h,m,4),gi(c,0,m,4);u.Dd=x(a,142)?x(a,114)?x(a,183)?1:3:2:0}if(r.m.Ka)return Be(e,7,"Premature end-of-partition0 encountered.");for(;e.ja<e.za;++e.ja){if(r=n,a=(s=e).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 y,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,gi(o,d,0,384),c.Za)var _=0,w=h[3];else{p=fi(16);var S=a.Na+g.Na;if(S=is(l,h[1],S,u.Eb,0,p,0),a.Na=g.Na=(0<S)+0,1<S)sn(p,0,o,d);else{var v=p[0]+3>>3;for(p=0;256>p;p+=16)o[d+p]=v}_=1,w=h[0]}var E=15&a.la,b=15&g.la;for(p=0;4>p;++p){var C=1&b;for(v=T=0;4>v;++v)E=E>>1|(C=(S=is(l,w,S=C+(1&E),u.Sc,_,o,d))>_)<<7,T=T<<2|(3<S?3:1<S?2:0!=o[d+0]),d+=16;E>>=4,b=b>>1|C<<7,f=(f<<8|T)>>>0}for(w=E,_=b>>4,y=0;4>y;y+=2){for(T=0,E=a.la>>4+y,b=g.la>>4+y,p=0;2>p;++p){for(C=1&b,v=0;2>v;++v)S=C+(1&E),E=E>>1|(C=0<(S=is(l,h[2],S,u.Qc,0,o,d)))<<3,T=T<<2|(3<S?3:1<S?2:0!=o[d+0]),d+=16;E>>=2,b=b>>1|C<<5}m|=T<<4*y,w|=E<<4<<y,_|=(240&b)<<y}a.la=w,g.la=_,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 Be(e,7,"Premature end-of-file encountered.")}if($e(e),s=t,r=1,i=(n=e).D,a=0<n.L&&n.M>=n.zb&&n.M<=n.Va,0==n.Aa)e:{if(i.M=n.M,i.uc=a,Ri(n,i),r=1,i=(T=n.D).Nb,a=(m=Ns[n.L])*n.R,l=m/2*n.B,p=16*i*n.R,v=8*i*n.B,h=n.sa,c=n.ta-a+p,u=n.qa,o=n.ra-l+v,d=n.Ha,g=n.Ia-l+v,b=0==(E=T.M),f=E>=n.Va-1,2==n.Aa&&Ri(n,T),T.uc)for(C=(S=n).D.M,ci(S.D.uc),T=S.yb;T<S.Hb;++T){_=T,w=C;var I=(A=(M=S).D).Nb;y=M.R;var A=A.wa[A.Y+_],P=M.sa,L=M.ta+16*I*y+16*_,k=A.dd,R=A.tc;if(0!=R)if(ci(3<=R),1==M.L)0<_&&_n(P,L,y,R+4),A.La&&wn(P,L,y,R),0<w&&Tn(P,L,y,R+4),A.La&&xn(P,L,y,R);else{var F=M.B,D=M.qa,V=M.ra+8*I*F+8*_,O=M.Ha,M=M.Ia+8*I*F+8*_;I=A.ld,0<_&&(un(P,L,y,R+4,k,I),gn(D,V,O,M,F,R+4,k,I)),A.La&&(mn(P,L,y,R,k,I),yn(D,V,O,M,F,R,k,I)),0<w&&(cn(P,L,y,R+4,k,I),dn(D,V,O,M,F,R+4,k,I)),A.La&&(fn(P,L,y,R,k,I),pn(D,V,O,M,F,R,k,I))}}if(n.ia&&alert("todo:DitherRow"),null!=s.put){if(T=16*E,E=16*(E+1),b?(s.y=n.sa,s.O=n.ta+p,s.f=n.qa,s.N=n.ra+v,s.ea=n.Ha,s.W=n.Ia+v):(T-=m,s.y=h,s.O=c,s.f=u,s.N=o,s.ea=d,s.W=g),f||(E-=m),E>s.o&&(E=s.o),s.F=null,s.J=null,null!=n.Fa&&0<n.Fa.length&&T<E&&(s.J=ni(n,s,T,E-T),s.F=n.mb,null==s.F&&0==s.F.length)){r=Be(n,3,"Could not decode alpha data.");break e}T<s.j&&(m=s.j-T,T=s.j,ci(!(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<E&&(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=E-T,r=s.put(s))}i+1!=n.Ic||f||(di(n.sa,n.ta-a,h,c+16*n.R,a),di(n.qa,n.ra-l,u,o+8*n.B,l),di(n.Ha,n.Ia-l,d,g+8*n.B,l))}if(!r)return Be(e,6,"Output aborted.")}return 1}(e,t)),null!=t.bc&&t.bc(t),i&=1}return i?(e.cb=0,i):0}function je(e,t,i,n,s){s=e[t+i+32*n]+(s>>3),e[t+i+32*n]=-256&s?0>s?0:255:s}function ze(e,t,i,n,s,r){je(e,t,0,i,n+s),je(e,t,1,i,n+r),je(e,t,2,i,n-r),je(e,t,3,i,n-s)}function Xe(e){return(20091*e>>16)+e}function Ke(e,t,i,n){var s,r=0,a=fi(16);for(s=0;4>s;++s){var o=e[t+0]+e[t+8],l=e[t+0]-e[t+8],h=(35468*e[t+4]>>16)-Xe(e[t+12]),c=Xe(e[t+4])+(35468*e[t+12]>>16);a[r+0]=o+c,a[r+1]=l+h,a[r+2]=l-h,a[r+3]=o-c,r+=4,t++}for(s=r=0;4>s;++s)o=(e=a[r+0]+4)+a[r+8],l=e-a[r+8],h=(35468*a[r+4]>>16)-Xe(a[r+12]),je(i,n,0,0,o+(c=Xe(a[r+4])+(35468*a[r+12]>>16))),je(i,n,1,0,l+h),je(i,n,2,0,l-h),je(i,n,3,0,o-c),r++,n+=32}function Je(e,t,i,n){var s=e[t+0]+4,r=35468*e[t+4]>>16,a=Xe(e[t+4]),o=35468*e[t+1]>>16;ze(i,n,0,s+a,e=Xe(e[t+1]),o),ze(i,n,1,s+r,e,o),ze(i,n,2,s-r,e,o),ze(i,n,3,s-a,e,o)}function qe(e,t,i,n,s){Ke(e,t,i,n),s&&Ke(e,t+16,i,n+4)}function Ze(e,t,i,n){rn(e,t+0,i,n,1),rn(e,t+32,i,n+128,1)}function Qe(e,t,i,n){var s;for(e=e[t+0]+4,s=0;4>s;++s)for(t=0;4>t;++t)je(i,n,t,s,e)}function et(e,t,i,n){e[t+0]&&ln(e,t+0,i,n),e[t+16]&&ln(e,t+16,i,n+4),e[t+32]&&ln(e,t+32,i,n+128),e[t+48]&&ln(e,t+48,i,n+128+4)}function tt(e,t,i,n){var s,r=fi(16);for(s=0;4>s;++s){var a=e[t+0+s]+e[t+12+s],o=e[t+4+s]+e[t+8+s],l=e[t+4+s]-e[t+8+s],h=e[t+0+s]-e[t+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=(e=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=e-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 it(e,t,i){var n,s=t-32,r=Fn,a=255-e[s-1];for(n=0;n<i;++n){var o,l=r,h=a+e[t-1];for(o=0;o<i;++o)e[t+o]=l[h+e[s+o]];t+=32}}function nt(e,t){it(e,t,4)}function st(e,t){it(e,t,8)}function rt(e,t){it(e,t,16)}function at(e,t){var i;for(i=0;16>i;++i)di(e,t+32*i,e,t-32,16)}function ot(e,t){var i;for(i=16;0<i;--i)gi(e,t,e[t-1],16),t+=32}function lt(e,t,i){var n;for(n=0;16>n;++n)gi(t,i+32*n,e,16)}function ht(e,t){var i,n=16;for(i=0;16>i;++i)n+=e[t-1+32*i]+e[t+i-32];lt(n>>5,e,t)}function ct(e,t){var i,n=8;for(i=0;16>i;++i)n+=e[t-1+32*i];lt(n>>4,e,t)}function ut(e,t){var i,n=8;for(i=0;16>i;++i)n+=e[t+i-32];lt(n>>4,e,t)}function dt(e,t){lt(128,e,t)}function gt(e,t,i){return e+2*t+i+2>>2}function ft(e,t){var i,n=t-32;n=new Uint8Array([gt(e[n-1],e[n+0],e[n+1]),gt(e[n+0],e[n+1],e[n+2]),gt(e[n+1],e[n+2],e[n+3]),gt(e[n+2],e[n+3],e[n+4])]);for(i=0;4>i;++i)di(e,t+32*i,n,0,n.length)}function mt(e,t){var i=e[t-1],n=e[t-1+32],s=e[t-1+64],r=e[t-1+96];w(e,t+0,16843009*gt(e[t-1-32],i,n)),w(e,t+32,16843009*gt(i,n,s)),w(e,t+64,16843009*gt(n,s,r)),w(e,t+96,16843009*gt(s,r,r))}function pt(e,t){var i,n=4;for(i=0;4>i;++i)n+=e[t+i-32]+e[t-1+32*i];for(n>>=3,i=0;4>i;++i)gi(e,t+32*i,n,4)}function yt(e,t){var i=e[t-1+0],n=e[t-1+32],s=e[t-1+64],r=e[t-1-32],a=e[t+0-32],o=e[t+1-32],l=e[t+2-32],h=e[t+3-32];e[t+0+96]=gt(n,s,e[t-1+96]),e[t+1+96]=e[t+0+64]=gt(i,n,s),e[t+2+96]=e[t+1+64]=e[t+0+32]=gt(r,i,n),e[t+3+96]=e[t+2+64]=e[t+1+32]=e[t+0+0]=gt(a,r,i),e[t+3+64]=e[t+2+32]=e[t+1+0]=gt(o,a,r),e[t+3+32]=e[t+2+0]=gt(l,o,a),e[t+3+0]=gt(h,l,o)}function Tt(e,t){var i=e[t+1-32],n=e[t+2-32],s=e[t+3-32],r=e[t+4-32],a=e[t+5-32],o=e[t+6-32],l=e[t+7-32];e[t+0+0]=gt(e[t+0-32],i,n),e[t+1+0]=e[t+0+32]=gt(i,n,s),e[t+2+0]=e[t+1+32]=e[t+0+64]=gt(n,s,r),e[t+3+0]=e[t+2+32]=e[t+1+64]=e[t+0+96]=gt(s,r,a),e[t+3+32]=e[t+2+64]=e[t+1+96]=gt(r,a,o),e[t+3+64]=e[t+2+96]=gt(a,o,l),e[t+3+96]=gt(o,l,l)}function _t(e,t){var i=e[t-1+0],n=e[t-1+32],s=e[t-1+64],r=e[t-1-32],a=e[t+0-32],o=e[t+1-32],l=e[t+2-32],h=e[t+3-32];e[t+0+0]=e[t+1+64]=r+a+1>>1,e[t+1+0]=e[t+2+64]=a+o+1>>1,e[t+2+0]=e[t+3+64]=o+l+1>>1,e[t+3+0]=l+h+1>>1,e[t+0+96]=gt(s,n,i),e[t+0+64]=gt(n,i,r),e[t+0+32]=e[t+1+96]=gt(i,r,a),e[t+1+32]=e[t+2+96]=gt(r,a,o),e[t+2+32]=e[t+3+96]=gt(a,o,l),e[t+3+32]=gt(o,l,h)}function xt(e,t){var i=e[t+0-32],n=e[t+1-32],s=e[t+2-32],r=e[t+3-32],a=e[t+4-32],o=e[t+5-32],l=e[t+6-32],h=e[t+7-32];e[t+0+0]=i+n+1>>1,e[t+1+0]=e[t+0+64]=n+s+1>>1,e[t+2+0]=e[t+1+64]=s+r+1>>1,e[t+3+0]=e[t+2+64]=r+a+1>>1,e[t+0+32]=gt(i,n,s),e[t+1+32]=e[t+0+96]=gt(n,s,r),e[t+2+32]=e[t+1+96]=gt(s,r,a),e[t+3+32]=e[t+2+96]=gt(r,a,o),e[t+3+64]=gt(a,o,l),e[t+3+96]=gt(o,l,h)}function wt(e,t){var i=e[t-1+0],n=e[t-1+32],s=e[t-1+64],r=e[t-1+96];e[t+0+0]=i+n+1>>1,e[t+2+0]=e[t+0+32]=n+s+1>>1,e[t+2+32]=e[t+0+64]=s+r+1>>1,e[t+1+0]=gt(i,n,s),e[t+3+0]=e[t+1+32]=gt(n,s,r),e[t+3+32]=e[t+1+64]=gt(s,r,r),e[t+3+64]=e[t+2+64]=e[t+0+96]=e[t+1+96]=e[t+2+96]=e[t+3+96]=r}function St(e,t){var i=e[t-1+0],n=e[t-1+32],s=e[t-1+64],r=e[t-1+96],a=e[t-1-32],o=e[t+0-32],l=e[t+1-32],h=e[t+2-32];e[t+0+0]=e[t+2+32]=i+a+1>>1,e[t+0+32]=e[t+2+64]=n+i+1>>1,e[t+0+64]=e[t+2+96]=s+n+1>>1,e[t+0+96]=r+s+1>>1,e[t+3+0]=gt(o,l,h),e[t+2+0]=gt(a,o,l),e[t+1+0]=e[t+3+32]=gt(i,a,o),e[t+1+32]=e[t+3+64]=gt(n,i,a),e[t+1+64]=e[t+3+96]=gt(s,n,i),e[t+1+96]=gt(r,s,n)}function vt(e,t){var i;for(i=0;8>i;++i)di(e,t+32*i,e,t-32,8)}function Et(e,t){var i;for(i=0;8>i;++i)gi(e,t,e[t-1],8),t+=32}function bt(e,t,i){var n;for(n=0;8>n;++n)gi(t,i+32*n,e,8)}function Ct(e,t){var i,n=8;for(i=0;8>i;++i)n+=e[t+i-32]+e[t-1+32*i];bt(n>>4,e,t)}function It(e,t){var i,n=4;for(i=0;8>i;++i)n+=e[t+i-32];bt(n>>3,e,t)}function At(e,t){var i,n=4;for(i=0;8>i;++i)n+=e[t-1+32*i];bt(n>>3,e,t)}function Pt(e,t){bt(128,e,t)}function Lt(e,t,i){var n=e[t-i],s=e[t+0],r=3*(s-n)+kn[1020+e[t-2*i]-e[t+i]],a=Rn[112+(r+4>>3)];e[t-i]=Fn[255+n+Rn[112+(r+3>>3)]],e[t+0]=Fn[255+s-a]}function kt(e,t,i,n){var s=e[t+0],r=e[t+i];return Dn[255+e[t-2*i]-e[t-i]]>n||Dn[255+r-s]>n}function Rt(e,t,i,n){return 4*Dn[255+e[t-i]-e[t+0]]+Dn[255+e[t-2*i]-e[t+i]]<=n}function Ft(e,t,i,n,s){var r=e[t-3*i],a=e[t-2*i],o=e[t-i],l=e[t+0],h=e[t+i],c=e[t+2*i],u=e[t+3*i];return 4*Dn[255+o-l]+Dn[255+a-h]>n?0:Dn[255+e[t-4*i]-r]<=s&&Dn[255+r-a]<=s&&Dn[255+a-o]<=s&&Dn[255+u-c]<=s&&Dn[255+c-h]<=s&&Dn[255+h-l]<=s}function Dt(e,t,i,n){var s=2*n+1;for(n=0;16>n;++n)Rt(e,t+n,i,s)&&Lt(e,t+n,i)}function Vt(e,t,i,n){var s=2*n+1;for(n=0;16>n;++n)Rt(e,t+n*i,1,s)&&Lt(e,t+n*i,1)}function Ot(e,t,i,n){var s;for(s=3;0<s;--s)Dt(e,t+=4*i,i,n)}function Mt(e,t,i,n){var s;for(s=3;0<s;--s)Vt(e,t+=4,i,n)}function Nt(e,t,i,n,s,r,a,o){for(r=2*r+1;0<s--;){if(Ft(e,t,i,r,a))if(kt(e,t,i,o))Lt(e,t,i);else{var l=e,h=t,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=kn[1020+3*(g-d)+kn[1020+u-f]])+63>>7,y=18*T+63>>7,T=9*T+63>>7;l[h-3*c]=Fn[255+l[h-3*c]+T],l[h-2*c]=Fn[255+u+y],l[h-c]=Fn[255+d+p],l[h+0]=Fn[255+g-p],l[h+c]=Fn[255+f-y],l[h+2*c]=Fn[255+m-T]}t+=n}}function Gt(e,t,i,n,s,r,a,o){for(r=2*r+1;0<s--;){if(Ft(e,t,i,r,a))if(kt(e,t,i,o))Lt(e,t,i);else{var l=e,h=t,c=i,u=l[h-c],d=l[h+0],g=l[h+c],f=Rn[112+((m=3*(d-u))+4>>3)],m=Rn[112+(m+3>>3)],p=f+1>>1;l[h-2*c]=Fn[255+l[h-2*c]+p],l[h-c]=Fn[255+u+m],l[h+0]=Fn[255+d-f],l[h+c]=Fn[255+g-p]}t+=n}}function Bt(e,t,i,n,s,r){Nt(e,t,i,1,16,n,s,r)}function Wt(e,t,i,n,s,r){Nt(e,t,1,i,16,n,s,r)}function Ht(e,t,i,n,s,r){var a;for(a=3;0<a;--a)Gt(e,t+=4*i,i,1,16,n,s,r)}function Yt(e,t,i,n,s,r){var a;for(a=3;0<a;--a)Gt(e,t+=4,1,i,16,n,s,r)}function $t(e,t,i,n,s,r,a,o){Nt(e,t,s,1,8,r,a,o),Nt(i,n,s,1,8,r,a,o)}function Ut(e,t,i,n,s,r,a,o){Nt(e,t,1,s,8,r,a,o),Nt(i,n,1,s,8,r,a,o)}function jt(e,t,i,n,s,r,a,o){Gt(e,t+4*s,s,1,8,r,a,o),Gt(i,n+4*s,s,1,8,r,a,o)}function zt(e,t,i,n,s,r,a,o){Gt(e,t+4,1,s,8,r,a,o),Gt(i,n+4,1,s,8,r,a,o)}function Xt(){this.ba=new Z,this.ec=[],this.cc=[],this.Mc=[],this.Dc=this.Nc=this.dc=this.fc=0,this.Oa=new ee,this.memory=0,this.Ib="OutputFunc",this.Jb="OutputAlphaFunc",this.Nd="OutputRowFunc"}function Kt(){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 Jt(){this.nc=this.Ea=this.b=this.hc=0,this.K=[],this.w=0}function qt(){this.ua=0,this.Wa=new I,this.vb=new I,this.md=this.xc=this.wc=0,this.vc=[],this.Wb=0,this.Ya=new r,this.yc=new n}function Zt(){this.xb=this.a=0,this.l=new Ne,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 qt,this.ab=0,this.gc=mi(4,Jt),this.Oc=0}function Qt(){this.Lc=this.Z=this.$a=this.i=this.c=0,this.l=new Ne,this.ic=0,this.ca=[],this.tb=0,this.qd=null,this.rd=0}function ei(e,t,i,n,s,r,a){for(e=null==e?0:e[t+0],t=0;t<a;++t)s[r+t]=e+i[n+t]&255,e=s[r+t]}function ti(e,t,i,n,s,r,a){var o;if(null==e)ei(null,null,i,n,s,r,a);else for(o=0;o<a;++o)s[r+o]=e[t+o]+i[n+o]&255}function ii(e,t,i,n,s,r,a){if(null==e)ei(null,null,i,n,s,r,a);else{var o,l=e[t+0],h=l,c=l;for(o=0;o<a;++o)h=c+(l=e[t+o])-h,c=i[n+o]+(-256&h?0>h?0:255:h)&255,h=l,s[r+o]=c}}function ni(e,t,i,n){var s=t.width,r=t.o;if(ci(null!=e&&null!=t),0>i||0>=n||i+n>r)return null;if(!e.Cc){if(null==e.ga){var a;if(e.ga=new Qt,(a=null==e.ga)||(a=t.width*t.o,ci(0==e.Gb.length),e.Gb=fi(a),e.Uc=0,null==e.Gb?a=0:(e.mb=e.Gb,e.nb=e.Uc,e.rc=null,a=1),a=!a),!a){a=e.ga;var o=e.Fa,l=e.P,c=e.qc,u=e.mb,d=e.nb,g=l+1,f=c-1,p=a.l;if(ci(null!=o&&null!=u&&null!=t),ms[0]=null,ms[1]=ei,ms[2]=ti,ms[3]=ii,a.ca=u,a.tb=d,a.c=t.width,a.i=t.height,ci(0<a.c&&0<a.i),1>=c)t=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)t=0;else if(p.put=re,p.ac=se,p.bc=ae,p.ma=a,p.width=t.width,p.height=t.height,p.Da=t.Da,p.v=t.v,p.va=t.va,p.j=t.j,p.o=t.o,a.$a)e:{ci(1==a.$a),t=xe();t:for(;;){if(null==t){t=0;break e}if(ci(null!=a),a.mc=t,t.c=a.c,t.i=a.i,t.l=a.l,t.l.ma=a,t.l.width=a.c,t.l.height=a.i,t.a=0,h(t.m,o,g,f),!we(a.c,a.i,1,t,null))break t;if(1==t.ab&&3==t.gc[0].hc&&me(t.s)?(a.ic=1,o=t.c*t.i,t.Ta=null,t.Ua=0,t.V=fi(o),t.Ba=0,null==t.V?(t.a=1,t=0):t=1):(a.ic=0,t=Se(t,a.c)),!t)break t;t=1;break e}a.mc=null,t=0}else t=f>=a.c*a.i;a=!t}if(a)return null;1!=e.ga.Lc?e.Ga=0:n=r-i}ci(null!=e.ga),ci(i+n<=r);e:{if(t=(o=e.ga).c,r=o.l.o,0==o.$a){if(g=e.rc,f=e.Vc,p=e.Fa,l=e.P+1+i*t,c=e.mb,u=e.nb+i*t,ci(l<=e.P+e.qc),0!=o.Z)for(ci(null!=ms[o.Z]),a=0;a<n;++a)ms[o.Z](g,f,p,l,c,u,t),g=c,f=u,u+=t,l+=t;else for(a=0;a<n;++a)di(c,u,p,l,t),g=c,f=u,u+=t,l+=t;e.rc=g,e.Vc=f}else{if(ci(null!=o.mc),t=i+n,ci(null!=(a=o.mc)),ci(t<=a.i),a.C>=t)t=1;else if(o.ic||li(),o.ic){o=a.V,g=a.Ba,f=a.c;var T=a.i,_=(p=1,l=a.$/f,c=a.$%f,u=a.m,d=a.s,a.$),x=f*T,w=f*t,S=d.wc,v=_<w?de(d,c,l):null;ci(_<=x),ci(t<=T),ci(me(d));t:for(;;){for(;!u.h&&_<w;){if(c&S||(v=de(d,c,l)),ci(null!=v),y(u),256>(T=ce(v.G[0],v.H[0],u)))o[g+_]=T,++_,++c>=f&&(c=0,++l<=t&&!(l%16)&&ye(a,l));else{if(!(280>T)){p=0;break t}T=le(T-256,u);var E,b=ce(v.G[4],v.H[4],u);if(y(u),!(_>=(b=he(f,b=le(b,u)))&&x-_>=T)){p=0;break t}for(E=0;E<T;++E)o[g+_+E]=o[g+_+E-b];for(_+=T,c+=T;c>=f;)c-=f,++l<=t&&!(l%16)&&ye(a,l);_<w&&c&S&&(v=de(d,c,l))}ci(u.h==m(u))}ye(a,l>t?t:l);break t}!p||u.h&&_<x?(p=0,a.a=u.h?5:3):a.$=_,t=p}else t=Te(a,a.V,a.Ba,a.c,a.i,t,ve);if(!t){n=0;break e}}i+n>=r&&(e.Cc=1),n=1}if(!n)return null;if(e.Cc&&(null!=(n=e.ga)&&(n.mc=null),e.ga=null,0<e.Ga))return alert("todo:WebPDequantizeLevels"),null}return e.nb+i*s}function si(e,t,i,n,s,r){for(;0<s--;){var a,o=e,l=t+(i?1:0),h=e,c=t+(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)}t+=r}}function ri(e,t,i,n,s){for(;0<n--;){var r;for(r=0;r<i;++r){var a=e[t+2*r+0],o=15&(h=e[t+2*r+1]),l=4369*o,h=(240&h|h>>4)*l>>16;e[t+2*r+0]=(240&a|a>>4)*l>>16&240|(15&a|a<<4)*l>>16>>4&15,e[t+2*r+1]=240&h|o}t+=s}}function ai(e,t,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=e[t+l];r[a+4*l]=u,c&=u}t+=i,a+=o}return 255!=c}function oi(e,t,i,n,s){var r;for(r=0;r<s;++r)i[n+r]=e[t+r]>>8}function li(){Sn=si,vn=ri,En=ai,bn=oi}function hi(e,t,i){self[e]=function(e,n,s,r,a,o,l,h,c,u,d,g,f,m,p,y,T){var _,x=T-1>>1,w=a[o+0]|l[h+0]<<16,S=c[u+0]|d[g+0]<<16;ci(null!=e);var v=3*w+S+131074>>2;for(t(e[n+0],255&v,v>>16,f,m),null!=s&&(v=3*S+w+131074>>2,t(s[r+0],255&v,v>>16,p,y)),_=1;_<=x;++_){var E=a[o+_]|l[h+_]<<16,b=c[u+_]|d[g+_]<<16,C=w+E+S+b+524296,I=C+2*(E+S)>>3;v=I+w>>1,w=(C=C+2*(w+b)>>3)+E>>1,t(e[n+2*_-1],255&v,v>>16,f,m+(2*_-1)*i),t(e[n+2*_-0],255&w,w>>16,f,m+(2*_-0)*i),null!=s&&(v=C+S>>1,w=I+b>>1,t(s[r+2*_-1],255&v,v>>16,p,y+(2*_-1)*i),t(s[r+2*_+0],255&w,w>>16,p,y+(2*_+0)*i)),w=E,S=b}1&T||(v=3*w+S+131074>>2,t(e[n+T-1],255&v,v>>16,f,m+(T-1)*i),null!=s&&(v=3*S+w+131074>>2,t(s[r+T-1],255&v,v>>16,p,y+(T-1)*i)))}}function yi(){ps[Vn]=ys,ps[On]=_s,ps[Mn]=Ts,ps[Nn]=xs,ps[Gn]=ws,ps[Bn]=Ss,ps[Wn]=vs,ps[Hn]=_s,ps[Yn]=xs,ps[$n]=ws,ps[Un]=Ss}function Ti(e){return e&~Ps?0>e?0:255:e>>As}function _i(e,t){return Ti((19077*e>>8)+(26149*t>>8)-14234)}function xi(e,t,i){return Ti((19077*e>>8)-(6419*t>>8)-(13320*i>>8)+8708)}function wi(e,t){return Ti((19077*e>>8)+(33050*t>>8)-17685)}function Si(e,t,i,n,s){n[s+0]=_i(e,i),n[s+1]=xi(e,t,i),n[s+2]=wi(e,t)}function vi(e,t,i,n,s){n[s+0]=wi(e,t),n[s+1]=xi(e,t,i),n[s+2]=_i(e,i)}function Ei(e,t,i,n,s){var r=xi(e,t,i);t=r<<3&224|wi(e,t)>>3,n[s+0]=248&_i(e,i)|r>>5,n[s+1]=t}function bi(e,t,i,n,s){var r=240&wi(e,t)|15;n[s+0]=240&_i(e,i)|xi(e,t,i)>>4,n[s+1]=r}function Ci(e,t,i,n,s){n[s+0]=255,Si(e,t,i,n,s+1)}function Ii(e,t,i,n,s){vi(e,t,i,n,s),n[s+3]=255}function Ai(e,t,i,n,s){Si(e,t,i,n,s),n[s+3]=255}function Me(e,t){return 0>e?0:e>t?t:e}function Pi(e,t,i){self[e]=function(e,n,s,r,a,o,l,h,c){for(var u=h+(-2&c)*i;h!=u;)t(e[n+0],s[r+0],a[o+0],l,h),t(e[n+1],s[r+0],a[o+0],l,h+i),n+=2,++r,++o,h+=2*i;1&c&&t(e[n+0],s[r+0],a[o+0],l,h)}}function Li(e,t,i){return 0==i?0==e?0==t?6:5:0==t?4:0:i}function ki(e,t,i,n,s){switch(e>>>30){case 3:rn(t,i,n,s,0);break;case 2:an(t,i,n,s);break;case 1:ln(t,i,n,s)}}function Ri(e,t){var i,n,s=t.M,r=t.Nb,a=e.oc,o=e.pc+40,l=e.oc,h=e.pc+584,c=e.oc,u=e.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:(gi(a,o-32-1,127,21),gi(l,h-32-1,127,9),gi(c,u-32-1,127,9)),n=0;n<e.za;++n){var d=t.ya[t.aa+n];if(0<n){for(i=-1;16>i;++i)di(a,o+32*i-4,a,o+32*i+12,4);for(i=-1;8>i;++i)di(l,h+32*i-4,l,h+32*i+4,4),di(c,u+32*i-4,c,u+32*i+4,4)}var g=e.Gd,f=e.Hd+n,m=d.ad,p=d.Hc;if(0<s&&(di(a,o-32,g[f].y,0,16),di(l,h-32,g[f].f,0,8),di(c,u-32,g[f].ea,0,8)),d.Za){var y=a,T=o-32+16;for(0<s&&(n>=e.za-1?gi(y,T,g[f].y[15],4):di(y,T,g[f+1].y,0,4)),i=0;4>i;i++)y[T+128+i]=y[T+256+i]=y[T+384+i]=y[T+0+i];for(i=0;16>i;++i,p<<=2)y=a,T=o+Ms[i],us[d.Ob[i]](y,T),ki(p,m,16*+i,y,T)}else if(y=Li(n,s,d.Ob[0]),cs[y](a,o),0!=p)for(i=0;16>i;++i,p<<=2)ki(p,m,16*+i,a,o+Ms[i]);for(i=d.Gc,y=Li(n,s,d.Dd),ds[y](l,h),ds[y](c,u),p=m,y=l,T=h,255&(d=i>>0)&&(170&d?on(p,256,y,T):hn(p,256,y,T)),d=c,p=u,255&(i>>=8)&&(170&i?on(m,320,d,p):hn(m,320,d,p)),s<e.Ub-1&&(di(g[f].y,0,a,o+480,16),di(g[f].f,0,l,h+224,8),di(g[f].ea,0,c,u+224,8)),i=8*r*e.B,g=e.sa,f=e.ta+16*n+16*r*e.R,m=e.qa,d=e.ra+8*n+i,p=e.Ha,y=e.Ia+8*n+i,i=0;16>i;++i)di(g,f+i*e.R,a,o+32*i,16);for(i=0;8>i;++i)di(m,d+i*e.B,l,h+32*i,8),di(p,y+i*e.B,c,u+32*i,8)}}function Fi(e,t,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 Kt;if(null==e||12>i)return 7;m.data=e,m.w=t,m.ha=i,t=[t],i=[i],m.gb=[m.gb];e:{var p=t,y=i,T=m.gb;if(ci(null!=e),ci(null!=y),ci(null!=T),T[0]=0,12<=y[0]&&!ui(e,p[0],"RIFF")){if(ui(e,p[0]+8,"WEBP")){T=3;break e}var _=E(e,p[0]+4);if(12>_||4294967286<_){T=3;break e}if(f&&_>y[0]-8){T=7;break e}T[0]=_,p[0]+=12,y[0]-=12}T=0}if(0!=T)return T;for(_=0<m.gb[0],i=i[0];;){e:{var x=e;y=t,T=i;var w=c,S=u,b=p=[0];if((A=d=[d])[0]=0,8>T[0])T=7;else{if(!ui(x,y[0],"VP8X")){if(10!=E(x,y[0]+4)){T=3;break e}if(18>T[0]){T=7;break e}var C=E(x,y[0]+8),I=1+v(x,y[0]+12);if(2147483648<=I*(x=1+v(x,y[0]+15))){T=3;break e}null!=b&&(b[0]=C),null!=w&&(w[0]=I),null!=S&&(S[0]=x),y[0]+=18,T[0]-=18,A[0]=1}T=0}}if(d=d[0],p=p[0],0!=T)return T;if(y=!!(2&p),!_&&d)return 3;if(null!=r&&(r[0]=!!(16&p)),null!=a&&(a[0]=y),null!=o&&(o[0]=0),a=c[0],p=u[0],d&&y&&null==l){T=0;break}if(4>i){T=7;break}if(_&&d||!_&&!d&&!ui(e,t[0],"ALPH")){i=[i],m.na=[m.na],m.P=[m.P],m.Sa=[m.Sa];e:{C=e,T=t,_=i;var A=m.gb;w=m.na,S=m.P,b=m.Sa;I=22,ci(null!=C),ci(null!=_),x=T[0];var P=_[0];for(ci(null!=w),ci(null!=b),w[0]=null,S[0]=null,b[0]=0;;){if(T[0]=x,_[0]=P,8>P){T=7;break e}var L=E(C,x+4);if(4294967286<L){T=3;break e}var k=8+L+1&-2;if(I+=k,0<A&&I>A){T=3;break e}if(!ui(C,x,"VP8 ")||!ui(C,x,"VP8L")){T=0;break e}if(P[0]<k){T=7;break e}ui(C,x,"ALPH")||(w[0]=C,S[0]=x+8,b[0]=L),x+=k,P-=k}}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];e:if(A=e,T=t,_=i,w=m.gb[0],S=m.Ja,b=m.xa,C=T[0],x=!ui(A,C,"VP8 "),I=!ui(A,C,"VP8L"),ci(null!=A),ci(null!=_),ci(null!=S),ci(null!=b),8>_[0])T=7;else{if(x||I){if(A=E(A,C+4),12<=w&&A>w-12){T=3;break e}if(f&&A>_[0]-8){T=7;break e}S[0]=A,T[0]+=8,_[0]-=8,b[0]=I}else b[0]=5<=_[0]&&47==A[C+0]&&!(A[C+4]>>5),S[0]=_[0];T=0}if(i=i[0],m.Ja=m.Ja[0],m.xa=m.xa[0],t=t[0],0!=T)break;if(4294967286<m.Ja)return 3;if(null==o||y||(o[0]=m.xa?2:1),a=[a],p=[p],m.xa){if(5>i){T=7;break}o=a,f=p,y=r,null==e||5>i?e=0:5<=i&&47==e[t+0]&&!(e[t+4]>>5)?(_=[0],A=[0],w=[0],h(S=new g,e,t,i),oe(S,_,A,w)?(null!=o&&(o[0]=_[0]),null!=f&&(f[0]=A[0]),null!=y&&(y[0]=w[0]),e=1):e=0):e=0}else{if(10>i){T=7;break}o=p,null==e||10>i||!We(e,t+3,i-3)?e=0:(f=e[t+0]|e[t+1]<<8|e[t+2]<<16,y=16383&(e[t+7]<<8|e[t+6]),e=16383&(e[t+9]<<8|e[t+8]),1&f||3<(f>>1&7)||!(f>>4&1)||f>>5>=m.Ja||!y||!e?e=0:(a&&(a[0]=y),o&&(o[0]=e),e=1))}if(!e)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=t-l.w,ci(4294967286>t-l.w),ci(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 Di(e,t,i){var n=t.width,s=t.height,r=0,a=0,o=n,l=s;if(t.Da=null!=e&&0<e.Da,t.Da&&(o=e.cd,l=e.bd,r=e.v,a=e.j,11>i||(r&=-2,a&=-2),0>r||0>a||0>=o||0>=l||r+o>n||a+l>s))return 0;if(t.v=r,t.j=a,t.va=r+o,t.o=a+l,t.U=o,t.T=l,t.da=null!=e&&0<e.da,t.da){if(!A(o,l,i=[e.ib],r=[e.hb]))return 0;t.ib=i[0],t.hb=r[0]}return t.ob=null!=e&&e.ob,t.Kb=null==e||!e.Sd,t.da&&(t.ob=t.ib<3*n/4&&t.hb<3*s/4,t.Kb=0),1}function Vi(e){if(null==e)return 2;if(11>e.S){var t=e.f.RGBA;t.fb+=(e.height-1)*t.A,t.A=-t.A}else t=e.f.kb,e=e.height,t.O+=(e-1)*t.fa,t.fa=-t.fa,t.N+=(e-1>>1)*t.Ab,t.Ab=-t.Ab,t.W+=(e-1>>1)*t.Db,t.Db=-t.Db,null!=t.F&&(t.J+=(e-1)*t.lb,t.lb=-t.lb);return 0}function Oi(e,t,i,n){if(null==n||0>=e||0>=t)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>e||o+r>t)return 2;e=s,t=r}if(i.da){if(!A(e,t,s=[i.ib],r=[i.hb]))return 2;e=s[0],t=r[0]}}n.width=e,n.height=t;e:{var l=n.width,h=n.height;if(e=n.S,0>=l||0>=h||!(e>=Vn&&13>e))e=2;else{if(0>=n.Rd&&null==n.sd){a=r=s=t=0;var c=(o=l*Ws[e])*h;if(11>e||(r=(h+1)/2*(t=(l+1)/2),12==e&&(a=(s=l)*h)),null==(h=fi(c+2*r+a))){e=1;break e}n.sd=h,11>e?((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=t,l.Cd=r,l.ea=h,l.W=0+c+r,l.Db=t,l.Ed=r,12==e&&(l.F=h,l.J=0+c+2*r),l.Tc=a,l.lb=s)}if(t=1,s=n.S,r=n.width,a=n.height,s>=Vn&&13>s)if(11>s)e=n.f.RGBA,t&=(o=Math.abs(e.A))*(a-1)+r<=e.size,t&=o>=r*Ws[s],t&=null!=e.eb;else{e=n.f.kb,o=(r+1)/2,c=(a+1)/2,l=Math.abs(e.fa);h=Math.abs(e.Ab);var u=Math.abs(e.Db),d=Math.abs(e.lb),g=d*(a-1)+r;t&=l*(a-1)+r<=e.Fd,t&=h*(c-1)+o<=e.Cd,t=(t&=u*(c-1)+o<=e.Ed)&l>=r&h>=o&u>=o,t&=null!=e.y,t&=null!=e.f,t&=null!=e.ea,12==s&&(t&=d>=r,t&=g<=e.Tc,t&=null!=e.F)}else t=0;e=t?0:2}}return 0!=e||null!=i&&i.fd&&(e=Vi(n)),e}var Mi=64,Ni=[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],Gi=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];k("Predictor0","PredictorAdd0"),self.Predictor0=function(){return 4278190080},self.Predictor1=function(e){return e},self.Predictor2=function(e,t,i){return t[i+0]},self.Predictor3=function(e,t,i){return t[i+1]},self.Predictor4=function(e,t,i){return t[i-1]},self.Predictor5=function(e,t,i){return F(F(e,t[i+1]),t[i+0])},self.Predictor6=function(e,t,i){return F(e,t[i-1])},self.Predictor7=function(e,t,i){return F(e,t[i+0])},self.Predictor8=function(e,t,i){return F(t[i-1],t[i+0])},self.Predictor9=function(e,t,i){return F(t[i+0],t[i+1])},self.Predictor10=function(e,t,i){return F(F(e,t[i-1]),F(t[i+0],t[i+1]))},self.Predictor11=function(e,t,i){var n=t[i+0];return 0>=O(n>>24&255,e>>24&255,(t=t[i-1])>>24&255)+O(n>>16&255,e>>16&255,t>>16&255)+O(n>>8&255,e>>8&255,t>>8&255)+O(255&n,255&e,255&t)?n:e},self.Predictor12=function(e,t,i){var n=t[i+0];return(D((e>>24&255)+(n>>24&255)-((t=t[i-1])>>24&255))<<24|D((e>>16&255)+(n>>16&255)-(t>>16&255))<<16|D((e>>8&255)+(n>>8&255)-(t>>8&255))<<8|D((255&e)+(255&n)-(255&t)))>>>0},self.Predictor13=function(e,t,i){var n=t[i-1];return(V((e=F(e,t[i+0]))>>24&255,n>>24&255)<<24|V(e>>16&255,n>>16&255)<<16|V(e>>8&255,n>>8&255)<<8|V(e>>0&255,n>>0&255))>>>0};var Yi=self.PredictorAdd0;self.PredictorAdd1=M,k("Predictor2","PredictorAdd2"),k("Predictor3","PredictorAdd3"),k("Predictor4","PredictorAdd4"),k("Predictor5","PredictorAdd5"),k("Predictor6","PredictorAdd6"),k("Predictor7","PredictorAdd7"),k("Predictor8","PredictorAdd8"),k("Predictor9","PredictorAdd9"),k("Predictor10","PredictorAdd10"),k("Predictor11","PredictorAdd11"),k("Predictor12","PredictorAdd12"),k("Predictor13","PredictorAdd13");var $i=self.PredictorAdd2;W("ColorIndexInverseTransform","MapARGB","32b",(function(e){return e>>8&255}),(function(e){return e})),W("VP8LColorIndexInverseTransformAlpha","MapAlpha","8b",(function(e){return e}),(function(e){return e>>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,en,tn,nn,sn,rn,an,on,ln,hn,cn,un,dn,gn,fn,mn,pn,yn,Tn,_n,xn,wn,Sn,vn,En,bn,Cn=fi(511),In=fi(2041),An=fi(225),Pn=fi(767),Ln=0,kn=In,Rn=An,Fn=Pn,Dn=Cn,Vn=0,On=1,Mn=2,Nn=3,Gn=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,es=[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],ts=[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=[];hi("UpsampleRgbLinePair",Si,3),hi("UpsampleBgrLinePair",vi,3),hi("UpsampleRgbaLinePair",Ai,4),hi("UpsampleBgraLinePair",Ii,4),hi("UpsampleArgbLinePair",Ci,4),hi("UpsampleRgba4444LinePair",bi,2),hi("UpsampleRgb565LinePair",Ei,2);var ys=window.UpsampleRgbLinePair,Ts=window.UpsampleBgrLinePair,_s=window.UpsampleRgbaLinePair,xs=window.UpsampleBgraLinePair,ws=window.UpsampleArgbLinePair,Ss=window.UpsampleRgba4444LinePair,vs=window.UpsampleRgb565LinePair,Es=16,bs=1<<Es-1,Cs=-227,Is=482,As=6,Ps=(256<<As)-1,Ls=0,ks=fi(256),Rs=fi(256),Fs=fi(256),Ds=fi(256),Vs=fi(Is-Cs),Os=fi(Is-Cs);Pi("YuvToRgbRow",Si,3),Pi("YuvToBgrRow",vi,3),Pi("YuvToRgbaRow",Ai,4),Pi("YuvToBgraRow",Ii,4),Pi("YuvToArgbRow",Ci,4),Pi("YuvToRgba4444Row",bi,2),Pi("YuvToRgb565Row",Ei,2);var Ms=[0,4,8,12,128,132,136,140,256,260,264,268,384,388,392,396],Ns=[0,2,8],Gs=[8,7,6,4,4,2,2,2,1,1,1,1],Bs=1;this.WebPDecodeRGBA=function(e,t,i,n,s){var r=On,a=new Xt,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==e)var d=2;else ci(null!=u),d=Fi(e,t,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);e:{if(n=new Ne,(s=new Kt).data=e,s.w=t,s.ha=i,s.kd=1,t=[0],ci(null!=s),(0==(e=Fi(s.data,s.w,s.ha,null,null,null,t,null,s))||7==e)&&t[0]&&(e=4),0==(t=e)){if(ci(null!=a),n.data=s.data,n.w=s.w+s.offset,n.ha=s.ha-s.offset,n.put=re,n.ac=se,n.bc=ae,n.ma=a,s.xa){if(null==(e=xe())){a=1;break e}if(function(e,t){var i=[0],n=[0],s=[0];t:for(;;){if(null==e)return 0;if(null==t)return e.a=2,0;if(e.l=t,e.a=0,h(e.m,t.data,t.w,t.ha),!oe(e.m,i,n,s)){e.a=3;break t}if(e.xb=fs,t.width=i[0],t.height=n[0],!we(i[0],n[0],1,e,null))break t;return 1}return ci(0!=e.a),0}(e,n)){if(n=0==(t=Oi(n.width,n.height,a.Oa,a.ba))){t:{n=e;i:for(;;){if(null==n){n=0;break t}if(ci(null!=n.s.yc),ci(null!=n.s.Ya),ci(0<n.s.Wb),ci(null!=(i=n.l)),ci(null!=(s=i.ma)),0!=n.xb){if(n.ca=s.ba,n.tb=s.tb,ci(null!=n.ca),!Di(s.Oa,i,Nn)){n.a=2;break i}if(!Se(n,i.width))break i;if(i.da)break i;if((i.da||K(n.ca.S))&&li(),11>n.ca.S||(alert("todo:WebPInitConvertARGBToYUV"),null!=n.ca.f.kb.F&&li()),n.Pb&&0<n.s.ua&&null==n.s.vb.X&&!b(n.s.vb,n.s.Wa.Xa)){n.a=1;break i}n.xb=0}if(!Te(n,n.V,n.Ba,n.c,n.i,i.o,fe))break i;s.Dc=n.Ma,n=1;break t}ci(0!=n.a),n=0}n=!n}n&&(t=e.a)}else t=e.a}else{if(null==(e=new Ge)){a=1;break e}if(e.Fa=s.na,e.P=s.P,e.qc=s.Sa,He(e,n)){if(0==(t=Oi(n.width,n.height,a.Oa,a.ba))){if(e.Aa=0,i=a.Oa,ci(null!=(s=e)),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*Gs[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)}Ue(e,n)||(t=e.a)}}else t=e.a}0==t&&null!=a.Oa&&a.Oa.fd&&(t=Vi(a.ba))}a=t}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(e,t){var i={},n=0,s=!1,r=0,a=0;if(i.frames=[],!function(e,t,i,n){for(var s=0;s<n;s++)if(e[t+s]!=i.charCodeAt(s))return!0;return!1}(e,t,"RIFF",4)){for(_i(e,t+=4),t+=8;t<e.length;){var o=yi(e,t),l=_i(e,t+=4);t+=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:t-8,d.src_size=r+l+8,n++,s&&(s=!1,r=0,a=0);break;case"VP8X":(d=i.header={}).feature_flags=e[t];var c=t+4;d.canvas_width=1+Ti(e,c),c+=3,d.canvas_height=1+Ti(e,c),c+=3;break;case"ALPH":s=!0,r=h+8,a=t-8;break;case"ANIM":(d=i.header).bgcolor=_i(e,t),c=t+4,d.loop_count=(g=e)[(f=c)+0]<<0|g[f+1]<<8,c+=2;break;case"ANMF":var u,d;(d=i.frames[n]={}).offset_x=2*Ti(e,t),t+=3,d.offset_y=2*Ti(e,t),t+=3,d.width=1+Ti(e,t),t+=3,d.height=1+Ti(e,t),t+=3,d.duration=Ti(e,t),t+=3,u=e[t++],d.dispose=1&u,d.blend=u>>1&1}"ANMF"!=o&&(t+=h)}var g,f;return i}},window.ApicTools={parseGIF:e,decompressFrames:t},F.FlexSetNames={NoSet:1,Auto:2,Row:3,RowReverse:4,Column:5,ColumnReverse:6,NoWrap:7,Wrap:8,WrapReverse:9,FlexStart:10,FlexEnd:11,Center:12,SpaceBetween:13,SpaceAround:14,SpaceEvenly:15,Stretch:16,Baseline:17},F.FlexContainerProps=class{constructor(){this.flexDirection=F.FlexSetNames.Row,this.flexWrap=F.FlexSetNames.NoWrap,this.justifyContent=F.FlexSetNames.FlexStart,this.alignItems=F.FlexSetNames.Center,this.alignContent=F.FlexSetNames.FlexStart}},F.FlexItemProps=class{constructor(){this.alignSelf=F.FlexSetNames.NoSet,this.flexGrow=0}},console.log("Using JsView HTML Forge");let xi=F;class wi{static StringToInt32(e){let t=P.InvalidInt32,i=parseInt(e);return 0==isNaN(i)&&(t=i),t}static StringTrim(e){return e.trim()}static StringStartsWith(e,t){return e.startsWith(t)}static StringEndsWith(e,t){return e.endsWith(t)}static StringSplit(e,t=" ",i=0,n=0,s=!1){e||(e=""),0==n&&(n=e.length-1);let r=(e=e.substring(i,n+1)).trim().split(t),a=[];for(let e of r)e&&(s&&(e=e.trim(),0==e.length)||a.push(e));return a}static MergeBrackets(e,t=null){let i=[],n="",s=null,r=null,a=0,o=!1;for(let l of e){let e=0;for(;e<l.length;)if(a>0){let t=l.indexOf(")",e),i=l.indexOf("(",e);if(-1!=i&&(-1==t||i<t))a++,e=i+1;else{if(!(t>=0))break;a--,e=t+1}}else{let t=l.indexOf("(",e);if(-1==t)break;a++,e=t+1}o?(t&&(n+=t),n+=l):null!=s?(n+=s,t&&(n+=t),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(e,t){if(t.is(P.DataType.Null))return 0;if(t.is(P.DataType.String)){const e=t.get();if(""===e)return 0;if(wi.StringTrim(e),wi.StringEndsWith(e,"px")){const t='JsView Warning: Using px will make style performance lower, you can directly use numbers instead of "'+e+'".';console.warn(t)}return wi.StringToInt32(e)}return t.is(P.DataType.Int32)||t.is(P.DataType.Float)?t.get():(E(_.InvalidArgument,P.InvalidInt32,["Failed to convert style ",e,"=",t.toString(),", value type is supported."]),P.InvalidInt32)}static ConvertToFloat(e,t){return t.is(P.DataType.Null)?P.InvalidFloat:t.is(P.DataType.String)&&""===t.get()?0:t.is(P.DataType.Int32)||t.is(P.DataType.Float)?t.get():(E(_.InvalidArgument,P.InvalidFloat,["Failed to convert style ",e,"=",t.toString(),", value type is supported."]),P.InvalidFloat)}static ConvertToString(e,t,i=!1){if(t.is(P.DataType.Null))return P.InvalidPointer;0==t.is(P.DataType.String)&&E(_.InvalidArgument,P.InvalidPointer,["Failed to convert style ",e,"=",t.toString(),", type is not string."]);let n=t.get();return null==n||n.length<=0?P.InvalidPointer:(i&&(n=n.toUpperCase()),n)}static ConvertToCorner(e,t){if(t.is(P.DataType.Null))return P.InvalidPointer;let i=null;if(t.is(P.DataType.Int32)){const e=t.get();i=new P.CornerImpl(String(e)),i.topLeft=e,i.topRight=e,i.bottomRight=e,i.bottomLeft=e}else if(t.is(P.DataType.String)){const e=t.get();if(null==e||e.length<=0)return P.InvalidPointer;const n=wi.StringSplit(e),s=n.length;i=new P.CornerImpl(e),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 E(_.InvalidArgument,P.InvalidPointer,["Failed to convert style ",e,"=",t.toString(),", type is not number or string."]);return i}static ConvertToRect(e,t){if(t.is(P.DataType.Null))return P.InvalidPointer;0==t.is(P.DataType.String)&&E(_.InvalidArgument,P.InvalidPointer,["Failed to convert style "+e+"="+t+", value type is not string."]);const i=t.get();if(null==i||i.length<=0)return P.InvalidPointer;const n=new P.RectImpl(i),s=wi.StringSplit(i),r=s.length;return n.top=r>0?parseInt(s[0]):0,n.right=r>1?parseInt(s[1]):n.top,n.bottom=r>2?parseInt(s[2]):n.top,n.left=r>3?parseInt(s[3]):n.right,n}static ConvertToAnimation(e,t,i=null){if(t.is(P.DataType.Null))return P.InvalidPointer;0==t.is(P.DataType.String)&&E(_.InvalidArgument,P.InvalidPointer,["Failed to convert style ",e,"=",t.toString(),", type is not string."]);const n=t.get();if(null==n||n.length<=0)return P.InvalidPointer;if(null!=i&&null!=i.rawValue&&i.rawValue==n)return i;return wi.ParseToAnimation(n)}static ConvertToTransition(e,t,i=null){if(t.is(P.DataType.Null))return P.InvalidPointer;0==t.is(P.DataType.String)&&E(_.InvalidArgument,P.InvalidPointer,["Failed to convert style ",e,"=",t.toString(),", type is not string."]);const n=t.get();if(null==n||n.length<=0)return P.InvalidPointer;if(null!=i&&null!=i.rawValue&&i.rawValue==n)return i;let s=[];const r=wi.StringSplit(n,",");for(let e=0;e<r.length;e++)if(r[e].indexOf("(")>=0){let t=e;for(;t<r.length&&r[t].indexOf(")")<0;)t++;let i="";for(let n=e;n<=t;n++)n!=e&&(i+=","),i+=r[n];e=t,s.push(i)}else s.push(r[e]);const a=new P.TransitionImpl(n);for(const t of s){const i=wi.ConvertToAnimation(e,new P(t));if(null!=i&&(a.animationMap.set(i.name,i),"all"==i?.name)){const e=["opacity","left","top","width","height","transform"];for(const t of e)a.animationMap.set(t,i)}}return a}static ConvertToTextShadow(e,t){if(t.is(P.DataType.Null))return P.InvalidPointer;0==t.is(P.DataType.String)&&E(_.InvalidArgument,P.InvalidPointer,["Failed to convert style ",e,"=",t.toString(),", type is not string."]);const i=t.get();if(null==i||i.length<=0)return P.InvalidPointer;const n=new P.TextShadowImpl(i),s=wi.StringSplit(i);s.length>0&&(n.hShadow=parseInt(s[0])),s.length>1&&(n.vShadow=parseInt(s[1])),s.length>2&&(n.blur=parseInt(s[2]));let r=-1;return 3==s.length?r=2:s.length>3&&(r=3),r>0&&(n.color=s[r]),n}static ConvertToWebkitTextStroke(e,t){if(t.is(P.DataType.Null))return P.InvalidPointer;0==t.is(P.DataType.String)&&E(_.InvalidArgument,P.InvalidPointer,["Failed to convert style ",e,"=",t.toString(),", type is not string."]);const i=t.get();if(null==i||i.length<=0)return P.InvalidPointer;const n=new P.WebkitTextStrokeImpl(i),s=wi.StringSplit(i);return s.length>0&&(n.length=parseInt(s[0])),s.length>1&&(n.color=s[1]),n}static ConvertToBorderImage(e,t){if(t.is(P.DataType.Null))return P.InvalidPointer;0==t.is(P.DataType.String)&&E(_.InvalidArgument,P.InvalidPointer,["Failed to convert style ",e,"=",t.toString(),", type is not string."]);const i=t.get();if(null==i||i.length<=0)return P.InvalidPointer;const n=new P.BorderImageImpl(i),s=wi.StringSplit(i),r=s.length;return r>0&&(n.source=s[0]),r>1&&(n.slice=wi.ConvertToRect(e,new P(s[1]))),n}static ConvertToBackgroundImage(e,t){if(t.is(P.DataType.Null))return P.InvalidPointer;0==t.is(P.DataType.String)&&E(_.InvalidArgument,P.InvalidPointer,["Failed to convert style ",e,"=",t.toString(),", type is not string."]);let i=t.get();if(null==i||i.length<=0)return P.InvalidPointer;const n=new P.BackgroundImageImpl(i),s="linear-gradient(";if(0==i.indexOf(s)){i=wi.StringTrim(i),n.type=P.BackgroundImageImpl.eType.LINEAR_GRADIENT,n.linearGradient=new P.BackgroundImageImpl.LinearGradient,n.urlPath=i;let e=wi.StringSplit(i,",",16,i.length-2);e=wi.MergeBrackets(e,",");let s=e.length;if(s>0){let t=e[0];if(-1!=t.indexOf("to ")){e.splice(0,1);let i=e.length;-1!=t.indexOf("left")?(n.linearGradient.fromX=i+1,n.linearGradient.toX=0):-1!=t.indexOf("right")?(n.linearGradient.fromX=0,n.linearGradient.toX=i+1):(n.linearGradient.fromX=0,n.linearGradient.toX=0),-1!=t.indexOf("top")?(n.linearGradient.fromY=i+1,n.linearGradient.toY=0):-1!=t.indexOf("bottom")?(n.linearGradient.fromY=0,n.linearGradient.toY=i+1):(n.linearGradient.fromY=0,n.linearGradient.toY=0)}else n.linearGradient.fromX=0,n.linearGradient.toX=0,n.linearGradient.fromY=0,n.linearGradient.toY=2}if(s<2)return console.error(`linear gradient format error: str=${t}`),null;let r=1/e.length,a=e.length;for(let t=0;t<a;t++){let i=e[t];i=wi.StringTrim(i);let s=new xi.LinearGradientTexture.StopPoint;s.color=i,s.stopPosition=t!=a-1?t*r:1,n.linearGradient.stops.push(s)}}else n.type=P.BackgroundImageImpl.eType.URL_PATH,n.urlPath=i;return n}static ConvertToFlexEnum(e,t){let i=t.toString();return"flexDirection"==e?"row"==i?xi.FlexSetNames.Row:"row-reverse"==i?xi.FlexSetNames.RowReverse:"column"==i?xi.FlexSetNames.Column:"column-reverse"==i?xi.FlexSetNames.ColumnReverse:(console.warn("Unknown flexDirection value="+i),P.InvalidInt32):"flexWrap"==e?"nowrap"==i?xi.FlexSetNames.NoWrap:"wrap"==i?xi.FlexSetNames.Wrap:"wrap-reverse"==i?xi.FlexSetNames.WrapReverse:(console.warn("Unknown flexWrap value="+i),P.InvalidInt32):"justifyContent"==e?"flex-start"==i?xi.FlexSetNames.FlexStart:"flex-end"==i?xi.FlexSetNames.FlexEnd:"center"==i?xi.FlexSetNames.Center:(console.warn("Unknown justifyContent value="+i),P.InvalidInt32):"alignItems"==e?"stretch"==i?xi.FlexSetNames.Stretch:"flex-start"==i?xi.FlexSetNames.FlexStart:"flex-end"==i?xi.FlexSetNames.FlexEnd:"center"==i?xi.FlexSetNames.Center:(console.warn("Unknown alignItems value="+i),P.InvalidInt32):"alignContent"==e?"flex-start"==i?xi.FlexSetNames.FlexStart:"flex-end"==i?xi.FlexSetNames.FlexEnd:"center"==i?xi.FlexSetNames.Center:(console.warn("Unknown alignContent value="+i),P.InvalidInt32):"alignSelf"==e?"stretch"==i?xi.FlexSetNames.Stretch:"flex-start"==i?xi.FlexSetNames.FlexStart:"flex-end"==i?xi.FlexSetNames.FlexEnd:"center"==i?xi.FlexSetNames.Center:(console.warn("Unknown alignSelf value="+i),P.InvalidInt32):P.InvalidInt32}static ParseToAnimation(e){const t=wi.StringTrim(e);let i=[];const n=t.indexOf("cubic-bezier");if(n>=0){const e=t.indexOf(")"),s=t.substring(n,e-1),r=wi.StringSplit(t,s);for(const e of r){const t=wi.StringSplit(e);i=[...i,...t]}i.push(s)}else i=wi.StringSplit(t);let s="",r=0,a=1,o=t.indexOf("alternate")>=0;for(var l=2;l<i.length;l++){if("infinite"==i[l]){a=-1;continue}let e=wi.ParseToTimeMs(i[l]);0==isNaN(e)?r=e:(e=wi.ParseToFloat(i[l]),0==isNaN(e)?a=e:s=i[l])}const h=i.length>1?wi.ParseToTimeMs(i[1]):0,c=new P.AnimationImpl(t);return c.name=i.length>0?i[0]:"",c.duration=h,c.timingFunction=wi.ParseToEasing(s,h),c.delay=r,c.iterationCount=a,c.direction=o,c}static ParseToTimeMs(e){if(0==wi.StringEndsWith(e,"s"))return NaN;let t=wi.ParseToFloat(e);return wi.StringEndsWith(e,"ms")?t*=1:wi.StringEndsWith(e,"s")&&(t*=1e3),t}static ParseToFloat(e){const t=wi.StringTrim(e);return parseFloat(t)}static ParseToEasing(e,t){let i=null;return e.indexOf("ease")>=0?i=e.indexOf("-in-out")>=0?F.Easing.Circular.InOut:e.indexOf("-out")>=0?F.Easing.Circular.Out:e.indexOf("-in")>=0?F.Easing.Circular.In:F.Easing.Circular.InOut:e.indexOf("linear")>=0?i=null:e.indexOf("cubic-bezier")>=0?i=wi.ParseToEasingBezier(e,t):e.indexOf("steps")>=0&&(i=wi.ParseToEasingSteps(e)),i}static ParseToEasingBezier(e,t){let i=e.indexOf("(");i>=0&&(e=e.substring(i+1));let n=wi.StringSplit(e,","),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 F.BezierEasing(s.x1,s.y1,s.x2,s.y2,t)}static ParseToEasingSteps(e){let t=e.indexOf("(");t>=0&&(e=e.substring(t+1));let i=wi.StringSplit(e,","),n={steps:i.length>0?parseInt(i[0]):1,type:i.length>1?i[1].includes("start")?0:1:0};return new F.StepsEasing(n.steps,n.type)}constructor(){throw new Error("new StyleGroup() is forbidden.")}}class Si{static IsInheritedProp(e){return e==A.Text.Color||e==A.Text.FontFamily||e==A.Text.FontSize||e==A.Text.FontStyle||e==A.Text.FontWeight||e==A.Text.LineHeight||e==A.Text.TextAlign||e==A.Text.TextOverflow||e==A.Text.TextShadow||e==A.Text.WebkitTextStroke||e==A.Text.WhiteSpace||e==A.Text.WordWrap||e==A.Text.Direction||e==A.Text.JsvTextEmoji||e==A.Text.JsvTextLatex||e==A.Text.JsvTextAlignMinWidth||e==A.Text.JsvTextVerticalAlign||e==A.Text.JsvTextLineAlign||e==A.Text.JsvTextInnerDirection}constructor(){this.changedStyleGroups=new Set,this.lockedPropNames=new Set,this.layout=void 0,this.background=void 0,this.flex=void 0,this.effect=void 0,this.text=void 0,this.motion=void 0}setPropValue(e,t,i){if(0==i&&1==this.isPropNameLocked(e))return _.CssStyleNotChanged;const n=this.setValue(e,t);return null==n?_.CssStyleNotChanged:(this.changedStyleGroups.add(n),this.needUpdateTransition(e)&&this.changedStyleGroups.add(R.Motion.Name),i&&this.lockedPropNames.add(e),0)}getPropValue(e){return this.getValue(e)}hasPropValue(e){return this.hasValue(e)}hasPropGroup(e){return e==R.Layout.Name?null!=this.layout:e==R.Background.Name?null!=this.background:e==R.Effect.Name?null!=this.effect:e==R.Text.Name?null!=this.text:e==R.Motion.Name&&null!=this.motion}isPropNameLocked(e){return 1==this.lockedPropNames.has(e)}addChangedStyleGroup(e){return e!=R.Layout.Name&&e!=R.Background.Name&&e!=R.Effect.Name&&e!=R.Text.Name&&e!=R.Motion.Name&&v(_.InvalidArgument),this.changedStyleGroups.add(e),0}getChangedStyleGroups(){return this.changedStyleGroups}clearChangedStyleGroups(){this.changedStyleGroups.clear()}setValue(e,t){let i=null;return e==A.Layout.Left||e==A.Layout.Top||e==A.Layout.Width||e==A.Layout.Height?i=this.setLayoutValue(e,t):e==A.Flex.FlexDirection||e==A.Flex.FlexWrap||e==A.Flex.JustifyContent||e==A.Flex.AlignItems||e==A.Flex.AlignContent||e==A.Flex.AlignSelf||e==A.Flex.FlexGrow?i=this.setFlexValue(e,t):e==A.Background.BackgroundColor||e==A.Background.BackgroundImage||e==A.Background.BorderRadius?i=this.setBackgroundValue(e,t):e==A.Effect.BackfaceVisibility||e==A.Effect.BorderImage||e==A.Effect.BorderImageWidth||e==A.Effect.BorderImageOutset||e==A.Effect.Display||e==A.Effect.ObjectFit||e==A.Effect.Opacity||e==A.Effect.Overflow||e==A.Effect.Perspective||e==A.Effect.PerspectiveOrigin||e==A.Effect.Transform||e==A.Effect.TransformOrigin||e==A.Effect.TransformStyle||e==A.Effect.Visibility||e==A.Effect.ZIndex?i=this.setEffectValue(e,t):e==A.Text.Color||e==A.Text.FontFamily||e==A.Text.FontSize||e==A.Text.FontStyle||e==A.Text.FontWeight||e==A.Text.TextAlign||e==A.Text.TextOverflow||e==A.Text.TextShadow||e==A.Text.LineHeight||e==A.Text.WebkitTextStroke||e==A.Text.WhiteSpace||e==A.Text.WordWrap||e==A.Text.Direction||e==A.Text.JsvTextEmoji||e==A.Text.JsvTextLatex||e==A.Text.JsvTextAlignMinWidth||e==A.Text.JsvTextVerticalAlign||e==A.Text.JsvTextLineAlign||e==A.Text.JsvTextInnerDirection?i=this.setTextValue(e,t):e==A.Motion.Animation||e==A.Motion.Transition||e==A.Motion.AnimationFillMode?i=this.setMotionValue(e,t):E(_.UnimplementedError,null),null!=i&&this.changedStyleGroups.add(i),i}getValue(e){let t;return e==A.Layout.Left||e==A.Layout.Top||e==A.Layout.Width||e==A.Layout.Height?t=this.getLayoutValue(e):e==A.Flex.FlexDirection||e==A.Flex.FlexWrap||e==A.Flex.JustifyContent||e==A.Flex.AlignItems||e==A.Flex.AlignContent||e==A.Flex.AlignSelf||e==A.Flex.FlexGrow?t=this.getFlexValue(e):e==A.Background.BackgroundColor||e==A.Background.BackgroundImage||e==A.Background.BorderRadius?t=this.getBackgroundValue(e):e==A.Effect.BackfaceVisibility||e==A.Effect.BorderImage||e==A.Effect.BorderImageWidth||e==A.Effect.BorderImageOutset||e==A.Effect.Display||e==A.Effect.ObjectFit||e==A.Effect.Opacity||e==A.Effect.Overflow||e==A.Effect.Perspective||e==A.Effect.PerspectiveOrigin||e==A.Effect.Transform||e==A.Effect.TransformOrigin||e==A.Effect.TransformStyle||e==A.Effect.Visibility||e==A.Effect.ZIndex?t=this.getEffectValue(e):e==A.Text.Color||e==A.Text.FontFamily||e==A.Text.FontSize||e==A.Text.FontStyle||e==A.Text.FontWeight||e==A.Text.TextAlign||e==A.Text.TextOverflow||e==A.Text.TextShadow||e==A.Text.LineHeight||e==A.Text.WebkitTextStroke||e==A.Text.WhiteSpace||e==A.Text.WordWrap||e==A.Text.Direction||e==A.Text.JsvTextEmoji||e==A.Text.JsvTextLatex||e==A.Text.JsvTextAlignMinWidth||e==A.Text.JsvTextVerticalAlign||e==A.Text.JsvTextLineAlign||e==A.Text.JsvTextInnerDirection?t=this.getTextValue(e):e==A.Motion.Animation||e==A.Motion.Transition||e==A.Motion.AnimationFillMode?t=this.getMotionValue(e):(E(_.UnimplementedError,null),t=new P),t}hasValue(e){let t=!1;return e==A.Layout.Left||e==A.Layout.Top||e==A.Layout.Width||e==A.Layout.Height?t=this.hasLayoutValue(e):e==A.Flex.FlexDirection||e==A.Flex.FlexWrap||e==A.Flex.JustifyContent||e==A.Flex.AlignItems||e==A.Flex.AlignContent||e==A.Flex.AlignSelf||e==A.Flex.FlexGrow?t=this.hasFlexValue(e):e==A.Background.BackgroundColor||e==A.Background.BackgroundImage||e==A.Background.BorderRadius?t=this.hasBackgroundValue(e):e==A.Effect.BackfaceVisibility||e==A.Effect.BorderImage||e==A.Effect.BorderImageWidth||e==A.Effect.BorderImageOutset||e==A.Effect.Display||e==A.Effect.ObjectFit||e==A.Effect.Overflow||e==A.Effect.Perspective||e==A.Effect.PerspectiveOrigin||e==A.Effect.Transform||e==A.Effect.TransformOrigin||e==A.Effect.TransformStyle||e==A.Effect.Visibility||e==A.Effect.ZIndex?t=this.hasEffectValue(e):e==A.Text.Color||e==A.Text.FontFamily||e==A.Text.FontSize||e==A.Text.FontStyle||e==A.Text.FontWeight||e==A.Text.TextAlign||e==A.Text.TextOverflow||e==A.Text.TextShadow||e==A.Text.LineHeight||e==A.Text.WebkitTextStroke||e==A.Text.WhiteSpace||e==A.Text.WordWrap||e==A.Text.Direction||e==A.Text.JsvTextEmoji||e==A.Text.JsvTextLatex||e==A.Text.JsvTextAlignMinWidth||e==A.Text.JsvTextVerticalAlign||e==A.Text.JsvTextLineAlign||e==A.Text.JsvTextInnerDirection?t=this.hasTextValue(e):e!=A.Motion.Animation&&e!=A.Motion.Transition&&e!=A.Motion.AnimationFillMode||(t=this.hasMotionValue(e)),t}setLayoutValue(e,t){const i=(e,t)=>{const i=t;return this.layout[e]==i==0&&(this.layout[e]=i,!0)};this.ensureGroupExist(R.Layout.Name);let n=!1;if(e==A.Layout.Height)n=i("height",wi.ConvertToInt32(e,t));else if(e==A.Layout.Left)n=i("left",wi.ConvertToInt32(e,t));else if(e==A.Layout.Top)n=i("top",wi.ConvertToInt32(e,t));else{if(e!=A.Layout.Width)throw new Error;n=i("width",wi.ConvertToInt32(e,t))}return n?R.Layout.Name:null}getLayoutValue(e){const t=e=>this.layout?new P(this.layout[e]):new P;if(e==A.Layout.Height)return t("height");if(e==A.Layout.Left)return t("left");if(e==A.Layout.Top)return t("top");if(e==A.Layout.Width)return t("width");throw new Error}hasLayoutValue(e){const t=e=>!(!this.layout||this.layout[e]==P.InvalidInt32);if(e==A.Layout.Height)return t("height");if(e==A.Layout.Left)return t("left");if(e==A.Layout.Top)return t("top");if(e==A.Layout.Width)return t("width");throw new Error}setFlexValue(e,t){const i=(e,t)=>{const i=t;return this.flex[e]==i==0&&(this.flex[e]=i,!0)};this.ensureGroupExist(R.Flex.Name);let n=!1;if(e==A.Flex.FlexDirection)n=i("flexDirection",wi.ConvertToFlexEnum(e,t));else if(e==A.Flex.FlexWrap)n=i("flexWrap",wi.ConvertToFlexEnum(e,t));else if(e==A.Flex.JustifyContent)n=i("justifyContent",wi.ConvertToFlexEnum(e,t));else if(e==A.Flex.AlignItems)n=i("alignItems",wi.ConvertToFlexEnum(e,t));else if(e==A.Flex.AlignContent)n=i("alignContent",wi.ConvertToFlexEnum(e,t));else if(e==A.Flex.AlignSelf)n=i("alignSelf",wi.ConvertToFlexEnum(e,t));else{if(e!=A.Flex.FlexGrow)throw new Error;n=i("flexGrow",wi.ConvertToFloat(e,t))}return n?R.Flex.Name:null}getFlexValue(e){const t=e=>this.flex?new P(this.flex[e]):new P;if(e==A.Flex.FlexDirection)return t("flexDirection");if(e==A.Flex.FlexWrap)return t("flexWrap");if(e==A.Flex.JustifyContent)return t("justifyContent");if(e==A.Flex.AlignItems)return t("alignItems");if(e==A.Flex.AlignContent)return t("alignContent");if(e==A.Flex.AlignSelf)return t("alignSelf");if(e==A.Flex.FlexGrow)return t("flexGrow");throw new Error}hasFlexValue(e){const t=e=>!(!this.flex||this.flex[e]==P.InvalidInt32);if(e==A.Flex.FlexDirection)return t("flexDirection");if(e==A.Flex.FlexWrap)return t("flexWrap");if(e==A.Flex.JustifyContent)return t("justifyContent");if(e==A.Flex.AlignItems)return t("alignItems");if(e==A.Flex.AlignContent)return t("alignContent");if(e==A.Flex.AlignSelf)return t("alignSelf");if(e==A.Flex.FlexGrow)return!(!this.flex||this.flex[e]==P.InvalidFloat);throw new Error}setBackgroundValue(e,t){const i=(e,t)=>{const i=t;return this.background[e]==i==0&&(this.background[e]=i,!0)};this.ensureGroupExist(R.Background.Name);let n=!1;if(e==A.Background.BackgroundColor)n=i("backgroundColor",wi.ConvertToString(e,t));else if(e==A.Background.BackgroundImage)n=i("backgroundImage",wi.ConvertToBackgroundImage(e,t));else{if(e!=A.Background.BorderRadius)throw new Error;n=i("borderRadius",wi.ConvertToCorner(e,t))}return n?R.Background.Name:null}getBackgroundValue(e){const t=e=>this.background?new P(this.background[e]):new P;if(e==A.Background.BackgroundColor)return t("backgroundColor");if(e==A.Background.BackgroundImage)return t("backgroundImage");if(e==A.Background.BorderRadius)return t("borderRadius");throw new Error}hasBackgroundValue(e){const t=e=>!(!this.background||this.background[e]==P.InvalidPointer);if(e==A.Background.BackgroundColor)return t("backgroundColor");if(e==A.Background.BackgroundImage)return t("backgroundImage");if(e==A.Background.BorderRadius)return t("borderRadius");throw new Error}setEffectValue(e,t){const i=(e,t)=>{const i=t;return this.effect[e]==i==0&&(this.effect[e]=i,!0)};this.ensureGroupExist(R.Effect.Name);let n=!1;if(e==A.Effect.BackfaceVisibility)n=i("backfaceVisibility",wi.ConvertToString(e,t));else if(e==A.Effect.BorderImage)n=i("borderImage",wi.ConvertToBorderImage(e,t));else if(e==A.Effect.BorderImageWidth)n=i("borderImageWidth",wi.ConvertToRect(e,t));else if(e==A.Effect.BorderImageOutset)n=i("borderImageOutset",wi.ConvertToRect(e,t));else if(e==A.Effect.Display)n=i("display",wi.ConvertToString(e,t));else if(e==A.Effect.ObjectFit)n=i("objectFit",wi.ConvertToString(e,t));else if(e==A.Effect.Opacity)n=i("opacity",wi.ConvertToFloat(e,t));else if(e==A.Effect.Overflow)n=i("overflow",wi.ConvertToString(e,t));else if(e==A.Effect.Perspective)n=i("perspective",wi.ConvertToInt32(e,t));else if(e==A.Effect.PerspectiveOrigin)n=i("perspectiveOrigin",wi.ConvertToInt32(e,t));else if(e==A.Effect.Transform)n=i("transform",wi.ConvertToString(e,t));else if(e==A.Effect.TransformOrigin)n=i("transformOrigin",wi.ConvertToString(e,t));else if(e==A.Effect.TransformStyle)n=i("transformStyle",wi.ConvertToString(e,t));else if(e==A.Effect.Visibility)n=i("visibility",wi.ConvertToString(e,t));else{if(e!=A.Effect.ZIndex)throw new Error;n=i("zIndex",wi.ConvertToInt32(e,t))}return n?R.Effect.Name:null}getEffectValue(e){const t=e=>this.effect?new P(this.effect[e]):new P;if(e==A.Effect.BackfaceVisibility)return t("backfaceVisibility");if(e==A.Effect.BorderImage)return t("borderImage");if(e==A.Effect.BorderImageWidth)return t("borderImageWidth");if(e==A.Effect.BorderImageOutset)return t("borderImageOutset");if(e==A.Effect.Display)return t("display");if(e==A.Effect.ObjectFit)return t("objectFit");if(e==A.Effect.Opacity)return t("opacity");if(e==A.Effect.Overflow)return t("overflow");if(e==A.Effect.Perspective)return t("perspective");if(e==A.Effect.PerspectiveOrigin)return t("perspectiveOrigin");if(e==A.Effect.Transform)return t("transform");if(e==A.Effect.TransformOrigin)return t("transformOrigin");if(e==A.Effect.TransformStyle)return t("transformStyle");if(e==A.Effect.Visibility)return t("visibility");if(e==A.Effect.ZIndex)return t("zIndex");throw new Error}hasEffectValue(e){const t=(e,t)=>!(!this.effect||this.effect[e]==t);if(e==A.Effect.BackfaceVisibility)return t("backfaceVisibility",P.InvalidInt32);if(e==A.Effect.BorderImage)return t("borderImage",P.InvalidPointer);if(e==A.Effect.BorderImageWidth)return t("borderImageWidth",P.InvalidPointer);if(e==A.Effect.BorderImageOutset)return t("borderImageOutset",P.InvalidPointer);if(e==A.Effect.Display)return t("display",P.InvalidPointer);if(e==A.Effect.ObjectFit)return t("objectFit",P.InvalidPointer);if(e==A.Effect.Overflow)return t("overflow",P.InvalidPointer);if(e==A.Effect.Perspective)return t("perspective",P.InvalidInt32);if(e==A.Effect.PerspectiveOrigin)return t("perspectiveOrigin",P.InvalidInt32);if(e==A.Effect.Transform)return t("transform",P.InvalidPointer);if(e==A.Effect.TransformOrigin)return t("transformOrigin",P.InvalidPointer);if(e==A.Effect.TransformStyle)return t("transformStyle",P.InvalidPointer);if(e==A.Effect.Visibility)return t("visibility",P.InvalidPointer);if(e==A.Effect.ZIndex)return t("zIndex",P.InvalidInt32);throw new Error}setTextValue(e,t){const i=(e,t)=>{const i=t;return this.text[e]==i==0&&(this.text[e]=i,!0)};this.ensureGroupExist(R.Text.Name);let n=!1;if(e==A.Text.Color)n=i("color",wi.ConvertToString(e,t));else if(e==A.Text.FontFamily)n=i("fontFamily",wi.ConvertToString(e,t));else if(e==A.Text.FontSize)n=i("fontSize",wi.ConvertToInt32(e,t));else if(e==A.Text.FontStyle)n=i("fontStyle",wi.ConvertToString(e,t));else if(e==A.Text.FontWeight)n=i("fontWeight",wi.ConvertToString(e,t));else if(e==A.Text.LineHeight)n=i("lineHeight",wi.ConvertToInt32(e,t));else if(e==A.Text.TextAlign)n=i("textAlign",wi.ConvertToString(e,t));else if(e==A.Text.TextOverflow)n=i("textOverflow",wi.ConvertToString(e,t));else if(e==A.Text.TextShadow)n=i("textShadow",wi.ConvertToTextShadow(e,t));else if(e==A.Text.WebkitTextStroke)n=i("webkitTextStroke",wi.ConvertToWebkitTextStroke(e,t));else if(e==A.Text.WhiteSpace)n=i("whiteSpace",wi.ConvertToString(e,t));else if(e==A.Text.WordWrap)n=i("wordWrap",wi.ConvertToString(e,t));else if(e==A.Text.Direction)n=i("direction",wi.ConvertToString(e,t));else if(e==A.Text.JsvTextEmoji)n=i("jsvTextEmoji",wi.ConvertToInt32(e,t));else if(e==A.Text.JsvTextLatex)n=i("jsvTextLatex",wi.ConvertToInt32(e,t));else if(e==A.Text.JsvTextAlignMinWidth)n=i("jsvTextAlignMinWidth",wi.ConvertToInt32(e,t));else if(e==A.Text.JsvTextVerticalAlign)n=i("jsvTextVerticalAlign",wi.ConvertToString(e,t));else if(e==A.Text.JsvTextLineAlign)n=i("jsvTextLineAlign",wi.ConvertToString(e,t));else{if(e!=A.Text.JsvTextInnerDirection)throw new Error;n=i("jsvTextInnerDirection",wi.ConvertToString(e,t))}return n?R.Text.Name:null}getTextValue(e){const t=e=>this.text?new P(this.text[e]):new P;if(e==A.Text.Color)return t("color");if(e==A.Text.FontFamily)return t("fontFamily");if(e==A.Text.FontSize)return t("fontSize");if(e==A.Text.FontStyle)return t("fontStyle");if(e==A.Text.FontWeight)return t("fontWeight");if(e==A.Text.LineHeight)return t("lineHeight");if(e==A.Text.TextAlign)return t("textAlign");if(e==A.Text.TextOverflow)return t("textOverflow");if(e==A.Text.TextShadow)return t("textShadow");if(e==A.Text.WebkitTextStroke)return t("webkitTextStroke");if(e==A.Text.WhiteSpace)return t("whiteSpace");if(e==A.Text.WordWrap)return t("wordWrap");if(e==A.Text.Direction)return t("direction");if(e==A.Text.JsvTextEmoji)return t("jsvTextEmoji");if(e==A.Text.JsvTextLatex)return t("jsvTextLatex");if(e==A.Text.JsvTextAlignMinWidth)return t("jsvTextAlignMinWidth");if(e==A.Text.JsvTextVerticalAlign)return t("jsvTextVerticalAlign");if(e==A.Text.JsvTextLineAlign)return t("jsvTextLineAlign");if(e==A.Text.JsvTextInnerDirection)return t("jsvTextInnerDirection");throw new Error}hasTextValue(e){const t=(e,t)=>!(!this.text||this.text[e]==t);if(e==A.Text.Color)return t("color",P.InvalidPointer);if(e==A.Text.FontFamily)return t("fontFamily",P.InvalidPointer);if(e==A.Text.FontSize)return t("fontSize",P.InvalidInt32);if(e==A.Text.FontStyle)return t("fontStyle",P.InvalidPointer);if(e==A.Text.FontWeight)return t("fontWeight",P.InvalidPointer);if(e==A.Text.LineHeight)return t("lineHeight",P.InvalidInt32);if(e==A.Text.TextAlign)return t("textAlign",P.InvalidPointer);if(e==A.Text.TextOverflow)return t("textOverflow",P.InvalidPointer);if(e==A.Text.TextShadow)return t("textShadow",P.InvalidPointer);if(e==A.Text.WebkitTextStroke)return t("webkitTextStroke",P.InvalidPointer);if(e==A.Text.WhiteSpace)return t("whiteSpace",P.InvalidPointer);if(e==A.Text.WordWrap)return t("wordWrap",P.InvalidPointer);if(e==A.Text.Direction)return t("direction",P.InvalidPointer);if(e==A.Text.JsvTextEmoji)return t("jsvTextEmoji",P.InvalidInt32);if(e==A.Text.JsvTextLatex)return t("jsvTextLatex",P.InvalidInt32);if(e==A.Text.JsvTextAlignMinWidth)return t("jsvTextAlignMinWidth",P.InvalidInt32);if(e==A.Text.JsvTextVerticalAlign)return t("jsvTextVerticalAlign",P.InvalidPointer);if(e==A.Text.JsvTextLineAlign)return t("jsvTextLineAlign",P.InvalidPointer);if(e==A.Text.JsvTextInnerDirection)return t("jsvTextInnerDirection",P.InvalidPointer);throw new Error}setMotionValue(e,t){const i=(e,t)=>{const i=t;return this.motion[e]==i==0&&(this.motion[e]=i,!0)};this.ensureGroupExist(R.Motion.Name);let n=!1;if(e==A.Motion.Animation)n=i("animation",wi.ConvertToAnimation(e,t,this.motion.animation));else if(e==A.Motion.Transition)n=i("transition",wi.ConvertToTransition(e,t,this.motion.transition));else{if(e!=A.Motion.AnimationFillMode)throw new Error;n=i("animationFillMode",wi.ConvertToString(e,t))}return n?R.Motion.Name:null}getMotionValue(e){const t=e=>this.motion?new P(this.motion[e]):new P;if(e==A.Motion.Animation)return t("animation");if(e==A.Motion.Transition)return t("transition");if(e==A.Motion.AnimationFillMode)return t("animationFillMode");throw new Error}hasMotionValue(e){const t=e=>!(!this.motion||this.motion[e]==P.InvalidPointer);if(e==A.Motion.Animation)return t("animation");if(e==A.Motion.Transition)return t("transition");if(e==A.Motion.AnimationFillMode)return t("animationFillMode");throw new Error}needUpdateTransition(e){return null!=this.motion&&null==this.motion.animation&&null!=this.motion.transition&&(e==A.Layout.Height||e==A.Layout.Left||e==A.Layout.Top||e==A.Layout.Width||e==A.Effect.Transform)}ensureGroupExist(e){e==R.Layout.Name&&null==this.layout?this.layout=new R.Layout:e==R.Flex.Name&&null==this.flex?this.flex=new R.Flex:e==R.Background.Name&&null==this.background?this.background=new R.Background:e==R.Effect.Name&&null==this.effect?this.effect=new R.Effect:e==R.Text.Name&&null==this.text?this.text=new R.Text:e==R.Motion.Name&&null==this.motion&&(this.motion=new R.Motion)}}var vi,Ei,bi;class Ci{constructor(e){this.classNames="",this.classAttributes=new Set,this.classStyleManager=e}getManager(){return this.classStyleManager}setClassNames(e){return null==e&&(e=""),this.classNames==e?_.CssClassNotChanged:(this.classNames=e,0)}getClassNames(){return this.classNames}appendClassAttribute(e){return this.classAttributes.has(e)?_.CssClassNotChanged:(this.classAttributes.add(e),0)}mergeClassAttributes(e){for(let t of e.classAttributes)this.classAttributes.add(t);return 0}hasClassAttribute(e){return this.classAttributes.has(e)}getClassAttributes(){return this.classAttributes}getClassDeclarations(e){if(0==this.classNames.length)return null;let t="";t+=this.classNames,t+=" @ ";for(const e of this.classAttributes)t+=e+" ";const i=t;let n=this.classStyleManager.findStyleClassCache(i);return null==n&&(n=this.makeClassDeclarations(e),this.classStyleManager.appendStyleClassCache(i,n)),n}getKeyframes(e){if(0==e.length)return"";const t=this.classStyleManager.getKeyframes(this.classAttributes,e);return 0==t.length?"":t}static CastToStyleValue(e){let t;return null==e||Number(e)===e||"string"==typeof e?t=new P(e):"boolean"==typeof e?t=new P(Number(e)):(E(_.UnimplementedError,null),t=new P),t}static ParseDeclarations(e,t,i){let n=new Map;for(let s of t){if(0==e.has(i))continue;const t=e.get(i);if(0==t.has(s))continue;const r=t.get(s);let a;a=r instanceof String==0?r:Ci.ParseDeclarationsFromString(r),n=new Map([...n,...a])}return n}static ParseDeclarationsFromString(e){let t=new Map;const i=JSON.parse(e);for(const[e,n]of Object.entries(i)){const i=A.ToConst(e);if(null==i){console.error("Unsupported style name: "+e);continue}if(i==A.Effect.ObjectFit||i==A.Effect.Overflow){console.warn("Unimplemented style name: "+i+", please set the "+i+" attribute directly in the element's style.");continue}const s=Ci.CastToStyleValue(n);t.set(i,s)}return t}makeClassDeclarations(e){let t=new Map;const i=this.classStyleManager.getStyleSheets(),n=this.getNestedClassCombine(e),s=Ci.ParseDeclarations(i,n,Ci.Manager.StyleSheetKeyGlobal);for(const[e,i]of s)t.set(e,i);for(const e of this.classAttributes){const s=Ci.ParseDeclarations(i,n,e);for(const[e,i]of s)t.set(e,i)}return t}getNestedClassCombine(e){const t=wi.StringSplit(this.classNames),i=[];for(const e of t)i.push("."+e);for(let t=e.length-1;t>=0;t--){const n=e[t],s=i.length,r=wi.StringSplit(n);for(const e of r)for(let t=0;t<s;t++){const n=i[t];i.push("."+e+" "+n)}}return i}}Ci.Manager=(T(vi=class{constructor(){this.styleSheetMap=new Map,this.parsedStyleClassCache=new Map,this.propVariableMap=new Map}declareStyleSheets(e){for(const[t,i]of Object.entries(e)){let e=0;e=parseInt(t,16),0==this.styleSheetMap.has(e)&&this.styleSheetMap.set(e,new Map);const n=this.styleSheetMap.get(e);for(const[e,t]of Object.entries(i))if(n.has(e)&&console.warn('StyleSheets class "'+e+'" already exists, overwrite it with the new value.'),t.includes("@keyframes"))n.set(e,t);else{const i=Ci.ParseDeclarationsFromString(t);n.set(e,i)}}return 0}undeclareStyleSheets(e){for(const[t,i]of Object.entries(e)){let e=0;if(e=parseInt(t,16),0==this.styleSheetMap.has(e))continue;const n=this.styleSheetMap.get(e);for(const[e,t]of Object.entries(i))n.delete(e)}return 0}getStyleSheets(){return this.styleSheetMap}appendStyleClassCache(e,t){this.parsedStyleClassCache.set(e,t)}findStyleClassCache(e){const t=this.parsedStyleClassCache.get(e);return null==t?null:t}clearStyleClassCache(){this.parsedStyleClassCache.clear()}watchVariable(e,t,i,n,s){let r=A.ToConst(t);x(null!=r,_.InvalidArgument);let a=this.getVariableInfo(n);if(x(null!=a,_.InvalidArgument),0==a.watchListenerMap.has(e)){const t=new Set;a.watchListenerMap.set(e,t)}const o=a.watchListenerMap.get(e),l=new Ci.Manager.VariableInfo.WatchListener;if(l.propName=r,l.listener=i,o.add(l),0==a.value.is(P.DataType.Null)){const e=i(r,a.value,s);if(e==_.CssStyleNotChanged)return e;v(e)}return 0}watchKeyframeVariables(e,t,i,n,s){const r=this.getRawKeyframes(e.classAttributes,n);if(0==r.length)return 0;const a=new Set;let o=this.getKeyframesVarNames(r,a);v(o);for(const n of a)o=this.watchVariable(e,t,i,n,s),v(o);return 0}unwatchVariable(e,t){for(const[i,n]of this.propVariableMap){if(0==n.watchListenerMap.has(e))continue;let i=n.watchListenerMap.get(e);for(const e of i)if(e.propName!=t){i.delete(e);break}}return 0}unwatchAllVariables(e){for(const[t,i]of this.propVariableMap)i.watchListenerMap.delete(e)}setVariable(e,t,i){let n=this.getVariableInfo(e);x(null!=n,_.InvalidArgument),n.value=t;for(const[e,s]of n.watchListenerMap)for(const e of s){let n=new Set;const s=e.listener(e.propName,t,n);if(s==_.CssStyleNotChanged)return s;v(s);for(const e of n)i.add(e)}return 0}insertKeyFrame(e,t){const i=this.styleSheetMap.get(Ci.Manager.StyleSheetKeyGlobal);w(i,null),i?.set(e,t)}removeKeyFrame(e){const t=this.styleSheetMap.get(Ci.Manager.StyleSheetKeyGlobal);if(w(t,null),t?.has(e)){t.delete(e);const i=document.styleSheets[0],n=i.cssRules;for(let t=n.length-1;t>=0;t--)if(n[t].name===e){i.deleteRule(t);break}}}getKeyframes(e,t){if(0==t.length)return"";const i=this.getRawKeyframes(e,t);if(0==i.length)return"";const n=new Set;if(E(this.getKeyframesVarNames(i,n),""),0==n.size)return i;let s=i;for(const e of n){const t=this.getVariableInfo(e);w(null!=t,""),r=e,a=t.value.toString(),s=s.replaceAll(r,a)}var r,a;return s}getRawKeyframes(e,t){if(0==t.length)return Ci.Manager.ConstEmptyString;if(0==this.styleSheetMap.has(Ci.Manager.StyleSheetKeyGlobal))return Ci.Manager.ConstEmptyString;const i=this.styleSheetMap.get(Ci.Manager.StyleSheetKeyGlobal);for(const n of e){const e=t+"-"+n.toString(16).padStart(8,"0");if(0==i.has(e))continue;return i.get(e)}if(i.has(t)){return i.get(t)}return Ci.Manager.ConstEmptyString}getKeyframesVarNames(e,t){t.clear();let i=e;const n=/var\([\s\S]+?\)/;let s;for(;null!==(s=n.exec(i));)t.add(s[0]),i=i.substring(s.index+s[0].length);return 0}getVariableInfo(e){let t=k.FormatVariableName(e);if(x(null!=t,null),0==this.propVariableMap.has(t)){const e=new Ci.Manager.VariableInfo;this.propVariableMap.set(t,e)}let i=this.propVariableMap.get(t);return i}},"Manager"),vi.StyleSheetKeyGlobal=0,vi.VariableInfo=(T(Ei=class{constructor(){this.value=new P,this.watchListenerMap=new Map}},"VariableInfo"),Ei.WatchListener=class{},Ei),vi.ConstEmptyString="",vi);class Ii{static STYLE_PROPERTY_GETTER(e,t,i){let n=new P;return e.getProperty(t,n)>=0?n.get():i}constructor(e,t){this.lastCssClassKeySet=new Set,this.elementDelegate=e,this.style=new Si,this.styleClass=new Ci(t)}finalize(){this.styleClass.getManager().unwatchAllVariables(this.styleClass)}hasPropGroup(e){return this.style.hasPropGroup(e)}setProperty(e,t,i){let n=e;0==k.IsVariable(e)&&(n=A.ToConst(e)),x(n,_.UnsupportedError),i.clear();return this.setStyleInheritedProperty(n,t,!0,i)}getProperty(e,t){const i=A.ToConst(e);x(i,_.UnsupportedError);return this.getStyleInheritedProperty(i,t)}setClassNames(e){const t=this.styleClass.setClassNames(e);return x(t>=0||t==_.CssClassNotChanged,t),0}getClassNames(){return this.styleClass.getClassNames()}appendClassAttribute(e){const t=this.styleClass.appendClassAttribute(e);return t==_.CssClassNotChanged||v(t),0}mergeClassAttributes(e){return v(this.styleClass.mergeClassAttributes(e.styleClass)),0}getKeyframes(e){const t=this.styleClass.getKeyframes(e);return w(null!=t,null,["Failed to get keyframes:"+e]),t}getNestedClassNames(e){const t=this.elementDelegate;x(null!=t,_.InvalidElement);const i=t.parentNode;x(null!=i,_.InvalidElement);const n=i.styleDelegate,s=this.styleClass.getClassAttributes();let r=[];for(const e of s){const t=[];v(n.getNestedClassNamesRecursive(e,t)),(r.length<=0||r.length>t.length)&&(r=t)}for(const t of r)e.push(t);if(e.length>5){let e="JsView: Low performance warning: ";e+="It is recommended that the nesting of style classes in a single vue file should less than 6.",e+="You can avoid this risk by splitting the vue file.",console.warn(e)}return 0}updateClassDeclarations(e,t){t.clear();const i=this.lastCssClassKeySet,n=new Set,s=this.styleClass.getClassDeclarations(e);if(null!=s)for(const[e,r]of s){let s=this.setStyleInheritedProperty(e,r,!1,t);s==_.CssStyleNotChanged&&(s=0),b(s),n.add(e),i.delete(e)}let r=new P;for(const e of i){let i=this.setStyleInheritedProperty(e,r,!1,t);i==_.CssStyleNotChanged&&(i=0),b(i)}this.lastCssClassKeySet=n}addChangedStyleGroup(e){return this.style.addChangedStyleGroup(e)}getChangedStyleGroups(){return this.style.getChangedStyleGroups()}clearChangedStyleGroups(){this.style.clearChangedStyleGroups()}jsvValidHeight(){return Ii.STYLE_PROPERTY_GETTER(this,A.Layout.Height,0)}height(){return Ii.STYLE_PROPERTY_GETTER(this,A.Layout.Height,P.InvalidInt32)}left(){return Ii.STYLE_PROPERTY_GETTER(this,A.Layout.Left,0)}top(){return Ii.STYLE_PROPERTY_GETTER(this,A.Layout.Top,0)}jsvValidWidth(){return Ii.STYLE_PROPERTY_GETTER(this,A.Layout.Width,0)}width(){return Ii.STYLE_PROPERTY_GETTER(this,A.Layout.Width,P.InvalidInt32)}flexDirection(){return Ii.STYLE_PROPERTY_GETTER(this,A.Flex.FlexDirection,P.InvalidInt32)}flexWrap(){return Ii.STYLE_PROPERTY_GETTER(this,A.Flex.FlexWrap,P.InvalidInt32)}justifyContent(){return Ii.STYLE_PROPERTY_GETTER(this,A.Flex.JustifyContent,P.InvalidInt32)}alignItems(){return Ii.STYLE_PROPERTY_GETTER(this,A.Flex.AlignItems,P.InvalidInt32)}alignContent(){return Ii.STYLE_PROPERTY_GETTER(this,A.Flex.AlignContent,P.InvalidInt32)}alignSelf(){return Ii.STYLE_PROPERTY_GETTER(this,A.Flex.AlignSelf,P.InvalidInt32)}flexGrow(){return Ii.STYLE_PROPERTY_GETTER(this,A.Flex.FlexGrow,P.InvalidFloat)}backgroundColor(){return Ii.STYLE_PROPERTY_GETTER(this,A.Background.BackgroundColor,null)}backgroundImage(){return Ii.STYLE_PROPERTY_GETTER(this,A.Background.BackgroundImage,null)}borderRadius(){return Ii.STYLE_PROPERTY_GETTER(this,A.Background.BorderRadius,null)}backfaceVisibility(){return Ii.STYLE_PROPERTY_GETTER(this,A.Effect.BackfaceVisibility,null)}borderImage(){return Ii.STYLE_PROPERTY_GETTER(this,A.Effect.BorderImage,null)}borderImageWidth(){return Ii.STYLE_PROPERTY_GETTER(this,A.Effect.BorderImageWidth,null)}borderImageOutset(){return Ii.STYLE_PROPERTY_GETTER(this,A.Effect.BorderImageOutset,null)}display(){return Ii.STYLE_PROPERTY_GETTER(this,A.Effect.Display,null)}objectFit(){return Ii.STYLE_PROPERTY_GETTER(this,A.Effect.ObjectFit,null)}opacity(){return Ii.STYLE_PROPERTY_GETTER(this,A.Effect.Opacity,1)}overflow(){return Ii.STYLE_PROPERTY_GETTER(this,A.Effect.Overflow,null)}perspective(){return Ii.STYLE_PROPERTY_GETTER(this,A.Effect.Perspective,0)}perspectiveOrigin(){return Ii.STYLE_PROPERTY_GETTER(this,A.Effect.PerspectiveOrigin,null)}transform(){return Ii.STYLE_PROPERTY_GETTER(this,A.Effect.Transform,null)}transformOrigin(){return Ii.STYLE_PROPERTY_GETTER(this,A.Effect.TransformOrigin,null)}transformStyle(){return Ii.STYLE_PROPERTY_GETTER(this,A.Effect.TransformStyle,null)}visibility(){return Ii.STYLE_PROPERTY_GETTER(this,A.Effect.Visibility,null)}zIndex(){return Ii.STYLE_PROPERTY_GETTER(this,A.Effect.ZIndex,0)}color(){return Ii.STYLE_PROPERTY_GETTER(this,A.Text.Color,L.Text.Color)}fontFamily(){return Ii.STYLE_PROPERTY_GETTER(this,A.Text.FontFamily,L.Text.FontFamily)}fontSize(){return Ii.STYLE_PROPERTY_GETTER(this,A.Text.FontSize,L.Text.FontSize)}fontStyle(){return Ii.STYLE_PROPERTY_GETTER(this,A.Text.FontStyle,L.Text.FontStyle)}fontWeight(){return Ii.STYLE_PROPERTY_GETTER(this,A.Text.FontWeight,L.Text.FontWeight)}lineHeight(){return Ii.STYLE_PROPERTY_GETTER(this,A.Text.LineHeight,L.Text.LineHeight)}textAlign(){return Ii.STYLE_PROPERTY_GETTER(this,A.Text.TextAlign,L.Text.TextAlign)}textOverflow(){return Ii.STYLE_PROPERTY_GETTER(this,A.Text.TextOverflow,L.Text.TextOverflow)}textShadow(){return Ii.STYLE_PROPERTY_GETTER(this,A.Text.TextShadow,L.Text.TextShadow)}webkitTextStroke(){return Ii.STYLE_PROPERTY_GETTER(this,A.Text.WebkitTextStroke,L.Text.WebkitTextStroke)}whiteSpace(){return Ii.STYLE_PROPERTY_GETTER(this,A.Text.WhiteSpace,L.Text.WhiteSpace)}wordWrap(){return Ii.STYLE_PROPERTY_GETTER(this,A.Text.WordWrap,L.Text.WordWrap)}direction(){return Ii.STYLE_PROPERTY_GETTER(this,A.Text.Direction,L.Text.Direction)}jsvTextEmoji(){return Ii.STYLE_PROPERTY_GETTER(this,A.Text.JsvTextEmoji,L.Text.JsvTextEmoji)}jsvTextLatex(){return Ii.STYLE_PROPERTY_GETTER(this,A.Text.JsvTextLatex,L.Text.JsvTextLatex)}jsvTextAlignMinWidth(){return Ii.STYLE_PROPERTY_GETTER(this,A.Text.JsvTextAlignMinWidth,L.Text.JsvTextAlignMinWidth)}jsvTextVerticalAlign(){return Ii.STYLE_PROPERTY_GETTER(this,A.Text.JsvTextVerticalAlign,L.Text.JsvTextVerticalAlign)}jsvTextLineAlign(){return Ii.STYLE_PROPERTY_GETTER(this,A.Text.JsvTextLineAlign,L.Text.JsvTextLineAlign)}jsvTextInnerDirection(){return Ii.STYLE_PROPERTY_GETTER(this,A.Text.JsvTextInnerDirection,L.Text.JsvTextInnerDirection)}animation(){return Ii.STYLE_PROPERTY_GETTER(this,A.Motion.Animation,null)}transition(){return Ii.STYLE_PROPERTY_GETTER(this,A.Motion.Transition,null)}animationFillMode(){return Ii.STYLE_PROPERTY_GETTER(this,A.Motion.AnimationFillMode,null)}static OnVariableChanged(e,t,i,n){const s=e;if(t==A.Motion.Animation){const e=s.elementDelegate;x(null!=e,_.InvalidElement),s.addChangedStyleGroup(R.Motion.Name),n.add(e.nativeId)}else{const e=s.setStyleInheritedProperty(t,i,!1,n);if(e==_.CssStyleNotChanged)return e;v(e)}return 0}setStyleInheritedProperty(e,t,i,n){const s=this.styleClass.getManager();let r=_.UnknownError;if(k.IsVariable(e))r=s.setVariable(e,t,n);else if(k.IsVariable(t))r=s.watchVariable(this.styleClass,e,Ii.OnVariableChanged.bind(null,this),t.get(),n);else{if(r=this.style.setPropValue(e,t,i),r==_.CssStyleNotChanged)return r;if(v(r),e==A.Motion.Animation){i&&(r=s.unwatchVariable(this.styleClass,e),v(r));const t=this.style.getPropValue(e);t.is(P.DataType.Animation)&&(r=s.watchKeyframeVariables(this.styleClass,e,Ii.OnVariableChanged.bind(null,this),t.get().name,n),v(r))}}if(r==_.CssStyleNotChanged)return r;v(r);const a=this.elementDelegate;x(null!=a,_.InvalidElement),n.add(a.nativeId);const o=(e,t,i)=>{for(const n of t.childNodes)n.styleDelegate.style.hasPropValue(e)||o(e,n,i);const n=t instanceof Mi?t:null;null!=n&&0!=n.getTextContent().length&&(t.styleDelegate.addChangedStyleGroup(R.Text.Name),i.add(t.nativeId))};return Si.IsInheritedProp(e)&&o(e,a,n),0}getStyleInheritedProperty(e,t){if(t.reset(this.style.getPropValue(e)),0==t.is(P.DataType.Null))return 0;if(0==Si.IsInheritedProp(e))return _.CssStyleNotExists;const i=this.elementDelegate;x(null!=i,_.InvalidElement);const n=i.parentNode;if(null==n)return _.CssStyleNotExists;const s=n.styleDelegate.getStyleInheritedProperty(e,t);return s<0?s:0}getNestedClassNamesRecursive(e,t){const i=this.elementDelegate;if(x(null!=i,_.InvalidElement),0==this.styleClass.hasClassAttribute(e))return 0;const n=i.parentNode;x(null!=n,_.InvalidElement);v(n.styleDelegate.getNestedClassNamesRecursive(e,t));const s=this.styleClass.getClassNames();return s.length<=0||t.push(s),0}}class Ai{constructor(e){let t=-1;null==e?t=Ai.DataType.Null:Number(e)===e&&e%1==0?t=Ai.DataType.Int32:Number(e)===e&&e%1!=0?t=Ai.DataType.Float:"string"==typeof e&&(t=Ai.DataType.String),this.data=new Ai.DataInfo,e!=Ai.InvalidInt32&&e!=Ai.InvalidFloat&&e!=Ai.InvalidPointer?this.data.value=e:this.data.value=null,this.data.index=t}is(e){return this.data.index==e}get(){return this.data.value}reset(e){this.data.value=e.data.value,this.data.index=e.data.index}equals(e){return this.data.value===e.data.value&&this.data.index===e.data.index}}Ai.DataType=(T(bi=class{},"DataType"),bi.Null=0,bi.Int32=1,bi.Float=2,bi.String=3,bi),Ai.InvalidInt32=Number.MIN_VALUE,Ai.InvalidFloat=Number.NaN,Ai.InvalidPointer=null,Ai.DataInfo=class{constructor(){this.value=null,this.index=-1}};class Pi{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(e){return this._PersistMap.get(e)}putPersistPack(e,t){Pi._putPack(this._PersistMap,this._PersistTrackList,this._PersistIdx,e,t),this._PersistIdx=(this._PersistIdx+1)%this._PersistMax}getTempPack(e){return this._TempMap.get(e)}putTempPack(e,t){Pi._putPack(this._TempMap,this._TempTrackList,this._TempIdx,e,t),this._TempIdx=(this._TempIdx+1)%this._TempMax}static _putPack(e,t,i,n,s){let r=t[i];r&&(e.delete(r),t[i]=n),e.set(n,s)}}let Li=new Pi;var ki,Ri;class Fi{GetAnimationManager(){}GetRootView(){return new F.RootView}GetTextureManager(){return window.JsvCode.ForgeHandles.TextureManager}GetTextureSetting(e,t){return new F.ExternalTextureSetting(e,t)}GetRenderBridge(){return Fi.sRenderBridge}}Fi.ClipView=F.ClipView,Fi.LayoutView=F.LayoutView,Fi.NinePatchView=F.NinePatchView,Fi.ViewRoundCornerMask=F.ViewRoundCornerMask,Fi.AnimationListener=F.AnimationListener,Fi.sRenderBridge=F.sRenderBridge,Fi.TextureInstantLoad={AUTO:F.TextureInstantLoad.AUTO,SYNC:F.TextureInstantLoad.SYNC,ASYNC:F.TextureInstantLoad.ASYNC},Fi.FlexContainerProps=F.FlexContainerProps,Fi.FlexSetNames=F.FlexSetNames,Fi.FlexItemProps=F.FlexItemProps,Fi.Animation=class{constructor(){}Cancel(){this.animation.Cancel()}Enable(e){this.animation.Enable(e)}EnableDelay(e){this.animation.EnableDelay(e)}SetAnimationListener(e){this.animation.SetAnimationListener(e)}SetRepeat(e){this.animation.SetRepeat(e)}Start(e){this.animation.Start(e)}},Fi.AnimationCssKeyframes=class extends F.CssKeyframeAnimation{constructor(e,t){super(t.keyframes,t.duration,t.easing,t.width,t.height)}},Fi.AnimationCssTransition=(T(ki=class extends F.CssTransitionAnimation{constructor(e,t){let i=[];for(const e of t){let t={name:e.name,dur:e.duration,tf:e.easing?.Package(),dly:e.delay,from:e.from.data,to:e.to.data};i.push(t)}super(i)}},"AnimationCssTransition"),ki.Value=class{constructor(e){this.data=e}},ki),Fi.AnimationManager=(T(Ri=class{},"AnimationManager"),Ri.AnimationEnable={ReleaseAfterEndCallback:1,KeepTransform:2,AckFinalProgress:4,AckRepeat:8},Ri),Fi.AnimationEnable=F.AnimationEnable,Fi.TextUtils=class{static GetTextWidth(e,t,i,n,s,r){return F.sTextUtils.GetTextWidth(t,i,n,s,r)}static GetOneLineTextDrawWidth(e,t,i,n,s,r,a){F.sTextUtils.GetOneLineTextDrawWidth(t,i,n,s,r,a)}static BuildTextView(e,t,i,n,s,r,a,o,l,h,c){return F.sTextUtils.BuildTextView(e,t,i.GetStylePack(),n,{width:s,height:r},0!=a?a:null,o,l,0!=h,0!=c)}},Fi.TextStyleCache=class{constructor(){this.stylePackData={}}UpdateShadow(e,t,i,n){this.stylePackData.shadow={shadowOffsetX:e,shadowOffsetY:t,shadowBlur:i,shadowColor:n}}UpdateStroke(e,t){this.stylePackData.stroke={strokeWidth:e,strokeColor:t}}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 e=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 t=Li.getTempPack(e);t||(t=F.sTextStyleCache.StyleToPack(this.stylePackData),Li.putTempPack(e,t)),this.textStylePack=t}GetStylePack(){return this.textStylePack}},Fi.LayoutView.eVisibility={VIEW_HIDDEN:"hidden",VIEW_VISIBLE:"visible"};class Di{constructor(e,t,i){this.name=e,this.value=t,this.viewType=i}}class Vi{static MakeShared(e,t,i,n){const s=new n(e,t);return s.styleDelegate=new Ii(s,i),s}bindToForgeRootView(e){this.forgeMainView=e.GetRootView(),this.forgeMaskView=this.forgeMainView}insertForgeView(e,t,i){t.ensureForgeMaskView(e);const n=this.forgeMainView.InsertView(t.forgeMaskView,i?i.forgeMaskView:null);S(n||void 0===n),this.linkChild(e,t,i)}removeForgeView(e,t){this.forgeMainView.RemoveView(t.forgeMaskView),this.unlinkChild(e,t)}linkChild(e,t,i){this.childNodes.push(t),t.parentNode=this,(t.attrStore.extendClassAttributeDepth>0||t.hasExtendClassAttributeChildren)&&(this.hasExtendClassAttributeChildren=!0)}unlinkChild(e,t){const i=this.childNodes.indexOf(t);this.childNodes.splice(i,1),t.parentNode=void 0}moveForgeView(e,t,i,n){t.unlinkChild(e,i),this.linkChild(e,i,n),(t.forgeMaskView?t.forgeMaskView:t.forgeMainView).MoveChildView(i.forgeMaskView,this.forgeMainView,n?n.forgeMaskView:null),console.log("moving child")}reOrderForgeView(e,t,i){this.forgeMainView.ReOrderChildView(t.forgeMaskView,i?i.forgeMaskView:null)}addEventListener(e,t,i){if(null==this.eventInfoMap&&(this.eventInfoMap=new Map),0==this.eventInfoMap.has(e)){const i=new Vi.EventInfo;i.listener=t,this.eventInfoMap.set(e,i)}this.eventInfoMap.get(e).count++;const n=this.tryDealWithCustomEvent(e,i);return v(n),n}removeEventListener(e,t){if(null==this.eventInfoMap)return;if(0==this.eventInfoMap.has(e))return;const i=this.eventInfoMap.get(e);i.count--,i.count<=0&&this.eventInfoMap.delete(e)}setAttribute(e,t,i){let n=_.UnsupportedError;if(wi.StringStartsWith(t,"data-v-"))n=this.appendStyleClassAttribute(t),v(n),n=Vi.State.NeedRefreshCssClassAttribute;else if(wi.StringStartsWith(t,"class"))n=this.styleDelegate.setClassNames(i),v(n),n=Vi.State.NeedRefreshCssClass;else if(wi.StringStartsWith(t,"data-jsv-extend-class-attr")){const e=wi.StringToInt32(i);x(e!=P.InvalidInt32,_.InvalidArgument),n=this.setExtendClassAttributeDepth(e),v(n),n=Vi.State.NeedRefreshCssClass}else wi.StringStartsWith(t,"data-jsv-flex-container")&&(this.enableAsFlexContainer(),n=Vi.State.NeedRefreshCssClassAttribute);return v(n),n}getExtendClassAttributeChildren(e,t=0){if(this.attrStore.extendClassAttributeDepth==t)return e.add(this),0;if(0==this.hasExtendClassAttributeChildren)return 0;for(let i of this.childNodes){if(i.attrStore.extendClassAttributeDepth<=0&&0==i.hasExtendClassAttributeChildren)continue;v(i.getExtendClassAttributeChildren(e,t+1))}return 0}onCssStyleChanged(e){const t=this.styleDelegate.getChangedStyleGroups();return t.has(R.Layout.Name)&&this.onFlushViewLayout(e),t.has(R.Flex.Name)&&this.onFlushViewFlex(e),t.has(R.Background.Name)&&this.onFlushViewBackground(e),t.has(R.Effect.Name)&&this.onFlushViewEffect(e),t.has(R.Motion.Name)&&this.onFlushViewMotion(e),this.styleDelegate.clearChangedStyleGroups(),0}onAllChangeFinished(e){if(null==this.onAllChangeFinishTasks)return 0;for(const e of this.onAllChangeFinishTasks)e();return this.onAllChangeFinishTasks=void 0,0}handleAfterAllChangeFinish(e){null==this.onAllChangeFinishTasks&&(this.onAllChangeFinishTasks=[]),this.onAllChangeFinishTasks.push(e)}setForgeViewInnerProps(e,t,i,n){return 1==i?this.forgeMaskView?this.forgeMaskView.SetElementProp(e,t,n):this.forgeInnerPropsCacheList.push(new Di(t,n,i)):this.forgeMainView.SetElementProp(e,t,n),0}getElementView(e){return e?this.forgeMaskView:this.forgeMainView}setClientWidth(e,t){this.clientWidth=t}getClientWidth(e){return this.clientWidth<0?this.styleDelegate.width():this.clientWidth}setClientHeight(e,t){this.clientHeight=t}getClientHeight(e){return this.clientHeight>0?this.clientHeight:this.styleDelegate.jsvValidHeight()}constructor(e,t){this.childNodes=[],this.parentNode=void 0,this.forgeAnimation=null,this.eventInfoMap=void 0,this.onAllChangeFinishTasks=void 0,this.attrStore=new Vi.AttrStore,this.hasExtendClassAttributeChildren=!1,this.transitionSetInfo=new Vi.TransitionSetInfo,this.flexEnabled=!1,this.clientWidth=-1,this.clientHeight=-1,this.forgeInnerPropsCacheList=[],this.nativeId=t,this.forgeMainView=new Fi.LayoutView,this.forgeMaskView=this.forgeMainView}sendEvent(e,t){if(null==this.eventInfoMap||0==this.eventInfoMap.has(e))return;console.log("ElementDelegate.sendEvent(). event="+e);const i=this.eventInfoMap.get(e);let n=[];n.push(new Ai(this.nativeId)),n.push(new Ai(e));for(const e of t)n.push(e);i.listener(n)}getObjectFitClipStatus(e){return!1}flushMaskViewClip(e){if(null==this.forgeMaskView)return;const t=this.forgeMaskView instanceof Fi.ClipView?this.forgeMaskView:null;if(null==t)return;let i={left:0,top:0,width:0,height:0,autoSizeClip:!1,useScissors:!1};if(!this.getObjectFitClipStatus(i)){const e=this.styleDelegate.overflow();null!=e&&"hidden"==e&&(i.autoSizeClip=!0,i.useScissors=!0)}i.autoSizeClip?t.SetWholeSizeScissor(i.useScissors,!0):t.SetClipRect(i.left,i.top,i.width,i.height,i.useScissors)}onFlushViewLayout(e){if(0==this.styleDelegate.hasPropGroup(R.Layout.Name))return;const t=this.styleDelegate.left(),i=this.styleDelegate.top(),n=this.styleDelegate.jsvValidWidth(),s=this.styleDelegate.jsvValidHeight();this.forgeMaskView.ResetLayoutParams({x:t,y:i,width:n,height:s}),this.forgeMaskView!=this.forgeMainView&&this.forgeMainView.ResetLayoutParams({x:0,y:0,width:n,height:s})}onFlushViewFlex(e){if(!this.flexEnabled)return;const t=this.styleDelegate.flexDirection(),i=this.styleDelegate.flexWrap(),n=this.styleDelegate.justifyContent(),s=this.styleDelegate.alignItems(),r=this.styleDelegate.alignContent();let a=new Fi.FlexContainerProps;a.flexDirection=t!=P.InvalidInt32?t:a.flexDirection,a.flexWrap=i!=P.InvalidInt32?i:a.flexWrap,a.justifyContent=n!=P.InvalidInt32?n:a.justifyContent,a.alignItems=s!=P.InvalidInt32?s:a.alignItems,a.alignContent=r!=P.InvalidInt32?r:a.alignContent,this.forgeMainView.ResetFlexContainerCell(a);const o=this.styleDelegate.alignSelf(),l=this.styleDelegate.flexGrow();if(o==P.InvalidInt32&&isNaN(l))this.forgeMainView.ResetFlexItemCell(null);else{let e=new Fi.FlexItemProps;e.alignSelf=o!=P.InvalidInt32?o:e.alignSelf,e.flexGrow=isNaN(l)?e.flexGrow:l,this.forgeMainView.ResetFlexItemCell(e)}}onFlushViewBackground(e){if(0==this.styleDelegate.hasPropGroup(R.Background.Name))return;const t=e.GetTextureManager(),i=this.styleDelegate.backgroundColor(),n=this.styleDelegate.backgroundImage(),s=this.styleDelegate.borderRadius();let r,a=null;n&&n.urlPath&&0!=n.urlPath.length&&(n.type==P.BackgroundImageImpl.eType.LINEAR_GRADIENT?(a=t.GetNamedCachedTexture(n.urlPath),null==a&&(a=t.CreateCssGradientColorTexture(n.urlPath,n.linearGradient.fromX,n.linearGradient.fromY,n.linearGradient.toX,n.linearGradient.toY,n.linearGradient.stops))):a=t.GetImage(n.urlPath,null)),i&&0!=i.length&&(null==a?a=t.GetColorTextureCached(i):console.warn(`Ignore color(${i}) when image(${n?.urlPath}) set(id=${this.nativeId})`)),s&&(r=new Fi.ViewRoundCornerMask(s.topLeft,s.topRight,s.bottomLeft,s.bottomRight)),this.forgeMainView.ResetTexture(a,r)}onFlushViewEffect(e){if(0==this.styleDelegate.hasPropGroup(R.Effect.Name))return;const t=this.styleDelegate.visibility();let i=t&&"hidden"==t?Fi.LayoutView.eVisibility.VIEW_HIDDEN:Fi.LayoutView.eVisibility.VIEW_VISIBLE;"none"==this.styleDelegate.display()&&(i=Fi.LayoutView.eVisibility.VIEW_HIDDEN),this.forgeMaskView.SetVisibility(i),this.flushMaskViewClip(e);const n=this.styleDelegate.perspective();if(n>0){const e=this.styleDelegate.perspectiveOrigin();this.forgeMainView.SetPerspective(n,e)}const s=this.styleDelegate.backfaceVisibility();s&&this.forgeMainView.SetBackfaceVisibility("visible"==s);const r=this.styleDelegate.opacity();isNaN(r)||1==r||this.setOpacity(r),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(e){if(null!=this.forgeAnimation&&(this.forgeAnimation.Cancel(),this.forgeAnimation=null),0==this.styleDelegate.hasPropGroup(R.Motion.Name))return;let t="",i="";const n=this.styleDelegate.animation(),s=this.styleDelegate.transition(),r=this.styleDelegate.animationFillMode();if(null!=n&&null!=s&&console.warn("ElementDelegate","Cannot set both animation and transition on a single element at the same time."),null!=n){t="animation",i=n.name;const s=this.styleDelegate.getKeyframes(n.name);this.forgeAnimation=this.makeAnimation(e,n,s),"forwards"===r&&this.forgeAnimation.Enable(Fi.AnimationManager.AnimationEnable.KeepTransform)}if(null!=s&&null==this.forgeAnimation){const i=e.GetRenderBridge().GetSwapCount();if(this.transitionSetInfo.alreadySet&&this.transitionSetInfo.swapCount!=i)t="transition",this.forgeAnimation=this.makeTransition(e,s);else{for(const[e,t]of s.animationMap){let t=new P;const i=A.ToConst(e);null!=i&&(this.styleDelegate.getProperty(i,t),this.attrStore.transitionStyleMap.set(e,t))}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 e=this.makeForgeAnimationListener(t,i);null!=e&&this.forgeAnimation.SetAnimationListener(e),this.forgeMaskView.StartAnimation(this.forgeAnimation)}}tryDealWithCustomEvent(e,t){if("jsv-getbound"===e){x(t.has("jsvtoken"),_.InvalidArgument);const i=t.get("jsvtoken"),n=()=>{const t=this;null!=t?t.getBoundingClientRect(e,i,t.forgeMainView):console.error("ElementDelegate.tryDealWithCustomEvent(), Element has been released.")};return this.handleAfterAllChangeFinish(n),Vi.State.NeedCallPostProcess}return 0}setOpacity(e){1!=e&&console.error("Error: not support opacity for performance issue(only <img>) value="+e)}static parsePerformAttr(e,t,i){return!(!wi.StringStartsWith(e,"data-jsv-perf-")||"data-jsv-perf-loadtex"!=e)&&(i.outTexInstantLoad="sync"==t?Fi.TextureInstantLoad.SYNC:"async"==t?Fi.TextureInstantLoad.ASYNC:Fi.TextureInstantLoad.AUTO,i.outParseResult=Vi.State.NeedRefreshCssClassAttribute,!0)}makeAnimation(e,t,i){if(null==t||null==i)return null;const n=this.styleDelegate.jsvValidWidth(),s=this.styleDelegate.jsvValidHeight();let r={keyframes:i,duration:t.duration,easing:t.timingFunction,width:n,height:s,left:this.styleDelegate.left(),top:this.styleDelegate.top()};const a=new Fi.AnimationCssKeyframes(e.GetAnimationManager(),r);return a.EnableDelay(t.delay),a.SetRepeat(t.iterationCount),a.Enable(Fi.AnimationEnable.ReleaseAfterEndCallback),a}makeTransition(e,t){if(null==t)return this.attrStore.transitionStyleMap.clear(),null;let i=[];for(const[e,n]of t.animationMap){if(null==n)continue;const t=this.attrStore.transitionStyleMap.get(e)??new P;let s=new P;const r=A.ToConst(e);if(x(r,null,["Failed makeTransition no support:"+e]),this.styleDelegate.getProperty(r,s),s.equals(t))continue;const a={name:e,duration:n.duration,easing:n.timingFunction,delay:n.delay,from:new Fi.AnimationCssTransition.Value,to:new Fi.AnimationCssTransition.Value,origin:""};if(t.is(P.DataType.Int32)){const e=t.get();a.from=new Fi.AnimationCssTransition.Value(e)}else if(t.is(P.DataType.Float)){const e=t.get();a.from=new Fi.AnimationCssTransition.Value(e)}else if(t.is(P.DataType.String)){const e=t.get();a.from=new Fi.AnimationCssTransition.Value(e)}if(s.is(P.DataType.Int32)){const e=s.get();a.to=new Fi.AnimationCssTransition.Value(e)}else if(s.is(P.DataType.Float)){const e=s.get();a.to=new Fi.AnimationCssTransition.Value(e)}else if(s.is(P.DataType.String)){const e=s.get();a.to=new Fi.AnimationCssTransition.Value(e)}e==A.Effect.Transform&&(a.origin=null!=this.styleDelegate.transformOrigin()?this.styleDelegate.transformOrigin():"center center"),i.push(a),this.attrStore.transitionStyleMap.set(e,s)}if(i.length>0){return new Fi.AnimationCssTransition(e.GetAnimationManager(),i)}return null}makeForgeAnimationListener(e,t){const i=new Fi.AnimationListener(null,null,null);return i.OnStart((()=>{const i=e+"start";this.sendEvent(i,[new Ai(t)])})),i.OnRepeat((i=>{const n=e+"iteration";this.sendEvent(n,[new Ai(t)])})),i.OnEnd((i=>{let n;this.forgeAnimation=null,n=i?e+"end":e+"cancel",this.sendEvent(n,[new Ai(t)])})),i}ensureForgeMaskView(e){if(this.forgeMainView.mParentView)return void console.log("ElementDelegate.ensureForgeMaskView(), Failed to ensure forge mask view, main view's parent is not null.");const t=this.styleDelegate.objectFit(),i=this.styleDelegate.overflow();if(null!=t||null!=i?(null!=this.forgeMaskView&&this.forgeMaskView!=this.forgeMainView&&console.error(Vi.TAG,"Jsview: jsvMaskView is conflicting."),this.forgeMaskView=new Fi.ClipView):null==this.forgeMaskView&&(this.forgeMaskView=this.forgeMainView),this.forgeMaskView!==this.forgeMainView&&(this.forgeMaskView.AddView(this.forgeMainView,0,0),this.flexEnabled&&this.forgeMaskView.TransChildFlexInfoPack(this.forgeMainView),this.forgeMaskView.MarkFlexChildrenFromChild0()),this.forgeInnerPropsCacheList.length>0){for(let t of this.forgeInnerPropsCacheList)this.forgeMaskView.SetElementProp(e,t.name,t.value);this.forgeInnerPropsCacheList=[]}}appendStyleClassAttribute(e){const t=e.replace("data-v-","");let i=0;i=parseInt(t,16);let n=this.styleDelegate.appendClassAttribute(i);v(n);const s=new Set;n=this.getExtendClassAttributeChildren(s),v(n);for(let e of s)n=e.styleDelegate.appendClassAttribute(i),v(n);return 0}setExtendClassAttributeDepth(e){if(e<=0)return 0;this.attrStore.extendClassAttributeDepth=e;let t=this;for(let i=0;i<e&&(t=t.parentNode,null!=t);i++);if(t){v(this.styleDelegate.mergeClassAttributes(t.styleDelegate))}return 0}convertObjectFit(e){return e?"fill"==e?"fill":"none"==e?"none":"cover"==e?"cover":"contain"==e?"contain":"scale-down"==e?"scale-down":"fill":"fill"}getBoundingClientRect(e,t,i){if(i){const n=i=>{this.sendEvent(e,[new Ai(i),new Ai(t)])};i.GetBoundingClientRect(n)}else{const i='{"status": -100, "error": target LayoutView is null})';this.sendEvent(e,[new Ai(i),new Ai(t)])}}enableAsFlexContainer(){this.flexEnabled=!0}}Vi.TAG="ElementDelegate",Vi.State={NeedRefreshCssClass:1,NeedRefreshCssClassAttribute:2,NeedCallPostProcess:3},Vi.EventInfo=class{constructor(){this.listener=void 0,this.count=0}},Vi.AttrStore=class{constructor(){this.transitionStyleMap=new Map,this.extendClassAttributeDepth=-1}},Vi.TransitionSetInfo=class{constructor(){this.swapCount=0,this.alreadySet=!1}};class Oi{static isRtl(e){for(let t=0;t<e.length;++t){let i=e.charCodeAt(t);if(32!==i)return i>=1536&&i<=1791}return!1}}class Mi extends Vi{setTextContent(e){this.textContent=e}getTextContent(){return this.textContent}onCssStyleChanged(e){const t=this.styleDelegate.getChangedStyleGroups();return(t.has(R.Text.Name)||t.has(R.Layout.Name)&&this.clientWidth!=this.styleDelegate.jsvValidHeight())&&this.onFlushViewText(e),t.has(R.Effect.Name)&&null!=this.styleDelegate.borderImage()&&this.onFlushViewBorder(e),super.onCssStyleChanged(e)}constructor(e,t){super(e,t),this.textContent="",this.instantLoadSet=Fi.TextureInstantLoad.AUTO}setAttribute(e,t,i){let n,s={};return Vi.parsePerformAttr(t,i,s)?(this.instantLoadSet=s.outTexInstantLoad,n=s.outParseResult,n):(n=super.setAttribute(e,t,i),n)}onFlushViewText(e){if(!this.textContent)return void(this.forgeContentView&&(this.forgeMainView.RemoveView(this.forgeContentView),this.forgeContentView=null));null==this.forgeContentView&&(this.forgeContentView=new Fi.LayoutView,this.forgeMainView.InsertView(this.forgeContentView),this.forgeMainView.MarkFlexSizeFromChild(this.forgeContentView)),this.forgeContentView.ClearViews(),this.clientWidth=0,this.clientHeight=0;let t=e.GetTextureManager(),i=new Fi.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(t);const u=this.styleDelegate.height();let d=this.styleDelegate.width(),g=u!=P.InvalidInt32?u:0,f=d==P.InvalidInt32;if(f&&(d=Fi.TextUtils.GetTextWidth(t,this.textContent,i.font,n,i.bold,i.italic)),d<=0)return void console.error(Mi.TAG,"Failed to render text: %s, text width is invalid.");let m=d,p=this.styleDelegate.jsvTextAlignMinWidth();p>0&&m<p&&(m=p);const y=u==P.InvalidInt32||0==u,T=y?(e,t,i)=>{this.clientWidth=e,this.clientHeight=t}:null;let _=Math.floor(d*Fi.sRenderBridge.GetScreenInfo().scaleRatio);if(_>3e3){if(!f)return void console.error(`long text only support style.width=undefine. str=${this.textContent}`);console.log(`text too long, start to break down. width(${_})`),this.forgeTextView=new Fi.LayoutView;const e=[];Fi.TextUtils.GetOneLineTextDrawWidth(t,this.textContent,i.font,n,i.bold,i.italic,e);const o=e[0];let l=0;const h="unset"===i.textInnerDirection?Oi.isRtl(this.textContent):"rtl"===i.textInnerDirection;for(let c=1;c<e.length;c+=3){const u=e[c],d=e[c+1],f=e[c+2],m=this.textContent.slice(u,d);let p=Fi.TextUtils.BuildTextView(t,m,i,0==u?T:null,f,g,n,s,this.instantLoadSet,a,r);const y=h?o-l-f:l;this.forgeTextView.AddView(p,y,0,f,g),l+=f}this.clientWidth=o,this.forgeTextView.ResetLayoutParams({x:0,y:0,width:o,height:g})}else this.forgeTextView=Fi.TextUtils.BuildTextView(t,this.textContent,i,T,m,g,n,s,this.instantLoadSet,a,r),this.clientWidth=d;y&&this.forgeTextView.EnableAutoHeight(),this.forgeContentView.InsertView(this.forgeTextView),this.forgeContentView.MarkFlexSizeFromChild(this.forgeTextView)}ensureForgeMaskView(e){null!=this.styleDelegate.borderImage()&&(this.forgeMaskView=new Fi.NinePatchView),super.ensureForgeMaskView(e)}onFlushViewBorder(e){if(null==this.forgeMaskView)return;const t=this.styleDelegate.borderImage();if(null!=t)if(0==t.source.length)this.forgeMaskView.ResetTexture(null,null);else{const i=e.GetTextureManager(),n=t.source,s=i.GetImage(n,null);this.forgeMaskView.ResetTexture(s,null),this.forgeMaskView.WaitTextureToResize(!0);const r=(e,i,n)=>{const s=this.styleDelegate.borderImageWidth(),r=this.styleDelegate.borderImageOutset();if(null==this.forgeMaskView||null==t.slice||null==s||null==r)return void console.log(Mi.TAG,"Nine patch settings are not complete.");const a=this.forgeMaskView,o=Math.floor(e*s.top/t.slice.top),l=Math.floor(i*s.left/t.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(e,t,i){this.styleDelegate.height()!=P.InvalidInt32&&this.styleDelegate.width()!=P.InvalidInt32||null==this.forgeTextView||(i=this.forgeTextView),super.getBoundingClientRect(e,t,i)}}Mi.TAG="DivDelegate";class Ni extends Vi{constructor(e,t){super(e,t)}}class Gi extends Ni{constructor(e,t){super(e,t)}}class Bi extends Vi{setAttribute(e,t,i){const n=()=>{const t=this;null!=t?t.loadImage(e,t.imgAttrStore.src):console.error("ElementDelegate.tryDealWithCustomEvent(), Element has been released.")};if("src"==t)return this.imgAttrStore.src!==i&&(this.imgAttrStore.sizeApplied=!1,this.imgAttrStore.imageWidth=0,this.imgAttrStore.imageHeight=0),this.imgAttrStore.src=i,this.handleAfterAllChangeFinish(n),Bi.State.NeedCallPostProcess;return 0==this.setTextureAttribute(e,t,i)?(this.handleAfterAllChangeFinish(n),Bi.State.NeedCallPostProcess):super.setAttribute(e,t,i)}onCssStyleChanged(e){const t=this.styleDelegate.getChangedStyleGroups();return(t.has(R.Layout.Name)||t.has(R.Effect.Name))&&this.onFlushViewImage(e),super.onCssStyleChanged(e)}constructor(e,t){super(e,t),this.imageInLoading=!1,this.forgeImageTexture=null,this.imageOperatorKey=null,this.loadCallbackSeq=0,this.imgAttrStore=new Bi.ImgAttrStore,this.forgeImageView=new Fi.LayoutView(null,"img"),this.forgeMainView.InsertView(this.forgeImageView),this.forgeMainView.MarkFlexSizeFromChild(this.forgeImageView)}setForgeViewInnerProps(e,t,i,n){return 1==i?super.setForgeViewInnerProps(e,t,i,n):(this.forgeImageView.SetElementProp(e,t,n),0)}getObjectFitClipStatus(e){if(0!=this.imgAttrStore.imageWidth&&0!=this.imgAttrStore.imageHeight){let t=this.convertObjectFit(this.styleDelegate.objectFit());if("fill"!=t){let i=this.forgeImageView.ApplyObjectFit(this.styleDelegate.jsvValidWidth(),this.styleDelegate.jsvValidHeight(),this.imgAttrStore.imageWidth,this.imgAttrStore.imageHeight,t);if(i)return e.left=i.x,e.top=i.y,e.width=i.width,e.height=i.height,e.autoSizeClip=!1,e.useScissors=!0,!0}}return!1}onFlushViewImage(e){if(0!=this.imgAttrStore.imageWidth&&0!=this.imgAttrStore.imageHeight&&!this.imgAttrStore.sizeApplied){this.flushMaskViewClip(e);let t=this.styleDelegate.jsvValidWidth(),i=this.styleDelegate.jsvValidHeight();0==t&&0!=i?t=this.imgAttrStore.imageWidth*i/this.imgAttrStore.imageHeight:0!=t&&0==i&&(i=this.imgAttrStore.imageHeight*t/this.imgAttrStore.imageWidth),this.clientWidth=t,this.clientHeight=i,this.imgAttrStore.sizeApplied=!0}const t=this.styleDelegate.jsvValidWidth(),i=this.styleDelegate.jsvValidHeight(),n={x:0,y:0,width:t>0?t:this.getClientWidth(e),height:i>0?i:this.getClientHeight(e)};this.forgeImageView.ResetLayoutParams({x:n.x,y:n.y,width:n.width,height:n.height})}setTextureAttribute(e,t,i){let n=_.UnsupportedError;return"dataJsvImgColorSpace"==t||"data-jsv-img-color-space"==t?(this.imageInLoading&&console.log("Failed to set attribute "+t+", this attribute must be set before src"),this.imgAttrStore.dataJsvColorSpace=i,n=0):"dataJsvImgScaledownTex"==t||"data-jsv-img-scaledown-tex"==t?(this.imageInLoading&&console.log("Failed to set attribute "+t+", this attribute must be set before src"),this.imgAttrStore.dataJsvScaleDownTex=""==i||"true"==i,n=0):"data-jsv-img-poster-image"==t&&(this.imageInLoading&&console.log("Failed to set attribute "+t+", this attribute must be set before src"),this.imgAttrStore.dataJsvPosterImage="true"==i,n=0),n}loadImage(e,t){if(null==t)return;this.imgAttrStore.imageWidth=0,this.imgAttrStore.imageHeight=0;let i=0,n=0;1==this.imgAttrStore.dataJsvScaleDownTex&&(i=this.styleDelegate.width(),0==i&&console.error("set dataJsvScaleDownTex while style.width is not set"),n=this.styleDelegate.height(),0==n&&console.error("set dataJsvScaleDownTex while style.height is not set"));let s=e.GetTextureManager();this.forgeImageTexture=s.GetImage2(this.imgAttrStore.src,i,n,this.imgAttrStore.dataJsvColorSpace,null,!1,this.imgAttrStore.dataJsvPosterImage),this.imageInLoading=!0;let r,a=++this.loadCallbackSeq;this.imageOperatorKey=this.forgeImageTexture.RegisterLoadImageCallback(((t,i,n)=>{a==this.loadCallbackSeq&&(this.imgAttrStore.imageWidth=t,this.imgAttrStore.imageHeight=i,this.imageInLoading=!1,this.onFlushViewImage(e),this.sendEvent("load",[new Ai(t),new Ai(i)]))}));let o=this.styleDelegate.borderRadius();o&&(r=new Fi.ViewRoundCornerMask(o.topLeft,o.topRight,o.bottomLeft,o.bottomRight)),this.forgeImageView.ResetTexture(this.forgeImageTexture,r)}getClientWidth(e){const t=super.getClientWidth(e);return t<=0&&this.imgAttrStore.imageWidth>0?this.imgAttrStore.imageWidth:t}getClientHeight(e){const t=super.getClientHeight(e);return t<=0&&this.imgAttrStore.imageHeight>0?this.imgAttrStore.imageHeight:t}setOpacity(e){this.forgeImageView.SetViewOpacity(e)}}Bi.ImgAttrStore=class{constructor(){this.src=void 0,this.imageWidth=0,this.imageHeight=0,this.sizeApplied=!1,this.dataJsvColorSpace="RGBA_8888",this.dataJsvScaleDownTex=!1,this.dataJsvPosterImage=!1}};class Wi extends Ni{onCssStyleChanged(e){return this.styleDelegate.getChangedStyleGroups().has(R.Layout.Name)&&this.onFlushViewHole(e),super.onCssStyleChanged(e)}constructor(e,t){super(e,t)}onFlushViewHole(e){this.forgeMainView.Element.style.backgroundColor="#222222"}}class Hi{static SetForgeFrontToContext(e,t){e.forgeFront=t}static GetForgeFrontFromContext(e){return e.forgeFront}}class Yi{constructor(){this.elementDelegateMap=new Map,this.onEventListener=void 0,this.styleClassMgr=new Ci.Manager}static GetInstance(e){const t=Yi.PlatformBridgeInstanceMap.get(e);if(t)return t;const i=new class extends Yi{};return i.jsviewId=e,Yi.PlatformBridgeInstanceMap.set(e,i),Hi.SetForgeFrontToContext(i,new Fi),window.JsvCode.Debug||(window.JsvCode.Debug={}),window.JsvCode.Debug.PlatformBridge=[],window.JsvCode.Debug.PlatformBridge.push(i),i}static SetOnEventListener(...e){w(e.length>=2,null);const t=e[0],i=e[1],n=Yi.GetInstance(t);return n.onEventListener=new Yi.EventListener,n.onEventListener.jseFunction=i,null}static RunSyncTask(...e){x(e.length>=3,_.BadArgumentSize);const t=e[0],i=e[1],n=e[2],s=e,r=Yi.GetInstance(t),a=Hi.GetForgeFrontFromContext(r);let o=new Ai,l=r.runGetterTaskByType(a,i,n,s,o);if(l<0)throw new Error("Failed to run synctask, error: "+l);return Yi.CastFromUnionValue(o)}static RunLazyTaskList(...e){w(e.length>=2,null);const t=e[0],i=e[1],n=JSON.parse(i),s=Yi.GetInstance(t),r=Hi.GetForgeFrontFromContext(s),a=n,o=new Yi.TaskStash;for(const e of a){const t=e[0],i=e[1],n=e;if(o.removedIdSet.has(i))continue;let a=s.runSetterTaskByType(r,t,i,n,o);if(a==_.CssStyleNotChanged&&(a=0),a<0)throw new Error("Failed to run lazytask, error: "+a)}for(const e of o.removedIdSet)o.cssClassChangedIdSet.delete(e),o.cssStyleChangedIdSet.delete(e),o.postprocessingIdSet.delete(e);const l=s.syncCssClasses(o.cssClassChangedIdSet,o.cssStyleChangedIdSet);o.cssClassChangedIdSet.clear(),function(e,t,i=[]){C(e,_.GetErrorMessage(i),t)}(l,null);for(const e of o.cssStyleChangedIdSet){s.getElementById(e).onCssStyleChanged(r)}o.cssStyleChangedIdSet.clear();for(const e of o.postprocessingIdSet){s.getElementById(e).onAllChangeFinished(r)}return o.postprocessingIdSet.clear(),null}static CastFromUnionValue(e){let t;return e.is(Ai.DataType.String)||e.is(Ai.DataType.Int32)||e.is(Ai.DataType.Float)?t=e.get():e.is(Ai.DataType.Null)?t=null:w(!1,null),t}static AppendToJsonObject(e,t,i){let n,s;if(n=t,i.is(P.DataType.String)){const e=i.get();e&&(s=e)}else if(i.is(P.DataType.Int32)){s=i.get()}else if(i.is(P.DataType.Float)){s=i.get()}else i.is(P.DataType.Null)||v(_.CssStyleBadType);return e[n]=s,0}getElementById(e){let t=null;const i=this.elementDelegateMap.get(e);return null!=i&&(t=i),w(t,null),t}forgeElementGetter(e){let t=null;const i=this.elementDelegateMap.get(e);return null!=i&&(t=i),t}syncCssClasses(e,t){for(const i of e){const n=this.getElementById(i),s=[];this.syncCssClassesRecursive(n,s,e,t)}return this.styleClassMgr.clearStyleClassCache(),0}syncCssClassesRecursive(e,t,i,n){let s=new Set;e.styleDelegate.updateClassDeclarations(t,s);for(const e of s)n.add(e)}runSetterTaskByType(e,t,i,n,s){let r=_.BadTaskType;switch(t){case Yi.TaskType.CreateElement:r=this.createElement(e,i,n);break;case Yi.TaskType.BindElementToRootView:r=this.bindElementToRootView(e,i,n);break;case Yi.TaskType.InsertElementChild:r=this.insertElementChild(e,i,n);break;case Yi.TaskType.RemoveElementChild:r=this.removeElementChild(e,i,n,s);break;case Yi.TaskType.MoveElementChild:r=this.moveElementChild(e,i,n);break;case Yi.TaskType.ReOrderElementChild:r=this.reOrderElementChild(e,i,n);break;case Yi.TaskType.AddElementEventListener:r=this.addElementEventListener(e,i,n,s);break;case Yi.TaskType.RemoveElementEventListener:r=this.removeElementEventListener(e,i,n);break;case Yi.TaskType.SetElementText:r=this.setElementText(e,i,n,s);break;case Yi.TaskType.SetElementAttribute:r=this.setElementAttribute(e,i,n,s);break;case Yi.TaskType.SetForgeViewInnerProps:r=this.setForgeViewInnerProps(e,i,n);break;case Yi.TaskType.InsertKeyFrameDefine:r=this.insertKeyFrame(e,i,n);break;case Yi.TaskType.RemoveKeyFrameDefine:r=this.removeKeyFrame(e,i,n);break;case Yi.TaskType.DeclareStyleSheets:r=this.declareStyleSheets(e,i,n);break;case Yi.TaskType.UndeclareStyleSheets:r=this.undeclareStyleSheets(e,i,n);break;case Yi.TaskType.SetStyleProperty:r=this.setStyleProperty(e,i,n,s)}return v(r),0}runGetterTaskByType(e,t,i,n,s){let r=_.BadTaskType;switch(t){case Yi.TaskType.GetElementBoundingClientStyles:r=this.getElementBoundingClientStyles(e,i,n,s);case Yi.TaskType.GetStyleProperties:r=this.getStyleProperties(e,i,n,s);break;case Yi.TaskType.GetElementAttribute:r=this.getElementAttributes(e,i,n,s);break;case Yi.TaskType.GetRelativePosition:r=this.getRelativePosition(e,i,n,s)}return v(r),0}createElement(e,t,i){const n=i;x(n.length>=3,_.BadArgumentSize);const s=n[2];let r;return r="AUDIO"==s?Vi.MakeShared(e,t,this.styleClassMgr,Gi):"DIV"==s?Vi.MakeShared(e,t,this.styleClassMgr,Mi):"IMG"==s?Vi.MakeShared(e,t,this.styleClassMgr,Bi):"VIDEO"==s?Vi.MakeShared(e,t,this.styleClassMgr,Wi):Vi.MakeShared(e,t,this.styleClassMgr,Vi),this.elementDelegateMap.set(t,r),0}bindElementToRootView(e,t,i){x(i.length>=2,_.BadArgumentSize);return this.getElementById(t).bindToForgeRootView(e),0}insertElementChild(e,t,i){const n=i;x(n.length>=3,_.BadArgumentSize);const s=n[2],r=n.length>=4&&n[3]?n[3]:-1,a=this.getElementById(t),o=this.getElementById(s),l=r>0?this.getElementById(r):void 0;return a.insertForgeView(e,o,l),0}removeElementChild(e,t,i,n){const s=i;x(s.length>=3,_.BadArgumentSize);const r=s[2],a=this.getElementById(t),o=this.getElementById(r),l=(e,t,i)=>{for(const n of e.childNodes)l(n,t,i);e.styleDelegate.finalize(),t.add(e.nativeId),i.delete(e.nativeId)};return l(o,n.removedIdSet,this.elementDelegateMap),a.removeForgeView(e,o),0}moveElementChild(e,t,i){const n=i;x(n.length>=4,_.BadArgumentSize);const s=n[2],r=n[3],a=n.length>=5&&n[4]?n[4]:-1,o=this.getElementById(t),l=this.getElementById(s),h=this.getElementById(r),c=a>0?this.getElementById(a):void 0;return o.moveForgeView(e,l,h,c),0}reOrderElementChild(e,t,i){const n=i;x(n.length>=3,_.BadArgumentSize);const s=n[2],r=n.length>=4&&n[3]?n[3]:-1,a=this.getElementById(t),o=this.getElementById(s),l=r>0?this.getElementById(r):void 0;return a.reOrderForgeView(e,o,l),0}addElementEventListener(e,t,i,n){const s=i;x(s.length>=4,_.BadArgumentSize);const r=s[2],a=new Map;if("object"==typeof s[3]&&null!==s[3]){const e=s[3];for(const[t,i]of Object.entries(e))x("number"==typeof i,_.InvalidArgument),a.set(t,i)}const o=this.getElementById(t).addEventListener(r,((e,t,i)=>{S(Yi.GetInstance(e).onEventListener),setTimeout(t.bind(this,e,i),0)}).bind(this,this.jsviewId,((e,t)=>{const i=Yi.GetInstance(e);if(null==i.onEventListener)return;const n=i.onEventListener.jseFunction;let s=[];for(const e of t){const t=Yi.CastFromUnionValue(e);s.push(t)}n(...s)})),a);return v(o),o==Vi.State.NeedCallPostProcess&&n.postprocessingIdSet.add(t),0}removeElementEventListener(e,t,i){const n=i;x(n.length>=4,_.BadArgumentSize);const s=n[2],r=new Map;if("object"==typeof n[3]&&null!==n[3]){const e=n[3];for(const[t,i]of Object.entries(e))x("number"==typeof i,_.InvalidArgument),r.set(t,i)}return this.getElementById(t).removeEventListener(s,r),0}setElementText(e,t,i,n){const s=i;x(s.length>=3,_.BadArgumentSize);const r=s[2],a=this.getElementById(t),o=a instanceof Mi?a:null;return x(o,_.BadElementType),o.setTextContent(r),o.styleDelegate.addChangedStyleGroup(R.Text.Name),n.cssStyleChangedIdSet.add(o.nativeId),0}setElementAttribute(e,t,i,n){const s=i;x(s.length>=4,_.BadArgumentSize);const r=s[2],a=s[3],o=this.getElementById(t);let l=o.setAttribute(e,r,a);if(v(l),l==Vi.State.NeedRefreshCssClass)n.cssClassChangedIdSet.add(t);else if(l==Vi.State.NeedRefreshCssClassAttribute){n.cssClassChangedIdSet.add(t);const e=new Set;l=o.getExtendClassAttributeChildren(e),v(l);for(const t of e)n.cssClassChangedIdSet.add(t.nativeId)}else l==Vi.State.NeedCallPostProcess&&n.postprocessingIdSet.add(t);return 0}getElementBoundingClientStyles(e,t,i,n){const s=i;x(s.length>=4,_.BadArgumentSize);const r=s[3];x(r,_.InvalidElement);const a=JSON.parse(r),o=this.getElementById(t),l=o.styleDelegate,h={},c=a;for(const e of c){const t=e,i=A.ToConst(t);x(i,_.CssStyleBadName);let n=new P;if(i==A.Layout.Left){let e=l.left(),t=o.parentNode;for(;null!=t;){e+=t.styleDelegate.left(),t=t.parentNode}n=new P(e)}else if(i==A.Layout.Top){let e=l.top(),t=o.parentNode;for(;null!=t;){e+=t.styleDelegate.top(),t=t.parentNode}n=new P(e)}else{let e=l.getProperty(i,n);x(e>=0||_.CssStyleNotExists,e,["Failed to get style ",i])}v(Yi.AppendToJsonObject(h,i,n))}const u=JSON.stringify(h),d=new Ai(u);return n.reset(d),0}declareStyleSheets(e,t,i){const n=i;x(n.length>=2,_.BadArgumentSize);const s=n[2];return v(this.styleClassMgr.declareStyleSheets(s)),0}undeclareStyleSheets(e,t,i){const n=i;x(n.length>=2,_.BadArgumentSize);const s=n[2];return v(this.styleClassMgr.undeclareStyleSheets(s)),0}setStyleProperty(e,t,i,n){const s=i;x(s.length>=3,_.BadArgumentSize);const r=s[2],a=s.length>=4?s[3]:null,o=this.getElementById(t).styleDelegate,l=Ci.CastToStyleValue(a);let h=new Set;const c=o.setProperty(r,l,h);if(c==_.CssStyleNotChanged)return 0;v(c,["Failed to set style ",r]);for(const e of h)n.cssStyleChangedIdSet.add(e);return 0}getStyleProperties(e,t,i,n){const s=i;x(s.length>=4,_.BadArgumentSize);const r=s[3];x(r,_.InvalidElement);const a=JSON.parse(r),o=this.getElementById(t).styleDelegate,l={},h=a;for(const e of h){const t=e,i=A.ToConst(t);x(i,_.CssStyleBadName);const n=new P;let s=o.getProperty(i,n);x(s>=0||_.CssStyleNotExists,s,["Failed to get style ",i]),s=Yi.AppendToJsonObject(l,i,n),v(s)}const c=JSON.stringify(l),u=new Ai(c);return n.reset(u),0}getElementAttributes(e,t,i,n){const s=i;x(s.length>=3,_.BadArgumentSize);const r=s[3],a=this.getElementById(t);if("clientWidth"==r){const t=new Ai(a.getClientWidth(e));n.reset(t)}else if("clientHeight"==r){const t=new Ai(a.getClientHeight(e));n.reset(t)}return 0}getRelativePosition(e,t,i,n){const s=i;x(s.length>=3,_.BadArgumentSize);const r=s[3],a=this.getElementById(t),o=this.getElementById(r);let l=0,h=0,c=a.getClientWidth(e),u=a.getClientHeight(e),d=a;for(;null!=d&&d!=o;)l+=d.styleDelegate.left(),h+=d.styleDelegate.top(),d=d.parentNode;const g=new Ai(JSON.stringify({left:l,top:h,width:c,height:u}));return n.reset(g),0}setForgeViewInnerProps(e,t,i){const n=i;x(n.length>=5,_.BadArgumentSize);const s=n[2],r=n[3],a=n[4];return this.getElementById(t).setForgeViewInnerProps(e,s,r,a)}insertKeyFrame(e,t,i){const n=i;x(n.length>=4,_.BadArgumentSize);const s=n[2],r=n[3];return this.styleClassMgr.insertKeyFrame(s,r),0}removeKeyFrame(e,t,i){const n=i;x(n.length>=3,_.BadArgumentSize);const s=n[2];return this.styleClassMgr.removeKeyFrame(s),0}}Yi.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,ReOrderElementChild:22,DeclareStyleSheets:30,SetStyleProperty:31,GetStyleProperties:32,UndeclareStyleSheets:39,SetForgeViewInnerProps:40,InsertKeyFrameDefine:41,RemoveKeyFrameDefine:42},Yi.TaskStash=class{constructor(){this.removedIdSet=new Set,this.cssClassChangedIdSet=new Set,this.cssStyleChangedIdSet=new Set,this.postprocessingIdSet=new Set}},Yi.EventListener=class{constructor(){this.jseContext=null}},Yi.JsViewId=1,Yi.PlatformBridgeInstanceMap=new Map,Yi.RegisterOriginDocument=function(e){let t=e.createElement("style");t.type="text/css",t.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 ";e.getElementsByTagName("Head")[0].appendChild(t),window.originDocument=e},window.JsvCode.BrowserPlatformDomBridge=Yi,y.LogF=function(e){},y.LogE=function(e){},y.LogW=function(e){},y.LogI=function(e){},y.LogD=function(e){},y.LogM=function(e){},y.ThrowError=function(e){throw new Error(e)},y.Assert=function(e){if(!e)throw new Error("ASSERT!!!!!")},y.EnableLog=function(e){y.LogM=console.log.bind(console),e>0&&(y.LogF=console.error.bind(console)),e>1&&(y.LogE=console.error.bind(console)),e>2&&(y.LogW=console.warn.bind(console)),e>3&&(y.LogI=console.log.bind(console)),e>4&&(y.LogD=console.debug.bind(console))},y.EnableLog(4),y.BaseActivity=class{},console.log("Log debug replace Forge.BaseActivity");{class In{constructor(e,t,i){this.PageName=e,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,t&&this.SetContentView(t)}OnRenderFrame(){y.LogE("OnRenderFrame() MUST override")}OnKeyDown(e){return!1}OnKeyUp(e){return!1}DispatchKeyDown(e){if(this._KeyLock)return!0;var t=!1;return In.sLastFocusPage=this,this._FocusChild&&(t=this._FocusChild.DispatchKeyDown(e)),t||(t=this.OnKeyDown(e)),t}OnCustomEvent(e){return!1}BubbleCustomEvent(e){this.OnCustomEvent(e)||this._ParentPage&&this._ParentPage.BubbleCustomEvent(e)}DispatchKeyUp(e){if(this._KeyLock)return!0;var t=!1;return this._FocusChild&&(t=this._FocusChild.DispatchKeyUp(e)),t||(t=this.OnKeyUp(e)),t}PrintLastFocusPage(){var e="------"+this.PageName+"\n",t=this._ParentPage;return t&&(e+=t.PrintLastFocusPage()),e}OnMouseDown(e){return!1}EnableTouchDispatcher(){this.TouchDispatcher=new y.TouchDispatcher(this)}DisableTouchDispatcher(){this.TouchDispatcher=null}GetTouchView(){return null}GetSwipeParams(e,t,i){var n=void 0===i||0==i?this._Acc:i,s=e*e/2/n;e<0&&(s=-s);var r=t*t/2/n;return t<0&&(r=-r),{durationX:Math.floor(Math.abs(e/n)),durationY:Math.floor(Math.abs(t/n)),distanceX:s,distanceY:r}}OnTouch(e){return!1}DispatchTouch(e){var t=!1;return this.TouchDispatcher&&(t=this.TouchDispatcher.OnTouch(e)),t}LostTouchFocus(e){}OnJavaKey(e,t){return!0}OnPlatformKey(e,t){return!0}PassPlatformKey(e,t){if(this._KeyLock)return!1;var i=this.OnPlatformKey(e,t);return i&&(i=this.OnJavaKey(e,t)),i}DispatchJavaKey(e,t){if(e==this._ConsumeKeycodeUntilUp)return 1==t&&(this._ConsumeKeycodeUntilUp=-1),y.LogM("Consume Javakey until up keycode="+e+" keyaction="+t),!1;if(this._KeyLock)return!1;-1!=this._ConsumeKeycodeUntilUp&&(y.LogE("ERROR: Other key pressed before locked key release"),this._ConsumeKeycodeUntilUp=-1);var i=this._FocusChild,n=!0;return i&&(n=i.DispatchJavaKey(e,t)),n&&(n=this.PassPlatformKey(e,t)),i!=this._FocusChild&&0==t&&this.CosumeAllKeyUnitlUpForFocusChange(e),n}CosumeAllKeyUnitlUpForFocusChange(e){this._ParentPage?this._ParentPage.CosumeAllKeyUnitlUpForFocusChange(e):this._ConsumeKeycodeUntilUp=e}OnHostActivityGetFocus(){this._ConsumeKeycodeUntilUp=-1}IsFocus(){return!this._ParentPage||this._ParentPage._FocusChild==this}_IsLeafInChain(){return this.IsFocus()&&!this._FocusChild}SetParent(e,t){null!=e?(null!=t&&this.SetContentView(t),e instanceof y.BaseActivity&&(e=e.GetRootPageBase()),this._ParentPage=e,e.SubPages.push(this),this._HostActivity=e._HostActivity,e._IsShowing&&this._AutoShow&&this._OnShowInternal()):y.ThrowError("ERROR: parent is null")}SetParentPage(e){this.SetParent(e)}OnRemoveFromTree(){if(this._ParentPage=null,this.SubPages&&this.SubPages.length>0){for(let e of this.SubPages)e.OnRemoveFromTree();this.SubPages=[]}}RemoveSubPage(e){e==this._FocusChild&&(this._FocusChild=null),e==this._LatestFocusChild&&(this._LatestFocusChild=null);for(var t=0;t<this.SubPages.length;t++)if(e==this.SubPages[t]){e._OnHideInternal(),this.SubPages.splice(t,1);break}}ClearSubPages(){this.SubPages=[],this._FocusChild=null,this._LatestFocusChild=null}GetParentPage(){return this._ParentPage}Focus(e){if(this.IsFocus()){if(!e)return void y.LogI("requestFocus(): Already focused name="+this.PageName);if(this._IsLeafInChain())return void y.LogI("requestFocus(): Already focused name="+this.PageName)}if(In.sChangingFocusLock)return void In.sDelayedFocusChanges.push(this);if(In.sChangingFocusLock=!0,this._ParentPage){for(var t,i=[],n=this;n._ParentPage&&!n.IsFocus();)i.push(n),n=n._ParentPage;t=e&&0==i.length?this._FocusChild:i[i.length-1]._ParentPage._FocusChild;for(var s=[];t;)s.push(t),t=t._FocusChild;for(var r=s.length-1;r>=0;r--)s[r]._BlurInternal();for(r=i.length-1;r>=0;r--)i[r]._FocusInternal();if(e)this._LatestFocusChild=null;else for(var a=i[0];a._LatestFocusChild&&null==a._FocusChild;)a._LatestFocusChild._FocusInternal(),(a=a._FocusChild)||y.ThrowError("ERROR: focus chain is broken")}In.sChangingFocusLock=!1;let o=In.sDelayedFocusChanges.length;if(o>0){let e=In.sDelayedFocusChanges;In.sDelayedFocusChanges=[];for(let t=0;t<o;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()):y.LogE("No dispatcher")}_BlurInternal(){this._ParentPage||y.LogE("No dispacher"),this._ParentPage._FocusChild==this?(this._ParentPage._FocusChild=null,this.OnBlur()):y.LogW("Not focus yet, page name="+this.PageName)}GetFocusChild(){return this._FocusChild}Hide(){this._AutoShow=!1,this._OnHideInternal()}Show(e){this._OnShowInternal(),e&&this.Focus()}OnFocus(){y.LogW("No overrided Page OnFocus event, page name="+this.PageName)}OnBlur(){y.LogW("No overrided Page OnBlur event, page name="+this.PageName)}OnShow(){y.LogW("No overrided Page OnShow event, page name="+this.PageName)}OnHide(){y.LogW("No overrided Page OnHide event, page name="+this.PageName)}_OnShowInternal(){for(var e,t=0;t<this.SubPages.length;t++)(e=this.SubPages[t])._AutoShow&&e._OnShowInternal();this._IsShowing||(this._IsShowing=!0,this.OnShow())}_OnHideInternal(){for(var e,t=0;t<this.SubPages.length;t++)(e=this.SubPages[t])._IsShowing&&e._OnHideInternal();this._IsShowing&&(this._IsShowing=!1,this.OnHide())}GetMainView(){return null==this._CVSet&&(this._CVSet=new y.MainViewSetting(null,null)),this._CVSet}GetContentView(){return null==this._CVSet?null:this._CVSet.View}SetContentView(e){null!=e&&(null!=this._CVSet&&this._CVSet.View.BindedPageBase(null),this._CVSet=new y.MainViewSetting(e,null),e.BindedPageBase(this))}OnContentViewLostInternal(){this.OnContentViewLost()}OnContentViewLost(){}GetHostActivity(){return this._HostActivity}SetHostActivity(e){this._HostActivity=e}GetTextureManager(){return null!=this._HostActivity?this._HostActivity.GetTextureManager():null}SetAutoShow(e){this._AutoShow=e}KeyLock(){this._KeyLock=!0}UnKeyLock(){this._KeyLock=!1}}In.sLastFocusPage=null,In.sChangingFocusLock=!1,In.sDelayedFocusChanges=[],y.PageBase=In}y.RectArea=Y;F.FreeMoveActionBuilder=class{static SetSpeed(e,t){return{type:"setSpeed",params:{Xspeed:e,Yspeed:t}}}static SetAccel(e,t){return{type:"setAccel",params:{Xacc:e,Yacc:t}}}static StopMoving(){return{type:"stop"}}static StopMovingExact(e,t){return{type:"stopExtract",params:{x:e,y:t}}}static SetArrowSpeed(e,t,i,n){return{type:"setArrowSpeed",params:{arrowTargetX:e,arrowTargetY:t,absSpeedX:i,absSpeedY:n}}}static BrakeToPos(e,t){return{type:"breakToPos",params:{targetX:e,targetY:t}}}static TeleportTo(e,t,i){return{type:"teleportTo",params:{targetX:e,targetY:t,boolean:i}}}static teleportOffset(e,t){return{type:"teleportOffset",params:{offsetX:e,offsetY:t}}}};F.FreeMoveCmdPackBuilder=class{static InitActCmdPack(e,t,i,n){return{t:1,cmds:n,tkn:isNaN(i)?0:i,spdxye:isNaN(e)?0:e,accxye:isNaN(t)?0:t}}static InitStateCmdPack(e){return{t:2,cmd:e}}},F.FreeMoveExternType={},F.FreeMoveExternType.GroupType_FromAction=10,F.FreeMoveExternType.GroupType_ActionAssoc=10;F.FreeMoveConditionSet=class{static ReachPosition(e,t,i){return{type:"Position",params:{x:e,y:t,groupType:i.g,multiTimes:i.m,actionCheckCount:0}}}static ReachSpeed(e,t,i,n){return{type:"Speed",params:{vx:e,vy:t,direction:i,groupType:n.g,multiTimes:n.m,actionCheckCount:0}}}static AcrossPosition(e,t,i){return{type:"acrossPosition",params:{Xposition:e,Yposition:t,groupType:i.g,multiTimes:i.m,actionCheckCount:0}}}static AppendSubCmd(e,t){const i="cmds";e.hasOwnProperty("cmdPacks")?console.error("Error: conflict with command pack list"):(e.hasOwnProperty(i)||(e[i]=[]),e[i].push(t))}static SetCmdList(e,t){t instanceof Array&&(e.hasOwnProperty("cmdPacks")?console.error("Error: conflict with command pack list"):e.cmds=t)}static SetCmdPackList(e,t){t instanceof Array&&(e.hasOwnProperty("cmds")?console.error("Error: conflict with sub-command list"):e.cmdPacks=t)}static InitCommonInfo(){return{g:0,m:!1,s:null}}static UpdateCommonInfo(e,t,i,n){e.g=t??0,e.m=i??!1,e.s=n??null}static AcrossSpeed(e,t,i){return{type:"acrossSpeed",params:{Xspeed:e,Yspeed:t,multiTimes:i.m,groupType:i.g,actionCheckCount:0}}}static OnNexusEvent(e,t,i){return{type:"onNexusEvent",params:{nexusId:e,eventType:t,multiTimes:i.m,groupType:i.g}}}static OnHitBlock(e,t){return{type:"onHitBlock",params:{GID:e,multiTimes:t.m,groupType:t.g,actionCheckCount:0}}}static OnNextTick(e,t){return{type:"onNextTick",params:{gap:e,multiTimes:t.m,groupType:t.g,actionCheckCount:0}}}static OnDragStart(e,t){return{type:"onDragStart",params:{multiTimes:e.m,groupType:e.g}}}static OnDragEnd(e,t){return{type:"onDragEnd",params:{multiTimes:e.m,groupType:e.g}}}static OnTouchDown(e,t){return{type:"onDragDown",params:{multiTimes:e.m,groupType:e.g}}}static OnTouchRelease(e,t){return{type:"onDragRelease",params:{multiTimes:e.m,groupType:e.g}}}static OnFlingStart(e,t){return{type:"onFlingStart",params:{multiTimes:e.m,groupType:e.g}}}static OnFlingProgress(e,t){return{type:"onFlingProgress",params:{multiTimes:e.m,groupType:e.g}}}static OnFlingEnd(e,t){return{type:"OnFlingEnd",params:{multiTimes:e.m,groupType:e.g}}}static BoxPosition(e,t,i,n,s){return{type:"boxPosition",params:{multiTimes:s.m,groupType:s.g}}}};const $i=[];let Ui=[];const ji=new Map,zi=()=>{if(Ui.length>0){let e=[];for(let t=0;t<Ui.length;t++)e.push(Ui[t]);Ui=[];for(const[e,t]of ji)for(let e=0;e<t.length;e++)0==t[e].available&&t.splice(e,1);for(const[e,t]of ji)0==t.length&&ji.delete(e);for(let t=0;t<e.length;t++){const i=ji.get(e[t].params.nexusEventId);for(let n=0;n<i.length;n++){let s=i[n].conditionItem.actions;i[n].conditionItem.params.eventType==e[t].params.eventType&&i[n].animationItem.doCommandInner(s)}}}};F.sRenderBridge.RegisterPerFrameCallback((()=>{for(let e=0;e<$i.length;e++)$i[e].animationRef.Invoking()}));const Xi=(e,t,i,n)=>{var s=(t.y-e.y)*(n.x-i.x)-(e.x-t.x)*(i.y-n.y);if(0==s)return!1;var r=((t.x-e.x)*(n.x-i.x)*(i.y-e.y)+(t.y-e.y)*(n.x-i.x)*e.x-(n.y-i.y)*(t.x-e.x)*i.x)/s,a=-((t.y-e.y)*(n.y-i.y)*(i.x-e.x)+(t.x-e.x)*(n.y-i.y)*e.y-(n.x-i.x)*(t.y-e.y)*i.y)/s;return(r-e.x)*(r-t.x)<=0&&(a-e.y)*(a-t.y)<=0&&(r-i.x)*(r-n.x)<=0&&(a-i.y)*(a-n.y)<=0&&{x:r,y:a}};function Ki(e,t,i,n,s){return"Vertical"==s?!(e.y>n.y||t.y<i.y):"Horizontal"==s?!(e.x>n.x||t.x<i.x):void 0}F.FreeMoveAnimation=class extends F.AnimationDelegate{constructor(e){super(),this.targetElement=null,this.position={x:0,y:0},this.style={top:0,left:0},this.acc={accX:0,accY:0},this.speed={speedX:0,speedY:0},this.prevSpeed={speedX:0,speedY:0},this.Echo=[],this._EchoCallbackFunc=e,this.Invoking=this.Invoking.bind(this),this.recordCount=0,this.sweepCount=0,this.timerConditionList=[],this.speedConditionList=[],this.positionConditionList=[],this.envBlockConditionList=[],this.nexusEventList=[],this.envPosition={x:void 0,y:void 0},this.prePosition={x:void 0,y:void 0},this.realPosition={x:void 0,y:void 0},this.realStartPosition={x:void 0,y:void 0}}Start(e){super.Start(e),this.targetElement=e.Element,this.style.left=0,this.style.top=0,this.realStartPosition.x=this.targetElement.getBoundingClientRect().x,this.realStartPosition.y=this.targetElement.getBoundingClientRect().y,this.differenceX=this.realStartPosition.x-this.style.left,this.differenceY=this.realStartPosition.y-this.style.top,$i.push({animationRef:this})}Cancel(){super.Cancel();for(let e=0;e<$i.length;e++)$i[e].animationRef==this&&$i.splice(e,1)}conditionDeal(e){let t=[];for(let i=0;i<e.length;i++)t.push(e[i]);for(let e=0;e<t.length;e++)if(this.testOneCondition(t[e])&&0==t[e].params.multiTimes){if(0==t[e].params.actionCheckCount){t[e].params.actionCheckCount=this.sweepCount;const i=t[e].actions.filter((e=>null!==e));0==t[e].checked&&(t[e].checked=!0,this.doCommandInner(i))}}else if(this.testOneCondition(t[e])&&1==t[e].params.multiTimes){t[e].params.actionCheckCount=this.sweepCount;const i=t[e].actions.filter((e=>null!==e));t[e].checked=!0,this.doCommandInner([{type:"delActionAssocCondition",params:{}}]),this.doCommandInner(i)}}Invoking(){this.realPosition.x=this.targetElement.getBoundingClientRect().x,this.realPosition.y=this.targetElement.getBoundingClientRect().y,this.conditionDeal(this.timerConditionList),this.prevSpeed.speedX=this.speed.speedX,this.prevSpeed.speedY=this.speed.speedY,this.prePosition.x=this.position.x,this.prePosition.y=this.position.y,this.speed.speedX+=this.acc.accX,this.speed.speedY+=this.acc.accY,this.position.y+=this.speed.speedY,this.position.x+=this.speed.speedX,this.conditionDeal(this.speedConditionList);do{zi()}while(Ui.length>0);if(this.conditionDeal(this.positionConditionList),this.envBlockConditionList.length>0){this.conditionDeal(this.envBlockConditionList);do{zi()}while(Ui.length>0);if(this.prePosition.x+this.speed.speedX!==this.position.x||this.prePosition.y+this.speed.speedY!==this.position.y){do{zi()}while(Ui.length>0);this.conditionDeal(this.positionConditionList)}}if(this.targetElement.style.top=this.position.y+"px",this.targetElement.style.left=this.position.x+"px",this.Echo.length>0){let e={retList:this.Echo,xSpd:this.speed.speedX,ySpd:this.speed.speedY,xAcc:this.acc.accX,yAcc:this.acc.accY,xPos:this.position.x,yPos:this.position.y};this._EchoCallbackFunc(JSON.stringify(e)),this.Echo=[]}this.sweepCount++}ParsePackageList(e){let t=[];if(!e)return t;for(let i of e)switch(i.t){case 1:for(let e=0;e<i.cmds.length;e++)t.push({type:i.cmds[e].type,params:i.cmds[e].params});t.unshift({type:"FreshState",params:{spd:i.spdxye,acc:i.accxye}});break;case 2:const e={type:i.cmd.type,params:i.cmd.params};t.push(e)}return t}doCommand(e){const t=this.ParsePackageList(e);this.doCommandInner(t)}doCommandInner(e){for(let t of e)switch(t.type){case"setSpeed":this.setSpeed(t);break;case"setAccel":this.setAcc(t);break;case"stop":this.stopMoving();break;case"newCondition":this.newCondition(t);break;case"FreshState":this.FreshState(t);break;case"setOffset":this.setOffset(t);break;case"callback":t.params();break;case"fireEcho":this.EchoPush(t);break;case"delActionAssocCondition":this.clearGroupTypeCondition();break;case"removeAllCondtions":this.RemoveAllCondtions();break;case"jumpTo":this.jumpToPositon(t);break;case"setArrowSpeed":this.setArrowSpeed(t);break;case"stopExtract":this.stopExtract(t);break;case"fireNexusEvent":this.FireNexusEvent(t);case"breakToPos":this.breakToPos(t);break;case"teleportTo":this.teleportTo(t);break;case"teleportOffset":this.teleportOffset(t);break;case"revertWithHitBlock":this.revertWithHitBlock(t);break;default:console.error("item的type格式错误",t.type)}e=[]}testOneCondition(e){let t=!1;switch(e.type){case"Position":t=this.checkPosition(e);break;case"Speed":t=this.checkSpeed(e);break;case"acrossPosition":t=this.checkAcrossPosition(e);break;case"acrossSpeed":t=this.checkAcrossSpeed(e);break;case"onNextTick":t=this.onNextTick(e);break;case"onHitBlock":t=this.onHitBlock(e);break;default:console.log("未设定的item类型",e)}return t}FreshState(e){let t=e.params.spd,i=e.params.acc;switch(t){case 1:this.speed.speedY=0;break;case 2:this.speed.speedX=0}switch(i){case 1:this.acc.accY=0;break;case 2:this.acc.accX=0}}setSpeed(e){isNaN(e.params.Xspeed)||(this.speed.speedX=e.params.Xspeed),isNaN(e.params.Yspeed)||(this.speed.speedY=e.params.Yspeed)}setAcc(e){isNaN(e.params.Xacc)||(this.acc.accX=e.params.Xacc),isNaN(e.params.Yacc)||(this.acc.accY=e.params.Yacc)}teleportTo(e){const{targetX:t,targetY:i,boolean:n}=e.params;if(n){const t={params:{offsetX:e.params.targetX,offsetY:e.params.targetY}};this.teleportOffset(t)}else isNaN(t)||(this.targetElement.style.left=`${parseInt(this.style.left)+t}px`,this.position.x=t),isNaN(i)||(this.targetElement.style.top=`${parseInt(this.style.top)+i}px`,this.position.y=i)}teleportOffset(e){const{offsetX:t,offsetY:i}=e.params;isNaN(t)?this.position.x=parseInt(this.targetElement.style.left):(this.targetElement.style.left=`${parseInt(this.position.x)+t}px`,this.position.x+=t),isNaN(i)?this.position.y=parseInt(this.targetElement.style.top):(this.targetElement.style.top=`${parseInt(this.position.y)+i}px`,this.position.y+=i)}setArrowSpeed(e){const{arrowTargetX:t,arrowTargetY:i,absSpeedX:n,absSpeedY:s}=e.params;this.position.x>t&&(this.speed.speedX=-1*n),this.position.x<t&&(this.speed.speedX=1*n),this.position.y>i&&(this.speed.speedY=-1*s),this.position.y<i&&(this.speed.speedY=1*s),t&&i&&n&&null==s&&(this.speed.speedY=this.speed.speedX/(t/i)),t&&i&&null==n&&s&&(this.speed.speedX=this.speed.speedY/(i/t))}jumpToPositon(e){const{xPos:t,yPos:i}=e.params;this.position.x=t,this.targetElement.style.left=`${parseInt(this.style.left)+t}px`,this.position.y=i,this.targetElement.style.top=`${parseInt(this.style.top)+i}px`}RemoveAllCondtions(){if(this.timerConditionList=[],this.speedConditionList=[],this.positionConditionList=[],this.nexusEventList.length>0)for(let e=0;e<this.nexusEventList.length;e++)if(ji.get(this.nexusEventList[e].params.nexusId)){const t=ji.get(this.nexusEventList[e].params.nexusId);for(let i=0;i<t.length;i++)t[i].conditionItem.params.eventType==this.nexusEventList[e].params.eventType&&(t[i].available=!1)}}EchoPush(e){const{msg:t}=e.params;return this.Echo.push({rbTkn:0,eTkn:t}),!0}checkPosition(e){const t=e.params.x,i=e.params.y,n=this.acc.accX,s=this.acc.accY,r=this.speed.speedX,a=this.speed.speedY,o=this.position.x,l=this.position.y,h=e.params.direction;if(void 0!==h){if(n||s){if(t)if(n>0){if(0==h&&r>0&&o>=t)return!0;if(1==h&&r<0&&o<=t)return!0}else if(n<0){if(0==h&&r<0&&o<=t)return!0;if(1==h&&r>0&&o>=t)return!0}if(i)if(s>0){if(2==h&&a>0&&l>=i)return!0;if(3==h&&a<0&&l<=i)return!0}else if(s<0){if(2==h&&a<0&&l<=i)return!0;if(3==h&&a>0&&l>=i)return!0}}}else if(r||a){if(void 0!==t)if(r>0){if(o>=t)return!0}else if(r<0&&o<=t)return!0;if(void 0!==i)if(a>0){if(l>=i)return!0}else if(a<0&&l<=i)return!0}}checkSpeed(e){const{Xspeed:t,Yspeed:i}=e.params;return void 0!==t&&this.speed.speedX==t||(void 0!==i&&this.speed.speedY==i||void 0)}checkAcrossPosition(e){const t=e.params.x,i=e.params.y,n=this.position.x,s=this.position.y;return 0===this.counter&&t&&n===t&&i&&s===i?(this.counter++,!1):this.checkPosition(e)}checkAcrossSpeed(e){const{Xspeed:t,Yspeed:i}=e.params;return void 0!==t&&null!==this.prevSpeed.speedX&&(this.prevSpeed.speedX<t&&this.speed.speedX>=t||this.speed.speedX>t&&this.speed.speedX<=t)||void 0!==i&&null!==this.prevSpeed.speedY&&(this.prevSpeed.speedY<i&&this.speed.speedY>=i||this.speed.speedY>i&&this.speed.speedY<=i)}newCondition(e){let t,i=e.params.conditionSet;i.cmdPacks?t=this.ParsePackageList(i.cmdPacks):i.cmds&&(t=i.cmds);let n={type:i.type,params:i.params,actions:t,checked:!1};n.actions.some((e=>!(!e||"stopExtract"!==e.type)&&(e.params=n.params,!0))),"onNexusEvent"===n.type?(this.nexusEventList.push(n),ji.get(n.params.nexusId)||ji.set(n.params.nexusId,[]),ji.get(n.params.nexusId).push({conditionItem:n,animationItem:this,available:!0})):n.type.includes("Speed")?this.speedConditionList.push(n):n.type.includes("Position")?this.testOneCondition(n)?this.doCommandInner(n.actions):this.positionConditionList.push(n):"onNextTick"===n.type?(this.recordCount=this.sweepCount,this.timerConditionList.push(n)):"onHitBlock"===n.type?this.envBlockConditionList.push(n):console.log("未被收录的条件类型",n)}setOffset(e){const{xOffset:t,yOffset:i}=e.params;isNaN(t)||(this.targetElement.style.left=`${parseInt(this.position.x)+t}px`,this.position.x=parseInt(this.position.x)+t),isNaN(i)||(this.targetElement.style.top=`${parseInt(this.position.y)+i}px`,this.position.y=parseInt(this.position.y)+i)}stopMoving(){this.acc.accX=0,this.acc.accY=0,this.speed.speedX=0,this.speed.speedY=0}stopExtract(e){this.acc.accX=0,this.acc.accY=0,this.speed.speedX=0,this.speed.speedY=0,Math.abs(this.position.x-e.params.x)<Math.abs(this.position.y-e.params.y)||e.params.x&&null==e.params.y?(this.position.x=e.params.x,this.targetElement.style.left=`${this.style.left+e.params.x}px`,this.targetElement.style.top=`${this.style.top+this.position.y}px`,this.style.left=parseInt(this.targetElement.style.left),this.style.top=parseInt(this.targetElement.style.top)):Math.abs(this.position.x-e.params.x)>Math.abs(this.position.y-e.params.y)||e.params.y&&null==e.params.x?(this.position.y=e.params.y,this.targetElement.style.top=`${this.style.top+e.params.y}px`,this.targetElement.style.left=`${this.style.left+this.position.x}px`,this.style.top=parseInt(this.targetElement.style.top),this.style.left=parseInt(this.targetElement.style.left)):Math.abs(this.position.x-e.params.x)==Math.abs(this.position.y-e.params.y)&&(this.position.x=e.params.x,this.position.y=e.params.y,this.targetElement.style.left=`${this.style.left+e.params.x}px`,this.targetElement.style.top=`${this.style.top+e.params.y}px`,this.style.left=parseInt(this.targetElement.style.left),this.style.top=parseInt(this.targetElement.style.top))}FireNexusEvent(e){Ui.push(e)}onNextTick(e){return e.params.gap+this.recordCount==this.sweepCount}breakToPos(e){const{targetX:t,targetY:i}=e.params;if(t&&null==i){let e=2*(t-this.position.x)/this.speed.speedX+1;this.acc.accX=-this.speed.speedX/e}if(i&&null==t){let e=2*(i-this.position.y)/this.speed.speedY+1;this.acc.accY=-this.speed.speedY/e}if(t&&i){const e=t-this.position.x,n=i-this.position.y;let s=2*e/this.speed.speedX+1;this.acc.accX=-this.speed.speedX/s;let r=2*n/this.speed.speedY+1;this.acc.accY=-this.speed.speedY/r}const n={type:"newCondition",params:{conditionSet:{params:{x:t,y:i,groupType:10,multiTimes:!1},type:"Position",cmds:[{params:{groupType:10,multiTimes:!1,x:t,y:i},type:"stopExtract"}]}}};this.newCondition(n)}clearGroupTypeCondition(){this.timerConditionList.forEach(((e,t)=>{10===e.params.groupType&&this.timerConditionList.splice(t,1)})),this.speedConditionList.forEach(((e,t)=>{10===e.params.groupType&&this.speedConditionList.splice(t,1)})),this.positionConditionList.forEach(((e,t)=>{10===e.params.groupType&&this.positionConditionList.splice(t,1)})),this.nexusEventList.forEach(((e,t)=>{10===e.params.groupType&&this.nexusEventList.splice(t,1)}))}onHitBlock(e){let t=!1,i=li.getSensor(e.params.GID);const n=parseInt(this.targetElement.style.width),s=parseInt(this.targetElement.style.height),r=this.differenceX,a=this.differenceY,o=this.prePosition.x+r,l=this.prePosition.y+a,h=this.position.x+r,c=this.position.y+a;return i.forEach(((e,i)=>{if("left"==e.direction){const i={x:o+n,y:l+s},u={x:h+n,y:c+s};let d=Xi({x:o+n,y:l},{x:h+n,y:c},{x:e.start.x,y:0},{x:e.end.x,y:1080}),g=Xi(i,u,{x:e.start.x,y:0},{x:e.end.x,y:1080});!1!==d&&!1!==g&&Ki(e.start,e.end,d,g,"Vertical")&&(this.envPosition.x=d.x-n-r,this.envPosition.y=d.y-a,t=!0)}else if("top"==e.direction){const i={x:o+n,y:l+s},u={x:h+n,y:c+s};let d=Xi({x:o,y:l+s},{x:h,y:c+s},{x:0,y:e.start.y},{x:1920,y:e.end.y}),g=Xi(i,u,{x:0,y:e.start.y},{x:1920,y:e.end.y});!1!==d&&!1!==g&&Ki(e.start,e.end,d,g,"Horizontal")&&(this.envPosition.x=d.x-r,this.envPosition.y=d.y-s-a,t=!0)}else if("right"===e.direction){const i={x:o,y:l+s},n={x:h,y:c+s};let u=Xi({x:o,y:l},{x:h,y:c},{x:e.start.x,y:0},{x:e.end.x,y:1080}),d=Xi(i,n,{x:e.start.x,y:0},{x:e.end.x,y:1080});!1!==u&&!1!==d&&Ki(e.start,e.end,u,d,"Vertical")&&(this.envPosition.x=u.x-r,this.envPosition.y=u.y-a,t=!0)}else if("bottom"===e.direction){const i={x:o+n,y:l},s={x:h+n,y:c};let u=Xi({x:o,y:l},{x:h,y:c},{x:0,y:e.start.y},{x:1920,y:e.end.y}),d=Xi(i,s,{x:0,y:e.start.y},{x:1920,y:e.end.y});!1!==u&&!1!==d&&Ki(e.start,e.end,u,d,"Horizontal")&&(this.envPosition.x=u.x-r,this.envPosition.y=u.y-a,t=!0)}})),t}revertWithHitBlock(){this.position.x=this.envPosition.x,this.position.y=this.envPosition.y}},F.FreeMoveActEvtType={ActEvent_ActFinish:1,ActEvent_Speed_X_Revert:2,ActEvent_Speed_Y_Revert:3};F.FreeMoveStateBuilder=class{static FireEcho(e){return{type:"fireEcho",params:{msg:e}}}static FireNexusEvent(e,t){return isNaN(e)||0==e?null:{type:"fireNexusEvent",params:{nexusEventId:isNaN(t)?0:t,eventType:e}}}static NewCondition(e){return{type:"newCondition",params:{conditionSet:e}}}static DelActionAssocCondition(){return{type:"delActionAssocCondition"}}static SetOffsetPos(e,t){return{type:"setOffset",params:{xOffset:e,yOffset:t}}}static SetPos(e,t){return{type:"jumpTo",params:{xPos:e,yPos:t}}}static RemoveAllCondtions(){return{type:"removeAllCondtions"}}static RevertWithHitBlock(){return{type:"revertWithHitBlock"}}static RemoveByGroup(e){return{type:"removeByGroup"}}static SetHitWallOverflow(){return{type:"setHitWallOverflow"}}},y.sParticleManager=At,y.AnimationListener=Ke,y.TranslateAnimation=ct,y.RotateAnimation=ut,y.ScaleAnimation=dt,y.TranslateFrameAnimation=gt,y.ThrowAnimation=ft,y.AnimationEnable=mt,y.TextureSetting=Ee,y.ExternalTextureSetting=be,y.DragInfo=Le,y.DragSetting=Pe;let Ji=Tt;y.sRenderBridge=Ji;{let An=[];function Pn(){if(An.length>0){for(let e of An)e.DoAttachToElement();An=[]}}Ji.AddAfterSwapListener("NewDomView",(()=>{Pn()}));class Ln extends Fe{constructor(e,t){super(null,"jsv-element-proxy"),this.ProxiedView=null,this._DomNativeId=e,this._UseMaskView=t,this.DelayedCalls=[],this._OnReadyCallbacks=[],An.push(this)}DoAttachToElement(){let e=y.DomElementGetter?.(this._DomNativeId);if(e){this.ProxiedView=e?.getElementView(this._UseMaskView),this.InvokeDelayCalls();for(const e of this._OnReadyCallbacks)e();this._OnReadyCallbacks=null}else console.log("domProxyView: attached element removed id="+this._DomNativeId)}RegisterOnProxyReady(e){this.ProxiedView?e():"function"==typeof e&&this._OnReadyCallbacks.push(e)}PushDelayCalls(e,t){this.DelayedCalls.push({name:e,args:t})}InvokeDelayCalls(){if(this.DelayedCalls.length>0)for(let e of this.DelayedCalls)this.ProxiedView[e.name].apply(this.ProxiedView,e.args)}HtmlCanAccessElement(){return null!=this.ProxiedView}}function kn(e,t){let i=new Ln(e,t);return new Proxy(i,{get(e,t){if("string"!=typeof t||t.startsWith("_"))return e[t];if(null!=e.ProxiedView)return void 0!==e.ProxiedView[t]?"function"==typeof e.ProxiedView[t]?e.ProxiedView[t].bind(e.ProxiedView):e.ProxiedView[t]:Reflect.get(e,t);if("function"==typeof e[t]){if("RegisterOnProxyReady"===t)return e[t].bind(e);{let i=e;return(...e)=>{i.PushDelayCalls(t,e),y.sRenderBridge.RequestSwap()}}}console.warn(`proxy not ready to get prop(${t})`)},set(e,t){console.warn("no support set prop")}})}y.NewDomProxyView=kn}y.LayoutView=class extends Fe{ResetTexture(e){e?super.ResetTexture(e.Texture,e.MaskSetting?.ImageTexture):super.ResetTexture(null)}AddView(e,t){let i=0,n=0,s=0,r=0;t&&(t instanceof y.LayoutParams?(i=t.MarginLeft,n=t.MarginTop,s=t.Width,r=t.Height):(i=isNaN(t.x)?0:t.x,n=isNaN(t.y)?0:t.y,s=isNaN(t.width)?0:t.width,r=isNaN(t.height)?0:t.height)),super.AddView(e,i,n,s,r)}},y.FilterView=Be,y.EditControlView=Ge,y.DragSetting=Pe,y.DragInfo=Le;y.TextureManager=class extends ge{RegisterLoadImageCallback(e,t,i){return super.RegisterLoadImageCallback(((e,n)=>{t({width:e,height:n},i)}))}},y.sViewStore=je,y.ViewInfo=ze,y.ViewMask=Ce,y.ViewTextureMask=Ie,y.ViewRoundCornerMask=Ae;{class Rn{constructor(e,t){this.OnBeginContact=e,this.OnEndContact=t}UpdateImpactCallback(e){this.OnBeginContact=e}UpdateLeaveCallback(e){this.OnEndContact=e}}y.sImpactSensorManager={StartTrace:(e,t,i,n)=>new ei(e,t,i,n),Callback:Rn,AutoFroze:ti}}y.ImpactAutoFroze=ti,y.ImpactSensor=ei,y.VisibleSensor=oi,y.TextInputType=He;const qi=window.ForgeFront,Zi=Object.keys(qi);for(let Fn of Zi)Fn in y||(y[Fn]=qi[Fn]);export{y as default};
|
|
1
|
+
/* eslint-disable */ import{parseGIF as e,decompressFrames as t}from"gifuct-js";void 0===window.Forge?(window.Forge={},console.log("Define forge browser")):console.log("Define using JsView forge engine-js");var i,s,n,r,a,o,l,h,c,u,d,g,f,m,p,y=window.Forge;function T(e,t,i){return"symbol"==typeof t&&(t=t.description?"[".concat(t.description,"]"):""),Object.defineProperty(e,"name",{configurable:!0,value:i?"".concat(i," ",t):t})}class _{static ToString(e){switch(e){case _.UnknownError:return"UnknownError("+e+")";case _.UnimplementedError:return"UnimplementedError("+e+")";case _.UnsupportedError:return"UnsupportedError("+e+")";case _.NotFoundError:return"NotFoundError("+e+")";case _.InvalidArgument:return"InvalidArgument("+e+")";case _.BadArgumentSize:return"BadArgumentSize("+e+")";case _.InvalidElement:return"InvalidElement("+e+")";case _.BadElementType:return"BadElementType("+e+")";case _.CssStyleNotExists:return"CssStyleNotExists("+e+")";case _.CssStyleNotChanged:return"CssStyleNotChanged("+e+")";case _.CssStyleBadType:return"CssStyleBadType("+e+")";case _.CssClassNotChanged:return"CssClassNotChanged("+e+")";case _.ForgeInsertView:return"ForgeInsertView("+e+")";default:return"UnknownError("+e+")"}}static GetFormattedMethod(e){var t,i;t=e.indexOf(" ")+1,i=e.indexOf("(")-t;return e.substr(t,i)+"()"}static GetErrorMessage(e=[]){var t="";for(const i of e)t+=i;return t}static PrintErrorMessage(e,t,i=[]){const s=_.GetErrorMessage(i);console.error("ForgeDom","Error@ "+e+":"+t+", "+s)}constructor(){throw new Error("new ErrCode() is forbidden.")}}function x(e,t,i=[]){I(e,_.GetErrorMessage(i),t)}function w(e,t,i=[]){I(e,_.GetErrorMessage(i),t)}function S(e,t=[]){I(e,_.GetErrorMessage(t))}function v(e,t=[]){C(e,_.GetErrorMessage(t),e)}function E(e,t,i=[]){C(e,_.GetErrorMessage(i),t)}function b(e,t=[]){C(e,_.GetErrorMessage(t))}function C(e,t,i=void 0){if(e<0)throw _.PrintErrorMessage("__FILE_NAME__","__LINE__",[_.ToString(e),". ",t]),new Error(i)}function I(e,t,i=void 0){if(!e)throw _.PrintErrorMessage("__FILE_NAME__","__LINE__",["ASSERT("+e+")",". ",t]),new Error(i)}_.UnknownError=-1,_.UnimplementedError=-2,_.UnsupportedError=-3,_.NotFoundError=-4,_.InvalidArgument=-5,_.BadArgumentSize=-6,_.InvalidElement=-100,_.BadElementType=-101,_.BadTaskType=-102,_.CssStyleNotExists=-120,_.CssStyleNotChanged=-121,_.CssStyleBadName=-122,_.CssStyleBadType=-123,_.CssClassNotChanged=-124,_.ForgeInsertView=-200;class A{static HasGetterMethod(e){switch(e){case A.Layout.Height:case A.Layout.Left:case A.Layout.Top:case A.Layout.Width:case A.Effect.ObjectFit:return!0;default:return!1}}static ToConst(e){return e==A.Layout.Height?A.Layout.Height:e==A.Layout.Left?A.Layout.Left:e==A.Layout.Top?A.Layout.Top:e==A.Layout.Width?A.Layout.Width:e==A.Flex.FlexDirection?A.Flex.FlexDirection:e==A.Flex.FlexWrap?A.Flex.FlexWrap:e==A.Flex.JustifyContent?A.Flex.JustifyContent:e==A.Flex.AlignItems?A.Flex.AlignItems:e==A.Flex.AlignContent?A.Flex.AlignContent:e==A.Flex.AlignSelf?A.Flex.AlignSelf:e==A.Flex.FlexGrow?A.Flex.FlexGrow:e==A.Background.BackgroundColor?A.Background.BackgroundColor:e==A.Background.BackgroundImage?A.Background.BackgroundImage:e==A.Background.BorderRadius?A.Background.BorderRadius:e==A.Effect.BackfaceVisibility?A.Effect.BackfaceVisibility:e==A.Effect.BorderImage?A.Effect.BorderImage:e==A.Effect.BorderImageWidth?A.Effect.BorderImageWidth:e==A.Effect.BorderImageOutset?A.Effect.BorderImageOutset:e==A.Effect.Display?A.Effect.Display:e==A.Effect.ObjectFit?A.Effect.ObjectFit:e==A.Effect.Opacity?A.Effect.Opacity:e==A.Effect.Overflow?A.Effect.Overflow:e==A.Effect.Perspective?A.Effect.Perspective:e==A.Effect.PerspectiveOrigin?A.Effect.PerspectiveOrigin:e==A.Effect.Transform?A.Effect.Transform:e==A.Effect.TransformOrigin?A.Effect.TransformOrigin:e==A.Effect.TransformStyle?A.Effect.TransformStyle:e==A.Effect.Visibility?A.Effect.Visibility:e==A.Effect.ZIndex?A.Effect.ZIndex:e==A.Text.Color?A.Text.Color:e==A.Text.FontFamily?A.Text.FontFamily:e==A.Text.FontSize?A.Text.FontSize:e==A.Text.FontStyle?A.Text.FontStyle:e==A.Text.FontWeight?A.Text.FontWeight:e==A.Text.LineHeight?A.Text.LineHeight:e==A.Text.TextAlign?A.Text.TextAlign:e==A.Text.TextOverflow?A.Text.TextOverflow:e==A.Text.TextShadow?A.Text.TextShadow:e==A.Text.WebkitTextStroke?A.Text.WebkitTextStroke:e==A.Text.WhiteSpace?A.Text.WhiteSpace:e==A.Text.WordWrap?A.Text.WordWrap:e==A.Text.Direction?A.Text.Direction:e==A.Text.JsvTextEmoji?A.Text.JsvTextEmoji:e==A.Text.JsvTextLatex?A.Text.JsvTextLatex:e==A.Text.JsvTextAlignMinWidth?A.Text.JsvTextAlignMinWidth:e==A.Text.JsvTextVerticalAlign?A.Text.JsvTextVerticalAlign:e==A.Text.JsvTextLineAlign?A.Text.JsvTextLineAlign:e==A.Text.JsvTextInnerDirection?A.Text.JsvTextInnerDirection:e==A.Motion.Animation?A.Motion.Animation:e==A.Motion.Transition?A.Motion.Transition:e==A.Motion.AnimationFillMode?A.Motion.AnimationFillMode:null}constructor(){throw new Error("new StyleName() is forbidden.")}}A.Layout=(T(i=class{constructor(){throw new Error("new StyleName.Layout() is forbidden.")}},"Layout"),i.Height="height",i.Left="left",i.Top="top",i.Width="width",i),A.Flex=(T(s=class{constructor(){throw new Error("new StyleName.Flex() is forbidden.")}},"Flex"),s.FlexDirection="flexDirection",s.FlexWrap="flexWrap",s.JustifyContent="justifyContent",s.AlignItems="alignItems",s.AlignContent="alignContent",s.AlignSelf="alignSelf",s.FlexGrow="flexGrow",s),A.Background=(T(n=class{constructor(){throw new Error("new StyleName.Background() is forbidden.")}},"Background"),n.BackgroundColor="backgroundColor",n.BackgroundImage="backgroundImage",n.BorderRadius="borderRadius",n),A.Effect=(T(r=class{constructor(){throw new Error("new StyleName.Effect() is forbidden.")}},"Effect"),r.BackfaceVisibility="backfaceVisibility",r.BorderImage="borderImage",r.BorderImageWidth="borderImageWidth",r.BorderImageOutset="borderImageOutset",r.Display="display",r.ObjectFit="objectFit",r.Opacity="opacity",r.Overflow="overflow",r.Perspective="perspective",r.PerspectiveOrigin="perspectiveOrigin",r.Transform="transform",r.TransformOrigin="transformOrigin",r.TransformStyle="transformStyle",r.Visibility="visibility",r.ZIndex="zIndex",r),A.Text=(T(a=class{constructor(){throw new Error("new StyleName.Text() is forbidden.")}},"Text"),a.Color="color",a.FontFamily="fontFamily",a.FontSize="fontSize",a.FontStyle="fontStyle",a.FontWeight="fontWeight",a.LineHeight="lineHeight",a.TextAlign="textAlign",a.TextOverflow="textOverflow",a.TextShadow="textShadow",a.WebkitTextStroke="WebkitTextStroke",a.WhiteSpace="whiteSpace",a.WordWrap="wordWrap",a.Direction="direction",a.JsvTextEmoji="JsvTextEmoji",a.JsvTextLatex="JsvTextLatex",a.JsvTextAlignMinWidth="JsvTextAlignMinWidth",a.JsvTextVerticalAlign="JsvTextVerticalAlign",a.JsvTextLineAlign="JsvTextLineAlign",a.JsvTextInnerDirection="JsvTextInnerDirection",a),A.Motion=(T(o=class{constructor(){throw new Error("new StyleName.Motion() is forbidden.")}},"Motion"),o.Animation="animation",o.Transition="transition",o.AnimationFillMode="animationFillMode",o);class P{constructor(e){let t=-1,i=null;null==e?t=P.DataType.Null:Number(e)===e&&e%1==0?t=P.DataType.Int32:Number(e)===e&&e%1!=0?t=P.DataType.Float:"string"==typeof e||e instanceof String?t=P.DataType.String:e instanceof P.AnimationImpl?t=P.DataType.Animation:e instanceof P.CornerImpl?t=P.DataType.Corner:e instanceof P.RectImpl?t=P.DataType.Rect:e instanceof P.TextShadowImpl?t=P.DataType.TextShadow:e instanceof P.WebkitTextStrokeImpl?t=P.DataType.WebkitTextStroke:e instanceof P.TransitionImpl?t=P.DataType.Transition:e instanceof P.BorderImageImpl&&(t=P.DataType.BorderImage),e!=P.InvalidInt32&&e!=P.InvalidFloat&&e!=P.InvalidPointer?i=e:(t=P.DataType.Null,i=null),this.data=new P.DataInfo,this.data.index=t,this.data.value=i}toString(){let e=null;switch(this.data.index){case P.DataType.Null:return"";case P.DataType.Int32:case P.DataType.Float:return String(this.get());case P.DataType.String:e=this.get();break;case P.DataType.Animation:case P.DataType.Corner:case P.DataType.Rect:case P.DataType.TextShadow:case P.DataType.WebkitTextStroke:case P.DataType.Transition:case P.DataType.BorderImage:case P.DataType.BackgroundImage:e=this.get().rawValue;break;default:console.error("Failed to do StyleValue.toString()")}return e??""}is(e){return this.data.index==e}get(){return this.data.value}reset(e){this.data.value=e.data.value,this.data.index=e.data.index}equals(e){return this.data.value===e.data.value&&this.data.index===e.data.index}}P.Base=class{constructor(e){this.rawValue=e}},P.AnimationImpl=class extends P.Base{constructor(e){super(e),this.name="",this.duration=0,this.timingFunction=null,this.delay=0,this.iterationCount=0,this.direction=!1}},P.CornerImpl=class extends P.Base{constructor(e){super(e),this.topLeft=0,this.topRight=0,this.bottomRight=0,this.bottomLeft=0}},P.RectImpl=class extends P.Base{constructor(e){super(e),this.top=0,this.right=0,this.left=0,this.bottom=0}},P.TextShadowImpl=class extends P.Base{constructor(e){super(e),this.hShadow=0,this.vShadow=0,this.blur=0,this.color=void 0}},P.WebkitTextStrokeImpl=class extends P.Base{constructor(e){super(e),this.length=0,this.color=void 0}},P.TransitionImpl=class extends P.Base{constructor(e){super(e),this.animationMap=new Map}},P.BorderImageImpl=class extends P.Base{constructor(e){super(e),this.source="",this.slice=null}},P.BackgroundImageImpl=(T(l=class extends P.Base{constructor(e){super(e),this.type=0,this.urlPath=""}},"BackgroundImageImpl"),l.eType={UNKNOWN:0,LINEAR_GRADIENT:1,URL_PATH:2},l.LinearGradient=class{constructor(){this.fromX=0,this.fromY=0,this.toX=0,this.toY=0,this.stops=[]}},l),P.DataType=(T(h=class{},"DataType"),h.Null=0,h.Int32=1,h.Float=2,h.String=3,h.Animation=4,h.Corner=5,h.Rect=6,h.TextShadow=7,h.WebkitTextStroke=8,h.Transition=9,h.BorderImage=10,h.BackgroundImage=11,h),P.InvalidInt32=Number.MIN_VALUE,P.InvalidFloat=Number.NaN,P.InvalidPointer=null,P.DataInfo=class{constructor(){this.value=null,this.index=-1}};class L{}L.Text=(T(c=class{},"Text"),c.Color="#000000",c.FontFamily="黑体",c.FontSize=10,c.FontStyle="normal",c.FontWeight="normal",c.LineHeight=0,c.TextAlign="start",c.TextOverflow="clip",c.TextShadow=null,c.WebkitTextStroke=null,c.WhiteSpace="normal",c.WordWrap="normal",c.Direction="ltr",c.JsvTextEmoji=0,c.JsvTextLatex=0,c.JsvTextAlignMinWidth=0,c.JsvTextVerticalAlign="top",c.JsvTextLineAlign="middle",c.JsvTextInnerDirection="unset",c);class k{static FormatVariableName(e){return e.startsWith("--")?"var("+e+")":e.startsWith("var(--")?e:(w(!1,null),null)}static IsVariable(e){let t;if(e instanceof P){if(0==e.is(P.DataType.String))return!1;t=e.get()}else{if("string"!=typeof e)return!1;t=e}return t.startsWith("--")||t.startsWith("var(--")}constructor(){throw new Error("new StyleVariable() is forbidden.")}}class R{constructor(){throw new Error("new StyleGroup() is forbidden.")}}R.Layout=(T(u=class{constructor(){this.height=P.InvalidInt32,this.left=P.InvalidInt32,this.top=P.InvalidInt32,this.width=P.InvalidInt32}},"Layout"),u.Name="layout",u),R.Flex=(T(d=class{constructor(){this.flexDirection=P.InvalidInt32,this.flexWrap=P.InvalidInt32,this.justifyContent=P.InvalidInt32,this.alignItems=P.InvalidInt32,this.alignContent=P.InvalidInt32,this.alignSelf=P.InvalidInt32,this.flexGrow=P.InvalidFloat}},"Flex"),d.Name="flex",d),R.Background=(T(g=class{constructor(){this.backgroundColor=P.InvalidPointer,this.backgroundImage=P.InvalidPointer,this.borderRadius=P.InvalidPointer}},"Background"),g.Name="background",g),R.Effect=(T(f=class{constructor(){this.backfaceVisibility=P.InvalidPointer,this.borderImage=P.InvalidPointer,this.borderImageWidth=P.InvalidPointer,this.borderImageOutset=P.InvalidPointer,this.display=P.InvalidPointer,this.objectFit=P.InvalidPointer,this.opacity=P.InvalidFloat,this.overflow=P.InvalidPointer,this.perspective=P.InvalidInt32,this.perspectiveOrigin=P.InvalidPointer,this.transform=P.InvalidPointer,this.transformOrigin=P.InvalidPointer,this.transformStyle=P.InvalidPointer,this.visibility=P.InvalidPointer,this.zIndex=P.InvalidInt32}},"Effect"),f.Name="effect",f),R.Text=(T(m=class{constructor(){this.color=P.InvalidPointer,this.fontFamily=P.InvalidPointer,this.fontSize=P.InvalidInt32,this.fontStyle=P.InvalidPointer,this.fontWeight=P.InvalidPointer,this.lineHeight=P.InvalidInt32,this.textAlign=P.InvalidPointer,this.textOverflow=P.InvalidPointer,this.textShadow=P.InvalidPointer,this.webkitTextStroke=P.InvalidPointer,this.whiteSpace=P.InvalidPointer,this.wordWrap=P.InvalidPointer,this.direction=P.InvalidPointer,this.jsvTextEmoji=P.InvalidInt32,this.jsvTextLatex=P.InvalidInt32,this.jsvTextAlignMinWidth=P.InvalidInt32,this.jsvTextVerticalAlign=P.InvalidPointer,this.jsvTextLineAlign=P.InvalidPointer,this.jsvTextInnerDirection=P.InvalidPointer}},"Text"),m.Name="text",m),R.Motion=(T(p=class{constructor(){this.animation=P.InvalidPointer,this.transition=P.InvalidPointer,this.animationFillMode="none"}},"Motion"),p.Name="motion",p),void 0===window.ForgeFront&&(window.ForgeFront={},console.log("Define global ForgeFront browser"));let F=window.ForgeFront;const D=new class{constructor(){this._count=1}get count(){return this._count}update(){this._count<Number.MAX_SAFE_INTEGER?++this._count:this._count=1}};F.sFrameCount=D;class V{static getTextPixelWith(e,t){null===V.sCanvas&&(V.sCanvas=window.originDocument.createElement("canvas"));const i=V.sCanvas.getContext("2d");i.font=t;const s=i.measureText(e);return Math.ceil(s.width)}static GetOneLineTextDrawWidth(e,t,i,s,n){const r=[];r.push(0);const a=s?"bold":"",o=n?"italic":"",l=Math.floor(2048/i);let h=0,c=0;for(;h<e.length;){const s=h+l;let n;if(h+l>=e.length)n=e.length-h;else{let t=e.lastIndexOf(" ",s);n=t>h?t-h+1:l}const u=e.slice(h,h+n),d=V.getTextPixelWith(u,`${a} ${o} ${i}px ${t}`);r.push(h),r.push(h+n),r.push(d),c+=d,h+=n}return r[0]=c,r}static GetTextWidth(e){let t="";e.bold&&(t="bold");let i="";return e.italic&&(i="italic"),this.getTextPixelWith(e.str,`${t} ${i} ${e.size}px ${e.font}`)}static GetTextRect(e,t,i,s,n){let r=Math.ceil(i.size*e.length/t.width)*n;r>t.height&&(r=t.height);return{width:t.width,height:r}}static GetCursorOffset(e,t,i,s,n,r,a){let o="";i.bold&&(o="bold");let l="";i.italic&&(l="italic");let h=0;if("right"===i.alignment){const s=this.getTextPixelWith(e,`${o} ${l} ${i.size}px ${i.font}`);(r-=t.width-s)<0&&(r=0)}let c=0;for(;r>=c&&h!==e.length;)c=this.getTextPixelWith(e.substr(0,h+1),`${o} ${l} ${i.size}px ${i.font}`),r>=c&&h++;return h}static GetCursorPosition(e,t,i,s,n,r){let a="";i.bold&&(a="bold");let o="";i.italic&&(o="italic");let l=0,h=e;if(r<e.length&&(h=h.substr(0,r)),l=this.getTextPixelWith(h,`${a} ${o} ${i.size}px ${i.font}`),"right"===i.alignment){const s=this.getTextPixelWith(e,`${a} ${o} ${i.size}px ${i.font}`);l=t.width-s+l}return{x:l,y:0}}}V.sCanvas=null,window.PlatformUtils=V;class O{constructor(e){this.state={},this.type=e,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(e){void 0!==e&&(this._AutoPlay=!0,this.Ele.paused&&setTimeout((()=>{this.play()}),0))}get currentTime(){return this.Ele.currentTime}set currentTime(e){this.Ele.currentTime=e,this.setState("seek",e,"number")}get duration(){return this.Ele.duration}set loop(e){this.Ele.loop="boolean"==typeof e||void 0!==e}get muted(){return this.getState("muted")}set muted(e){this.setState("muted",e,"boolean")}get paused(){return this.Ele.paused}get playbackRate(){return this.getState("playbackRate")}set playbackRate(e){this.setState("playbackRate",e,"number")}set src(e){this.setState("src",e,"string"),e&&this._AutoPlay&&setTimeout((()=>{this.play()}),0)}get style(){const e=this;return{set bottom(t){e.setState("style",`{"bottom":"${t}"}`,"string")},set left(t){e.setState("style",`{"left":"${t}"}`,"string")},set right(t){e.setState("style",`{"right":"${t}"}`,"string")},set top(t){e.setState("style",`{"top":"${t}"}`,"string")},set height(t){e.setState("style",`{"height":"${t}"}`,"string")},set width(t){e.setState("style",`{"width":"${t}"}`,"string")}}}get volume(){return this.getState("volume")}set volume(e){this.setState("volume",e,"number")}get playableDuration(){return this.Ele.playableDuration}addEventListener(e,t){this[`on${e}`]=t,this.Ele.addEventListener(e,(t=>{this[`on${e}`](t)}))}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(e,t,i){typeof t===i?("playbackRate"==e?this.Ele.playbackRate=t:"muted"==e?this.Ele.muted=t:this.Ele.setAttribute(e,t),this.state[e]=t,console.log(`set ${e} = ${t}`)):console.warn(`invalid paramter type to set ${e}. value is not ${i}`)}getState(e){let t=this.state[e];return console.log(`get ${e} = ${t}`),void 0===t&&(t=this.Ele.getAttribute(e),this.state[e]=t),t}onEnd(e){this.setState("paused",!0,"boolean"),this.hasOwnProperty("onended")&&this.onended()}onError(e){this.hasOwnProperty("onerror")&&this.onerror(e.currentTarget.error.code)}mediaHandler(){return this.Ele}static setDesignMapWidth(e){"number"==typeof e?O.prototype.designMapWidth=e:console.warn(`Invalid paramter type to set ${e}. It is not number.`)}}O.prototype.designMapWidth=0;class M extends O{constructor(e){super(e),super.buildPlatformInstance(e)}}class N extends M{constructor(){super("audio")}}window._ExtAudio=N;class G extends M{constructor(){super("video"),this.state.height=0,this.state.width=0,this.state.aspectRatiow="origin"}get height(){return this.getState("height")}set height(e){this.style.height=e,this.state.height=e}get poster(){return console.log("Video.poster() TODO"),null}set poster(e){console.log("Video.poster() TODO")}get videoAspectRatio(){return this.getState("aspectRatio")}set videoAspectRatio(e){this.setState("aspectRatio",e,"string")}get videoHeight(){return this.Ele.videoHeight}get videoWidth(){return this.Ele.videoWidth}get width(){return this.getState("width")}set width(e){this.style.width=e,this.state.width=e}onLoad(e){super.onLoad(e)}setRotation(e,t,i,s){let n=function(){let n=`rotate3d(0, 0, 1, ${e}deg)`;if(90==e||-90==e){let e,r;if(s?(e=i/t,r=t/i):(e=this.videoHeight/this.videoWidth,r=this.videoWidth/this.videoHeight),isNaN(e)||isNaN(r))return!1;n+=` scale3d(${e}, ${r}, 1)`}return this.Ele.style.transform=n,this.Ele.parentNode&&(this.Ele.parentNode.style.overflow="hidden"),!0};n=n.bind(this);n()||this.Ele.addEventListener("loadedmetadata",(()=>{n()}))}}window._ExtVideo=G;class B extends O{constructor(){super("video"),this._ReleaseCallbacks=[],this._ResourceTerminater=null,super.buildPlatformInstance()}setResourceTerminator(e){this._ResourceTerminater=e}hasTerminator(){return null!==this._ResourceTerminater}listenToRelease(e){this._ReleaseCallbacks.push(e)}unload(){super.unload(),null!==this._ResourceTerminater&&this._ResourceTerminater(),this._ResourceTerminater=null}releaseResource(){for(let e=0;e<this._ReleaseCallbacks.length;e++)this._ReleaseCallbacks[e]();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=B,window.Audio=N,window.Video=G,window.OffscreenVideoPlayer=B;class W{constructor(e,t){if(this.href="",this.origin="",this.protocol="",this.host="",this.hostname="",this.port="",this.pathname="",this.search="",this.hash="",!e)return;if(!0===e.startsWith("url")){const t=e.indexOf("(")+1,i=e.lastIndexOf(")");e=e.substring(t,i).trim()}if(!0===e.startsWith("data:"))return void(this.href=e);if(!0===e.startsWith("/")&&(e=document.location.origin+e),!0===e.startsWith("./")){const t=document.location.pathname.lastIndexOf("/");let i="";t>0&&(i=document.location.pathname.substring(0,t)),e=document.location.origin+i+e.substring(1)}if(this.href=e,!t)return;let i=this.href.indexOf("?");const s=i>0?this.href.substring(0,i):this.href;this.search=i>1?this.href.substring(i):"",i=s.indexOf("://"),this.protocol=i>0?s.substring(0,i+1):"";const n=i>1?s.substring(i+3):"";i=n.indexOf("/"),this.host=i>0?n.substring(0,i):"",this.pathname=i>1?n.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(e){this.href=e}}const H=window.AudioContext||window.webkitAudioContext;if(H){const Qi=new H;let es=0,ts=0;class is{constructor(e,t,i){this._Context=e,this._BufferSource=t,this._Gain=i,this._BufferSource.connect(this._Gain),this._Gain.connect(this._Context.destination)}start(e,t,i){this._BufferSource.start(e,t,i)}setVolume(e){this._Gain.gain.setValueAtTime(e,this._Context.currentTime)}stop(e){this._BufferSource.stop(e)}}class ss{constructor(){this._SoundBufferMap={},this._StreamMap={}}load(e,t,i,s){const n=new W(e).href,r=es++;return this._requestBuffer(n,((e,t)=>{0===e?Qi.decodeAudioData(t,(e=>{this._SoundBufferMap[r]=e,s(r,0)})):s(-1,-1)})),r}unload(e){delete this._SoundBufferMap[e]}autoPause(){}autoResume(){}play(e,t,i,s,n,r){if(this._SoundBufferMap[e]){const i=ts++,s=Qi.createBufferSource();s.buffer=this._SoundBufferMap[e],s.playbackRate.value=r,s.onended=e=>{this.stop(i)},n>0&&(s.loop=!0);const a=Qi.createGain();a.gain.setValueAtTime(t,Qi.currentTime);const o=new is(Qi,s,a);return this._StreamMap[i]=o,console.log("loop test",(n+1)*this._SoundBufferMap[e].duration),o.start(0,0,(n+1)*this._SoundBufferMap[e].duration),i}return-1}pause(e){}resume(e){}stop(e){this._StreamMap[e]&&(this._StreamMap[e].stop(),delete this._StreamMap[e])}release(){this._SoundBufferMap={},this._StreamMap={}}setVolume(e,t,i){this._StreamMap[e]&&this._StreamMap[e].setVolume(t)}setPriority(e,t){}setRate(e,t){}setLoop(e,t){}_requestBuffer(e,t){const i=new XMLHttpRequest;i.open("GET",e,!0),i.responseType="arraybuffer",i.onload=()=>{200===i.status?(console.log("http request succeed"),t(0,i.response)):(console.error(`download audio ${e} failed.`,i.status),t(-1,null))},i.send()}}window.SoundPool=ss}else window.SoundPool=null;F.LogF=function(e){},F.LogE=function(e){},F.LogW=function(e){},F.LogI=function(e){},F.LogD=function(e){},F.LogM=function(e){},F.ThrowError=function(e){throw new Error(e)},F.Assert=function(e){if(!e)throw new Error("ASSERT!!!!!")},F.EnableLog=function(e){F.LogM=console.log.bind(console),e>0&&(F.LogF=console.error.bind(console)),e>1&&(F.LogE=console.error.bind(console)),e>2&&(F.LogW=console.warn.bind(console)),e>3&&(F.LogI=console.log.bind(console)),e>4&&(F.LogD=console.debug.bind(console))};class Y{constructor(e,t,i,s){this.x="number"==typeof e?e:0,this.y="number"==typeof t?t:0,("number"!=typeof i||i<0)&&(i=0),this.width=i,("number"!=typeof s||s<0)&&(s=0),this.height=s}Equals(e){return null!==e&&(e.x===this.x&&e.y===this.y&&e.width===this.width&&e.height===this.height)}}F.RectArea=Y;F.Coordinate=class{constructor(e,t){this.x=e,this.y=t}};F.Size=class{constructor(e,t){this.width=e,this.height=t}};F.RectUtils=class{FormatRectArea(e){let t=null;if(e instanceof F.RectArea)t=e;else if("object"==typeof e&&null!==e){if(isNaN(e.width)||isNaN(e.height))throw new Error("ERROR: target_size format should be {width:XXXX, height:XXXX}");t=new F.RectArea(0,0,e.width,e.height)}return t}},F.sRectUitls=new F.RectUtils,F.TextShaderType={LinearGradient:0,Image:1};F.TextShader=class{constructor(e,t){this.Type=e,this.Params=t}};class ${constructor(){const e=(new F.LayoutView).GetRenderer();this._Renderer=e,this.StringWithFont=F.sTextUtils.StringWithFont("",0,void 0,"center","middle",void 0,!1,!1,void 0,void 0,"top"),this.RectArea=new F.RectArea(0,0,0,0),this.TextAttr=F.sTextUtils.TextAttr("ellipsis","none"),this.Marquee=null,this.Shader=null,this.IsInstantLoad=!0,this.LineHeight=0,this.LatexMode=!1}SetInstantLoad(e){return this.IsInstantLoad=e,this}SetStringWithFont(e){return this.StringWithFont=e,this}SetLatexMode(e){return this.LatexMode=e,this}SetFontStyle(e,t,i,s,n,r,a,o,l,h){return this.StringWithFont="object"==typeof e?F.sTextUtils.StringWithFont("",void 0!==e.size?e.size:10,void 0!==e.font?e.font:"宋体",void 0!==e.hAlign?e.hAlign:"center",void 0!==e.vAlign?e.vAlign:"middle",void 0!==e.textColor?e.textColor:"#000000",void 0!==e.italic&&e.italic,void 0!==e.bold&&e.bold,void 0!==e.shadow?e.shadow:null,void 0!==e.strokeWidth?e.strokeWidth:null,void 0!==e.vAreaAlign?e.vAreaAlign:"top"):F.sTextUtils.StringWithFont("",e,t,i,s,n,r,a,o,l,h),this}SetRectArea(e){return e instanceof F.RectArea?this.RectArea=e:this.RectArea=new F.RectArea(e.x,e.y,e.width,e.height),this}SetViewSize(e){return e instanceof F.RectArea||(e=new F.RectArea(e.x,e.y,e.width,e.height)),this.SetRectArea(e),0===this.LineHeight&&0!==e.height&&(this.LineHeight=e.height),this}SetTextAttr(e){let t,i;return t=e.hasOwnProperty("textOverflow")?e.textOverflow:e.hasOwnProperty("text_overflow")?e.text_overflow:"clip",i=e.hasOwnProperty("wordWrap")?e.wordWrap:e.hasOwnProperty("word_wrap")?e.word_wrap:"none",this.TextAttr={word_wrap:i,text_overflow:t},this}SetMarquee(e){return e&&(this.Marquee={repetition:"infinite",direction:"left",speed:"normal"},e.repetition&&(this.Marquee.repetition=e.repetition),e.direction&&(this.Marquee.direction=e.direction),e.speed&&(this.Marquee.speed=e.speed)),this}SetShader(e){return this.Shader=e,this}SetLineHeight(e){return this.LineHeight=e,this}EnableDuplicateBuilder(){this.BuildCopyBag=!0}Clone(){const e=new $(null);return e.StringWithFont=this.StringWithFont,e.RectArea=this.RectArea,e.TextAttr=this.TextAttr,e.LineHeight=this.LineHeight,e}}F.TextViewParams=$,window.TextViewParams=F.TextViewParams;class U{constructor(e,t,i,s,n){this._layoutView=null,this._textWidth=0,this._textViewReahHeight=0,this._marqueeRunning=!0,this._marqueePause=!1,this._marqueeCurrentNum=2,this._textView=null,this._TextViewParams=t,this._NeedQuick=void 0!==s&&s,this._marquee=t.Marquee,this._rectArea=t.RectArea,this._DrawCount=0,this._ShowInterval=0,this._TextureManager=e,this._LatexMode=t.LatexMode,this._Shader=t.Shader,this._IsInstantLoad=t.IsInstantLoad?1:0,this._AutoHeight=!1,this._EnableTextureOnloadCallback=!!n,this._DuplicateBag=t.BuildCopyBag?{Set:null,Swf:null,Siz:null}:null;const r=this;let a=null;const o=t.RectArea.width,l=t.RectArea.height;let h=null,c=null;null!==this._marquee?(c=new F.ClipView,c.Init(),c.SetClipRect(0,0,o,l,!0),c.SetId("matrixClipLayoutview"),c.OnDettachFromSystem=function(){r._marqueeRunning=!1,F.ClipView.prototype.OnDettachFromSystem.call(this)}):(c=new F.LayoutView,c.OnDettachFromSystem=function(){this._TextureOnloadCallbacksTimer&&(clearTimeout(this._TextureOnloadCallbacksTimer),this._TextureOnloadCallbacksTimer=null)}),a=c.GetRenderer(),this._Renderer=a;let u=i;u||(u=t.StringWithFont.str),u=this._ConvertEscToString(u);let d=!1;t.StringWithFont.italic.length>0&&(d=!0);let g=!1;t.StringWithFont.bold.length>0&&(g=!0),h=F.sTextUtils.StringWithFont(u,t.StringWithFont.size,t.StringWithFont.font,t.StringWithFont.alignment,t.StringWithFont.vertical_align,t.StringWithFont.textColour,d,g,t.StringWithFont.shadow,t.StringWithFont.stroke_width,t.StringWithFont.vertical_area_align),void 0!==t.Marquee&&null!==t.Marquee?this._textWidth=F.sTextUtils.GetTextWidth(h):this._NeedQuick?this._textWidth=t.RectArea.width-2*t.RectArea.x:this._textWidth=F.sTextUtils.GetTextWidth(h),this.addTextView(c,h,t.TextAttr,t.RectArea,t.Marquee,t.LineHeight),this._TextureOnloadCallbacksTimer&&(clearTimeout(this._TextureOnloadCallbacksTimer),this._TextureOnloadCallbacksTimer=null),this._TextureOnloadCallbacksTimer=setTimeout((()=>{n&&n({width:this._textView.Element.clientWidth,height:this._textView.Element.clientHeight})}),0),this._layoutView=c,this._TextTexture=null,this._MarqueeTimer=null}_ConvertEscToString(e){let t=`${e}`;return-1!==t.indexOf(""")&&(t=t.replace(/"/gi,'"')),-1!==t.indexOf("&")&&(t=t.replace(/&/gi,"&")),-1!==t.indexOf("<")&&(t=t.replace(/</gi,">")),-1!==t.indexOf(">")&&(t=t.replace(/>/gi,"<")),-1!==t.indexOf(" ")&&(t=t.replace(/ /gi," ")),t}EnableAutoHeight(){this._AutoHeight=!0,this._textView.EnableAutoHeight()}addTextView(e,t,i,s,n,r){const a=s.height;let o;const l=F.Clone(s);let h=null;0!==t.str.length?(o=this._TextureManager.GetTextTextureByMultiRows(t,i,l,r,this._NeedQuick,this._Shader,this._IsInstantLoad,this._LatexMode,this._DuplicateBag),this._TextTexture=o.texture,this._textViewReahHeight=o.real_height,h=new F.LayoutView,h.Init(new F.TextureSetting(o.texture,null,null,!0)),h.SetId(`Text-${t.str}`),"middle"!==t.vertical_area_align&&"bottom"!==t.vertical_area_align||(h.Element.style.display="table-cell",h.Element.style.position="static",e.Element.style.display="table",e.Element.style.position="static"),e.AddView(h,0,0,l.width,a),this._textView=h):(this._textViewReahHeight=0,F.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(e){e&&null!==this._textView&&this._textView.StartAnimation(e)}}F.TextViewEx=U,F.TextViewControl=U;F.CopiedTextViewEx=class{constructor(e,t,i,s,n){const r={x:0,y:0,width:i.width,height:i.height};this._ContainerView=new F.LayoutView,this._TextView=this._AddTextView(e,t,r,this._ContainerView,s,n)}_AddTextView(e,t,i,s,n,r){let a=null;if(t&&0!==t.length){const o=e.GetCopiedTextTexture(t,i,n,r);a=new F.LayoutView,a.Init(new F.TextureSetting(o,null,null,!0)),t.length<15?a.SetId(`Text-${t}`):a.SetId(`Text-Long${t.length}`),s.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}},F.Clone=function(e){return JSON.parse(JSON.stringify(e))},window.Clone=F.Clone;F.PersistTimer=new class{constructor(){this._AlreadyExited=!1,window.PersistTimer&&(this._AlreadyExited=!0)}setTimeout(e,t){return this._AlreadyExited&&window.PersistTimer.setTimeout?window.PersistTimer.setTimeout(e,t):window.setTimeout(e,t)}clearTimeout(e){this._AlreadyExited&&window.PersistTimer.clearTimeout?window.PersistTimer.clearTimeout(e):window.clearTimeout(e)}setInterval(e,t){if(!this._AlreadyExited||!window.PersistTimer.setInterval)return window.setInterval(e,t);window.PersistTimer.setInterval(e,t)}clearInterval(e){this._AlreadyExited&&window.PersistTimer.clearInterval?window.PersistTimer.clearInterval(e):window.clearInterval(e)}};F.ForegroundTimer=new class{setTimeout(e,t){return window.setTimeout(e,t)}clearTimeout(e){window.clearTimeout(e)}setInterval(e,t){return window.setInterval(e,t)}clearInterval(e){window.clearInterval(e)}},F.EasingTypeIn=0,F.EasingTypeOut=1,F.EasingTypeInOut=2,F.EasingTypeBezier=3,F.EasingTypeBlink=4,F.EasingTypeDeceleration=5,F.EasingTypeSteps=6;F.EasingBase=class{constructor(){this.Pacakge=this.Package}Package(){}_GetBasePackage(e){return{T:e,St:null}}};class j extends F.EasingBase{Package(){return this._GetBasePackage(F.EasingTypeIn)}}F.EasingIn=j;class X extends F.EasingBase{Package(){return this._GetBasePackage(F.EasingTypeOut)}}F.EasingOut=X;class z extends F.EasingBase{Package(){return this._GetBasePackage(F.EasingTypeInOut)}}F.EasingInOut=z;class K extends F.EasingBase{Package(){return this._GetBasePackage(F.EasingTypeDeceleration)}}F.EasingDeceleration=K;class J extends F.EasingBase{Package(){return this._GetBasePackage(F.EasingTypeBlink)}}F.EasingBlink=J;class q extends F.EasingBase{constructor(e,t,i,s,n){super(),this._Inited=!1,this._X1=e,this._X2=i,this._Y1=t,this._Y2=s,this._Duration=n}Package(){const e=this._GetBasePackage(F.EasingTypeBezier);return e.St={X1:this._X1,X2:this._X2,Y1:this._Y1,Y2:this._Y2,Dur:this._Duration},e}}F.BezierEasing=q;class Z extends F.EasingBase{constructor(e,t){super(),this._Steps=e,this._Type=t}Package(){const e=this._GetBasePackage(F.EasingTypeSteps);return e.St={S:this._Steps,T:this._Type},e}}F.StepsEasing=Z,F.Easing={Circular:{In:new F.EasingIn,Out:new F.EasingOut,InOut:new F.EasingInOut,Deceleration:new F.EasingDeceleration}},window.Easing=F.Easing;let Q=null,ee=null,te=null;F.sCustomCanvasResProvider=new class{GetDataUrl(e){return JSON.parse(e).forEach(((e,t)=>{switch(e.cmd){case 1:Q=window.originDocument.createElement("canvas"),ee=Q.getContext("2d"),Q.setAttribute("width",`${e.w}px`),Q.setAttribute("height",`${e.h}px`);break;case 2:"stroke"==e.type?(ee.strokeStyle=e.clr,ee.lineWidth=e.lineWidth,ee.fillStyle=null,te="stroke"):(ee.fillStyle=e.clr,ee.strokeStyle=null,te="fill");break;case 3:ee.beginPath();break;case 30:this.myMoveTo(e.x,e.y);break;case 31:this.myLineTo(e.x,e.y);break;case 32:this.myArcTo(e);break;case 33:ee.closePath();break;case 14:"stroke"===te?ee.stroke():"fill"===te&&ee.fill();break;case 13:this.myRect(e);break;case 12:this.circleDraw(e);break;case 15:this.drawLine(e);break;case 16:this.drawLinearGradientRect(e);break;case 11:this.drawColor(e.clr);break;case 10:this.clearCanvas()}})),Q.toDataURL("image/png")}myMoveTo(e,t){void 0!==e&&void 0!==t&&ee.moveTo(e,t)}myLineTo(e,t){void 0!==e&&void 0!==t&&ee.lineTo(e,t)}myArcTo(e){let t=(e.left+e.right)/2,i=(e.top+e.bottom)/2,s=(e.right-e.left)/2,n=(e.bottom-e.top)/2;const r={x:t+s*Math.cos(e.startAngle*Math.PI/180),y:i-n*Math.sin(e.startAngle*Math.PI/180)};let a=e.startAngle*Math.PI/180,o=(e.startAngle+e.sweepAngle)*Math.PI/180,l=1!=Math.sign(e.sweepAngle);ee.moveTo(r.x,r.y),ee.ellipse(t,i,s,n,0,a,o,l)}circleDraw(e){void 0!==e.x&&void 0!==e.y&&void 0!==e.radius&&(ee.arc(e.x,e.y,e.radius,0,2*Math.PI),"stroke"===te?ee.stroke():"fill"===te&&ee.fill())}myRect(e){let t=e.right-e.left,i=e.bottom-e.top,s=e.left,n=e.top;ee.rect(s,n,t,i),"stroke"===te?ee.stroke():"fill"===te&&ee.fill()}drawLine(e){ee.moveTo(e.x0,e.y0),ee.lineTo(e.x1,e.y1),ee.lineWidth=e.lineWidth,ee.strokeStyle=e.clr,ee.stroke()}drawLinearGradientRect(e){const t=e.clrs,i=e.stops;if(!t||!i||t.length!==i.length)return void console.error("drawLinearGradientRect error: stopList size is not equal to colorList size.");const s=ee.createLinearGradient(e.x0,e.y0,e.x1,e.y1);for(let e=0;e<t.length;++e)s.addColorStop(i[e],t[e]);ee.fillStyle=s,ee.fillRect(0,0,Q.width,Q.height)}drawColor(e){let t=Q.getContext("2d");t.fillStyle=e,t.fillRect(0,0,Q.width,Q.height)}clearCanvas(){Q.getContext("2d").clearRect(0,0,Q.width,Q.height)}},F.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"},F.QRCodeLevel={L:1,M:0,Q:3,H:2},F.TextureInstantLoad={AUTO:0,SYNC:1,ASYNC:2};class ie{RenderTextureWrapper(){this.RenderTexture=null}GetTextureId(){return this.RenderTexture?.IdToken}}class se extends ie{constructor(e,t,i){if(super(),this._Manager=e,i){F.sRenderTextureDelegateManager.CreateTextureStatus().SetResourceInfo(i)}this.RenderTexture=F.sRenderTextureDelegateManager.CreateTexture(),this.RenderTexture.SetResourceInfo(t),this._CallbackIdToken=0,de.set(this.RenderTexture.IdToken,this),this._OnLoadCallback=[],F.ForgeDebug.EnableTextureTracer&&(e._ImageTextureTracer.push(this),this._TracerDescript="")}get Unloaded(){return null===this.RenderTexture||this.RenderTexture.Unloaded}set Unloaded(e){}get LoadTime(){return null!==this.RenderTexture?this.RenderTexture.LoadTime:0}set LoadTime(e){}get Width(){return null!==this.RenderTexture?this.RenderTexture.Width:0}set Width(e){}get Height(){return null!==this.RenderTexture?this.RenderTexture.Height:0}set Height(e){}UnloadTex(){this._OnLoadCallback=[],null!==this.RenderTexture&&(this._CallbackIdToken>0&&(this.RenderTexture.UnregisterOnloadCallback(this._CallbackIdToken),this._CallbackIdToken=0),de.delete(this.RenderTexture.IdToken),this.RenderTexture.UndoRef(),this.RenderTexture=null),this._TracerDescript=""}RequestToUnload(){this.UnloadTex()}RegisterLoadImageCallback(e){if(this.IsLoaded()&&null!=e)return this.RenderTexture&&e(this.RenderTexture.Width,this.RenderTexture.Height),null;let t=null;return null!=e&&(t={callback:e},this._OnLoadCallback.push(t),0===this._CallbackIdToken&&(F.Assert(null!==this.RenderTexture),this._CallbackIdToken=this.RenderTexture.RegisterOnloadCallback(se.prototype._InvokeOnLoadCallbacks.bind(this)))),t}UnregisterLoadImageCallback(e){e&&this._OnLoadCallback.some(((t,i,s)=>{if(t===e)return s.splice(i,1),!0}))}EnableBackgroundLoad(e){}DisableBackgroundLoad(e){}_InvokeOnLoadCallbacks(e,t){const i=this._OnLoadCallback;this._OnLoadCallback=[];for(let s=0;s<i.length;s++){i[s].callback(e,t)}this.RenderTexture&&this.RenderTexture.UnregisterOnloadCallback(this._CallbackIdToken)}IsLoaded(){return 0!==this.LoadTime&&!this.Unloaded}SetTextureTracerDescript(e){this._TracerDescript=e}ReallocRenderTexture(){}}F.ImageTexture=se;class ne extends F.ImageTexture{constructor(e,t,i,s,n,r){const a=F.sRenderTextureDelegateManager.CreateResourceInfo(e.GetId(),"IMG");a.Set={URL:t,Siz:s,Clr:n||"",IsF:i?1:0,NtS:r,ILd:0},super(e,a),this.Name="IMG",this.Source=t,this.IsForever=i?1:0,this.TargetSize=s,this.ColorSpace=n||"",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=t,this.RenderTexture.NeedCheckExpired=!0}_Loaded(){null!=this.RenderTexture&&(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))}UnloadTex(){super.UnloadTex(),this._ImageElement.onload=null,this._ImageElement.onerror=null}InstantLoad(e){if(this._InstantLoad=e?1:0,this.RenderTexture){const e=this.RenderTexture.GetResourceInfo();null!==e&&(e.Set.ILd=this._InstantLoad,this.RenderTexture.SetResourceInfo(e))}return this}ReallocRenderTexture(){if(this.IsForever)return void F.LogE("ReallocRenderTexture(): NOT need for forever texture");const e=this.Source,t=this.TargetSize,i=this.ColorSpace,s=this.IsForever,n=F.sRenderTextureDelegateManager.CreateResourceInfo(this._Manager.GetId(),this.Name);n.Set={URL:e,Siz:t,Clr:i,IsF:s,ILd:this._InstantLoad},this.RenderTexture=F.sRenderTextureDelegateManager.CreateTexture(),this.RenderTexture.SetResourceInfo(n),this._Manager.CachedTextureManager.CacheTheTexture(this)}}F.UrlImageTexture=ne;class re extends F.ImageTexture{constructor(e,t,i,s,n){const r=F.sRenderTextureDelegateManager.CreateResourceInfo(e.GetId(),"GRAD");r.Set={URL:n},super(e,r),this.Gradient=n}}F.GradientTexture=re;class ae extends F.ImageTexture{constructor(e,t,i,s){const n=F.sRenderTextureDelegateManager.CreateResourceInfo(e.GetId(),"LGT");n.Set={L:t,S:i},super(e,n),this.Gradient=s}static StopPoint=class{constructor(){this.stopPosition=0,this.color=""}}}F.LinearGradientTexture=ae;class oe extends F.ImageTexture{constructor(e,t,i,s,n,r,a,o,l,h,c){const u=F.sRenderTextureDelegateManager.CreateResourceInfo(e.GetId(),"TST");let d=null;c&&(d={x:0,y:0,w:0,h:0},Object.assign(d,c)),u.Set={ST:t,IDS:i.GetIdsPack(),W:Math.floor(n.width+.5),H:Math.floor(n.height+.5),FS:r,LA:l,EM:h,LH:Math.floor(a+.5),ILD:o?1:0,TLC:s?1:0,EA:d},super(e,u),this.Name="TST",this._TextStylePack=i,i.DoRef()}UnloadTex(){this._TextStylePack.UnRef(),super.UnloadTex()}}F.TextStyleTexture=oe;F.CachedTextureManager=class{constructor(e){this._TextureManager=e,this._Renderer=e.GetRenderer(),this._CachedTextureStack=[],this._LockedTextureStack=[],this._MemoryLimited=10485760,this._VisibleMark=1}SetMemoryLimited(e){this._MemoryLimited=1024*e*1024}_FindTexture(e,t,i){for(let s=this._CachedTextureStack.length-1;s>=0;s--){const n=this._CachedTextureStack[s];if(n.Source===e&&(t===n.TargetSize||null!==t&&t.Equals(n.TargetSize))&&i===n.ColorSpace){if(null===n.RenderTexture)continue;return n}}return null}CacheTheTexture(e){for(let t=this._CachedTextureStack.length-1;t>=0;t--)if(e===this._CachedTextureStack[t])return;this._CachedTextureStack.push(e)}_MarkVisibleViewTextures(e,t){e.TextureSetting&&e.TextureSetting.Texture&&(e.TextureSetting.Texture.VisibleMark=t);const i=e.ChildViews.length;for(let s=0;s<i;s++){const i=e.ChildViews[s];i&&"VISIBLE"!==i.Visibility||this._MarkVisibleViewTextures(i,t)}}ReduceInvisibleTexture(e){this._MarkVisibleViewTextures(e,++this._VisibleMark);for(let e=0;e<this._CachedTextureStack.length;e++){const t=this._CachedTextureStack[e];t.VisibleMark!==this._VisibleMark&&(t.UnloadTex(),this._CachedTextureStack.splice(e,1),e--)}}GetCacheSize(){return this._CachedTextureStack.length}};const le=new Map;let he=0;const ce=new Map;let ue=0,de=new Map;class ge{constructor(){this.CachedTextureManager=new F.CachedTextureManager(this),this._ForeverCachedTextureManager=new F.CachedTextureManager(this),this._AtlasDataInfo={atlas_data:[],buffer_data_offset:0,textures:[]},this._ClearTimer=-1,this._ImageTextureTracer=[],this._Id=ge.sTextureManagerToken++,this._CacheMaxSize=100,this.StartScavengerCachedTimer()}StartScavengerCachedTimer(){-1===this._ClearTimer&&(this._ClearTimer=F.ForegroundTimer.setInterval(this.ScavengerCached.bind(this),3e4))}GetId(){return this._Id}GetRenderer(){return F.sDeprecatedRenderer}GetGifImage(e,t,i){return this.GetImage(e,t,i)}GetImage(e,t,i){return e?this.GetImage2(e,t,null,F.ColorSpace.RGBA_8888,i,!1,!1):(F.LogI("GetImage, url is null!"),null)}GetImage2(e,t,i,s,n,r,a){if(!e)return F.LogI("GetImage2, url is null!"),null;if(0==e.indexOf("jsvtexturestore://")){const t=e.lastIndexOf("-");if(-1!==t){const i=e.substr(t+1),s=parseInt(i,10);if(!isNaN(s))return this.GetTextureById(s)}return console.error("Error: jsvtexturestore:// parse failed url="+e),null}let o=null;i&&(o=F.sRectUitls.FormatRectArea(i)),"string"!=typeof s&&(s=e.indexOf(".pkm")>=0?e.indexOf(".pkma")>=0?F.ColorSpace.RGBA_ETC1:F.ColorSpace.RGB_ETC1:F.ColorSpace.RGB_565);return this._GetImageInternal(e,o,s,t,!1,n)}CreateMiniGradientTexture(e,t,i,s){return new F.GradientTexture(this,e,t,i,s)}_GetImageInternal(e,t,i,s,n,r){if(s){const s=this._ForeverCachedTextureManager._FindTexture(e,t,i);if(s)return s}else{const s=this.CachedTextureManager._FindTexture(e,t,i);if(s)return s}const a=new F.UrlImageTexture(this,e,s,t,i,r);return a.IsForever?this._ForeverCachedTextureManager.CacheTheTexture(a):this.CachedTextureManager.CacheTheTexture(a),a}GetRoundCornerMask(e,t){return this.GetCustomCornerMask(e,t,t,t,t)}GetCustomCornerMask(e,t,i,s,n){const r=F.sRectUitls.FormatRectArea(e),a=Math.max(t,i,s,n);if(a>r.width/2||a>r.height/2)return F.LogE(`TextureManager.GetRoundCornerMask(): radius is too large, radius=${a} w=${r.width} h=${r.height}`),null;const o=F.sRenderTextureDelegateManager.CreateResourceInfo(this._Id,"CCM");o.Set={W:r.width,H:r.height,LT:t,RT:i,LB:s,RB:n};const l=new F.ImageTexture(this,o);return F.ForgeDebug.EnableTextureTracer&&l.SetTextureTracerDescript("CornerMask"),l}GetOneCornerMask(e){const t=F.sRenderTextureDelegateManager.CreateResourceInfo(this._Id,"OCM");t.Set={Rad:e};const i=new F.ImageTexture(this,t);return F.ForgeDebug.EnableTextureTracer&&i.SetTextureTracerDescript("OneCornerMask"),i}GetTextTextureFromStylePack(e,t,i,s,n,r,a,o,l,h){return e&&0!==e.length?new F.TextStyleTexture(this,e,t,i,s,n,r,a,o,l,h):null}_getParamsId(e,t,i){const s=e.font,n=e.size,r=e.italic,a=e.bold,o=e.alignment,l=e.vertical_align,h=e.vertical_area_align,c=e.textColour,u=e.backgroundColour,d=e.shadow;let g="";e.stroke_width&&(g=e.stroke_width);const f=t.text_overflow,m=t.word_wrap,p=[s,r,a,d,g].join(":"),y=[n,o,l,h,f,m].join(":");let T="",_="";return le.has(p)?T=le.get(p):(T=`TS${he}`,le.set(p,T),he++),ce.has(y)?_=ce.get(y):(_=`DS${ue}`,ce.set(y,_),ue++),[T,_,c,u]}GetTextTextureByMultiRows(e,t,i,s,n,r,a,o,l){const h=e.str;if(null===h||0===h.length)return null;const c=F.sRenderBridge.GetScreenInfo().scaleRatio,u=Object.assign(i);u.x*=c,u.y*=c,u.width*=c,u.height*=c;const d=Object.assign(e);d.size=Math.ceil(d.size*c),s*=c;const g={ST:e.str,AT:JSON.stringify({TO:t.text_overflow,WW:t.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(s+.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 e=this._getParamsId(d,t,r);g.PI={FS:e[0],DS:e[1],TC:e[2],BC:e[3]}}const f=this._BuildTextTextureAndSerialStatus(g,d);if(null!==l){const e=Object.assign({},g);e.ST=null,e.TLC=0,l.Set=e,l.Swf=Object.assign({},d)}let m=u.height;if(void 0!==window.PlatformUtils&&!1===n){m=window.PlatformUtils.GetTextRect(h,u,d,t,s).height}if(m=Math.floor(m/c+.5),F.ForgeDebug.EnableTextureTracer){let t=e.str;t.length>8&&(t=`${e.str.substr(0,8)}...`),f.SetTextureTracerDescript(`[${t}]`)}return{texture:f,real_height:m}}GetCopiedTextTexture(e,t,i,s){const n=Object.assign({},i.Set);n.ST=e,n.TLC=void 0!==s&&s?1:0;const r=i.Swf,a=F.sRenderBridge.GetScreenInfo().scaleRatio;n.RA=JSON.stringify({X:parseInt(t.x*a+.5,10),Y:parseInt(t.y*a+.5,10),W:parseInt(t.width*a+.5,10),H:parseInt(t.height*a+.5,10)});const o=this._BuildTextTextureAndSerialStatus(n,r);if(F.ForgeDebug.EnableTextureTracer&&e){let t=e;t.length>8&&(t=`${e.substr(0,8)}...`),o.SetTextureTracerDescript(`[${t}]`)}return o}_BuildTextTextureAndSerialStatus(e,t){F.sRenderTextureDelegateManager.AppendFontStatusIfNeed(e,t);let i=null;e.FO&&(i={STA:{Nam:"T",Sta:e.FO}});const s=F.sRenderTextureDelegateManager.CreateResourceInfo(this._Id,"T");return s.Set=e,new F.ImageTexture(this,s,i)}GetCanvasTexture(e,t){return new F.UrlImageTexture(this,F.sCustomCanvasResProvider.GetDataUrl(e),!1,null,F.ColorSpace.RGBA_8888,null)}GetColorTexture(e){const t=F.sRenderTextureDelegateManager.CreateResourceInfo(this._Id,"CT");t.Set={Clr:e};const i=new F.ImageTexture(this,t);return F.ForgeDebug.EnableTextureTracer&&i.SetTextureTracerDescript(`Color[${e}]`),i}GetColorTextureCached(e){return this.GetColorTexture(e)}GetNamedCachedTexture(e){return null}CreateCssGradientColorTexture(e,t,i,s,n,r){let a=[];for(let e of r){let t={stop:e.stopPosition,color:e.color};a.push(t)}return new F.LinearGradientTexture(this,JSON.stringify({x0:t,y0:i,x1:s,y1:n}),JSON.stringify(a),e)}ScavengerCached(){this.CachedTextureManager.GetCacheSize()>=this._CacheMaxSize&&this.CachedTextureManager.ReduceInvisibleTexture(F.sRootView)}GetOffScreenMediaTexture(e){if(void 0===window.OffscreenVideoPlayer||!(e instanceof window.OffscreenVideoPlayer))return null;if(!e.hasTerminator()){const t=this._BuildVideoTexture(e);e.setResourceTerminator((()=>{t.UnloadTex()}))}return this._BuildVideoTexture(e)}_BuildVideoTexture(e){const t=F.sRenderTextureDelegateManager.CreateResourceInfo(this._Id,"VPLY");t.Set={Hdl:e.mediaHandler()};const i=new F.ImageTexture(this,t);return F.ForgeDebug.EnableTextureTracer&&i.SetTextureTracerDescript(`Video[${e.mediaHandler()}]`),i}GetTextureById(e){return de.has(e)?de.get(e):(console.error(`TextureManager: texture not found id=${e}`),null)}}ge.sTextureManagerToken=100,F.TextureManager=ge,window.TextureManager=F.TextureManager;F.LayoutViewDebugClass=class{SetTextureTracer(e){}GetTextureTracer(){return null}},F.ForgeDebug=new F.LayoutViewDebugClass,window.ForgeDebug=F.ForgeDebug;class fe{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(e,t,i){this.MarginTop=t,this.MarginLeft=e,i&&(this.Z=i)}SetSize(e,t){this.Width=e,this.Height=t}Clone(){const e=new fe(null);return e.Width=this.Width,e.Height=this.Height,e.MarginTop=this.MarginTop,e.MarginLeft=this.MarginLeft,e.MarginRight=this.MarginRight,e.MarginBottom=this.MarginBottom,e.Z=this.Z,e.SizeAdjust=this.SizeAdjust,e}Equals(e){return e.Width===this.Width&&e.Height===this.Height&&e.MarginTop===this.MarginTop&&e.MarginLeft===this.MarginLeft&&e.MarginRight===this.MarginRight&&e.MarginBottom===this.MarginBottom&&e.Z===this.Z}}F.LayoutParamsBase=fe;class me extends F.LayoutParamsBase{constructor(e){super(),e instanceof F.RectArea&&(e={x:e.x,y:e.y,width:e.width,height:e.height}),e&&(e.x?this.MarginLeft=e.x:e.marginLeft&&(this.MarginLeft=e.marginLeft),e.y?this.MarginTop=e.y:e.marginTop&&(this.MarginTop=e.marginTop),e.z&&(this.Z=e.z),e.width&&(this.Width=e.width),e.height&&(this.Height=e.height),isNaN(this.MarginTop)&&(F.LogE("isNaN(this.MarginTop)!"),this.MarginTop=0),isNaN(this.MarginLeft)&&(F.LogE("isNaN(this.MarginLeft)!"),this.MarginLeft=0),"MatchParent"!==this.Width?isNaN(this.Width)&&F.LogE("isNaN(this.Width)!"):this.SizeAdjust=!0,"MatchParent"!==this.Height?isNaN(this.Height)&&F.LogE("isNaN(this.Height)!"):this.SizeAdjust=!0)}}F.LayoutParams=me,window.LayoutParams=F.LayoutParams;F.RenderTextureDelegateManager=class{constructor(){this._IdTokenGenerator=66,F.sRenderTextureDelegateManager=this,this._CheckExpiredTime=0}CreateTextureHeadStatus(){const e=new F.RenderTextureDelegate(this,0);return e.DoRef(),e}CreateTextureStatus(){const e=new F.RenderTextureDelegate(this,0);return e.DoRef(),e}CreateTexture(){const e=new F.RenderTextureDelegate(this,this._IdTokenGenerator++);return e.DoRef(),e}RecycleTexture(e){}CreateResourceInfo(e,t){return{Id:0,Nam:t,Set:null,TmId:e,NdLd:0}}AppendFontStatusIfNeed(e,t){const i={};i.Fo=t.font,i.Si=t.size,i.It=t.italic,i.Bo=t.bold,i.Al=t.alignment,i.Ve=t.vertical_align,i.Vaa=t.vertical_area_align,i.Tx=t.textColour,i.Ba=t.backgroundColour,i.En=t.enableBlend,i.Sh=t.shadow,t.stroke_width?i.Stk=t.stroke_width:i.Stk=-1,e.FO=JSON.stringify(i)}},F.sRenderTextureDelegateManager=new F.RenderTextureDelegateManager;F.RenderTextureDelegate=class{constructor(e,t){this.IdToken=t,this._Manager=e,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(F.ForgeDebug.GetTextureTracer()){const e=new Error;this.Stack=e.stack}}DoRef(){this._Reference++}UndoRef(){this._Reference--,0===this._Reference&&(this._OnloadCallbacksSize>0&&(this._OnloadCallbacks={}),this._Manager.RecycleTexture(this))}SetResourceInfo(e){e.Id=this.IdToken,this._SyncingResourceInfo=e}GetResourceInfo(){return this._SyncingResourceInfo}ReadSyncInfo(){const e=this._SyncingResourceInfo;return this._SyncingResourceInfo=null,e}RegisterOnloadCallback(e){const t=this._OnloadCallbackIdGenerator++;return this._OnloadCallbacks[`${t}`]=e,this._OnloadCallbacksSize++,null!==this._SyncingResourceInfo&&(this._SyncingResourceInfo.NdLd=1),t}UnregisterOnloadCallback(e){delete this._OnloadCallbacks[`${e}`],this._OnloadCallbacksSize--}InvokeOnloadCallbacks(e,t){if(this._OnloadCallbacksSize>0)for(const i in this._OnloadCallbacks)this._OnloadCallbacks.hasOwnProperty(i)&&this._OnloadCallbacks[i](e,t)}IsLoaded(){return 0!==this.LoadTime&&!this.Unloaded}};F.DeprecatedRenderer=class{constructor(){F.sDeprecatedRenderer=this,this._SharedTextureManager=this.CreateTextureManager()}SetUserId(e){F.sRenderBridge.UpdateUserId(e)}GetScreenInfo(){return F.sRenderBridge.GetScreenInfo()}StringWithFont(){return F.sTextUtils.StringWithFont.apply(this,arguments)}GetTextWidth(){return F.sTextUtils.GetTextWidth.apply(this,arguments)}GetTextUtils(){return F.sTextUtils}RectArea(e,t,i,s){return new F.RectArea(e,t,i,s)}TextAttr(){return F.sTextUtils.TextAttr.apply(this,arguments)}GarbageCollect(){F.LogM("GarbageCollect called")}TriggerFrameDraw(){F.sRenderBridge.RequestSwap()}GetSharedTextureManager(){return this._SharedTextureManager}CreateTextureManager(){return new F.TextureManager}},F.sDeprecatedRenderer=null;const pe={STRING:Symbol("STRING"),FUNCTION:Symbol("FUNCTION"),LINE_FEED:Symbol("LINE_FEED"),LEFT_BRACE:Symbol("LEFT_BRACE"),RIGHT_BRACE:Symbol("RIGHT_BRACE")};const ye={},Te={BASE:Symbol("BASE"),COLOR:Symbol("COLOR"),BOLD:Symbol("BOLD"),ITALIC:Symbol("ITALIC"),DECORATION:Symbol("DECORATION"),SUPERSCRIPT:Symbol("SUPERSCRIPT"),SUBSCRIPT:Symbol("SUBSCRIPT")};class _e{constructor(){this.style,this.styleValue=""}}class xe{constructor(){this.textStyle=new _e,this.childNodes=[],this.parent}}class we extends xe{constructor(){super(),this.styleList=[],this.indexPair,this.lineFeedNode=!1,this.testValue}}function Se(e){if(null===e||0===e.length)return null;const t=function(e){const t=[];let i=0;for(;i<e.length;)if("\\"===e[i])if(i<e.length-1)if("\\"===e[i+1]||"{"===e[i+1]||"}"===e[i+1]){const e=[i+1,i+2],s={type:pe.STRING,indexPair:e};t.push(s),i+=2}else{++i;const s=i;let n=i,r=!1;for(;i<e.length&&"{"!==e[i]&&"}"!==e[i];)" "!==e[i]&&(r=!0)," "===e[i]&&r?++i:n=++i;const a=[s,n],o={type:pe.FUNCTION,indexPair:a};t.push(o)}else console.error("backslash at end.");else if("{"===e[i]){const e={type:pe.LEFT_BRACE,indexPair:null};t.push(e),++i}else if("}"===e[i]){const e={type:pe.RIGHT_BRACE,indexPair:null};t.push(e),++i}else if("\n"===e[i]){const e={type:pe.LINE_FEED,indexPair:null};t.push(e),++i}else{const s=i;let n=i;for(;i<e.length&&"\\"!==e[i]&&"{"!==e[i]&&"}"!==e[i]&&"\n"!==e[i];)++i,n=i;const r=[s,n],a={type:pe.STRING,indexPair:r};t.push(a)}for(let i=t.length-1;i>=0;i--){const s=t[i];if(s.type===pe.STRING){let n=!0;for(let t=s.indexPair[0];t<s.indexPair[1];t++)if(" "!==e[t]){n=!1;break}!(n&&i>0&&i<t.length-1)||t[i-1].type!==pe.LEFT_BRACE&&t[i-1].type!==pe.RIGHT_BRACE||t[i+1].type!==pe.RIGHT_BRACE&&t[i+1].type!==pe.LEFT_BRACE||t.splice(i,1)}}return t}(e),i=[],s=[];let n=0;for(;n<t.length;){const r=t[n];if(r.type===pe.STRING){const e=new we;s.push(e),e.indexPair=r.indexPair,e.textStyle.style=Te.BASE,i.push(e)}else if(r.type===pe.LINE_FEED){const e=new we;s.push(e),e.lineFeedNode=!0}else if(r.type===pe.LEFT_BRACE)i.push(ye);else if(r.type===pe.RIGHT_BRACE)if(i.length>0){const e=[];let t=i.pop();for(;t!==ye&&(e.push(t),i.length>0);)t=i.pop();if(i.length>0){const t=i[i.length-1];if(t.textStyle.style===Te.BASE)console.error("lack of function");else for(;e.length>0;){const i=e.pop();t.childNodes.push(i),i.parent=t}}else console.error("lack of function")}else console.error("extra }");else if(r.type===pe.FUNCTION){const s=e.substring(r.indexPair[0],r.indexPair[1]),a=new xe;switch(s){case"textcolor":if(n<t.length-3){a.textStyle.style=Te.COLOR;const i=t[n+1],s=t[n+2],r=t[n+3];i.type===pe.LEFT_BRACE&&s.type===pe.STRING&&r.type===pe.RIGHT_BRACE?(a.textStyle.styleValue=e.substring(s.indexPair[0],s.indexPair[1]),n+=3):console.error("textcolor param format error.")}else console.error("textcolor param format error.");break;case"textb":a.textStyle.style=Te.BOLD;break;case"texti":a.textStyle.style=Te.ITALIC;break;case"textdecoration":if(n<t.length-3){a.textStyle.style=Te.DECORATION;const i=t[n+1],s=t[n+2],r=t[n+3];i.type===pe.LEFT_BRACE&&s.type===pe.STRING&&r.type===pe.RIGHT_BRACE?(a.textStyle.styleValue=e.substring(s.indexPair[0],s.indexPair[1]),n+=3):console.error("textdecoration param format error.")}else console.error("textdecoration param format error.");break;case"textsup":a.textStyle.style=Te.SUPERSCRIPT;break;case"textsub":a.textStyle.style=Te.SUBSCRIPT;break;default:console.error(`undefined style type: ${s}`)}i.push(a)}++n}return s.forEach(((e,t,i)=>{let s=e.parent;for(;s;)e.styleList.push(s.textStyle),s=s.parent})),{nodeList:s,text:e}}function ve(){this.positionQueue=[],this.timeQueue=[]}ve.prototype.reset=function(){this.positionQueue=[],this.timeQueue=[]},ve.prototype.pruneQueue=function(e){for(;this.timeQueue.length&&this.timeQueue[0]<Date.now()-e;)this.timeQueue.shift(),this.positionQueue.shift()},ve.prototype.updatePosition=function(e){this.positionQueue.push(e),this.timeQueue.push(Date.now()),this.pruneQueue(50)},ve.prototype.getVelocity=function(){this.pruneQueue(1e3);const e=this.timeQueue.length;if(e<2)return 0;const t=(this.timeQueue[e-1]-this.timeQueue[0])/1e3,i=this.positionQueue[e-1]-this.positionQueue[0];return console.log(`getVelocity distance:${i}, time:${t}, velocity:${i/t}, this.timeQueue[length-1]:${this.timeQueue[e-1]}, this.timeQueue[0]:${this.timeQueue[0]}`),i/t},window.gRootView=null,F.sRootView=null;class Ee{constructor(e,t,i,s){this.Texture=e,this._IsTextureExternal=!1,t instanceof F.ImageTexture?(t&&t.RenderTexture&&t.RenderTexture.NeedCheckExpired&&(t.RenderTexture.RequireTime=0),this.MaskSetting=new F.ViewTextureMask(t)):this.MaskSetting=t,e&&e.RenderTexture&&e.RenderTexture.NeedCheckExpired&&(e.RenderTexture.RequireTime=0),this._IsMaskTextureExternal=!1,this.TextureBeforeImageLoad=i,this._IsPreloadImageTextureExternal=!1,void 0===s&&(s=!0),this.HasAlpha=s}SetExternal(e,t,i){this._IsTextureExternal=e,this._IsMaskTextureExternal=t,this._IsPreloadImageTextureExternal=i}ReleaseInternalTexture(e,t){!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}`}}F.TextureSetting=Ee,window.TextureSetting=F.TextureSetting;class be extends F.TextureSetting{constructor(e,t,i,s){super(e,t,i,s),this.SetExternal(!0,!0,!0)}}F.ExternalTextureSetting=be,window.ExternalTextureSetting=F.ExternalTextureSetting;F.PackedLayout=class{constructor(e){const t=e.RectInfo;this.RectInfo={coordX:t.coordX,coordY:t.coordY,width:t.width,height:t.height},this.LayoutParams=JSON.parse(JSON.stringify(e.LayoutParams))}ApplyToView(e){const t=this.RectInfo;e.RectInfo={coordX:t.coordX,coordY:t.coordY,width:t.width,height:t.height},e.LayoutParams=JSON.parse(JSON.stringify(this.LayoutParams))}};class Ce{constructor(){this._MaskType="COMMON"}Type(){return this._MaskType}UnLoad(){}}F.ViewMask=Ce;class Ie extends F.ViewMask{constructor(e){super(),this._MaskType="TEXTURE",this.ImageTexture=e}UnLoad(){this.ImageTexture.UnloadTex()}}F.ViewTextureMask=Ie;class Ae extends F.ViewMask{constructor(e,t,i,s){super(),this._MaskType="CORNER",this._TopLeft=e,this._TopRight=isNaN(t)?e:t,this._BottomLeft=isNaN(i)?e:i,this._BottomRight=isNaN(s)?e:s,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(){}}F.ViewRoundCornerMask=Ae;class Pe{constructor(e,t,i,s,n,r){this.DragDirection=e||0,this.TriggerMovedDistance=t||0,this._EnableJsFling=i?1:0,this.SlidePile=s||new F.RectArea(0,0,1280,720),this.PageWidth=n>0?n:65535,this.EnableTabMode=n>0,this.PageEdge=r||1/4}}Pe.DIRECTION_DISABLE=0,Pe.DIRECTION_VERTICAL=1,Pe.DIRECTION_HORIZONTAL=2,Pe.DIRECTION_AUTO=Pe.DIRECTION_VERTICAL|Pe.DIRECTION_HORIZONTAL,F.DragSetting=Pe;class Le{constructor(){this.Settings=null,this.Listener=null,this.ListenerFlags=0,this.OverListener=null,this.OverListenerFlags=0,this.Formula=null,this.SyncString=null}SetListener(e){this.Listener=e}}Le.INFLEXION=.35,Le.DECELERATION_RATE=Math.log(.78)/Math.log(.9),Le.PHYSICAL_COEF=51890.2,F.DragInfo=Le,F.DragInfo.SCROLL_FRICTION=.06,F.DragInfo.EVENT_TYPE={OnDown:0,OnTap:1,OnLongPress:2,OnDragStart:3,OnMoved:4,OnDragEnd:5,OnRelease:6,OnFling:7};let ke=0;class Re{constructor(e,t){this.TextureSetting=e,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=++ke,this.childZIndexCount=0,this._IsChildOfRootView=!1,this._DetachFromSystemCallback=null,this.Element=null,this.InnerChildElement=null,"root"===t?(this.Element=window.originDocument.getElementById(t),this.Element||(this.Element=window.originDocument.getElementById("app"))):"svg"===t||"path"===t?this.Element=document.createElementNS("http://www.w3.org/2000/svg",t):"jsv-element-proxy"===t?this.Element=null:t&&(this.Element=window.originDocument.createElement(t),this.Element.style.position="absolute"),this.TransitionStore={},this.TransformAnimationObj=null,this._TextureAnimationObj=null,this._DragInfo=null,this.DragControl=null,this._Velocity={x:new ve,y:new ve},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,this._SizeFromChild=null,this._ChildrenFromChild0=!1,this._FlexAssignedCallback=null,this._MySizeObserver=null,this.FlexInfoPack=null,this.FlexInfoPackWeak=null,this._EnableVisibleTestRect=!1}Init(e){this.ResetTexture(e)}SetElementProp(e,t,i){switch(t){case"innerview":{const e=F.sViewStore.get(i);if(e){const t=e.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}),t&&(null===this._ProxyView?this._InsertProxyLayer(t,i):t!==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:F.LogE(`Error: View Unknown prop name=${t}`)}}InsertView(e,t,i){this._InsertView(e,t,i)}AddView(e,t=0,i=0,s=0,n=0){this._InsertView(e,null,{x:t,y:i,width:s,height:n})}ReOrderChildView(e,t){if(null!=this._ProxyView&&child_view_to_move!=this._ProxyView)return void this._ProxyView.ReOrderChildView(e,t);let i=!1;for(var s=0;s<this.ChildViews.length;s++)if(this.ChildViews[s]==e){this.ChildViews.splice(s,1),i=!0;break}if(i||F.LogE("ReOrderChildView(): view is not in child list stack="),t){let i=this.ChildViews.indexOf(t);i<0&&(i=this.ChildViews.length),this.ChildViews.splice(i,0,e)}else this.ChildViews.push(e);this._ChildrenListDirty=!0}MoveChildView(e,t,i){if(null!=this._ProxyView&&e!=this._ProxyView)return void this._ProxyView.MoveChildView(e,t);let s=!1;for(var n=0;n<this.ChildViews.length;n++)if(this.ChildViews[n]==e){0!=e.zIndex&&this.childZIndexCount--,this.ChildViews.splice(n,1),e.ParentView=null,s=!0;break}s||F.LogE("MoveChildView(): view is not in child list stack="),t._InsertView(e,i,e.LayoutParams);let r=null;i&&(r=t.ChildViews[t.ChildViews.indexOf(i)+1]),r&&t.Element.contains(r.Element)?t.Element.insertBefore(e.Element,r.Element):t.Element.appendChild(e.Element)}IsVisibleInTree(){if(!this._IsChildOfRootView)return!1;let e=this,t=this;for(;t;){if("hidden"==t.Element?.style?.visibility)return!1;e=t,t=t.ParentView}return e instanceof F.RootView}_InsertView(e,t,i){if(i?i instanceof F.LayoutParamsBase?e.LayoutParams=i.Clone():e.LayoutParams=new F.LayoutParams(i):e.LayoutParams||(e.LayoutParams=new F.LayoutParams({x:0,y:0})),null!==e.LayoutParams&&(e.LayoutParams.MarginLeft&&(e.Element.style.left=`${e.LayoutParams.MarginLeft}px`),e.LayoutParams.MarginTop&&(e.Element.style.top=`${e.LayoutParams.MarginTop}px`),e.LayoutParams.Width&&(e.Element.style.width=`${e.LayoutParams.Width}px`),e.LayoutParams.Height?e.Element.style.height=`${e.LayoutParams.Height}px`:e.Element.style.height=""),e.ParentView=this,t){let i=this.ChildViews.indexOf(t);i<0&&(i=this.ChildViews.length),this.ChildViews.splice(i,0,e)}else this.ChildViews.push(e);this._ChildrenListDirty=!0,this._IsChildOfRootView&&e._OnAttachToSystem(),0!=e.zIndex&&this.childZIndexCount++,this.childZIndexCount>0&&this._RequestZIndexReorder()}SetZIndex(e){if(e!=this.zIndex){var t=this.zIndex;this.zIndex=e;var i=this.ParentView;i&&(0==t&&0!=e?i.childZIndexCount++:0!=t&&0==e&&i.childZIndexCount--,i.childZIndexCount<0&&F.ThrowError("ERROR: LayoutViewBase, child z-index count ERROR"),i._RequestZIndexReorder())}}_RequestZIndexReorder(){let e=[],t=[],i=0,s=this.ChildViews.length;for(var n=0;n<s;n++){let s=this.ChildViews[n].zIndex;s<0?(s<i&&(i=s),e.push(this.ChildViews[n])):s>0&&t.push(this.ChildViews[n])}i=1e3*Math.floor(-i/1e3)+1e3;let r=e.length,a=t.length;if(r>0){e.sort(((e,t)=>e.zIndex-t.zIndex));for(n=0;n<r;n++)e[n].Element.style.zIndex=e[n].zIndex+i}if(this.ChildViews.length-e.length-t.length>0)for(n=0;n<s;n++)0==this.ChildViews[n].zIndex&&(this.ChildViews[n].Element.style.zIndex=i);if(a>0){t.sort(((e,t)=>e.zIndex-t.zIndex));for(n=0;n<a;n++)t[n].Element.style.zIndex=t[n].zIndex+i}}SetPerspective(e,t){this.Element.style.perspective=`${e}px`,this.Element.style.webkitPerspective=`${e}px`,this.Element.style.perspectiveOrigin=t,this.Element.style.webkitPerspectiveOrigin=t,this._Perspective=e,this._PerspectiveOrigin=t}SetBackfaceVisibility(e){this.Element.style.backfaceVisibility=e?"visible":"hidden",this.Element.style.webkitBackfaceVisibility=e?"visible":"hidden",console.log(`back face style ${this.Element.style.backfaceVisibility}`),this._BackfaceVisibility=e?1:0}SetTransformStyle(e){this.Element.style.transformStyle=e,this.Element.style.webkitTransformStyle=e,this._TransformStyle=e}EnableDivTouch(e,t){e.eventHandlers&&e.eventHandlers.onClick&&(this.Element.onclick=t=>{e.eventHandlers.onClick(),t.preventDefault&&t.preventDefault()},this.Element.style.pointerEvents="auto")}_DoDragPause(e){this._DragInfo.Settings.EnableTabMode||this.DragControl&&this.DragControl.pause(((t,i)=>{if(null!==this.Element.style.transform){let s=this.GetLayoutParams();s=this._GetMovedLayoutParams(t-s.MarginLeft,i-s.MarginTop),this.ResetLayoutParams(s),this._DragImactSensorRecycle(),console.log(`_DoDragPause lp.MarginLeft:${s.MarginLeft}, lp.MarginTop:${s.MarginTop}`),this.DragControl=null,this.Element.style.transform=null,e.viewX=t,e.viewY=i,this._DragInfo.Listener.OnFling(e)}}))}TouchEventProcess(e){let t=!1;switch(e.type){case F.DragInfo.EVENT_TYPE.OnDown:console.log("TouchEventProcess OnDown in"),this._DoDragPause(e),this._DragInfo.Listener&&this._DragInfo.Listener.OnDown&&(t=this._DragInfo.Listener.OnDown(e));break;case F.DragInfo.EVENT_TYPE.OnTap:this._DragInfo.Listener&&this._DragInfo.Listener.OnTap&&(t=this._DragInfo.Listener.OnTap(e));break;case F.DragInfo.EVENT_TYPE.OnLongPress:this._DragInfo.Listener&&this._DragInfo.Listener.OnLongPress&&(t=this._DragInfo.Listener.OnLongPress(e));break;case F.DragInfo.EVENT_TYPE.OnDragStart:this._DragMovedDistanceX=0,this._DragMovedDistanceY=0,this._DragInfo.Listener&&this._DragInfo.Listener.OnDragStart&&(t=this._DragInfo.Listener.OnDragStart(e));break;case F.DragInfo.EVENT_TYPE.OnMoved:this._DragInfo.Listener&&this._DragInfo.Listener.OnMoved&&(t=this._DoDragMove(e,!0));break;case F.DragInfo.EVENT_TYPE.OnDragEnd:if(this._DragInfo.Listener&&this._DragInfo.Listener.OnDragEnd){t=!!this._SlideIfEnableTabMod(e,-1)||this._DoDragEnd(e)}break;case F.DragInfo.EVENT_TYPE.OnRelease:this._DragInfo.Listener&&this._DragInfo.Listener.OnRelease&&(t=this._DragInfo.Listener.OnRelease(e));break;case F.DragInfo.EVENT_TYPE.OnFling:if(this._DragInfo.Listener&&this._DragInfo.Listener.OnFling){t=!!this._SlideIfEnableTabMod(e,-1)||this._DoFling(e)}break;default:console.log(`TouchEventProcess:${e}`)}return t}DisableDrag(){this._DragInfo=null}EnableDrag(e,t,i){e instanceof F.DragSetting||F.ThrowError("EnableDrag The setting is not Forge.DragSetting"),null===t&&F.ThrowError("EnableDrag The listener is null");const s=new F.DragInfo;s.Settings=e,s.SetListener(t),s.Formula=i,this._DragInfo=s,this.DragControl=null,this._AddEventListener(),F.sRenderBridge.RequestSwap()}RemoveView(e){for(let t=0;t<this.ChildViews.length;t++)if(this.ChildViews[t]===e){e.IsChildOfRootView()&&e._OnDetachFromSystem(),this.ChildViews.splice(t,1),e.ParentView=null;break}}_OnDetachFromSystem(){this._IsChildOfRootView=!1,this._DetachFromSystemCallback?(this._DetachFromSystemCallback.some(((e,t,i)=>{e()})),this._DetachFromSystemCallback=null):this.OnDettachFromSystem();for(let e=0;e<this.ChildViews.length;e++){this.ChildViews[e]._OnDetachFromSystem()}this.ParentView.Element.removeChild(this.Element),this._releaseViewResources()}RegisterDetachCallback(e){e&&(null==this._DetachFromSystemCallback&&(this._DetachFromSystemCallback=[]),this._DetachFromSystemCallback.push(e))}UnregisterDetachCallback(e){if(e&&this._DetachFromSystemCallback){let t=!1,i=this._DetachFromSystemCallback;for(let s=0;s<i.length;s++)if(i[s]===e){i.splice(s,1),t=!0;break}t?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 e=this.ChildViews.length;if(0!==e){for(let t=0;t<e;t++){const e=this.ChildViews[t];e&&e.IsChildOfRootView()&&e._OnDetachFromSystem()}this.ChildViews=[]}}_ResetTextStyle(e){this.Element.style.overflow="hidden";let t=F.sTextStyleCache.GetDsFromId(e.Set.IDS.DS).Describe,i=F.sTextStyleCache.GetFsFromId(e.Set.IDS.FS).Describe,s=F.sTextStyleCache.GetCsFromId(e.Set.IDS.CS).Describe,n=null;"DISABLE"!==e.Set.IDS.SS&&(n=F.sTextStyleCache.GetSsFromId(e.Set.IDS.SS).Describe),this.Element.style.fontFamily=i.font,this.Element.style.fontSize=`${e.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=t.alignment,this.Element.style.verticalAlign=t.vertical_area_align,this.Element.style.direction=t.direction;let r=s.text_color;this.Element.style.color=r;let a=s.bg_color;this.Element.style.backgroundColor=a,n&&(n.shadow_blur>0&&(this.Element.style.textShadow=`${n.shadow_offset_x}px ${n.shadow_offset_y}px ${n.shadow_blur}px ${n.shadow_color}`),n.stroke_width>0&&(this.Element.style.WebkitTextStroke=`${n.stroke_width}px ${n.stroke_color}`)),this.Element.style.width=`${e.Set.W}px`,this.Element.style.height=`${e.Set.H}px`;let o=parseInt(this.Element.style.fontSize);if(e.Set.LH&&(this.Element.style.lineHeight=`${e.Set.LH}px`,o=parseInt(this.Element.style.lineHeight)),e.Set.EA){let t=e.Set.EA,i=window.originDocument.createElement("div");i.style.float=t.x>0?"right":"left",i.style.width=t.w+"px",i.style.height=t.h-1+"px",i.style.backgroundColor="rgba(0,0,0,0)",i.style.position="relative",this.Element.appendChild(i)}this.Element.style.textOverflow=t.text_overflow,this.Element.style.wordBreak="normal";let l=!1,h=t.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"),e.Set.LA){const t=Se(e.Set.ST);!function(e,t){const i=t.text;for(const s of t.nodeList){if(s.lineFeedNode){e.appendChild(window.originDocument.createElement("br"));continue}const t=i.substring(s.indexPair[0],s.indexPair[1]),n=window.originDocument.createElement("span");let r,a=n;for(const e of s.styleList)switch(e.style){case Te.BASE:break;case Te.BOLD:r=window.originDocument.createElement("b"),a.appendChild(r),a=r;break;case Te.ITALIC:r=window.originDocument.createElement("i"),a.appendChild(r),a=r;break;case Te.COLOR:n.style.color=e.styleValue;break;case Te.DECORATION:n.style.textDecoration=e.styleValue;break;case Te.SUPERSCRIPT:r=window.originDocument.createElement("sup"),a.appendChild(r),a=r;break;case Te.SUBSCRIPT:r=window.originDocument.createElement("sub"),a.appendChild(r),a=r}a.textContent=t,e.appendChild(n)}}(this.Element,t)}else{let t=window.originDocument.createElement("span");t.textContent=e.Set.ST,this.Element.appendChild(t)}}_SetBorderRadius(e){(this.InnerChildElement?this.InnerChildElement:this.Element).style.borderRadius=`${e._TopLeft}px ${e._TopRight}px ${e._BottomRight}px ${e._BottomLeft}px`}_InsertProxyLayer(e,t){if(e.ParentView=this,this._IsChildOfRootView){for(let e of this.ChildViews)e._AdvanceDepthForProxyLayer();e._OnAttachToSystem()}e.ChildViews=e.ChildViews.concat(this.ChildViews),e._ChildrenListDirty=!0;for(let t=0;t<e.ChildViews.length;t++)e.ChildViews[t].ParentView=e,e._RequestLayoutForAddingView(e.ChildViews[t]);null!==t?t instanceof F.LayoutParamsBase?e.LayoutParams=t.Clone():e.LayoutParams=new F.LayoutParams(t):null===e.LayoutParams&&(e.LayoutParams=new F.LayoutParams({x:0,y:0})),e.ResetLayoutParams(e.LayoutParams),this.ChildViews=[e],this._ChildrenListDirty=!0,this._RequestLayoutForAddingView(e),this._ProxyView=e,this._IsChildOfRootView&&e._OnAttachToSystem()}_RequestLayoutForAddingView(e){this._RequestLayout()}ResetTexture(e,t){let i=null;if(e&&(i=new F.ExternalTextureSetting(e,t)),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%",this.Element.style.backgroundColor=null);else if(i.Texture.Gradient)this.Element.style.backgroundImage=i.Texture.Gradient,this.Element.style.backgroundColor=null;else if(i.Texture.RenderTexture&&i.Texture.RenderTexture._SyncingResourceInfo){const e=i.Texture.RenderTexture._SyncingResourceInfo;if("TST"===e.Nam)this._ResetTextStyle(e);else if("CT"===e.Nam)this.Element.style.backgroundColor=e.Set.Clr,this.Element.style.backgroundImage=null;else if("VPLY"===e.Nam){const t=e.Set.Hdl;t.style.width="100%",t.style.height="100%",t.style.objectFit="fill",this.Element.appendChild(t),this.InnerChildElement=t}}i.MaskSetting&&"CORNER"===i.MaskSetting._MaskType&&this._SetBorderRadius(i.MaskSetting)}else this.Element.style.backgroundColor="",this.Element.style.backgroundImage="",this.Element.style.borderRadius=""}SetVisibility(e){if("string"==typeof e){let t=e.toLocaleLowerCase();this.Element.style.visibility="visible"==t?"inherit":t}else this.Element.style.visibility="inherit"}SetViewOpacity(e){this.Element.style.opacity=e}_OnAttachToSystem(){"svg"!==this.Element.id&&"path"!==this.Element.id||console.log("_OnAttachToSystem appendChild");let e=this.ParentView.ChildViews[this.ParentView.ChildViews.indexOf(this)+1];e&&this.ParentView.Element.contains(e.Element)?this.ParentView.Element.insertBefore(this.Element,e.Element):this.ParentView.Element.appendChild(this.Element),this._IsChildOfRootView=!0;const t=this.ChildViews;let i;for(let e=0;e<t.length;e++)i=t[e],i._OnAttachToSystem();this._FlushFlexDiv()}IsChildOfRootView(){return this._IsChildOfRootView}StartAnimation(e,t,i){void 0!==this.TransformAnimationObj&&this.TransformAnimationObj&&(this.TransformAnimationObj.Cancel(e),this.TransformAnimationObj=null,window.jsvInAndroidWebView?this.Element.style.webkitAnimation=null:this.Element.style.animation=null),null==this._ProxyView?(this.TransformAnimationObj=e,!isNaN(i)&&i>0&&e.EnableDelay(i),e.Start(this)):this._ProxyView.StartAnimation(e,t,i)}ApplyStyleTransition(e){this.TransitionStore={...this.TransitionStore,...e};let t="";Object.values(this.TransitionStore).forEach((e=>{t&&(t+=","),t+=e})),window.jsvInAndroidWebView?this.Element.style.webkitTransition=t:this.Element.style.transition=t}StopAnimation(){void 0!==this.TransformAnimationObj&&this.TransformAnimationObj&&(this.TransformAnimationObj.Cancel(),this.TransformAnimationObj=null),null==this._ProxyView||this._ProxyView.StopAnimation()}StartTextureAnimation(e){void 0!==this._TextureAnimationObj&&this._TextureAnimationObj&&(this._TextureAnimationObj.Cancel(e),this._TextureAnimationObj=null),this._TextureAnimationObj=e,e.AsTextureAnimation(),e.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 e=0;e<this.ChildViews.length;e++)this.ChildViews[e].StopAllAnimations()}GetAnimation(){return this.TransformAnimationObj}DetachAnimation(e){this.TransformAnimationObj===e&&(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(e,t){if(e){const t=e.split("translate3d");for(let e=1;e<t.length;e++){let i=!1,s=t[e].replace(/\).*/,"");s=s.replace(/.*\(/,"");const n=s.split(",");for(let e=0;e<n.length;e++){const t=n[e].trim();t.match(/[0-9]$/)&&(n[e]=t+"px",i=!0)}i&&(s=n.join(","),t[e]=t[e].replace(/\(.*?\)/,"("+s+")"))}e=t.join("translate3d")}e===this._CssTransform&&t===this._CssTransformOrigin||(window.jsvInAndroidWebView?(this.Element.style.webkitTransform=e,this.Element.style.webkitTransformOrigin=t):(this.Element.style.transform=e,this.Element.style.transformOrigin=t),this._CssTransform=e,this._CssTransformOrigin=t)}ResetTextureCssTransform(e,t){this.ResetCssTransform(e,t)}SetId(e){this.Id=e}ResetLayoutParams(e){if(null==this._ProxyView)if(null!==e)if(e instanceof F.LayoutParamsBase?this.LayoutParams=e.Clone():this.LayoutParams=new F.LayoutParams(e),null==this.FlexInfoPackWeak)this.ParentView?.FlexInfoPackWeak?.container||(this.Element.style.left=`${this.LayoutParams.MarginLeft}px`,this.Element.style.top=`${this.LayoutParams.MarginTop}px`),isNaN(this.LayoutParams.Width)||this._SizeFromChild&&0==this.LayoutParams.Width||(this.Element.style.width=`${this.LayoutParams.Width}px`),isNaN(this.LayoutParams.Height)||this._SizeFromChild&&0==this.LayoutParams.Height||(this.Element.style.height=`${this.LayoutParams.Height}px`);else{this.ParentView.FlexInfoPackWeak||(this.Element.style.left=`${this.LayoutParams.MarginLeft}px`,this.Element.style.top=`${this.LayoutParams.MarginTop}px`);let e=this;for(;e._ChildrenFromChild0;)e=e.ChildViews[0];e._SizeFromChild||(e.Element.width=0==this.LayoutParams.Width?void 0:this.LayoutParams.Width+"px",e.Element.height=0==this.LayoutParams.Height?void 0:this.LayoutParams.Height+"px")}else F.ThrowError("ResetLayoutParams(): new params is null");else this._ProxyView.ResetLayoutParams(e)}GetRenderer(){return F.LayoutViewBase.sRenderer}GetLayoutParams(){return this.LayoutParams?this.LayoutParams.Clone():new F.LayoutParams}EnableAutoHeight(){this._AutoHeight=!0}WaitTextureToResize(e){}ApplyObjectFit(e,t,i,s,n){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===e&&r.objectFit===n&&r.frameHeight===t&&r.textureWidth===i&&r.textureHeight===s)return r.clipLayout;r.frameWidth=e,r.frameHeight=t,r.textureWidth=i,r.textureHeight=s,r.objectFit=n;let a={width:0,height:0},o=e/t;const l=i/s;if(!l)return console.warn("Warning:Texture size is 0!"),clip_layout;if(0===e||0===t){if(0===e&&0===t)return clip_layout;0===e?e=t*l:t=e/l,o=e/t}let h="";switch(n){case"fill":a.width=e,a.height=t,h="fill";break;case"none":a.width=i,a.height=s,h="none";break;case"cover":a=this._StretchSize(e,t,l,l<o),h="cover";break;case"scale-down":a=this._StretchSize(e,t,l,l>o),a.width>i&&(a.width=i,a.height=s),h="scale-down";break;case"contain":a=this._StretchSize(e,t,l,l>o),h="contain"}if(a.width=Math.floor(a.width),a.height=Math.floor(a.height),a.width!=e||a.height!=t){let i={};i.width=Math.min(a.width,e),i.height=Math.min(a.height,t),i.x=Math.floor((e-i.width)/2),i.y=Math.floor((t-i.height)/2),r.clipLayout=i;return(this.InnerChildElement?this.InnerChildElement:this.Element).style.objectFit=h,i}return null}_StretchSize(e,t,i,s){const n={width:0,height:0};return s?(n.width=e,n.height=e/i):(n.height=t,n.width=t*i),n}GetPositionOffset(e){let t=this,i=0,s=0;for(;e!==t;)i+=t.LayoutParams?t.LayoutParams.MarginLeft:0,s+=t.LayoutParams?t.LayoutParams.MarginTop:0,t=t.ParentView,t||F.ThrowError("ERROR: Target parent layoutview is not found in LayoutView tree");return new F.Coordinate(i,s)}_dispatchLongPress(){this._LongPressDelayRequestTaskId=0,this._InLongPress=!0;const e={type:F.DragInfo.EVENT_TYPE.OnLongPress,x:this._CurrentDownEvent.designX,y:this._CurrentDownEvent.designY};this.TouchEventProcess(e)}_onMouseDown(e,t,i){this._Velocity.x.reset(),this._Velocity.y.reset(),this._Velocity.x.updatePosition(e),this._Velocity.y.updatePosition(t),this._LastFocusX=e,this._DownFocusX=this._LastFocusX,this._LastFocusY=t,this._DownFocusY=this._LastFocusY,this._CurrentDownEvent={designX:e,designY:t,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:F.DragInfo.EVENT_TYPE.OnDown,x:e,y:t,deltaX:0,deltaY:0}}_onMouseMove(e,t,i){if(!this._CurrentDownEvent)return null;this._Velocity.x.updatePosition(e),this._Velocity.y.updatePosition(t);const s=parseInt(e-this._LastFocusX,10),n=parseInt(t-this._LastFocusY,10),r=parseInt(e-this._DownFocusX,10),a=parseInt(t-this._DownFocusY,10);let o=null;if(this._AlwaysInTapRegion){r*r+a*a>this._TouchSlopSquare&&(o={type:F.DragInfo.EVENT_TYPE.OnDragStart,x:e,y:t},this._LastFocusX=e,this._LastFocusY=t,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(s)>=1||Math.abs(n)>=1)&&(o={type:F.DragInfo.EVENT_TYPE.OnMoved,x:e,y:t,deltaX:r,deltaY:a,_deltaX:s,_deltaY:n,timeStamp:parseInt((this._LastTimeStamp-i)/1e3,10)},this._LastFocusX=e,this._LastFocusY=t,this._LastTimeStamp=i);return o}_onMouseUp(e,t,i){let s=null;if(this._CurrentDownEvent){const i=window.Forge.DesignMap(),n=Math.floor(i.displayScale*i.width),r=window.innerWidth/n,a=this._Velocity.x.getVelocity()/r,o=this._Velocity.y.getVelocity()/r;let l=e-this._CurrentDownEvent.designX,h=t-this._CurrentDownEvent.designY;const c=e-this._LastFocusX,u=t-this._LastFocusY;this._InLongPress||(this._AlwaysInTapRegion?s={type:F.DragInfo.EVENT_TYPE.OnTap,x:e,y:t,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),s={type:F.DragInfo.EVENT_TYPE.OnFling,x:e,y:t,velocityX:a,velocityY:o,deltaX:a<0?-l:l,deltaY:o<0?-h:h,_deltaX:c,_deltaY:u}):s={type:F.DragInfo.EVENT_TYPE.OnDragEnd,x:e,y:t,deltaX:l,deltaY:h,_deltaX:c,_deltaY:u},this.TouchEventProcess(s),s={type:F.DragInfo.EVENT_TYPE.OnRelease,x:e,y:t,deltaX:l,deltaY:h,_deltaX:c,_deltaY:u},this._CurrentDownEvent=null)),this._InLongPress=!1,0!==this._LongPressDelayRequestTaskId&&(clearTimeout(this._LongPressDelayRequestTaskId),this._LongPressDelayRequestTaskId=0)}return s}_onTouchEvent(e){const t=window.Forge.DesignMap(),i=Math.floor(t.displayScale*t.width),s=window.innerWidth/i,n=e.clientX/s,r=e.clientY/s;let a=null;switch(e.type){case"touchstart":case"mousedown":a=this._onMouseDown(n,r,e.timeStamp);break;case"touchmove":case"mousemove":a=this._onMouseMove(n,r,e.timeStamp);break;case"touchend":case"touchcancel":case"mouseup":a=this._onMouseUp(n,r,e.timeStamp)}return!!a&&this.TouchEventProcess(a)}_AddEventListener(){this.Element.style.pointerEvents="auto",this._ValidTouch=!1;"ontouchstart"in window?(this.Element.addEventListener("touchstart",(e=>{if(console.log("touchstart",e),this._ValidTouch=!0,e.touches&&e.touches.length>0){console.log(`touchstart event.touches[0].clientX:${e.touches[0].clientX}, event.touches[0].clientY:${e.touches[0].clientY}`);this._onTouchEvent({type:e.type,clientX:e.touches[0].clientX,clientY:e.touches[0].clientY,timeStamp:e.timeStamp})&&e.stopPropagation()}}),!0),this.Element.addEventListener("touchmove",(e=>{if(this._ValidTouch&&(console.log("touchmove",e),e.touches&&e.touches.length>0)){console.log(`touchmove event.touches[0].clientX:${e.touches[0].clientX}, event.touches[0].clientY:${e.touches[0].clientY}`);this._onTouchEvent({type:e.type,clientX:e.touches[0].clientX,clientY:e.touches[0].clientY,timeStamp:e.timeStamp})&&e.stopPropagation()}}),!0),this.Element.addEventListener("touchend",(e=>{if(console.log(`touchend event.touches.length:${e.touches.length}, event.clientX:${e.clientX}, event.pageX:${e.pageX}`),this._ValidTouch=!1,e.changedTouches&&e.changedTouches.length>0){console.log(`touchend event.changedTouches[0].clientX:${e.changedTouches[0].clientX}, event.changedTouches[0].pageX:${e.changedTouches[0].pageX}`);this._onTouchEvent({type:e.type,clientX:e.changedTouches[0].clientX,clientY:e.changedTouches[0].clientY,timeStamp:e.timeStamp})&&e.stopPropagation()}}),!0),this.Element.addEventListener("touchcancel",(e=>{if(this._ValidTouch=!1,console.log("touchcancel",e),e.changedTouches&&e.changedTouches.length>0){console.log(`touchcancel event.clientX:${e.clientX}, event.clientY:${e.clientY}`);this._onTouchEvent({type:e.type,clientX:e.touches[0].clientX,clientY:e.touches[0].clientY,timeStamp:e.timeStamp})&&e.stopPropagation()}}),!0)):(this.Element.addEventListener("mousedown",(e=>{console.log("mousedown",e),this._ValidTouch=!0;this._onTouchEvent(e)&&e.stopPropagation()}),!0),this.Element.addEventListener("mousemove",(e=>{if(this._ValidTouch){this._onTouchEvent(e)&&e.stopPropagation()}}),!0),this.Element.addEventListener("mouseup",(e=>{console.log("mouseup",e),this._ValidTouch=!1;this._onTouchEvent(e)&&e.stopPropagation()}),!0))}_GetSplineDeceleration(e){return Math.log(F.DragInfo.INFLEXION*Math.abs(e)/(F.DragInfo.SCROLL_FRICTION*F.DragInfo.PHYSICAL_COEF))}_GetSplineFlingDistance(e){const t=this._GetSplineDeceleration(e),i=F.DragInfo.DECELERATION_RATE-1;return F.DragInfo.SCROLL_FRICTION*F.DragInfo.PHYSICAL_COEF*Math.exp(F.DragInfo.DECELERATION_RATE/i*t)}_DoDragMove(e,t){let i=e._deltaX,s=e._deltaY;this._DragMovedDistanceX+=i,this._DragMovedDistanceY+=s,t||(i=e.deltaX,s=e.deltaY);const n=e.timeStamp/1e3;let r=`left ${n}s, top ${n}s`;this._DragInfo.Settings.DragDirection===F.DragSetting.DIRECTION_VERTICAL?(i=0,r=`top ${n}s`):this._DragInfo.Settings.DragDirection===F.DragSetting.DIRECTION_HORIZONTAL?(s=0,r=`left ${n}s`):this._DragInfo.Settings.DragDirection===F.DragSetting.DIRECTION_DISABLE&&(i=0,s=0);let a=this.GetLayoutParams();return a=this._GetMovedLayoutParams(i,s),t&&(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)&&(e.viewX=a.MarginLeft,e.viewY=a.MarginTop,this._DragInfo.Listener.OnMoved(e))}_GetMovedLayoutParams(e,t){const i=this.GetLayoutParams();let s=i.MarginLeft+e,n=i.MarginTop+t;return s>this._DragInfo.Settings.SlidePile.x?s=this._DragInfo.Settings.SlidePile.x:s+i.Width<this._DragInfo.Settings.SlidePile.x+this._DragInfo.Settings.SlidePile.width&&(s=this._DragInfo.Settings.SlidePile.x+this._DragInfo.Settings.SlidePile.width-i.Width),n>this._DragInfo.Settings.SlidePile.y?n=this._DragInfo.Settings.SlidePile.y:n+i.Height<this._DragInfo.Settings.SlidePile.y+this._DragInfo.Settings.SlidePile.height&&(n=this._DragInfo.Settings.SlidePile.y+this._DragInfo.Settings.SlidePile.height-i.Height),i.SetPosition(s,n),i}_SlideIfEnableTabMod(e,t){if(!this._DragInfo.Settings.EnableTabMode)return!1;const i=e._deltaX,s=e._deltaY;let n=e.deltaX,r=e.deltaY,a=this._DragInfo.Settings.PageWidth*this._DragInfo.Settings.PageEdge;const o=this.GetLayoutParams(),l=o.MarginLeft+i,h=o.MarginTop+s;switch(e.type===F.DragInfo.EVENT_TYPE.OnFling&&(a=0),this._DragInfo.Settings.DragDirection){case F.DragSetting.DIRECTION_VERTICAL:if(n=0,r>=0){const e=this._DragInfo.Settings.PageWidth-Math.abs(h)%this._DragInfo.Settings.PageWidth;r=e>=a?this._DragInfo.Settings.PageWidth-e:-e}else{const e=Math.abs(h)%this._DragInfo.Settings.PageWidth;r=e>=a?-(this._DragInfo.Settings.PageWidth-e):e}break;case F.DragSetting.DIRECTION_HORIZONTAL:if(r=0,n>=0){const e=this._DragInfo.Settings.PageWidth-Math.abs(l)%this._DragInfo.Settings.PageWidth;n=e>=a?this._DragInfo.Settings.PageWidth-e:-e,console.log(`right, left_width:${e}, distance_x:${n}`)}else{const e=Math.abs(l)%this._DragInfo.Settings.PageWidth;n=e>=a?-(this._DragInfo.Settings.PageWidth-e):e,console.log(`left, left_width:${e}, distance_x:${n}`)}break;case F.DragSetting.DIRECTION_AUTO:console.log("slideIfEnableTabMode DragDirection error DRAG_DIRECTION_AUTO")}if(0===n&&0===r)return console.log("slideIfEnableTabMode distance_x === 0 && distance_y === 0"),!1;const c=Math.sqrt(n*n+r*r)/.3;return e.deltaX=n,e.deltaY=r,this._DonFlingAnim(e,c),!0}_DoDragEnd(e){let t=e._deltaX,i=e._deltaY;this._DragInfo.Settings.DragDirection===F.DragSetting.DIRECTION_VERTICAL?t=0:this._DragInfo.Settings.DragDirection===F.DragSetting.DIRECTION_HORIZONTAL?i=0:this._DragInfo.Settings.DragDirection===F.DragSetting.DIRECTION_DISABLE&&(t=0,i=0),console.log("_DoDragEnd event:",e,this.Element.style);let s=this.GetLayoutParams();return s=this._GetMovedLayoutParams(t,i),this.ResetLayoutParams(s),e.viewX=s.MarginLeft,e.viewY=s.MarginTop,this._DragInfo.Listener.OnDragEnd(e)}_DragImactSensorRecycle(){console.log("_DragImactSensorRecycle this._DragImactSensor:",this._DragImactSensor),this._DragImactSensor&&this._DragImactSensor.Recycle()}_DonFlingAnim(e,t){const i=e.deltaX,s=e.deltaY,n=this.GetLayoutParams(),r=n.MarginLeft,a=n.MarginTop,o=n.MarginLeft+i,l=n.MarginTop+s,h=this._GetMovedLayoutParams(i,s);if(h.MarginLeft===n.MarginLeft&&h.MarginTop===n.MarginTop)return void console.log("_DonFlingAnim adjust_lp.MarginLeft === lp.MarginLeft && adjust_lp.MarginTop === lp.MarginTop");this.DragControl=new F.DragTranslateControl,this.DragControl._SetView(this),this.DragControl.speed(t),console.log(`OnFling speed:${t}`);const c=this._DragInfo.Settings;this._DragImactSensorRecycle(),this.Element.style.transform=null,this.DragControl.target(n.MarginLeft,n.MarginTop).jumpSilent(),n.SetPosition(0,0),this.ResetLayoutParams(n);let u=0;this.DragControl.target(o,l).start(((t,r)=>{this.DragControl=null,n.SetPosition(t,r),this.ResetLayoutParams(n),this.Element.style.transform=null,this._DragImactSensorRecycle(),e.viewX=t,e.viewY=r,this._DragInfo.Listener.OnFling(e),console.log(`_DonFlingAnim end view_x:${t}, view_y:${r}, distance_x:${i}, distance_y:${s}`)}),(e=>{const t=i*e,n=s*e;if(console.log(`_DonFlingAnim progress:${e}, deltaX:${t}, deltaY:${n}`),Math.abs(t)>this._DragInfo.Settings.TriggerMovedDistance||Math.abs(n)>this._DragInfo.Settings.TriggerMovedDistance){const e={deltaX:r+t,deltaY:a+n,_deltaX:t,_deltaY:n,timeStamp:parseInt((Date.now()-u)/1e3,10)};this._DoDragMove(e,!1),u=Date.now()}}));const d=this.GetPositionOffset(this.ParentView);this._DragImactSensor=new F.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 F.sImpactSensorManager.Callback((t=>{this._DoDragPause(e),this._DragImactSensorRecycle()}),null))}_DoFling(e){let t=e.deltaX,i=e.deltaY,s=!0,n=0;switch(this._DragInfo.Settings.DragDirection){case F.DragSetting.DIRECTION_VERTICAL:t=0,0===i&&(s=!1),n=Math.abs(e.velocityY);break;case F.DragSetting.DIRECTION_HORIZONTAL:i=0,0===t&&(s=!1),n=Math.abs(e.velocityX);break;case F.DragSetting.DIRECTION_DISABLE:s=!1;break;default:n=Math.sqrt(e.velocityX**2,e.velocityY**2)}return s&&(e.deltaX=t,e.deltaY=i,this._DonFlingAnim(e,n)),!0}_FindFirstRectChild(){if(0!=this.Element.clientWidth&&0!=this.Element.clientHeight)return this;let e,t;if(this.ChildViews.length>0)for(let i=0;i<this.ChildViews.length;i++)if(t=this.ChildViews[i],t&&(e=t._FindFirstRectChild(),null!=e))return e;return null}GetBoundingClientRect(e){this.Element?setTimeout((()=>{let t=this,i=0;for(;t;)t.TransformAnimationObj&&t.TransformAnimationObj.repeatTimes>0&&(i++,t.TransformAnimationObj.AddAnimationListener(new F.AnimationListener(null,(t=>{if(i--,i<=0){let t=this._FindFirstRectChild();t||(t=this);const{left:i,top:s,width:n,height:r}=t.Element.getBoundingClientRect();e?.(JSON.stringify({status:0,data:{left:i,top:s,width:n,height:r}}))}})))),t=t.ParentView;if(0==i){let t=this._FindFirstRectChild();t||(t=this);const{left:i,top:s,width:n,height:r}=t.Element.getBoundingClientRect();e?.(JSON.stringify({status:0,data:{left:i,top:s,width:n,height:r}}))}}),1):e?.(JSON.stringify({status:-1,error:"BrowserError: dom element is null."}))}ChildViewsCount(){return this.ChildViews.length}MarkFlexSizeFromChild(e){this._ChildrenFromChild0&&console.error("Error: from child0 冲突 size"),this._SizeFromChild=e,this.Element.style.display="flex","0px"==this.Element.style.width&&(this.Element.style.width=""),"0px"==this.Element.style.height&&(this.Element.style.height=""),this._SizeFromChild?this._SizeFromChild.Element.style.position="relative":console.error("Error: Need insert child0 before mark")}MarkFlexChildrenFromChild0(){this._SizeFromChild&&console.error("Error: from child0 冲突 child"),this._ChildrenFromChild0=!0}TransChildFlexInfoPack(e){e.FlexInfoPack?(this.FlexInfoPack=e.FlexInfoPack,e.FlexInfoPack=null):this.FlexInfoPack!=e.FlexInfoPackWeak&&console.error("Error: TransChildFlexInfoPack dismatch")}RegisterFlexAssigned(e){this._FlexAssignedCallback=e,null==this._MySizeObserver&&(this._MySizeObserver=new ResizeObserver((t=>{for(let i of t)i.target==this.Element&&e?.(0,0,i.contentRect.width,i.contentRect.height)}))),e?(this._MySizeObserver.disconnect(),this._MySizeObserver.observe(this.Element)):this._MySizeObserver.disconnect()}ResetFlexContainerCell(e){e?(this._EnsureFlexInfoPack(),this.FlexInfoPackWeak.container=e,this._FlushFlexDiv()):console.error("Error: Can NOT cancel flex container")}ResetFlexItemCell(e){this._EnsureFlexInfoPack(),this.FlexInfoPackWeak.item=e,this._FlushFlexDiv()}_EnsureFlexInfoPack(){null==this.FlexInfoPackWeak&&(this.FlexInfoPack={container:null,item:null},this.FlexInfoPackWeak=this.FlexInfoPack)}_FlushFlexDiv(){if(this._IsChildOfRootView){if(null!=this.FlexInfoPackWeak){if(null!=this.FlexInfoPackWeak.container)if(this._ChildrenFromChild0)this.Element.style.width="",this.Element.style.height="",this.Element.style.display="flex";else{this.Element.style.display="flex";let e=this.FlexInfoPackWeak.container;this.Element.style.flexDirection=this._ConvertFlexSetToString(e.flexDirection),this.Element.style.flexWrap=this._ConvertFlexSetToString(e.flexWrap),this.Element.style.justifyContent=this._ConvertFlexSetToString(e.justifyContent),this.Element.style.alignItems=this._ConvertFlexSetToString(e.alignItems),this.Element.style.alignContent=this._ConvertFlexSetToString(e.alignContent);let t=this;for(;t.ParentView._ChildrenFromChild0;)t=t.ParentView;this.Element.style.width=t.LayoutParams.Width>0?t.LayoutParams.Width+"px":"",this.Element.style.height=t.LayoutParams.Height>0?t.LayoutParams.Height+"px":"";for(let e=0;e<this.ChildViews.length;e++){let t=this.ChildViews[e].Element;t.style.position="relative",t.style.left="",t.style.top=""}}else this.Element.style.flexDirection="",this.Element.style.flexWrap="",this.Element.style.justifyContent="",this.Element.style.alignItems="",this.Element.style.alignContent="";if(this.FlexInfoPack&&this.FlexInfoPack.item){let e=this.FlexInfoPack.item;this.Element.style.alignSelf=this._ConvertFlexSetToString(e.alignSelf),this.Element.style.flexGrow=e.flexGrow}}this.ParentView.FlexInfoPackWeak?.container?this.Element.style.position="relative":this.ParentView._SizeFromChild||(this.Element.style.position="absolute")}}_ConvertFlexSetToString(e){switch(e){case F.FlexSetNames.NoSet:return"";case F.FlexSetNames.Auto:return"auto";case F.FlexSetNames.Row:return"row";case F.FlexSetNames.RowReverse:return"row-reverse";case F.FlexSetNames.Column:return"column";case F.FlexSetNames.ColumnReverse:return"column-reverse";case F.FlexSetNames.NoWrap:return"nowrap";case F.FlexSetNames.Wrap:return"wrap";case F.FlexSetNames.FlexStart:return"flex-start";case F.FlexSetNames.FlexEnd:return"flex-end";case F.FlexSetNames.Center:return"center";case F.FlexSetNames.Stretch:return"stretch";default:return console.error("No support flex set, value="+e),""}}EnableVisibleTestRect(){this._EnableVisibleTestRect=!0}DragEnables(){}}Re.DivId=0,F.LayoutViewBase=Re;class Fe extends Re{constructor(e,t){!e||e instanceof F.TextureSetting||F.ThrowError("ERROR:LayoutView need TextureSetting as parameter"),super(e,t=t||"div")}HtmlCanAccessElement(){return!0}HtmlGetElement(){return this.Element}}F.LayoutView=Fe,window.LayoutView=F.LayoutView;class De extends F.LayoutView{constructor(){super(void 0,"root"),this._ViewType=1,this._IsChildOfRootView=!0,window.gRootView=this,F.sRootView=this}Init(e,t,i,s,n){this.InitLayoutViewStaticValues(e),this.ResetLayoutParams({x:0,y:0,width:1280,height:720})}InitLayoutViewStaticValues(e){F.LayoutViewBase.sRenderer=e,F.LayoutViewBase.sInternalTextureManager=e.GetSharedTextureManager(),F.LayoutViewBase.sIdentityMat4=new F.Mat4,F.LayoutViewBase.sNullDirectParentMat4=new F.Mat4,F.LayoutViewBase.sBakeFlipYMat4=(new F.Mat4).rotatex(180)}}F.RootView=De,window.RootView=F.RootView;class Ve{constructor(e,t,i,s,n){this.coordX=e,this.coordY=t,this.width=i,this.height=s,this.useScissors=n,this.maskStencil=null}updateInfo(e,t,i,s,n){this.coordX=e,this.coordY=t,this.width=i,this.height=s,this.useScissors=n}setMaskStencil(e){this.maskStencil=e}}class Oe extends F.LayoutView{constructor(e){super(e,"div"),this._ClipRectInfo=null,this.Id="ClipView",this.TextureSetting=null}SetId(e){this.Id=`${e}_ClipView`}SetClipRect(e,t,i,s,n){null===this._ClipRectInfo?this._ClipRectInfo=new Ve(e,t,i,s,n):this._ClipRectInfo.updateInfo(e,t,i,s,n);const r=e,a=t,o=this.LayoutParams.Width-r-i,l=this.LayoutParams.Height-a-s;n?(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(e,t){this.Element.style.overflow=e&&t?"hidden":"visible"}}F.ClipView=Oe,window.ClipView=F.ClipView;class Me extends F.LayoutView{constructor(e){super(e,"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(e,t){let i=null;e&&(i=new F.ExternalTextureSetting(e,t)),this.TextureSetting=i,this._ApplyChanges()}SetRepeat(e,t){F.Assert(e.length<=2),F.Assert(t.length<=2);for(let i=0;i<2;i++)i<e.length?(this._HorizontalRepeats[2*i]=e[i].start,this._HorizontalRepeats[2*i+1]=e[i].width):(this._HorizontalRepeats[2*i]=0,this._HorizontalRepeats[2*i+1]=0),i<t.length?(this._VerticalRepeats[2*i]=t[i].start,this._VerticalRepeats[2*i+1]=t[i].width):(this._VerticalRepeats[2*i]=0,this._VerticalRepeats[2*i+1]=0);return this._ApplyChanges(),this}SetPadding(e,t){return F.Assert(null!==e),F.Assert(null!==t),this._VerticalPadding[0]=t.start,this._VerticalPadding[1]=t.width,this._HorizontalPadding[0]=e.start,this._HorizontalPadding[1]=e.width,this._ApplyChanges(),this}SetImageDspSize(e,t){this._ImageDspWidth=e,this._ImageDspHeight=t}_ApplyChanges(){let e=this.TextureSetting;if(e){if(e.MaskSetting&&"CORNER"===e.MaskSetting._MaskType&&this._SetBorderRadius(e.MaskSetting),e.Texture.Source){const t=e.Texture.RenderTexture.Width,i=e.Texture.RenderTexture.Height,s=t/this._ImageDspWidth,n=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]*s),c=t-Math.floor(this._HorizontalRepeats[1]*s)-h,u=Math.floor(this._VerticalRepeats[0]*n),d=i-Math.floor(this._VerticalRepeats[1]*n)-u;h+c>=t&&(h-=1,c-=1),u+d>=i&&(u-=1,d-=1);const g=`${u} ${c} ${d} ${h}`;this.Element.style.borderImage=`url(${e.Texture.Source}) ${g} fill`;const f=this._HorizontalPadding[0],m=this._ImageDspWidth-this._HorizontalPadding[1]-f,p=this._VerticalPadding[0],y=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 ${y}px ${f}px`}}else this.Element.style.borderRadius="",this.Element.style.borderImage=""}}F.NinePatchView=Me;class Ne extends F.LayoutView{constructor(e){let t;t=e.startsWith("jsve-")?e.substr(5):e.substr(3),super(void 0,t)}setAttribute(e,t){this.Element.setAttribute(e,t)}removeAttribute(e){this.Element.removeAttribute(e)}getAttribute(e){return this.Element.getAttribute(e)}hasAttribute(e){return this.Element.hasAttribute(e)}get textContent(){return this.Element.textContent}set textContent(e){this.Element.textContent=e}}F.JsvElementView=Ne;F.VideoView=class extends Fe{constructor(e,t){super(t),this._ViewType=8,this.Element=e,this.Id="VideoView"}SetId(e){this.Id=`${e}_VideoView`}ResetLayoutParams(e){null!==e?(e instanceof F.LayoutParamsBase?this.LayoutParams=e.Clone():this.LayoutParams=new F.LayoutParams(e),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`)):F.ThrowError("ResetLayoutParams(): new params is null")}_OnAttachToSystem(){console.log("Video attach"),super._OnAttachToSystem()}_OnDetachFromSystem(){super._OnDetachFromSystem()}};class Ge extends F.LayoutView{constructor(){super(null,"input"),this._ViewType=5,this._InputType=F.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",(e=>{e=e||window.event;let t=this.Element.selectionStart;console.log(`keydown cur_offset:${t}`),37===e.keyCode?(--t,t<0&&(t=0),t!==this.Element.selectionStart?(this.OnTextChanged(this.Element.value,t,!0),e.stopPropagation&&e.stopPropagation()):this.Element.blur()):39===e.keyCode?(++t,t>this.Element.value.length&&(t=this.Element.value.length),t!==this.Element.selectionStart?(this.OnTextChanged(this.Element.value,t,!0),e.stopPropagation&&e.stopPropagation()):this.Element.blur()):38===e.keyCode||40===e.keyCode?this.Element.blur():27!==e.keyCode&&1e4!==e.keyCode||this.Element.blur()})),this.Element.onfocus=e=>{console.log("onfocus in"),this.OnStatusChanged(1)},this.Element.onblur=e=>{console.log("onblur in"),this.OnStatusChanged(0)};this.Element.oninput=e=>{if(console.log("oninput:",e),e.target.value.length>0&&e.target.selectionStart>0){const i=e.target.selectionStart-1,s=e.target.selectionStart,n=e.target.value.slice(i,s);t=n,"0".charCodeAt()<=t.charCodeAt()&&t.charCodeAt()<="9".charCodeAt()||this._InputType!==F.TextInputType.NUMBER||(e.target.value=e.target.value.substr(0,i)+e.target.value.substr(s),e.target.selectionStart=i)}var t;const i=e.target.value,s=e.target.selectionStart;this.OnTextChanged(decodeURIComponent(i),s)}}SetId(e){this.Id=`${e}_EditControlView`}showIme(e,t,i){this.Element?e!==F.TextInputType.NONE?(null==i&&(i=t.length>0?t.length:0),i<0?i=0:i>t.length&&(i=t.length>0?t.length:0),this._InputType=e,this.Element.type="text",this.Element.value=t,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(e,t){this.Element?(this.Element.selectionStart=t,this.Element.selectionEnd=t,this.Element.value=e):console.log("updateCursorOffset, but ele is null!")}OnTextChanged(e,t,i){console.log(`OnTextChanged value:${e}`)}OnStatusChanged(e){}OnEditAction(e){}}class Be extends F.LayoutView{constructor(e,t=1){super(e),this._ViewType=10,this._FilterType=t,this.Id="FilterView",this._Type=t,t==Be.Type.GRAY_DOWN?this.Element.style.filter="grayscale(100%)":t==Be.Type.WAVE&&console.warn("FilterView: ripple effect has not been implemented on the browser side.")}FilterSwitch(e){this.Element&&this._Type==Be.Type.GRAY_DOWN&&(this.Element.style.filter=e?"grayscale(100%)":"")}SetId(e){this.Id=e+"_FilterView"}AddWaveSourceList(){}AddWaveSourceSingle(){}RemoveSource(){}DispatchCommand(){}}Be.Type={GRAY_DOWN:1,WAVE:2},Be.WAVE={CIRCLE_WAVE:1,RECTANGLE_WAVE:2},F.FilterView=Be;class We extends F.LayoutView{constructor(){super(null,"div"),this._Iframe=window.originDocument.createElement("iframe"),this._Iframe.style.border="none",this._Iframe.style.margin="0px",this._Iframe.style.padding="0px",this._Iframe.scrolling="no",this._IframeWidth=0,this._IframeHeight=0,this.Element.appendChild(this._Iframe)}SetIframeSize(e,t){isNaN(e)||(this._IframeWidth=e,this._Iframe.width=e),isNaN(t)||(this._IframeHeight=t,this._Iframe.height=t)}SetInnerHtml(e){this._Iframe.srcdoc=e,this._Iframe.onload=()=>{0==this._IframeHeight&&(this._Iframe.height=this._Iframe.contentDocument.body.clientHeight)}}}F.IFrameView=We;let He={NONE:0,TEXT:1,PASSWORD:2,TEXT_AREA:3,CONTENT_EDITABLE:4,SEARCH:5,URL:6,EMAIL:7,TELEPHONE:8,NUMBER:9};F.TextInputType=He,F.EditControlView=Ge;class Ye{constructor(e){this._Current=new Array(e).fill(0),this._Target=new Array(e).fill(0),this._RepeatStart=new Array(e).fill(0),this._JumpTarget=null,this._Jumping=!1,this._ParameterCount=e,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(e,t){return this._Repeat=e,this._OnRepeatCallback=e?t:null,this}start(e,t){this._NextEndCallback=e,this._EndCallback=null,this._AdvanceCallback=t,this._StartSwitcher=!0,this._Jumping=!1,this._StateMachineNext()}pause(e){this._AdvanceCallback=null,null===this._EndCallback&&null===this._NextEndCallback||(this._EndCallback=null,this._NextEndCallback=null),0===this._StateIndex?e&&this._CallbackWithCatch(this._Current,e):(e&&(this._PausedCallback=e),this._StateMachineNext())}jump(){this._JumpTarget=[...this._Target],this._Jumping=!0,this._StartSwitcher=!0,this._StateMachineNext()}jumpSilent(){this._JumpTarget=[...this._Target]}startFpsTesting(){F.sRenderBridge.SetStepFpsSwitch(!0)}stopFpsTesting(){F.sRenderBridge.SetStepFpsSwitch(!1)}_WrapBuildAnimation(e,t,i,s){console.warn("Should Override")}_WrapCallback(e,t){console.warn("Should Override")}_CallbackWithCatch(e,t){try{this._WrapCallback(e,t)}catch(e){console.error("Error:in callback"),console.error(e)}}_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 e=this._JumpTarget?[...this._JumpTarget]:[...this._Current],t=this._Target,i=this._Repeat?[...this._RepeatStart]:null,s=this._WrapBuildAnimation(i,e,t,this._Jumping);if(this._JumpTarget=null,this._Jumping=!1,null===s)return;const n=[...t],r=this,a=(new F.AnimationListener).OnFinalProgress((t=>{r._OnPaused(null!==i?i:e,n,t)})).OnAdvance((e=>{this._AdvanceCallback&&this._AdvanceCallback(e)}));return this._OnRepeatCallback&&a.OnRepeat((e=>{r._OnRepeatCallback&&r._OnRepeatCallback(e)})),s.AddAnimationListener(a),s.Enable(F.AnimationEnable.KeepTransform),this._Repeat&&s.EnableInfinite(),this._SpriteView.StartAnimation(s),!0}_StopAnimation(){this._SpriteView.StopAnimation()}_OnPaused(e,t,i){for(let s=0;s<this._ParameterCount;s++)this._Current[s]=Math.floor((t[s]-e[s])*i+e[s]);this._StateLocked=!0;const s=this._PausedCallback,n=this._EndCallback;this._PausedCallback=null,s&&this._CallbackWithCatch(this._Current,s),n&&1===i&&(this._EndCallback=null,this._CallbackWithCatch(this._Current,n)),this._StateLocked=!1,this._StateIndex=0;this._StateMachineNext()}_SetView(e){this._SpriteView=e}}F.DragTranslateControl=class extends Ye{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(e){return this._AllowFrameStep=e,this}selectMode(e){switch(e){case"UniformMotion":this._Mode=0;break;case"AcceleratedMotion":this._Mode=1,this.setRepeat(!1);break;default:console.error(`Unsupported input=${e}`)}return this}targetX(e){return this._Target[0]=e,this}targetY(e){return this._Target[1]=e,this}target(e,t){return this._Target[0]=e,this._Target[1]=t,this}enableRepeatFrom(e,t,i){if(this._ComfirmMode(0))return this.setRepeat(!0,i),this._RepeatStart[0]=e,this._RepeatStart[1]=t,this}speed(e){if(console.log(`speed, pixel_per_second:${e}`),this._ComfirmMode(0))return this._Speed=e,this}accelerateX(e,t){if(this._ComfirmMode(1))return this._Target[0]=t,this._VerlocityAcc=e,this._VerlocityInit=0,this._AccAlongX=!0,this}accelerateY(e,t){if(this._ComfirmMode(1))return this._Target[1]=t,this._VerlocityAcc=e,this._VerlocityInit=0,this._AccAlongX=!1,this}decelerateX(e,t){if(this._ComfirmMode(1))return this._VerlocityAcc=e,this._VerlocityInit=t,this._AccAlongX=!0,this}decelerateY(e,t){if(this._ComfirmMode(1))return this._VerlocityAcc=e,this._VerlocityInit=t,this._AccAlongX=!1,this}decelerate(e,t,i,s){if(1===this._Mode)return this._VerlocityAcc[0]=e,this._VerlocityAcc[1]=t,this._VerlocityInit[0]=i,this._VerlocityInit[1]=s,this;console.error("Error: mode error")}_ComfirmMode(e){return this._Mode===e||(console.error("Error: mode error"),!1)}_WrapBuildAnimation(e,t,i,s){return s?this._AnimationRef=this._UniformMove(null,t,i,s):0===this._Mode?this._AnimationRef=this._UniformMove(e,t,i,!1):1===this._Mode&&(this._AnimationRef=this._AccelerMove(t,i)),this._AnimationRef}_UniformMove(e,t,i,s){let n=0,r=0,a=0,o=1;const l=t[0],h=t[1],c=i[0],u=i[1];if(null!==e){n=e[0],r=e[1];const t=this._Distance(l,h,c,u),i=this._Distance(n,r,c,u);a=(i-t)/i,s||(o=1e3*i/this._Speed)}else n=l,r=h,a=0,s||(o=1e3*this._Distance(l,h,c,u)/this._Speed);s||0!==o||console.warn("Discard starting request for no distance");let d=null;if(n!==c&&r!==u||s||!this._AllowFrameStep||!window.JsView)d=new F.TranslateAnimation(n,c,r,u,o,null);else{console.log("Using frame translate animation");let e=0,t=0,i=!0;n!==c?(e=n,t=c,i=!0):(e=r,t=u,i=!1),d=new F.TranslateFrameAnimation(e,t,this._Speed,i)}return 0!==a&&(a<0?console.warn("Warning: start position out of repeating range"):d.SetStartPos(a)),d}_AccelerMove(e,t){const i=this._AccAlongX?e[0]:e[1],s=this._VerlocityInit,n=this._VerlocityAcc;let r,a,o,l,h=!0;if(0!==n)return 0===s?(r=this._AccAlongX?t[0]:t[1],a=Math.floor(1e3*Math.sqrt(2*Math.abs(r-i)/n)),h=!0):(a=Math.floor(1e3*Math.abs(s)/n),r=i+Math.floor(5e-4*s*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 F.TranslateAnimation(e[0],o,e[1],l,a,h?F.Easing.Circular.In:F.Easing.Circular.Out);console.error("Error: no found acceleration")}_Distance(e,t,i,s){const n=i-e,r=s-t;return Math.sqrt(n*n+r*r)}_WrapCallback(e,t){this._AnimationRef=null,t&&t(e[0],e[1])}};F.LayoutView;class $e{StringWithFont(e,t,i,s,n,r,a,o,l,h,c){t||(t=$e._sDefaultFontSize),i||(i=$e._sDefaultFont);let u="";!0===a&&(u="italic");let d="";return!0===o&&(d="bold"),s||(s="left"),n||(n="middle"),r||(r=$e._sDefaultFontColor),l||(l=null),c||(c="top"),h||(h=-1),{str:`${e}`,font:i,size:t,italic:u,bold:d,stroke_width:h,alignment:s,vertical_align:n,textColour:r,backgroundColour:$e._sDefaultBackgroundColor,enableBlend:!0,shadow:l,vertical_area_align:c}}TextAttr(e,t){return e||(e="none"),t||(t="none"),{text_overflow:e,word_wrap:t}}GetTextWidth(...e){if(e.length<=1){let t=e[0];return void 0!==window.PlatformUtils?window.PlatformUtils.GetTextWidth(t):t.str.length*t.size+1}{let t=e[0];if(void 0!==window.PlatformUtils){let i={str:t,font:e[1]?e[1]:"黑体",size:e[2],bold:e[3],italic:e[4]};return window.PlatformUtils.GetTextWidth(i)}return t.length*t.size+1}}GetOneLineTextDrawWidth(e,t,i,s,n,r){if(void 0!==window.PlatformUtils){let a=window.PlatformUtils.GetOneLineTextDrawWidth(e,t??"黑体",i,s,n);r.push(...a)}else console.error("GetOneLineTextDrawWidth: window.PlatformUtils undefined.")}GetTextRect(e,t,i,s,n){return void 0!==window.PlatformUtils?window.PlatformUtils.GetTextRect(e,t,i,s,n):{width:t.width,height:t.height}}GetTextInfo(e,t,i,s,n){return void 0!==window.PlatformUtils?window.PlatformUtils.GetTextInfo(e,t,i,s,n):{start:0,end:e.length,width:t.width,height:t.height}}GetCursorOffset(e,t,i,s,n,r,a){return void 0!==window.PlatformUtils?window.PlatformUtils.GetCursorOffset(e,t,i,s,n,r,a):0}GetCursorPosition(e,t,i,s,n,r){return void 0!==window.PlatformUtils?window.PlatformUtils.GetCursorPosition(e,t,i,s,n,r):{x:0,y:0}}BuildTextView(e,t,i,s,n,r,a,o,l,h,c){n.width=isNaN(n.width)?0:n.width,n.height=isNaN(n.height)?0:n.height,r=isNaN(r)?10:r,a=isNaN(a)?0:a;let u=new F.LayoutView;const d=e.GetTextTextureFromStylePack(t,i,!!s,n,r,a,2!=o,l,h,c);return s&&setTimeout((()=>{s(u.Element.clientWidth,u.Element.clientHeight)})),null===d?(console.error("Error: Build text texture failed!"),null):(u.ResetTexture(d),t.length<10?u.SetId("Text-"+t):u.SetId("Text-Long-"+t.length),u.ResetLayoutParams({x:0,y:0,width:n.width,height:n.height}),u)}}$e._sDefaultFont="黑体",$e._sDefaultFontSize=30,$e._sDefaultFontColor="#FFFFFF",$e._sDefaultBackgroundColor="rgba(0, 0, 0, 0)",F.TextUtils=$e,F.sTextUtils=new F.TextUtils;class Ue{constructor(){this._InnerViews={},this._ViewToken=1}add(e){const t=++this._ViewToken;return this._InnerViews[`${t}`]=e,t}remove(e){this._InnerViews[e]&&delete this._InnerViews[e]}get(e){return this._InnerViews[e]}clear(){this._InnerViews={},this._ViewToken=1}}F.ViewStore=Ue;let je=new Ue;F.sViewStore=je;class Xe{constructor(e,t){this.view=e,this.layout_params=t}}F.ViewInfo=Xe;let ze=0;F.AnimationBase=class{constructor(){this.IdToken=ze++,this._AttachedGroup=null,this.AnimationListenerObj=null,this._AnimationClose=!1,this._LayoutViewRef=null,this._IsTextureAnim=!1}SetAnimationListener(e){this.AnimationListenerObj=e,this.OnNewListener(e)}AddAnimationListener(e){this.AnimationListenerObj&&e.AddInherit(this.AnimationListenerObj),this.AnimationListenerObj=e,this.OnNewListener(e)}RemoveAnimationListener(){this.AnimationListenerObj=null}OnNewListener(e){}GetAnimationListener(){return this.AnimationListenerObj}Cancel(e){this._LayoutViewRef&&this._LayoutViewRef.DetachAnimation(this);const t=this.AnimationListenerObj;if(t&&t.OnAnimationEnd&&!this._AnimationClose&&(this._AnimationClose=!0,t.OnAnimationEnd(!1)),this._AttachedGroup){let t=!0;e&&(t=e._AttachedGroup!==this._AttachedGroup),t&&(this._AttachedGroup.CancelFromInternalAnimation(this),this._AttachedGroup=null)}}AttachToGroup(e){null!==this._AttachedGroup&&F.ThrowError("ERROR: In TransformAnimation.AttachToGroup(), animation already attached to other group"),this._AttachedGroup=e}RemoveFromGroup(){this._AttachedGroup=null}AsTextureAnimation(){this._IsTextureAnim=!0}Start(e){this._LayoutViewRef=e}SetCannotDisable(e){}OnStart(){const e=this.AnimationListenerObj;e&&e.OnAnimationStart&&e.OnAnimationStart()}OnEnd(e){this._LayoutViewRef&&!e&&(this._LayoutViewRef.DetachAnimation(this),this._LayoutViewRef=null);const t=this.AnimationListenerObj;t&&t.OnAnimationEnd&&!this._AnimationClose&&(this._AnimationClose=!0,t.OnAnimationEnd(!0))}OnRepeatEvent(){const e=this.AnimationListenerObj;e&&e.OnAnimRepeat&&e.OnAnimRepeat()}OnViewHide(){const e=this.AnimationListenerObj;e&&e.OnViewNoVisible&&e.OnViewNoVisible()}OnFinalProgress(e){const t=this.AnimationListenerObj;t&&t.OnAnimFinal&&t.OnAnimFinal(e)}OnAnimAdvance(e){const t=this.AnimationListenerObj;t&&t.OnAnimAdvance&&t.OnAnimAdvance(e)}};class Ke{constructor(e,t,i){this.OnAnimationStart=e,this._OnAnimationStart=e,this.OnAnimationEnd=t,this._OnAnimationEnd=t,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(e){return this._OnAnimationStart=e,this.OnAnimationStart=e,this}OnEnd(e){return this._OnAnimationEnd=e,this.OnAnimationEnd=e,this}OnAdvance(e){return this._OnAnimAdvance=e,this.OnAnimAdvance=e,this}OnFinalProgress(e){return this._OnAnimFinal=e,this.OnAnimFinal=e,this}OnRepeat(e){return this._OnAnimRepeat=e,this.OnAnimRepeat=e,this}AddInherit(e){if(e){if(0===this._InheritListener.length){const e=this;this.OnAnimationStart=function(){e._OnAnimationStart&&e._OnAnimationStart();for(let t=0;t<e._InheritListener.length;t++)e._InheritListener[t].OnAnimationStart&&e._InheritListener[t].OnAnimationStart()},this.OnAnimationEnd=function(t){e._OnAnimationEnd&&e._OnAnimationEnd(t);for(let i=0;i<e._InheritListener.length;i++)e._InheritListener[i].OnAnimationEnd&&e._InheritListener[i].OnAnimationEnd(t)},this.OnViewNoVisible=function(){e._OnViewNoVisible&&e._OnViewNoVisible();for(let t=0;t<e._InheritListener.length;t++)e._InheritListener[t].OnViewNoVisible&&e._InheritListener[t].OnViewNoVisible()},this.OnAnimFinal=function(t){e._OnAnimFinal&&e._OnAnimFinal(t);for(let i=0;i<e._InheritListener.length;i++)e._InheritListener[i].OnAnimFinal&&e._InheritListener[i].OnAnimFinal(t)},this.OnAnimRepeat=function(){e._OnAnimRepeat&&e._OnAnimRepeat();for(let t=0;t<e._InheritListener.length;t++)e._InheritListener[t].OnAnimRepeat&&e._InheritListener[t].OnAnimRepeat()},this.OnAnimAdvance=function(){e._OnAnimAdvance&&e._OnAnimAdvance();for(let t=0;t<e._InheritListener.length;t++)e._InheritListener[t].OnAnimAdvance&&e._InheritListener[t].OnAnimAdvance()}}this._InheritListener.push(e)}}}F.AnimationListener=Ke;class Je{constructor(e){this._SS=e}insertRule(e){window.jsvInAndroidWebView&&(e=(e=e.replace(/@keyframes/,"@-webkit-keyframes")).replace(/transform/g,"-webkit-transform"));const t=this._SS.cssRules.length;this._SS.insertRule(e,t)}removeRule(e){this.removeMultiRules([e])}hasRule(e){const t=this._SS.cssRules;for(let i=t.length-1;i>=0;i--)if(t[i].name===e)return!0;return!1}removeMultiRules(e){const t=this._SS,i=this._SS.cssRules;for(let s=i.length-1;s>=0;s--)for(const n in e)if(i[s].name===e[n]){e.splice(n,1),t.deleteRule(s);break}}}let qe=null;function Ze(){return null===qe&&(qe=function(e){let t=null;const i=document.styleSheets;if(!i||0===i.length)return console.error("Error: styleSheet empty"),null;if(e){for(let s=0;s<i.length;++s){const n=i[s];if(n.cssRules[0]&&n.cssRules[0].name&&n.cssRules[0].name===e){t=n;break}}if(null===t)return console.error(`Error: no found tag=${e}`),null}else t=i[i.length-1];return new Je(t)}()),qe}function Qe(e){let t="linear";if(e&&void 0!==e.T)switch(e.T){case F.EasingTypeIn:t="ease-in";break;case F.EasingTypeOut:t="ease-out";break;case F.EasingTypeInOut:t="ease-in-out";break;case F.EasingTypeBezier:t=`cubic-bezier(${e.St.X1},${e.St.Y1},${e.St.X2},${e.St.Y2})`;break;case F.EasingTypeSteps:t=`steps(${e.St.S},${0===e.St.T?"start":"end"})`;case F.EasingTypeBlink:case F.EasingTypeDeceleration:}return t}function et(e,t){const i=-1===e.repeatTimes?"infinite":e.repeatTimes;let s="linear";e.easing&&(s=Qe(e.easing));return`${t} ${e.duration/1e3}s ${s} ${e.delayedTime/1e3}s ${i}`}const tt=(e,t,i)=>{e.hasOwnProperty("__jsvHookListeners")||(e.__jsvHookListeners=new Map);const s=e.__jsvHookListeners;s.has(t)&&s.forEach((i=>{e.removeEventListener(t,i),e.__jsvHookListeners.delete(t)})),e.addEventListener(t,i),e.__jsvHookListeners.set(t,i)},it=e=>e>=65&&e<=90||e>=97&&e<=122,st=e=>e>=48&&e<=57,nt=e=>{if(!e)return null;let t="",i="",s=[],n=0;for(let r=0;r<e.length;r++){const a=e.charCodeAt(r);if(0===n?(it(a)||st(a))&&(t+=e[r]):(st(a)||46===a||45===a||101===a)&&(i+=e[r]),40===a)n=1,i="",s=[];else{if(41===a)return s.push(parseFloat(i)),{name:t,params:s};44===a&&(s.push(parseFloat(i)),i="")}}return console.error("transform error",e),null};function rt(e){const t=e.Element.children;let i=null;for(let e=0;e<t.length;e++)if("_AnimateProgressTracer"===t[e].id){i=t[e];break}return null===i&&(i=window.originDocument.createElement("div"),i.id="_AnimateProgressTracer",e.Element.appendChild(i)),i}let at=0;class ot{constructor(e){this._TracerDiv=rt(e),this._IdToken=at++,this._KeyFrameName=null,this._AdvanceTimer=null,this._AdvanceListener=null,this._TracerDiv.hasOwnProperty("_ForgeProgressToken")||(this._TracerDiv._ForgeProgressToken=0),this._OnEndListener=e=>{e.stopPropagation()},tt(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 e=this.GetProgress();this._AdvanceListener(e),1===e&&this._ClearAdvanceTimer()}),100))}Start(e,t,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(t,this._IdToken,this._TracerDiv._ForgeProgressToken),this._TracerDiv.style.animation=et(e,this._KeyFrameName),tt(this._TracerDiv,"animationend",this._OnEndListener),this._NotifyAdvance()}Stop(){const e=this.GetProgress();return this._TracerDiv.style.animation=null,this._KeyFrameName&&(this._RemoveTraceKeyFrame(this._KeyFrameName),this._KeyFrameName=null),this._AdvanceListener&&(this._ClearAdvanceTimer(),this._AdvanceListener(e),this._AdvanceListener=null),e}GetProgress(){const e=window.getComputedStyle(this._TracerDiv);if(0===e.transform.length);else if(e.transform.length>0&&"none"!==e.transform){const t=nt(e.transform);return null!==t?t.params[4]/1e3:(console.error("Error:internal error"),0)}return 1}_BuildTraceKeyFrame(e,t,i){const s=`_AnimateProgress_${t}_${i}`,n=Ze(),r=`@keyframes ${s}\n {0%{transform:translate3d(${Math.floor(1e3*e)}px,0,0)}\n 100%{transform:translate3d(1000px,0,0)}}`;return n.insertRule(r),s}_RemoveTraceKeyFrame(e){Ze().removeRule(e)}}class lt{constructor(e,t){this._TracerDiv=rt(e),this._IdToken=at++,this._KeyFrameNameArray=null,this._StepsTotal=t,this._RunAnimList=null,this._TracerDiv.hasOwnProperty("_ForgeProgressToken")||(this._TracerDiv._ForgeProgressToken=0),this._OnEndListener=e=>{e.stopPropagation()},this._TracerDiv.addEventListener("animationend",this._OnEndListener)}Start(e){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(e),this._TracerDiv.style.animation=this._RunAnimList[0]}TriggerNextStep(e){this._TracerDiv.style.animation=this._RunAnimList[e]}Stop(){const e=this.GetProgress();return this._TracerDiv.style.animation=null,null!==this._KeyFrameNameArray&&(this._RemoveTraceKeyFrameGroup(),this._KeyFrameNameArray=null),e}GetProgress(){const e=window.getComputedStyle(this._TracerDiv);if(0===e.transform.length);else if("none"!==e.transform){const t=nt(e.transform);if(null!==t){return t.params[4]/(100*this._StepsTotal)}return console.error("Error:internal error"),0}return 1}_BuildTraceKeyFrameGroup(e,t){this._KeyFrameNameArray=new Array(this._StepsTotal);const i=Ze();for(let s=0;s<this._KeyFrameNameArray.length;s++){const n=`_AnimateGroupProgress_${e}_${t}_Cnt_${s===this._KeyFrameNameArray.length-1?"finalStep":`${s}`}`,r=`@keyframes ${n}\n {0%{transform:translate3d(${100*s}px,0,0)}\n 100%{transform:translate3d(${100+100*s}px,0,0)}}`;i.insertRule(r),this._KeyFrameNameArray[s]=n}}_RemoveTraceKeyFrameGroup(){const e=Ze();this._KeyFrameNameArray.forEach((t=>{e.removeRule(t)}))}_ConvertToAnimationStyle(e){const t=[];for(let i=0;i<e.length;i++){let s="linear";const n=e[i];n.easing&&(s=Qe(n.easing)),t.push(`${this._KeyFrameNameArray[i]} ${n.duration/1e3}s ${s}`)}return t}}let ht=0;F.AnimationDelegate=class extends F.AnimationBase{constructor(e,t,i){super();let s=null;i&&(s=i.Package()),this.typeName=e,this.duration=t,this.easing=s,this.repeatTimes=1,this.delayedTime=0,this.enableFlags=0,this.enableStartPos=0,this._Progress=null}EnableDelay(e){return this.delayedTime=e,this}SetStartPos(e){this.enableStartPos=e}EnableInfinite(){return this.repeatTimes=-1,this}SetRepeat(e){return this.repeatTimes=e,this}Enable(e){return this._EnableFlagsInner(e),this}OnNewListener(e){let t=0;e.OnAnimFinal&&(t|=F.AnimationEnable.AckFinalProgress),e.OnAnimRepeat&&(t|=F.AnimationEnable.AckRepeat),0!==t&&this._EnableFlagsInner(t)}_EnableFlagsInner(e){-1!==this.enableFlags?this.enableFlags|=e:this.enableFlags=e}_GetCSSKeyframesRule(e){let t=null;const i=document.styleSheets;for(let s=0;s<i.length;++s)if(i[s]&&i[s].cssRules){for(const n in i[s].cssRules)if(i[s].cssRules[n].name===e){t=i[s].cssRules[n];break}if(t)break}return t}CheckCssAnimationFormat(e){const t=this._GetCSSKeyframesRule(e);if(t&&t.cssRules)for(const i in t.cssRules){if(!t.cssRules[i]||!t.cssRules[i].style)continue;if(!t.cssRules[i].style.opacity&&!t.cssRules[i].style.transform)continue;const s=t.cssRules[i].style.transform;s&&(-1!==s.indexOf("rotate(")?console.error(`@keyframe ${e}, only support rotate3d, current transform:${s}`):-1!==s.indexOf("translate(")?console.error(`@keyframe ${e}, only support translate3d, current transform:${s}`):-1!==s.indexOf("scale(")&&console.error(`@keyframe ${e}, only support scale3d, current transform:${s}`))}}},F.KeyFrameAnimation=class extends F.AnimationDelegate{constructor(e,t,i){super(e,t,i),this._KeyFrameNameToRecycle=null,this._TestRepeat=this._TestRepeat.bind(this),this._LatestProgressValue=0;const s=this;this._OnEndEvent=e=>{e.stopPropagation(),s._PerformAnimationEnd(!0)},this._CurrentEndEventFunc=null}Start(e){super.Start(e),e.ResetCssTransform(null,null),e.Element&&(e.Element.style.pointerEvents="auto"),this.enableStartPos>0?this._EnableStarterAnimation():this._EnableCssAnimation(this._BuildKeyFrame(),this._OnEndEvent,0)}Cancel(){super.Cancel(),this._PerformAnimationEnd(!1)}_EnableStarterAnimation(){let e=this._OnEndEvent;if(1!==this.repeatTimes){const t=this;e=e=>{e.stopPropagation(),null!==t._Progress&&t._Progress.Stop(),t.delayedTime=0,t.repeatTimes>0&&(t.repeatTimes-=1),this.OnRepeatEvent(),t._EnableCssAnimation(t._BuildKeyFrame(),t._OnEndEvent,0)}}const t=this.repeatTimes,i=this.duration;this.repeatTimes=1,this.duration*=1-this.enableStartPos,this._EnableCssAnimation(this._BuildStarterKeyFrame(),e,this.enableStartPos),this.repeatTimes=t,this.duration=i}_CreateAnimation(e){const t=Ze();t.removeRule(e.name),t.insertRule(e.keyFrameString)}_EnableCssAnimation(e,t,i){if(null===e)return;e.tmp?null!==e.keyFrameString&&(Ze().insertRule(e.keyFrameString),this._KeyFrameNameToRecycle=e.name):this._CreateAnimation(e);const s=e.name;this.CheckCssAnimationFormat(s);const n=this._LayoutViewRef.Element;0==(this.enableFlags&F.AnimationEnable.AckFinalProgress)&&0==(this.enableFlags&F.AnimationEnable.KeepTransform)&&0==(this.enableFlags&F.AnimationEnable.AckRepeat)||(this._Progress=new ot(this._LayoutViewRef),this._Progress.Start(this,i,(e=>{this.OnAnimAdvance(e)})),0!=(this.enableFlags&F.AnimationEnable.AckRepeat)&&(this._LatestProgressValue=0,F.sRenderBridge.RegisterPerFrameCallback(this._TestRepeat)));const r=et(this,s);window.jsvInAndroidWebView?(n.style.webkitAnimation=r,n.addEventListener("webkitAnimationEnd",t)):(n.style.animation=r,n.addEventListener("animationend",t)),this._CurrentEndEventFunc=t}_PerformAnimationEnd(e){if(null!==this._CurrentEndEventFunc){const e=this._LayoutViewRef.Element,t=this._CurrentEndEventFunc;setTimeout((()=>{window.jsvInAndroidWebView?e.removeEventListener("webkitAnimationEnd",t):e.removeEventListener("animationend",t)}),0),this._CurrentEndEventFunc=null}if(null===this._Progress)return void(e&&this.OnEnd());0!=(this.enableFlags&F.AnimationEnable.AckRepeat)&&F.sRenderBridge.UnregisterPerFrameCallback(this._TestRepeat);let t=this._Progress.Stop();if(e&&(t=1),0!=(this.enableFlags&F.AnimationEnable.KeepTransform)){const e=this._GetFrozenTransform(t);this._LayoutViewRef?.ResetCssTransform(e.transform,e.transformOrigin)}e&&this.OnEnd(),0!=(this.enableFlags&F.AnimationEnable.AckFinalProgress)&&window.setTimeout((()=>{this.OnFinalProgress(t)}),0),null!==this._KeyFrameNameToRecycle&&(Ze().removeRule(this._KeyFrameNameToRecycle),this._KeyFrameNameToRecycle=null)}_TestRepeat(){const e=this._Progress.GetProgress();this._LatestProgressValue>e&&this.OnRepeatEvent(),this._LatestProgressValue=e}_BuildStarterKeyFrame(){console.warn("Warning:Should override and return keyframe name")}_BuildKeyFrame(){console.warn("Warning:Should override and return keyframe name")}_GetFrozenTransform(e){console.warn("Warning:Should override and keep view transform by ResetCssTransform()")}};let ct=class extends F.KeyFrameAnimation{constructor(e,t,i,s,n,r){super("TL",n,r),this.startX=e,this.startY=i,this.endX=t,this.endY=s}_BuildStarterKeyFrame(){if(this.enableStartPos>0){const e=(this.endX-this.startX)*this.enableStartPos+this.startX,t=(this.endY-this.startY)*this.enableStartPos+this.startY,i="_ForgeAnim_TL_"+ht++;return{name:i,keyFrameString:`@keyframes ${i} {0%{transform:translate3d(${e}px,${t}px,0);}100%{transform:translate3d(${this.endX}px,${this.endY}px,0);}}`}}console.error("Error: no enabled starter position")}_BuildKeyFrame(){const e="_ForgeAnim_TL_"+ht++;return{name:e,keyFrameString:`@keyframes ${e} {0%{transform:translate3d(${this.startX}px,${this.startY}px,0);}100%{transform:translate3d(${this.endX}px,${this.endY}px,0);}}`,tmp:!0}}_GetFrozenTransform(e){return{transform:`translate3d(${Math.floor((this.endX-this.startX)*e+this.startX)}px,${Math.floor((this.endY-this.startY)*e+this.startY)}px,0)`,transformOrigin:null}}};F.FuncAnimation=class extends F.AnimationDelegate{constructor(e,t,i){super("FC2",t,i),this.formula=e,console.warn("NO implemented")}},F.TranslateAnimation=ct;let ut=class extends F.AnimationDelegate{constructor(e,t,i,s,n,r){super("RO",n,r),i instanceof F.Vec3||(i=new F.Vec3(i)),s instanceof F.Vec3||(s=new F.Vec3(s)),this.startAngle=e,this.offsetAngle=t,this.anchorVec3=i,this.axisVec3=s,console.warn("NO implemented")}};F.RotateAnimation=ut,F.BasicScaleAnimation=class extends F.AnimationDelegate{constructor(e,t,i,s,n,r,a,o,l,h){super("SC",a,o),console.warn("NO implemented")}};let dt=class extends F.BasicScaleAnimation{constructor(e,t,i,s,n,r){const a=200;super(e*a,e*a,t*a,t*a,i,s,n,r,200,200)}};F.ScaleAnimation=dt,F.OpacityAnimation=class extends F.AnimationDelegate{constructor(e,t,i,s){super("OP",i,s),console.warn("NO implemented")}},F.CssKeyframeAnimation=class extends F.KeyFrameAnimation{constructor(e,t,i,s,n){super("CK",t,i),this._keyFramesSet=e}_BuildKeyFrame(){let e=this._keyFramesSet.replaceAll("\n","");if(e.indexOf("@keyframes")<0&&e.indexOf("@-webkit-keyframes")<0)return console.warn("Warning:keyframes array empty"),null;let t=e.split(" ")[1];t.indexOf("{")>=0&&(t=t.substr(0,t.indexOf("{"))),e=e.replaceAll(/([left|top|width|height]:\s+\d+)/g,"$1px");const i=e.split("translate3d");for(let e=1;e<i.length;e++){let t=!1,s=i[e].replace(/\).*/,"");s=s.replace(/.*\(/,"");const n=s.split(",");for(let e=0;e<n.length;e++){const i=n[e].trim();i.match(/[0-9]$/)&&(n[e]=i+"px",t=!0)}t&&(s=n.join(","),i[e]=i[e].replace(/\(.*?\)/,"("+s+")"))}return{name:t,keyFrameString:i.join("translate3d"),tmp:!1}}_GetLastKeyframeTransform(e){let t=e.indexOf("to");if(t<0&&(t=e.indexOf("100%")),t<0)return"";{let i=e.indexOf("transform:",t);return i<0?"":e.substring(i+10,e.indexOf(";",i))}}_GetFrozenTransform(e){let t={transform:"",transformOrigin:null};return 1===e?t={transform:this._GetLastKeyframeTransform(this._keyFramesSet),transformOrigin:null}:console.warn("CssKeyframeAnimation can not get transform whill progress is not 1"),t}},F.CssTransitionAnimation=class extends F.AnimationDelegate{constructor(e){super("CT",null,null),this._transArray=e}Start(e){super.Start(e);const t=this,i=this._transArray,s={};if(0===i.length)return void console.warn("Warning:transition empty");let n="";for(let e=0;e<i.length;e++){let t="linear";const r=i[e];r.tf&&(t=Qe(r.tf)),n=`${r.name} ${r.dur/1e3}s ${t} ${r.dly/1e3}s`,s[r.name]=n}e.ApplyStyleTransition(s),n&&(e.Element.addEventListener("transitionend",(e=>{e.stopPropagation(),t.OnEnd(!0)})),e.Element.addEventListener("webkitTransitionEnd",(e=>{e.stopPropagation(),t.OnEnd(!0)})))}},F.KeyFrameGroupAnimation=class extends F.AnimationDelegate{constructor(e){super(e,0,null),this._KeyFrameArray=null,this._LatestProgressValue=0,this._CurrentEndEventFunc=null,this._Progress=null,this._AnimRunList=null,this._AnimationRunIndex=0;const t=this;this._OnEndEvent=e=>{e.stopPropagation(),this._TestFinalKeyFrame(e)?t._PerformAnimationEnd(!0):(this._AnimationRunIndex++,this._LayoutViewRef.Element.style.animation=this._AnimRunList[this._AnimationRunIndex],this._Progress.TriggerNextStep(this._AnimationRunIndex),t._OnSubKeyFrameDone(e))}}Start(e){super.Start(e),e.ResetCssTransform(null,null),e.Element&&(e.Element.style.pointerEvents="auto"),this._EnableCssAnimation(this._BuildKeyFrameGroup(),this._OnEndEvent)}Cancel(){super.Cancel(),this._PerformAnimationEnd(!1)}_EnableCssAnimation(e,t){if(null===e)return;this._KeyFrameArray=new Array(e.length);const i=Ze();for(let t=0;t<e.length;t++){const s=e[t];this.CheckCssAnimationFormat(s.name),this._KeyFrameArray[t]={name:s.name,easing:s.ease.Package(),duration:s.duration,needRecycle:!1},null!==s.keyFrameString&&(i.insertRule(s.keyFrameString),this._KeyFrameArray.needRecycle=!0)}const s=this._LayoutViewRef.Element;0==(this.enableFlags&F.AnimationEnable.AckFinalProgress)&&0==(this.enableFlags&F.AnimationEnable.KeepTransform)||(this._Progress=new lt(this._LayoutViewRef,this._KeyFrameArray.length),this._Progress.Start(this._KeyFrameArray)),this._AnimRunList=this._ConvertToAnimationStyle(this._KeyFrameArray),this._AnimationRunIndex=0,window.jsvInAndroidWebView?(s.style.webkitAnimation=this._AnimRunList[0],s.addEventListener("webkitAnimationEnd",t)):(s.style.animation=this._AnimRunList[0],s.addEventListener("animationend",t)),this._CurrentEndEventFunc=t}_PerformAnimationEnd(e){if(null!==this._CurrentEndEventFunc){const e=this._LayoutViewRef.Element,t=this._CurrentEndEventFunc;setTimeout((()=>{window.jsvInAndroidWebView?e.removeEventListener("webkitAnimationEnd",t):e.removeEventListener("animationend",t)}),0),this._CurrentEndEventFunc=null}if(null===this._Progress)return void(e&&this.OnEnd());let t=this._Progress.Stop();if(e&&(t=1),0!=(this.enableFlags&F.AnimationEnable.KeepTransform)){const e=this._GetFrozenTransform(t);this._LayoutViewRef.ResetCssTransform(e.transform,e.transformOrigin)}e&&this.OnEnd(),0!=(this.enableFlags&F.AnimationEnable.AckFinalProgress)&&window.setTimeout((()=>{this.OnFinalProgress(t)}),0);const i=Ze();for(const e of this._KeyFrameArray)e.needRecycle&&i.removeRule(e.name);this._KeyFrameArray=null}_ConvertToAnimationStyle(e){const t=[];for(let i=0;i<e.length;i++){let s="linear";const n=e[i];n.easing&&(s=Qe(n.easing)),t.push(`${n.name} ${n.duration/1e3}s ${s}`)}return t}_BuildKeyFrameGroup(){console.warn("Warning:Should override and return keyframe name")}_GetFrozenTransform(e){console.warn("Warning:Should override and keep view transform by ResetCssTransform()")}_TestFinalKeyFrame(e){console.warn("Warning:Should override")}_OnSubKeyFrameDone(e){console.warn("Warning:Should override")}};let gt=class extends F.TranslateAnimation{constructor(e,t,i,s,n,r){let a=n,o=r,l=n,h=r;s?(a=e,l=t):(o=e,h=t);super(a,l,o,h,Math.abs(Math.floor((t-e)/i*1e3)),null)}};F.TranslateFrameAnimation=gt;let ft=class extends F.KeyFrameGroupAnimation{constructor(e,t,i,s,n,r,a,o){super("Thr"),this._FromX=e,this._FromY=t,this._XorY=i,this._InitV=s,this._Acc=n,this._To=r,this._HasPole=a,this._PoleCallback=null,this._PolePosition=o,this._IsPositiveMove=this._InitV>0||0===this._InitV&&this._Acc>0}SetPoleCallback(e){this._PoleCallback=e}_MakeTranslateString(e,t,i){return`@keyframes ${e} {0%{transform:translate3d(${t.x.value}px,${t.y.value}px,0);}100%{transform:translate3d(${i.x.value}px,${i.y.value}px,0);}}`}_BuildKeyFrameGroup(){const e=""+ht++,t=[],i={x:{value:this._FromX},y:{value:this._FromY}},s={x:{value:this._FromX},y:{value:this._FromY}},n=0===this._XorY?i.x:i.y,r=0===this._XorY?s.x:s.y;if(this._HasPole){let a=`_ForgeAnim_Thr_Forw_${e}`;r.value=this._PolePosition;let o=this._MakeTranslateString(a,i,s);t.push({name:a,keyFrameString:o,ease:F.Easing.Circular.Out,duration:Math.floor(-this._InitV/this._Acc*1e3)}),a=`_ForgeAnim_Thr_Backw_${e}`,n.value=this._PolePosition,r.value=this._To,o=this._MakeTranslateString(a,i,s),t.push({name:a,keyFrameString:o,ease:F.Easing.Circular.In,duration:Math.floor(1e3*Math.sqrt(2*(this._To-this._PolePosition)/this._Acc))})}else{const a=`_ForgeAnim_Thr_Forw_${e}`;r.value=this._To;const o=this._MakeTranslateString(a,i,s),l=this._IsPositiveMove?this._InitV:-this._InitV,h=this._IsPositiveMove?this._Acc:-this._Acc,c=this._IsPositiveMove?r.value-n.value:n.value-r.value;t.push({name:a,keyFrameString:o,ease:h>0?F.Easing.Circular.In:F.Easing.Circular.Out,duration:Math.floor((Math.sqrt(l*l+2*h*c)-l)/h*1e3)})}return t}_GetFrozenTransform(e){const t={x:{value:this._FromX},y:{value:this._FromY}};let i=0===this._XorY?t.x.value:t.y.value;const s=0===this._XorY?t.x:t.y;let n=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 t=(2*a-i-r)*e;n=t>a-i?a-(t-(a-i)):i+t}else n=i+(r-i)*e;s.value=Math.floor(this._IsPositiveMove?n:-n);return{transform:`translate3d(${t.x.value}px,${t.y.value}px,0)`,transformOrigin:null}}_TestFinalKeyFrame(e){return this._HasPole?e.animationName.indexOf("_ForgeAnim_Thr_Backw_")>=0:e.animationName.indexOf("_ForgeAnim_Thr_Forw_")>=0}_OnSubKeyFrameDone(e){this._HasPole&&this._PoleCallback&&this._PoleCallback()}};F.ThrowAnimation=ft;let mt={ReleaseAfterEndCallback:1,KeepTransform:2,AckFinalProgress:4,AckRepeat:8};F.AnimationEnable=mt,F.AnimFireCommand={AltSpeed:(e,t,i)=>{},RunFreeMoveCmdPacks:(e,t)=>{e.TransformAnimationObj.doCommand(t)}},F.FreeMoveActEvtType={ActEvent_ActFinish:1,ActEvent_Speed_X_Revert:2,ActEvent_Speed_Y_Revert:3,ActEvent_ActReject:4};let pt=0;class yt extends F.AnimationDelegate{constructor(e,t){super(e,t,null),this._StepsCount=1,this._Running=!1,this._NextStepIndex=0;const i=this;this._OnStepEnd=()=>{i._NextStep()}}SetStepsCount(e){this._StepsCount=e,this._SplitSteps()}Start(e){super.Start(e),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&&(Ze().removeRule(this._KeyFrameName),this._KeyFrameName=null);const e=this._NextStepIndex===this._StepsCount;if(!this._Running||e)return void this._PerformAnimationEnd(e);const t=this._CreateOneStepKeyFrame(this._NextStepIndex);this._KeyFrameName=t.name,Ze().insertRule(t.keyFrameString);const i=et({repeatTimes:this.repeatTimes,easing:this.easing,delayedTime:0,duration:this.duration/this._StepsCount},this._KeyFrameName),s=this._LayoutViewRef.Element;window.jsvInAndroidWebView?s.style.webkitAnimation=i:s.style.animation=i,this._NextStepIndex++}_PerformAnimationEnd(e){window.jsvInAndroidWebView?this._LayoutViewRef.Element.removeEventListener("webkitAnimationEnd",this._OnStepEnd):this._LayoutViewRef.Element.removeEventListener("animationend",this._OnStepEnd);const t=this._NextStepIndex/this._StepsCount;if(0!=(this.enableFlags&F.AnimationEnable.KeepTransform)){const e=this._GetFrozenTransform(this._NextStepIndex-1);this._LayoutViewRef.ResetCssTransform(e.transform,e.transformOrigin)}e&&this.OnEnd(),window.setTimeout((()=>{this.OnFinalProgress(t)}),0)}_GetFrozenTransform(e){console.warn("Warning:Should override and keep view transform by ResetCssTransform()")}_SplitSteps(){console.warn("Warning: should be override by child class")}_CreateOneStepKeyFrame(e){console.warn("Warning: should be override by child class")}}F.TranslateStepAnimation=class extends yt{constructor(e,t,i,s,n){super("TL-S",n),this.startX=e,this.startY=i,this.endX=t,this.endY=s,this._StepsArray=null}_SplitSteps(){const e=this._StepsCount,t=(this.endX-this.startX)/e,i=(this.endY-this.startY)/e;this._StepsArray=new Array(e);let s=this.startX,n=this.startY;for(let r=0;r<e-1;r++)s+=t,n+=i,this._StepsArray[r]={targetX:Math.floor(s),targetY:Math.floor(n)};this._StepsArray[e-1]={targetX:this.endX,targetY:this.endY}}_CreateOneStepKeyFrame(e){let t=0,i=0;0===e?(t=this.startX,i=this.startY):(t=this._StepsArray[e-1].targetX,i=this._StepsArray[e-1].targetY);const s=this._StepsArray[e].targetX,n=this._StepsArray[e].targetY,r="_ForgeStepAnim_TL_"+pt++;return{name:r,keyFrameString:`@keyframes ${r} {\n 0%{transform:translate3d(${t}px,${i}px,0);}\n 100%{transform:translate3d(${s}px,${n}px,0);}}`}}_GetFrozenTransform(e){return{transform:`translate3d(${this._StepsArray[e].targetX}px,${this._StepsArray[e].targetY}px,0)`,transformOrigin:null}}};F.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 e=!1;if(F.sViewSensorManager.HtmlHasActiveSensor()&&(F.sViewSensorManager.HtmlDoWorkOnFrame(),F.sViewSensorManager.HtmlHasActiveSensor()&&(e=!0)),this._CallbacksPerFrame.size>0){for(const e of this._CallbacksPerFrame)e();this._CallbacksPerFrame.size>0&&(e=!0)}e?window.requestAnimationFrame(this._FrameLoopFunc):this._FrameLoopFunc=null}GetScreenInfo(){return this._ScreenInfo}InitScreenBuffer(e,t){isNaN(e)&&(e=1),isNaN(t)&&(t=1280);const i=t*e,s=i/16*9;this._ScreenInfo.width=Math.floor(i),this._ScreenInfo.height=Math.floor(s),this._ScreenInfo.x=2/this._ScreenInfo.width,this._ScreenInfo.y=2/this._ScreenInfo.height,this._ScreenInfo.perspective=this._ScreenInfo.x,this._ScreenInfo.scaleRatio=e,this._ScreenInfo.designedWidth=t}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(e){}AddWillSwapListener(e,t){this._WillSwapCallbacks.set(e,t)}AddAfterSwapListener(e,t){this._AfterSwapCallbacks.set(e,t)}_DoRequestSwap(){this._WillSwapCallbacks.size>0&&this._WillSwapCallbacks.forEach(this._DoWillSwapCallback),this._AfterSwapCallbacks.size>0&&this._AfterSwapCallbacks.forEach(this._DoAfterSwapCallback),this._OnRequesting=!1,F.sFrameCount.update()}GetSwapCount(){return F.sFrameCount.count}InstantPerformSwap(){this._OnRequesting&&(this._OnRequesting=!1,this._DoRequestSwap(!1))}_OnWillSwap(e){e()}_OnAfterSwap(e){e()}RegisterPerFrameCallback(e){this._CallbacksPerFrame.add(e),this.BeginHtmlFrameLoop()}UnregisterPerFrameCallback(e){this._CallbacksPerFrame.delete(e)}HasPendingRenderBreak(){return!1}FinishRenderBreak(){}};let Tt=new F.RenderBridge;F.sRenderBridge=Tt;class _t{constructor(e,t,i){this._TextureManager=e,this._GL=t,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)}}_t.IMAGE=Symbol("Texture.IMAGE"),_t.COLOR=Symbol("Texture.COLOR");class xt extends _t{constructor(e,t,i,s){if(super(e,t,i),s){const e=s.trim();if(0===e.indexOf("http"))this.Url=e;else if(0===e.indexOf("url")){const t=e.indexOf("("),i=e.indexOf(")");this.Url=e.substring(t+1,i)}else this.Url=s;this._TextureSource=new Image,this._TextureSource.onload=()=>{this._setGLTexture(),this._Loaded=!0,this._OnLoad&&this._OnLoad()},this._TextureSource.src=this.Url,this._TextureSource.crossOrigin="*",this._TextureSource.crossOrigin="Anonymous"}}}class wt{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(e,t,i,s){const n=this._GL.createImageData(1,1);return n.data[0]=e,n.data[1]=t,n.data[2]=i,n.data[3]=s,n}}let St=null;class vt extends _t{constructor(e,t,i,s){super(e,t,i),null===St&&(St=new wt),this.Color=s;const n=(e=>{if(!e)return null;if(0===(e=e.trim()).indexOf("rgba")){const t=e.indexOf("("),i=e.indexOf(")");return e.substr(t+1,i-t-1).split(",").map(((e,t)=>3===t?Math.ceil(255*parseFloat(e)):parseInt(e,10)))}if(0===e.indexOf("#")){let t=e.substr(1);const i=t.length;if(6===i||8===i){6===i&&(t+="FF");const e=parseInt(`0x${t}`,10);return[e>>24&255,e>>16&255,e>>8&255,255&e]}return null}return null})(this.Color);this._TextureSource=St.getColorImageData(...n),this._setGLTexture(),this._Loaded=!0,this._OnLoad&&this._OnLoad()}}const Et=new class{constructor(){this._TextureMap={}}getTexture(e,t,i,s){let n;if(this._TextureMap[s])n=this._TextureMap[s].texture,this._TextureMap[s].useCount++;else{switch(e){case _t.IMAGE:n=new xt(this,t,i,s);break;case _t.COLOR:n=new vt(this,t,i,s);break;default:console.log(`getTexture type is error:${e}`)}this._TextureMap[s]={texture:n,useCount:1}}return n}recycle(e){this._TextureMap[e]&&(this._TextureMap[e].useCount--,this._TextureMap[e].useCount<0&&delete this._TextureMap[e])}},bt=(e,t)=>Math.random()*(t-e)+e;class Ct{constructor(e,t,i,s,n){this._ViewId=e,this._Type=t.type,this._ParticleNum=t.particleNum,this._DeltaAngle=t.deltaAngle/180*Math.PI,this._DeltaWidthFact=t.deltaWidth/s.width,this._DeltaHeightFact=t.deltaHeight/s.height,this._PointSizeMin=t.pointSizeMin,this._PointSizeMax=t.pointSizeMax,this._SpeedMin=t.speedMin,this._SpeedMax=t.speedMax,this._LifeMin=t.lifeMin/1e3,this._LifeMax=t.lifeMax/1e3,this._AddNumSpeed=t.addNumSpeed,this._AcceletateX=t.accelerateX,this._AcceletateY=t.accelerateY,this._EnableFade=t.enableFade,this._EnableShrink=t.enableShrink,this._AngularVelocityMin=0,this._AngularVelocityMax=0,"number"==typeof t.angularVelocityMin&&"number"==typeof t.angularVelocityMax&&(this._AngularVelocityMin=t.angularVelocityMin,this._AngularVelocityMax=t.angularVelocityMax),this._AlphaMin=1,this._AlphaMax=1,"number"==typeof t.alphaMin&&"number"==typeof t.alphaMax&&(this._AlphaMin=t.alphaMin,this._AlphaMax=t.alphaMax),this._Texture=i,this._Buffer=new Float32Array(9*this._ParticleNum),this._AddedParticleNum=0,this._DomProxyView=n,this._StartTime=-1,this._LastFrameTime=-1,this._Stopped=!1,this._getTransform=this._getTransform.bind(this)}_getTransform(){let e=this._DomProxyView.HtmlGetElement();const t=Pt(e.style.width),i=Pt(e.style.height);let s=new window.WebKitCSSMatrix;for(;e.parentNode;){const t=getComputedStyle(e);if(t.transform){const i=t.transformOrigin?t.transformOrigin:t.webkitTransformOrigin;if(i){const n=Pt(i),r=new window.WebKitCSSMatrix(`translate(-${n[0]}px,-${n[1]}px)`),a=new window.WebKitCSSMatrix(`translate(${n[0]}px,${n[1]}px)`),o=new window.WebKitCSSMatrix(`translate(${e.offsetLeft}px,${e.offsetTop}px)`),l=new window.WebKitCSSMatrix(t.transform);s=o.multiply(a.multiply(l.multiply(r.multiply(s))))}else s=new window.WebKitCSSMatrix(t.transform).multiply(s)}e=e.parentNode}const n=new window.WebKitCSSMatrix;n.m11=0,n.m12=0,n.m14=1,n.m21=t,n.m22=0,n.m24=1,n.m31=0,n.m32=i,n.m34=1,n.m41=t,n.m42=i,n.m44=1,s=s.multiply(n);return[s.m11,s.m12,s.m21,s.m22,s.m31,s.m32,s.m41,s.m42]}_updateParticleInfo(e,t,i,s,n,r){const a=bt(0,2*this._DeltaWidthFact),o=bt(0,2*this._DeltaHeightFact);this._Buffer[9*e]=a*i[0]+o*s[0]+t[0],this._Buffer[9*e+1]=a*i[1]+o*s[1]+t[1],this._Buffer[9*e+2]=n+bt(-this._DeltaAngle,this._DeltaAngle),this._Buffer[9*e+3]=bt(this._SpeedMin,this._SpeedMax),this._Buffer[9*e+4]=r,this._Buffer[9*e+5]=bt(this._LifeMin,this._LifeMax),this._Buffer[9*e+6]=bt(this._PointSizeMin,this._PointSizeMax),this._Buffer[9*e+7]=bt(this._AngularVelocityMin,this._AngularVelocityMax),this._Buffer[9*e+8]=bt(this._AlphaMin,this._AlphaMax)}onDrawFrame(e,t,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 s=this._getTransform();for(let e=0;e<s.length;e++)s[e]=e%2==0?2*s[e]/window.innerWidth-1:1-2*s[e]/window.innerHeight;const n=(Date.now()-this._StartTime)/1e3,r=[s[0],s[1]],a=[s[2]-s[0],s[3]-s[1]],o=[s[4]-s[0],s[5]-s[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 e=0;e<this._ParticleNum;e++)this._updateParticleInfo(e,r,a,o,c,n);this._AddedParticleNum=this._ParticleNum}else{let e=!0;for(let t=0;t<this._ParticleNum;t++)if(this._Buffer[9*t+4]+this._Buffer[9*t+5]>n){e=!1;break}e&&(this._Stopped=!0)}else if(this._AddedParticleNum<this._ParticleNum){let e=Math.round((Date.now()-this._LastFrameTime)*this._AddNumSpeed);this._AddedParticleNum+e>this._ParticleNum&&(e=this._ParticleNum-this._AddedParticleNum);for(let t=0;t<e;t++)this._updateParticleInfo(this._AddedParticleNum+t,r,a,o,c,n);this._AddedParticleNum+=e}else for(let e=0;e<this._ParticleNum;e++)this._Buffer[9*e+4]+this._Buffer[9*e+5]<n&&this._updateParticleInfo(e,r,a,o,c,n);const u=e.getUniformLocation(t,"uTime");e.uniform1f(u,n);const d=e.getUniformLocation(t,"uAccelerate");e.uniform2f(d,this._AcceletateX,this._AcceletateY);const g=e.getUniformLocation(t,"uEnableFade");e.uniform1i(g,this._EnableFade?1:0);const f=e.getUniformLocation(t,"uEnableShrink");e.uniform1i(f,this._EnableShrink?1:0),e.bindBuffer(e.ARRAY_BUFFER,i),e.activeTexture(e.TEXTURE0),e.bindTexture(e.TEXTURE_2D,this._Texture.TextureId),e.bufferSubData(e.ARRAY_BUFFER,0,this._Buffer);const m=this._Buffer.BYTES_PER_ELEMENT,p=e.getAttribLocation(t,"aPosition");e.vertexAttribPointer(p,2,e.FLOAT,!1,9*m,0),e.enableVertexAttribArray(p);const y=e.getAttribLocation(t,"aSpeed");e.vertexAttribPointer(y,2,e.FLOAT,!1,9*m,2*m),e.enableVertexAttribArray(y);const T=e.getAttribLocation(t,"aLife");e.vertexAttribPointer(T,2,e.FLOAT,!1,9*m,4*m),e.enableVertexAttribArray(T);const _=e.getAttribLocation(t,"aPointSize");e.vertexAttribPointer(_,1,e.FLOAT,!1,9*m,6*m),e.enableVertexAttribArray(_);const x=e.getAttribLocation(t,"aAngularVelocity");e.vertexAttribPointer(x,1,e.FLOAT,!1,9*m,7*m),e.enableVertexAttribArray(x);const w=e.getAttribLocation(t,"aAlpha");e.vertexAttribPointer(w,1,e.FLOAT,!1,9*m,8*m),e.enableVertexAttribArray(w),e.drawArrays(e.POINTS,0,this._AddedParticleNum)}recycle(){this._Buffer=null,this._Texture.recycle(),this._Stopped=!0}}let It=0;let At=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 e=this._GL.createShader(this._GL.VERTEX_SHADER);this._GL.shaderSource(e,"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(e);const t=this._GL.createShader(this._GL.FRAGMENT_SHADER);this._GL.shaderSource(t,"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(t),this._GLProgram=this._GL.createProgram(),this._GL.attachShader(this._GLProgram,e),this._GL.attachShader(this._GLProgram,t),this._GL.linkProgram(this._GLProgram);const i=new Float32Array(4500),s=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 n=this._GL.getAttribLocation(this._GLProgram,"aPosition");this._GL.vertexAttribPointer(n,2,this._GL.FLOAT,!1,9*s,0),this._GL.enableVertexAttribArray(n);const r=this._GL.getAttribLocation(this._GLProgram,"aSpeed");this._GL.vertexAttribPointer(r,2,this._GL.FLOAT,!1,9*s,2*s),this._GL.enableVertexAttribArray(r);const a=this._GL.getAttribLocation(this._GLProgram,"aLife");this._GL.vertexAttribPointer(a,2,this._GL.FLOAT,!1,9*s,4*s),this._GL.enableVertexAttribArray(a);const o=this._GL.getAttribLocation(this._GLProgram,"aPointSize");this._GL.vertexAttribPointer(o,1,this._GL.FLOAT,!1,9*s,6*s),this._GL.enableVertexAttribArray(o);const l=this._GL.getAttribLocation(this._GLProgram,"aAngularVelocity");this._GL.vertexAttribPointer(l,1,this._GL.FLOAT,!1,9*s,7*s),this._GL.enableVertexAttribArray(l);const h=this._GL.getAttribLocation(this._GLProgram,"aAlpha");this._GL.vertexAttribPointer(h,1,this._GL.FLOAT,!1,9*s,8*s),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 e in this._ParticleViewMap)this._ParticleViewMap.hasOwnProperty(e)&&this._ParticleViewMap[e].onDrawFrame(this._GL,this._GLProgram,this._VBO);window.requestAnimationFrame(this._onDrawFrame)}addParticle(e,t,i,s){this._Inited||this._initCanvas();const n=It++;let r;return r=0===t.indexOf("rgba")||0===t.indexOf("#")?Et.getTexture(_t.COLOR,this._GL,null,t):Et.getTexture(_t.IMAGE,this._GL,null,t),this._ParticleViewMap[n]=new Ct(n,e,r,i,s),this._LoopStarted||(this._LoopStarted=!0,window.requestAnimationFrame(this._onDrawFrame)),n}recycleView(e){this._ParticleViewMap[e]&&(this._ParticleViewMap[e].recycle(),delete this._ParticleViewMap[e])}};F.sParticleManager=At;let Pt=e=>{if(e.indexOf(" ")>=0){return e.split(" ").map((e=>parseInt(e.substr(0,e.length-2),10)))}return parseInt(e.substr(0,e.length-2),10)};F.ReactUtils={StyleClassMap:{}};{let ns=0;class rs{constructor(e,t){this._ID=t||e+ns++,this.Describe={},this._RefCount=0,this._Recycled=!1}ManualSetId(e){this._ID=e}GetId(){return this._ID}DoRef(){this._RefCount++}UnRef(){this._RefCount>0?this._RefCount--:console.warn("Already 0...")}}class as extends rs{constructor(e){super(null,e)}}const os=new as("DISABLE"),ls={alignment:"left",vertical_align:"top",vertical_area_align:"top",text_overflow:"clip",word_wrap:"normal",direction:"ltr"},hs=["alignment","vertical_align","vertical_area_align","text_overflow","word_wrap","direction"];class cs extends rs{constructor(e,t,i,s,n,r){super("DS",null),this.Describe.alignment=e,this.Describe.vertical_align=t,this.Describe.vertical_area_align=i,this.Describe.text_overflow=s,this.Describe.word_wrap=n,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 us={font:"黑体",italic:!1,bold:!1},ds=["font","italic","bold"];class gs extends rs{constructor(e,t,i){super("FS",null),this.Describe.font=e,this.Describe.italic=t,this.Describe.bold=i}GetSyncData(){return{T:1,ID:this._ID,F:this.Describe.font,I:this.Describe.italic,B:this.Describe.bold}}}const fs={text_color:"#000000",bg_color:"#FFFFFF00"},ms=["text_color","bg_color"];class ps extends rs{constructor(e,t){super("CS",null),this.Describe.text_color=e,this.Describe.bg_color=t}GetSyncData(){return{T:2,ID:this._ID,TC:this.Describe.text_color,BC:this.Describe.bg_color}}}const ys=["shadow_offset_x","shadow_offset_y","shadow_blur","shadow_color","stroke_width","stroke_color"];class Ts extends rs{constructor(e,t,i,s,n,r){super("SS",null),this.Describe.shadow_offset_x=e,this.Describe.shadow_offset_y=t,this.Describe.shadow_blur=i,this.Describe.shadow_color=s,this.Describe.stroke_width=n,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 _s{constructor(e){this.DS=F.sTextStyleCache.GetDisplayStyle(e),this.FS=F.sTextStyleCache.GetFontStyle(e),this.CS=F.sTextStyleCache.GetColorStyle(e),this.SS=F.sTextStyleCache.GetSpecialStyle(e),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 xs{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(e){let t={alignment:void 0!==e.hAlign?e.hAlign:ls.alignment,vertical_align:void 0!==e.vAlign?e.vAlign:ls.vertical_align,vertical_area_align:void 0!==e.vAreaAlign?e.vAreaAlign:ls.vertical_area_align,text_overflow:void 0!==e.textOverflow?e.textOverflow:ls.text_overflow,word_wrap:void 0!==e.wordWrap?e.wordWrap:ls.word_wrap,font:void 0!==e.font?e.font:us.font,italic:void 0!==e.italic?e.italic:us.italic,bold:void 0!==e.bold?e.bold:us.bold,text_color:void 0!==e.textColor?e.textColor:fs.text_color,bg_color:void 0!==e.backgroundColor?e.backgroundColor:fs.bg_color,direction:void 0!==e.direction?e.direction:"ltr",shadow_offset_x:0,shadow_offset_y:0,shadow_blur:0,shadow_color:null,stroke_width:0,stroke_color:null};if(e.shadow){const i=e.shadow;t.shadow_offset_x=i.shadowOffsetX,t.shadow_offset_y=i.shadowOffsetY,t.shadow_blur=i.shadowBlur,t.shadow_color=i.shadowColor}if(e.stroke){const i=e.stroke;t.stroke_width=i.strokeWidth,t.stroke_color=i.strokeColor}return new _s(t)}PrepareSyncNewStyles(){if(this._NewStyleList.length>0){let e=[];for(let t of this._NewStyleList)e.push(t.GetSyncData());F.sRenderTextureDelegateManager.CreateTextureHeadStatus().SetResourceInfo({STA:{Nam:"TST",Sta:e}}),this._NewStyleList=[]}}GetDisplayStyle(e){return this._GetStyle(e,hs,cs,this._DisplayStyleMap,this._DisplayStyleIds)}GetFontStyle(e){return this._GetStyle(e,ds,gs,this._FontStyleMap,this._FontStyleIds)}GetColorStyle(e){return this._GetStyle(e,ms,ps,this._ColorStyleMap,this._ColorStyleIds)}GetSpecialStyle(e){return 0===e.shadow_blur&&0===e.stroke_width?os:this._GetStyle(e,ys,Ts,this._SpecialStyleMap,this._SpecialStyleIds)}GetDsFromId(e){return this._DisplayStyleIds.get(e)}GetFsFromId(e){return this._FontStyleIds.get(e)}GetCsFromId(e){return this._ColorStyleIds.get(e)}GetSsFromId(e){return this._SpecialStyleIds.get(e)}_GetStyle(e,t,i,s,n){let r=[];for(let i of t)r.push(e[i]);let a=r.join(":"),o=null;return s.has(a)?o=s.get(a):(o=new i(...r),s.set(a,o),n.set(o.GetId(),o),window.JsView&&this._NewStyleList.push(o)),o}}F.TextStyleObjectBase=rs,F.TextStylePack=_s,F.sTextStyleCache=new xs}{let ws=1,Ss=2,vs=3;class Es{constructor(e,t){this.IdToken=F.sViewSensorManager.IdTokenGenerator++,this.Type=e,this.Manager=null,this._OnAnyViewLostList=null,this._AnyViewLostMark=null,this._OnWholeViewLostList=null,this._WholeViewLostMark=null,this._HtmlStatusInfo={target:null==t?ws:Ss}}OnManaged(e){return this._HtmlStatusInfo.target!=vs&&(this.Manager?(console.error("manage duplicated"),!1):(this._RegisterViewLostCallbacks(),this.Manager=e,!0))}ResetAutoRecycleViewsRef(e,t){e instanceof Array&&t instanceof Array?this._HtmlStatusInfo.target!=vs&&(this._UnregisterViewCallbacks(),this._OnAnyViewLostList=e,this._OnWholdViewLostList=t,this.Manager&&this._RegisterViewLostCallbacks()):console.error("need array ",e,t)}Expired(){return this._HtmlStatusInfo.target==vs}Recycle(){this._HtmlStatusInfo.target!=vs&&this.Manager&&(this._HtmlStatusInfo.target=vs,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(e){console.log("Need be override")}OnSelfRecycle(){}_RegisterViewLostCallbacks(){let e=this;if(this._OnAnyViewLostList?.length>0){let t=this._OnAnyViewLostList.length;this._AnyViewLostMark={callbacks:new Array(t).fill(null)};for(let i=0;i<t;i++){let t=this._OnAnyViewLostList[i];if(t.HtmlCanAccessElement()&&t.Expired)this._OnAnyViewLostList[i]=null;else{let s=()=>{e.Recycle()};this._AnyViewLostMark.callbacks[i]=s,t.RegisterDetachCallback(s)}}}else this._AnyViewLostMark=null;if(this._OnWholeViewLostList?.length>0){let t=this._OnWholeViewLostList.length;this._WholeViewLostMark={list:new Array(t).fill({callback:null,lost:!1}),lostCount:0};for(let i=0;i<t;i++){let t=this._OnWholeViewLostList[i];if(t.HtmlCanAccessElement()&&t.Expired)this._OnWholeViewLostList[i]=null,this._WholeViewLostMark.list[i].lost=!0,this._WholeViewLostMark.lostCount++;else{let s=()=>{e._OnViewOfWholeListLost(i)};this._WholeViewLostMark.list[i].callback=s,t.RegisterDetachCallback(s)}}}else this._WholeViewLostMark=null}_UnregisterViewCallbacks(){if(this._AnyViewLostMark){let e=this._OnAnyViewLostList.length;for(let t=0;t<e;t++){this._OnAnyViewLostList[t]&&this._OnAnyViewLostList[t].UnregisterDetachCallback(this._AnyViewLostMark.callbacks[t])}this._AnyViewLostMark=null}if(this._WholeViewLostMark){let e=this._OnWholdViewLostList.length;for(let t=0;t<e;t++){this._OnWholdViewLostList[t]&&this._OnWholdViewLostList[t].UnregisterDetachCallback(this._WholeViewLostMark.list[t].callback)}this._WholeViewLostMark=null}}_OnViewOfWholeListLost(e){this._WholeViewLostMark.list[e].lost||(this._WholeViewLostMark.lostCount++,this._WholeViewLostMark.list[e].lost=!0,this._WholeViewLostMark.list[view_idx].callback=null,this._OnWholdViewLostList[e]=null),this._WholeViewLostMark.lostCount==this._OnWholeViewLostList.length&&this.Recycle()}}Es.TypeDefines={TYPE_IMPACT:1,TYPE_FROZE_SET:2,TYPE_ON_SCREEN:3,TYPE_ENV_BLOCK:3,TYPE_DRAG_IMPACT:101},F.ViewSensor=Es}{class bs{constructor(){this._SensorMaps={},this.IdTokenGenerator=77}HtmlDoWorkOnFrame(){for(let e in this._SensorMaps){let t=this._SensorMaps[e];t.Expired()?delete this._SensorMaps[e]:t.HtmlDoWorkOnFrame()}}HtmlHasActiveSensor(){for(let e in this._SensorMaps)if(this._SensorMaps[e].HtmlNeedWorkOnFrame())return!0;return!1}AddSensor(e){if(e){e.OnManaged(this)&&(this._SensorMaps[e.IdToken]=e),this.RequestSwap()}}AddToSyncList(e){this._SensorMaps.hasOwnProperty(e.IdToken)||console.error("Error: (Add)No in map",this._SensorMaps,e)}RecycleSensor(e){this._SensorMaps.hasOwnProperty(e.IdToken)?(delete this._SensorMaps[e.IdToken],this.RequestSwap()):console.error("Error: (del)No in map",this._SensorMaps,e)}RequestSwap(){F.sRenderBridge.BeginHtmlFrameLoop()}}F.sViewSensorManager=new bs}class Lt{constructor(e,t,i){this.element=i,this.row=e,this.column=t}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(e){if(this.column!==e.row)throw new Error("matrix multiply error");const t=[];for(let i=0;i<this.row;i++)for(let s=0;s<e.column;s++){t[i+s*e.column]=0;for(let n=0;n<this.column;n++)t[i+s*e.column]+=this.element[i+n*this.column]*e.element[n+s*e.column]}return new Lt(this.row,e.column,t)}static identity(){return new Lt(4,4,[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])}static translate(e,t,i){return new Lt(4,4,[1,0,0,0,0,1,0,0,0,0,1,0,e,t,i,1])}static scale(e,t,i){return new Lt(4,4,[e,0,0,0,0,t,0,0,0,0,i,0,0,0,0,1])}static rotate(e,t,i,s){const n=Math.cos(s/180*Math.PI),r=Math.sin(s/180*Math.PI),a=Math.sqrt(e*e+t*t+i*i);if(1!==a){const s=1/a;e*=s,t*=s,i*=s}const o=1-n,l=e*t,h=t*i,c=i*e,u=e*r,d=t*r,g=i*r,f=[];return f[0]=e*e*o+n,f[1]=l*o+g,f[2]=c*o-d,f[3]=0,f[4]=l*o-g,f[5]=t*t*o+n,f[6]=h*o+u,f[7]=0,f[8]=c*o+d,f[9]=h*o-u,f[10]=i*i*o+n,f[11]=0,f[12]=0,f[13]=0,f[14]=0,f[15]=1,new Lt(4,4,f)}static skew(e,t){const i=new Array(16).fill(0),s=2*Math.PI*(t/360),n=-2*Math.PI*(e/360);return i[0]=1-n*s,i[1]=-Math.tan(s),i[4]=Math.tan(n),i[5]=1,i[10]=1,i[15]=1,new Lt(4,4,i)}static transform2d(e,t,i,s,n,r){return new Lt(4,4,[e,t,0,0,i,s,0,0,0,0,1,0,n,r,0,1])}}const kt=e=>e>=65&&e<=90||e>=97&&e<=122,Rt=e=>e>=48&&e<=57,Ft=(e,t)=>{switch(e){case"translate3d":return Lt.translate(t[0],t[1],t[2]);case"scale3d":return Lt.scale(t[0],t[1],t[2]);case"rotate3d":return Lt.rotate(t[0],t[1],t[2],t[3]);case"skew":return Lt.skew(t[0],t[1]);case"matrix":return Lt.transform2d(t[0],t[1],t[2],t[3],t[4],t[5]);case"matrix3d":return new Lt(4,4,t);default:throw new Error(`no support type ${e}`)}},Dt=e=>{let t=Lt.identity();if(!e)return t;let i="",s="",n=[],r=0;for(let a=0;a<e.length;a++){const o=e.charCodeAt(a);0===r?(kt(o)||Rt(o))&&(i+=e[a]):(Rt(o)||46===o||45===o||101===o)&&(s+=e[a]),40===o?(r=1,s="",n=[]):41===o?(n.push(parseFloat(s)),t=t.multiply(Ft(i,n)),i="",r=0):44===o&&(n.push(parseFloat(s)),s="")}return t},Vt=e=>{if(e.indexOf(" ")>=0){return e.split(" ").map((e=>parseInt(e.substr(0,e.length-2),10)))}return parseInt(e.substr(0,e.length-2),10)},Ot=e=>{let t=e;const i=Vt(t.style.width),s=Vt(t.style.height);let n=Lt.identity();for(;t.parentNode;){const e=getComputedStyle(t),i=e.transform?e.transform:e.webkitTransform;if(i){const s=e.transformOrigin?e.transformOrigin:e.webkitTransformOrigin,r=Dt(i);if(s){const e=Vt(s),i=Lt.translate(-e[0],-e[1],0),a=Lt.translate(e[0],e[1],0);n=Lt.translate(t.offsetLeft,t.offsetTop,0).multiply(a.multiply(r.multiply(i.multiply(n))))}else n=r.multiply(n)}t=t.parentNode}const r=new Lt(4,4,[0,0,0,1,i,0,0,1,0,s,0,1,i,s,0,1]);n=n.multiply(r);const a=n.element;return[a[0],a[1],a[4],a[5],a[8],a[9],a[12],a[13]]};function Mt(e){let t=Ot(e),i=Math.min(t[0],t[2],t[4],t[6]),s=Math.max(t[0],t[2],t[4],t[6]);return[Math.min(t[1],t[3],t[5],t[7]),Math.max(t[1],t[3],t[5],t[7]),i,s]}class Nt{constructor(e,t){this.set(e,t)}add(e,t){return e instanceof Nt?(this.x+=e.x,this.y+=e.y):(this.x+=e||0,this.y+=t||0),this}angle(e){if(void 0!==e)return this.set(this.length(),0).rotate(e);let t=Math.atan2(this.y,this.x);return t<0&&(t+=2*Math.PI),t}angleDeg(e){return void 0!==e?this.angle(e/180*Math.PI):180*this.angle()/Math.PI}clone(){return new Nt(this.x,this.y)}cross(e,t){return e instanceof Nt?this.x*e.y-this.y*e.x:this.x*t-this.y*e}distance(e,t){const i=this.distanceSq(e,t);if(void 0!==i)return Math.sqrt(i)}distanceSq(e,t){let i,s;if(e instanceof Nt)i=e.x-this.x,s=e.y-this.y;else{if(void 0===t)return;i=e-this.x,s=t-this.y}return i*i+s*s}dot(e,t){return e instanceof Nt?this.x*e.x+this.y*e.y:this.x*e+this.y*t}equals(e,t,i){return e instanceof Nt?(t=t||0,Math.abs(this.x-e.x)<=t&&Math.abs(this.y-e.y)<=t):void 0!==t&&(i=i||0,Math.abs(this.x-e)<=i&&Math.abs(this.y-t)<=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(e){const t=Math.cos(e),i=Math.sin(e);return this.set(this.x*t-this.y*i,this.x*i+this.y*t)}rotateDeg(e){return this.rotate(e/180*Math.PI)}scale(e,t){return this.x*=e,this.y*=t||e,this}set(e,t){return e instanceof Nt?(this.x=e.x,this.y=e.y):(this.x=e||0,this.y=t||0),this}setPolar(e,t){return this.set(t,0).rotate(e)}setPolarDeg(e,t){return this.setPolar(e/180*Math.PI,t)}sub(e,t){return void 0!==t?(this.x-=e,this.y-=t):(this.x-=e.x,this.y-=e.y),this}toString(){return`(${this.x}, ${this.y})`}}function Gt(e,t,i){return i=i||0,Math.abs(e-t)<Math.abs(i)}const Bt={isEqual:Gt,isZero:(e,t)=>Gt(e,0,t),clamp:(e,t,i)=>e>t?e<i?e:i:t},Wt=Bt.isZero,Ht=Bt.clamp,Yt=1/3,$t=new Nt(0,0),Ut=1e-4;function jt(e){return"[object Array]"===Object.prototype.toString.call(e)}function Xt(e){if(!jt(e))throw new Error("Polygon must be an array of points");switch(typeof e[0]){case"number":{if(e.length%2!=0)throw new Error("Polygon that contains array of numbers must has even length ([x0, y0, x1, y1, ...., xn, yn])");const t=[];for(let i=0;i<e.length;i+=2)t.push(new Nt(e[i],e[i+1]));return t}case"object":return e.map(jt(e[0])?e=>new Nt(e[0],e[1]):e=>new Nt(e.x,e.y));default:throw new Error("Passed polygon is not an array of 2D coordinates")}}function zt(e){if(1===e.length)return new Nt(e[0]);const t=new Nt(0,0);e.forEach((e=>t.add(e))),t.scale(1/e.length);const i=new Nt;let s=0;return e.forEach(((n,r)=>{const a=new Nt(n),o=new Nt(r+1===e.length?e[0]:e[r+1]);a.add(-t.x,-t.y),o.add(-t.x,-t.y);const l=.5*a.cross(o);s+=l,i.add(a.add(o).scale(Yt).scale(l))})),Wt(s,Ut)?i.set(e[0]):i.scale(1/s).add(t)}function Kt(e,t){let i=e[0],s=t.dot(e[0]),n=0;for(let r=1;r<e.length;r++)n=t.dot(e[r]),n>s&&(s=n,i=e[r]);return new Nt(i)}function Jt(e,t,i){const s=Kt(e,i),n=Kt(t,i.negate());return new Nt(s.sub(n))}function qt(e,t){const i=new Nt(0,0),s=new Nt(e).negate(),n=new Nt(t).sub(e),r=n.dot(n);if(Wt(r,Ut))return i.set(e);let a=s.dot(n)/r;return a=Ht(a,0,1),i.set(n.scale(a).add(e))}function Zt(e,t){e=Xt(e),t=Xt(t);const i=zt(e),s=zt(t).add(i.negate());let n,r,a;n=Jt(e,t,s),r=Jt(e,t,s.negate());for(let i=0;i<30;i++){const i=qt(n,r);if(Wt(i.length(),Ut))return 0;s.set(i.negate().normalize()),a=Jt(e,t,s);const o=a.dot(s),l=n.dot(s);if(Wt(o-l,Ut))return o;n.distanceSq($t)<r.distanceSq($t)?r=a:n=a}return 0}const Qt={intersect:(e,t)=>Wt(Zt(e,t),Ut),distance:Zt};class ei extends F.ViewSensor{constructor(e,t,i,s){super(F.ViewSensor.TypeDefines.TYPE_IMPACT),this._HtmlConfig={view1:e,view2:t,frozeSetId:s?s.IdToken:0,status:{contacted:!1}},this._Callback=i,this._FrozeViewsSet=s,s&&s.DoRef(),this.ResetAutoRecycleViewsRef([e,t],[]),F.sViewSensorManager.AddSensor(this)}HtmlDoWorkOnFrame(){if(!this.Expired()&&this._HtmlConfig.view1&&this._HtmlConfig.view2&&this._HtmlConfig.view1.HtmlCanAccessElement()&&this._HtmlConfig.view1.HtmlCanAccessElement()){(e=this._HtmlConfig.view1.HtmlGetElement(),t=this._HtmlConfig.view2.HtmlGetElement(),Qt.intersect(Ot(e),Ot(t)))?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 e,t}OnCallback(e){this._Callback&&(1==e&&this._Callback.OnBeginContact?this._Callback.OnBeginContact():2==e&&this._Callback.OnEndContact&&this._Callback.OnEndContact())}OnSelfRecycle(){this._FrozeViewsSet&&(this._FrozeViewsSet.UnRef(),this._FrozeViewsSet=null),this._HtmlConfig=null}}F.ImpactSensor=ei;class ti extends F.ViewSensor{constructor(e,t){super(F.ViewSensor.TypeDefines.TYPE_FROZE_SET),this._PreImpactViewList=null,this._OnImpactViewList=null,this._UpdateAutoRecycleRef(e,!0,t,!0),F.sViewSensorManager.AddSensor(this)}HtmlDoWorkOnFrame(){}HtmlNeedWorkOnFrame(){return!1}UpdatePreImpactList(e){this._UpdateAutoRecycleRef(e,!0,null,!1)}UpdateOnImpactList(e){this._UpdateAutoRecycleRef(null,!1,e,!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(e,t,i,s){t&&(this._PreImpactViewList=e instanceof Array?e:[]),s&&(this._OnImpactViewList=i instanceof Array?i:[]),this.ResetAutoRecycleViewsRef([],[...this._PreImpactViewList,...this._OnImpactViewList])}}class ii{constructor(e,t){this.Start=e,this.End=t}Merge(e){return this.IsInterAct(e)?(this.Start>e.Start&&(this.Start=e.Start),this.End<e.End&&(this.End=e.End),!0):this.End+1==e.Start?(this.End=e.End,!0):this.Start==e.End+1&&(this.Start=e.Start,!0)}IsInterAct(e){return e.Start<this.Start?!(e.End<this.Start):e.Start<=this.End}IsInclude(e){return this.Start<=e.Start&&this.End>=e.End}Exclude(e){var t={success:!1,newSplitedRange:null};return this.IsInterAct(e)?(e.Start<=this.Start?e.End<this.End?this.Start=e.End+1:this.Clear():(e.End<this.End&&(t.newSplitedRange=new ii(e.End+1,this.End),t.newSplitedRange=t.newSplitedRange),this.End=e.Start-1),t.success=!0,t.success=t.success,t):t}IsEmpty(){return this.Start>this.End}Clear(){this.End=this.Start-1}Clone(){return new ii(this.Start,this.End)}}const si="OV",ni="NV",ri="OH",ai="NH";class oi extends F.ViewSensor{constructor(e,t){super(F.ViewSensor.TypeDefines.TYPE_ON_SCREEN),this._HtmlConfig={view:e,container:null,enable:!1,testRange:null,status:{horizonVisible:!1,verticalVisible:!1}},this._Callback=t,this.ResetAutoRecycleViewsRef([e],[]),F.sViewSensorManager.AddSensor(this)}HtmlDoWorkOnFrame(){if(!this.Expired()&&this._HtmlConfig.enable&&this._HtmlConfig.testRange&&this._HtmlConfig.view&&this._HtmlConfig.view.HtmlCanAccessElement()){let e=F.sRenderBridge.GetScreenInfo().designedWidth,t=Math.floor(9*e/16);if(!this._HtmlConfig.view.IsVisibleInTree()){if(this._HtmlConfig.status.horizonVisible||this._HtmlConfig.status.verticalVisible){let e={};e[ri]=this._HtmlConfig.status.horizonVisible,e[ai]=!1,e[si]=this._HtmlConfig.status.verticalVisible,e[ni]=!1,this._HtmlConfig.status.horizonVisible=!1,this._HtmlConfig.status.verticalVisible=!1,this.OnCallback(e)}return}let i={top:0,bottom:0,left:0,right:0},s=Mt(this._HtmlConfig.view.HtmlGetElement());[i.top,i.bottom,i.left,i.right]=s;let n,r,a={top:0,bottom:t,left:0,right:e},o=!0;if(this._HtmlConfig.container&&this._HtmlConfig.container.HtmlCanAccessElement()){let i=Mt(this._HtmlConfig.container.HtmlGetElement());[a.top,a.bottom,a.left,a.right]=i,n=new ii(a.left,a.right),r=new ii(a.top,a.bottom);let s=new ii(0,e),l=new ii(0,t);o=s.IsInterAct(n)&&l.IsInterAct(r)}else n=new ii(a.left,a.right),r=new ii(a.top,a.bottom);let l,h,c,u,d=new ii(i.left,i.right),g=new ii(i.top,i.bottom),f=this._HtmlConfig.testRange;{let e=Math.floor((i.right-i.left)*f.horizon);l=new ii(i.left,i.left+e),h=new ii(i.right-e,i.right)}{let e=Math.floor((i.bottom-i.top)*f.vertical);c=new ii(i.top,i.top+e),u=new ii(i.bottom-e,i.bottom)}let m=(n.IsInclude(l)||n.IsInclude(h))&&r.IsInterAct(g)&&o,p=(r.IsInclude(c)||r.IsInclude(u))&&n.IsInterAct(d)&&o;if(m!=this._HtmlConfig.status.horizonVisible||p!=this._HtmlConfig.status.verticalVisible){let e={};e[ri]=this._HtmlConfig.status.horizonVisible,e[ai]=m,e[si]=this._HtmlConfig.status.verticalVisible,e[ni]=p,this._HtmlConfig.status.horizonVisible=m,this._HtmlConfig.status.verticalVisible=p,this.OnCallback(e)}}}HtmlNeedWorkOnFrame(){return this._HtmlConfig.enable}HtmlRequestSync(){F.sRenderBridge.BeginHtmlFrameLoop()}ResetArea(e){"number"!=typeof e.horizon&&(e.horizon=1),"number"!=typeof e.vertical&&(e.vertical=1),this._HtmlConfig.testRange=e,this.HtmlRequestSync()}Enable(e){this._HtmlConfig.enable=e,this._HtmlConfig.status.horizonVisible=!1,this._HtmlConfig.status.verticalVisible=!1,this.HtmlRequestSync()}ResetContainer(e){this._HtmlConfig.container=e,this.HtmlRequestSync()}OnCallback(e){this._Callback&&this._Callback(e[ri],e[ai],e[si],e[ni])}OnSelfRecycle(){this._HtmlConfig=null}}F.VisibleSensor=oi;const li=new class{constructor(){this.allEnvBlockList=[]}getSensor(e){const t=[];for(let i=0;i<this.allEnvBlockList.length;i++)this.allEnvBlockList[i].topGID==e&&t.push({direction:"top",start:{x:parseInt(this.allEnvBlockList[i]._HtmlConfig.view.HtmlGetElement().getBoundingClientRect().left),y:parseInt(this.allEnvBlockList[i]._HtmlConfig.view.HtmlGetElement().getBoundingClientRect().top)},end:{x:parseInt(this.allEnvBlockList[i]._HtmlConfig.view.HtmlGetElement().getBoundingClientRect().right),y:parseInt(this.allEnvBlockList[i]._HtmlConfig.view.HtmlGetElement().getBoundingClientRect().top)}}),this.allEnvBlockList[i].bottomGID==e&&t.push({direction:"bottom",start:{x:parseInt(this.allEnvBlockList[i]._HtmlConfig.view.HtmlGetElement().getBoundingClientRect().left),y:parseInt(this.allEnvBlockList[i]._HtmlConfig.view.HtmlGetElement().getBoundingClientRect().bottom)},end:{x:parseInt(this.allEnvBlockList[i]._HtmlConfig.view.HtmlGetElement().getBoundingClientRect().right),y:parseInt(this.allEnvBlockList[i]._HtmlConfig.view.HtmlGetElement().getBoundingClientRect().bottom)}}),this.allEnvBlockList[i].leftGID==e&&t.push({direction:"left",start:{x:parseInt(this.allEnvBlockList[i]._HtmlConfig.view.HtmlGetElement().getBoundingClientRect().left),y:parseInt(this.allEnvBlockList[i]._HtmlConfig.view.HtmlGetElement().getBoundingClientRect().top)},end:{x:parseInt(this.allEnvBlockList[i]._HtmlConfig.view.HtmlGetElement().getBoundingClientRect().left),y:parseInt(this.allEnvBlockList[i]._HtmlConfig.view.HtmlGetElement().getBoundingClientRect().bottom)}}),this.allEnvBlockList[i].rightGID===e&&t.push({direction:"right",start:{x:parseInt(this.allEnvBlockList[i]._HtmlConfig.view.HtmlGetElement().getBoundingClientRect().right),y:parseInt(this.allEnvBlockList[i]._HtmlConfig.view.HtmlGetElement().getBoundingClientRect().top)},end:{x:parseInt(this.allEnvBlockList[i]._HtmlConfig.view.HtmlGetElement().getBoundingClientRect().right),y:parseInt(this.allEnvBlockList[i]._HtmlConfig.view.HtmlGetElement().getBoundingClientRect().bottom)}});return t}addSensor(e){this.allEnvBlockList.push(e)}deleteSensor(e){for(let t=0;t<this.allEnvBlockList.length;t++)this.allEnvBlockList[t]===e&&this.allEnvBlockList.splice(t,1)}};class hi extends F.ViewSensor{constructor(e){super(F.ViewSensor.TypeDefines.TYPE_ENV_BLOCK),this._HtmlConfig={view:e,enable:!0},this.topGID=0,this.bottomGID=0,this.leftGID=0,this.rightGID=0}HtmlNeedWorkOnFrame(){return this._HtmlConfig.enable}ResetTopGID(e){if(null==e||0==e)return!1;this.topGID=e}ResetBottomGID(e){if(null==e||0==e)return!1;this.bottomGID=e}ResetLeftGID(e){if(null==e||0==e)return!1;this.leftGID=e}ResetRightGID(e){if(null==e||0==e)return!1;this.rightGID=e}Enable(e){this._HtmlConfig.enable=e,e?li.addSensor(this):li.deleteSensor(this)}OnSelfRecycle(){this._HtmlConfig=null}}function ci(e){if(!e)throw Error("assert :P")}function ui(e,t,i){for(var s=0;4>s;s++)if(e[t+s]!=i.charCodeAt(s))return!0;return!1}function di(e,t,i,s,n){for(var r=0;r<n;r++)e[t+r]=i[s+r]}function gi(e,t,i,s){for(var n=0;n<s;n++)e[t+n]=i}function fi(e){return new Int32Array(e)}function mi(e,t){for(var i=[],s=0;s<e;s++)i.push(new t);return i}function pi(e,t){var i=[];return function e(i,s,n){for(var r=n[s],a=0;a<r&&(i.push(n.length>s+1?[]:new t),!(n.length<s+1));a++)e(i[a],s+1,n)}(i,0,e),i}function yi(e,t){for(var i="",s=0;s<4;s++)i+=String.fromCharCode(e[t++]);return i}function Ti(e,t){return(e[t+0]<<0|e[t+1]<<8|e[t+2]<<16)>>>0}function _i(e,t){return(e[t+0]<<0|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0}F.EnvBlockerSensor=hi,window.WebPDecoder=function(){function e(e,t){for(var i=1<<t-1>>>0;e&i;)i>>>=1;return i?(e&i-1)+i:e}function t(e,t,i,s,n){ci(!(s%i));do{e[t+(s-=i)]=n}while(0<s)}function i(i,n,r,a,o){if(ci(2328>=o),512>=o)var l=fi(512);else if(null==(l=fi(o)))return 0;return function(i,n,r,a,o,l){var h,c,u=n,d=1<<r,g=fi(16),f=fi(16);for(ci(0!=o),ci(null!=a),ci(null!=i),ci(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 s).g=0,a.value=l[0],t(i,u,1,d,a),d;var m,p=-1,y=d-1,T=0,_=1,x=1,w=1<<r;for(c=0,h=1,o=2;h<=r;++h,o<<=1){if(_+=x<<=1,0>(x-=g[h]))return 0;for(;0<g[h];--g[h])(a=new s).g=h,a.value=l[c++],t(i,u+T,o,w,a),T=e(T,h)}for(h=r+1,o=2;15>=h;++h,o<<=1){if(_+=x<<=1,0>(x-=g[h]))return 0;for(;0<g[h];--g[h]){if(a=new s,(T&y)!=p){for(u+=w,m=1<<(p=h)-r;15>p&&!(0>=(m-=g[p]));)++p,m<<=1;d+=w=1<<(m=p-r),i[n+(p=T&y)].g=m+r,i[n+p].value=u-n-p}a.g=h-r,a.value=l[c++],t(i,u+(T>>r),o,w,a),T=e(T,h)}}return _!=2*f[15]-1?0:d}(i,n,r,a,o,l)}function s(){this.value=this.g=0}function n(){this.value=this.g=0}function r(){this.G=mi(5,s),this.H=fi(5),this.jc=this.Qb=this.qb=this.nd=0,this.pd=mi(Mi,n)}function a(e,t,i,s){ci(null!=e),ci(null!=t),ci(2147483648>s),e.Ca=254,e.I=0,e.b=-8,e.Ka=0,e.oa=t,e.pa=i,e.Jd=t,e.Yc=i+s,e.Zc=4<=s?i+s-4+1:i,T(e)}function o(e,t){for(var i=0;0<t--;)i|=x(e,128)<<t;return i}function l(e,t){var i=o(e,t);return _(e)?-i:i}function h(e,t,i,s){var n,r=0;for(ci(null!=e),ci(null!=t),ci(4294967288>s),e.Sb=s,e.Ra=0,e.u=0,e.h=0,4<s&&(s=4),n=0;n<s;++n)r+=t[i+n]<<8*n;e.Ra=r,e.bb=s,e.oa=t,e.pa=i}function c(e){for(;8<=e.u&&e.bb<e.Sb;)e.Ra>>>=8,e.Ra+=e.oa[e.pa+e.bb]<<Bi-8>>>0,++e.bb,e.u-=8;m(e)&&(e.h=1,e.u=0)}function u(e,t){if(ci(0<=t),!e.h&&t<=Gi){var i=f(e)&Ni[t];return e.u+=t,c(e),i}return e.h=1,e.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(e){return e.Ra>>>(e.u&Bi-1)>>>0}function m(e){return ci(e.bb<=e.Sb),e.h||e.bb==e.Sb&&e.u>Bi}function p(e,t){e.u=t,e.h=m(e)}function y(e){e.u>=Wi&&(ci(e.u>=Wi),c(e))}function T(e){ci(null!=e&&null!=e.oa),e.pa<e.Zc?(e.I=(e.oa[e.pa++]|e.I<<8)>>>0,e.b+=8):(ci(null!=e&&null!=e.oa),e.pa<e.Yc?(e.b+=8,e.I=e.oa[e.pa++]|e.I<<8):e.Ka?e.b=0:(e.I<<=8,e.b+=8,e.Ka=1))}function _(e){return o(e,1)}function x(e,t){var i=e.Ca;0>e.b&&T(e);var s=e.b,n=i*t>>>8,r=(e.I>>>s>n)+0;for(r?(i-=n,e.I-=n+1<<s>>>0):i=n+1,s=i,n=0;256<=s;)n+=8,s>>=8;return s=7^n+Hi[s],e.b-=s,e.Ca=(i<<s)-1,r}function w(e,t,i){e[t+0]=i>>24&255,e[t+1]=i>>16&255,e[t+2]=i>>8&255,e[t+3]=i>>0&255}function S(e,t){return e[t+0]<<0|e[t+1]<<8}function v(e,t){return S(e,t)|e[t+2]<<16}function E(e,t){return S(e,t)|S(e,t+2)<<16}function b(e,t){var i=1<<t;return ci(null!=e),ci(0<t),e.X=fi(i),null==e.X?0:(e.Mb=32-t,e.Xa=t,1)}function C(e,t){ci(null!=e),ci(null!=t),ci(e.Xa==t.Xa),di(t.X,0,e.X,0,1<<t.Xa)}function I(){this.X=[],this.Xa=this.Mb=0}function A(e,t,i,s){ci(null!=i),ci(null!=s);var n=i[0],r=s[0];return 0==n&&(n=(e*r+t/2)/t),0==r&&(r=(t*n+e/2)/e),0>=n||0>=r?0:(i[0]=n,s[0]=r,1)}function P(e,t){return e+(1<<t)-1>>>t}function L(e,t){return((4278255360&e)+(4278255360&t)>>>0&4278255360)+((16711935&e)+(16711935&t)>>>0&16711935)>>>0}function k(e,t){self[t]=function(t,i,s,n,r,a,o){var l;for(l=0;l<r;++l){var h=self[e](a[o+l-1],s,n+l);a[o+l]=L(t[i+l],h)}}}function R(){this.ud=this.hd=this.jd=0}function F(e,t){return((4278124286&(e^t))>>>1)+(e&t)>>>0}function D(e){return 0<=e&&256>e?e:0>e?0:255<e?255:void 0}function V(e,t){return D(e+(e-t+.5>>1))}function O(e,t,i){return Math.abs(t-i)-Math.abs(e-i)}function M(e,t,i,s,n,r,a){for(s=r[a-1],i=0;i<n;++i)r[a+i]=s=L(e[t+i],s)}function N(e,t,i,s,n){var r;for(r=0;r<i;++r){var a=e[t+r],o=a>>8&255,l=16711935&(l=(l=16711935&a)+((o<<16)+o));s[n+r]=(4278255360&a)+l>>>0}}function G(e,t){t.jd=e>>0&255,t.hd=e>>8&255,t.ud=e>>16&255}function B(e,t,i,s,n,r){var a;for(a=0;a<s;++a){var o=t[i+a],l=o>>>8,h=o,c=255&(c=(c=o>>>16)+((e.jd<<24>>24)*(l<<24>>24)>>>5));h=255&(h=(h=h+((e.hd<<24>>24)*(l<<24>>24)>>>5))+((e.ud<<24>>24)*(c<<24>>24)>>>5));n[r+a]=(4278255360&o)+(c<<16)+h}}function W(e,t,i,s,n){self[t]=function(e,t,i,r,a,o,l,h,c){for(r=l;r<h;++r)for(l=0;l<c;++l)a[o++]=n(i[s(e[t++])])},self[e]=function(e,t,r,a,o,l,h){var c=8>>e.b,u=e.Ea,d=e.K[0],g=e.w;if(8>c)for(e=(1<<e.b)-1,g=(1<<c)-1;t<r;++t){var f,m=0;for(f=0;f<u;++f)f&e||(m=s(a[o++])),l[h++]=n(d[m&g]),m>>=c}else self["VP8LMapColor"+i](a,o,d,g,l,h,t,r,u)}}function H(e,t,i,s,n){for(i=t+i;t<i;){var r=e[t++];s[n++]=r>>16&255,s[n++]=r>>8&255,s[n++]=r>>0&255}}function Y(e,t,i,s,n){for(i=t+i;t<i;){var r=e[t++];s[n++]=r>>16&255,s[n++]=r>>8&255,s[n++]=r>>0&255,s[n++]=r>>24&255}}function $(e,t,i,s,n){for(i=t+i;t<i;){var r=(a=e[t++])>>16&240|a>>12&15,a=a>>0&240|a>>28&15;s[n++]=r,s[n++]=a}}function U(e,t,i,s,n){for(i=t+i;t<i;){var r=(a=e[t++])>>16&248|a>>13&7,a=a>>5&224|a>>3&31;s[n++]=r,s[n++]=a}}function j(e,t,i,s,n){for(i=t+i;t<i;){var r=e[t++];s[n++]=r>>0&255,s[n++]=r>>8&255,s[n++]=r>>16&255}}function X(e,t,i,s,n,r){if(0==r)for(i=t+i;t<i;)w(s,((r=e[t++])[0]>>24|r[1]>>8&65280|r[2]<<8&16711680|r[3]<<24)>>>0),n+=32;else di(s,n,e,t,i)}function z(e,t){self[t][0]=self[e+"0"],self[t][1]=self[e+"1"],self[t][2]=self[e+"2"],self[t][3]=self[e+"3"],self[t][4]=self[e+"4"],self[t][5]=self[e+"5"],self[t][6]=self[e+"6"],self[t][7]=self[e+"7"],self[t][8]=self[e+"8"],self[t][9]=self[e+"9"],self[t][10]=self[e+"10"],self[t][11]=self[e+"11"],self[t][12]=self[e+"12"],self[t][13]=self[e+"13"],self[t][14]=self[e+"0"],self[t][15]=self[e+"0"]}function K(e){return e==Ws||e==Hs||e==Ys||e==$s}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 ee(){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 te(e){return alert("todo:WebPSamplerProcessPlane"),e.T}function ie(e,t){var i=e.T,s=t.ba.f.RGBA,n=s.eb,r=s.fb+e.ka*s.A,a=pn[t.ba.S],o=e.y,l=e.O,h=e.f,c=e.N,u=e.ea,d=e.W,g=t.cc,f=t.dc,m=t.Mc,p=t.Nc,y=e.ka,T=e.ka+e.T,_=e.U,x=_+1>>1;for(0==y?a(o,l,null,null,h,c,u,d,h,c,u,d,n,r,null,null,_):(a(t.ec,t.fc,o,l,g,f,m,p,h,c,u,d,n,r-s.A,n,r,_),++i);y+2<T;y+=2)g=h,f=c,m=u,p=d,c+=e.Rc,d+=e.Rc,r+=2*s.A,a(o,(l+=2*e.fa)-e.fa,o,l,g,f,m,p,h,c,u,d,n,r-s.A,n,r,_);return l+=e.fa,e.j+T<e.o?(di(t.ec,t.fc,o,l,_),di(t.cc,t.dc,h,c,x),di(t.Mc,t.Nc,u,d,x),i--):1&T||a(o,l,null,null,h,c,u,d,h,c,u,d,n,r+s.A,null,null,_),i}function se(e,t,i){var s=e.F,n=[e.J];if(null!=s){var r=e.U,a=t.ba.S,o=a==Ns||a==Ys;t=t.ba.f.RGBA;var l=[0],h=e.ka;l[0]=e.T,e.Kb&&(0==h?--l[0]:(--h,n[0]-=e.width),e.j+e.ka+e.T==e.o&&(l[0]=e.o-e.j-h));var c=t.eb;h=t.fb+h*t.A;e=vs(s,n[0],e.width,r,l,c,h+(o?0:3),t.A),ci(i==l),e&&K(a)&&ws(c,h,o,r,l,t.A)}return 0}function ne(e){var t=e.ma,i=t.ba.S,s=11>i,n=i==Vs||i==Ms||i==Ns||i==Gs||12==i||K(i);if(t.memory=null,t.Ib=null,t.Jb=null,t.Nd=null,!Di(t.Oa,e,n?11:12))return 0;if(n&&K(i)&&yi(),e.da)alert("todo:use_scaling");else{if(s){if(t.Ib=te,e.Kb){if(i=e.U+1>>1,t.memory=fi(e.U+2*i),null==t.memory)return 0;t.ec=t.memory,t.fc=0,t.cc=t.ec,t.dc=t.fc+e.U,t.Mc=t.cc,t.Nc=t.dc+i,t.Ib=ie,yi()}}else alert("todo:EmitYUV");n&&(t.Jb=se,s&&li())}if(s&&!Ln){for(e=0;256>e;++e)kn[e]=89858*(e-128)+bn>>En,Dn[e]=-22014*(e-128)+bn,Fn[e]=-45773*(e-128),Rn[e]=113618*(e-128)+bn>>En;for(e=Cn;e<In;++e)t=76283*(e-16)+bn>>En,Vn[e-Cn]=Me(t,255),On[e-Cn]=Me(t+8>>4,15);Ln=1}return 1}function re(e){var t=e.ma,i=e.U,s=e.T;return ci(!(1&e.ka)),0>=i||0>=s?0:(i=t.Ib(e,t),null!=t.Jb&&t.Jb(e,t,i),t.Dc+=i,1)}function ae(e){e.ma.memory=null}function oe(e,t,i,s){return 47!=u(e,8)?0:(t[0]=u(e,14)+1,i[0]=u(e,14)+1,s[0]=u(e,1),0!=u(e,3)?0:!e.h)}function le(e,t){if(4>e)return e+1;var i=e-2>>1;return(2+(1&e)<<i)+u(t,i)+1}function he(e,t){return 120<t?t-120:1<=(i=((i=Js[t-1])>>4)*e+(8-(15&i)))?i:1;var i}function ce(e,t,i){var s=f(i),n=e[t+=255&s].g-8;return 0<n&&(p(i,i.u+8),s=f(i),t+=e[t].value,t+=s&(1<<n)-1),p(i,i.u+e[t].g),e[t].value}function ue(e,t,i){return i.g+=e.g,i.value+=e.value<<t>>>0,ci(8>=i.g),e.g}function de(e,t,i){var s=e.xc;return ci((t=0==s?0:e.vc[e.md*(i>>s)+(t>>s)])<e.Wb),e.Ya[t]}function ge(e,t,i,s){var n=e.ab,r=e.c*t,a=e.C;t=a+t;var o=i,l=s;for(s=e.Ta,i=e.Ua;0<n--;){var h=e.gc[n],c=a,u=t,d=o,g=l,f=(l=s,o=i,h.Ea);switch(ci(c<u),ci(u<=h.nc),h.hc){case 2:Ui(d,g,(u-c)*f,l,o);break;case 0:var m=c,p=u,y=l,T=o,_=(E=h).Ea;0==m&&(Yi(d,g,null,null,1,y,T),M(d,g+1,0,0,_-1,y,T+1),g+=_,T+=_,++m);for(var x=1<<E.b,w=x-1,S=P(_,E.b),v=E.K,E=E.w+(m>>E.b)*S;m<p;){var b=v,C=E,I=1;for($i(d,g,y,T-_,1,y,T);I<_;){var A=(I&~w)+x;A>_&&(A=_),(0,Ji[b[C++]>>8&15])(d,g+ +I,y,T+I-_,A-I,y,T+I),I=A}g+=_,T+=_,++m&w||(E+=S)}u!=h.nc&&di(l,o-f,l,o+(u-c-1)*f,f);break;case 1:for(f=d,p=g,_=(d=h.Ea)-(T=d&~(y=(g=1<<h.b)-1)),m=P(d,h.b),x=h.K,h=h.w+(c>>h.b)*m;c<u;){for(w=x,S=h,v=new R,E=p+T,b=p+d;p<E;)G(w[S++],v),qi(v,f,p,g,l,o),p+=g,o+=g;p<b&&(G(w[S++],v),qi(v,f,p,_,l,o),p+=_,o+=_),++c&y||(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,y=o,m=[],T=(_=T)-1;0<=T;--T)m[T]=g[y+T];for(T=_-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=s,l=i}l!=i&&di(s,i,o,l,r)}function fe(e,t){var i=e.V,s=e.Ba+e.c*e.C,n=t-e.C;if(ci(t<=e.l.o),ci(16>=n),0<n){var r=e.l,a=e.Ta,o=e.Ua,l=r.width;if(ge(e,n,i,s),n=o=[o],ci((i=e.C)<(s=t)),ci(r.v<r.va),s>r.o&&(s=r.o),i<r.j){var h=r.j-i;i=r.j;n[0]+=h*l}if(i>=s?i=0:(n[0]+=4*r.v,r.ka=i-r.j,r.U=r.va-r.v,r.T=s-i,i=1),i){if(o=o[0],11>(i=e.ca).S){var c=i.f.RGBA,u=(s=i.S,n=r.U,r=r.T,h=c.eb,c.A),d=r;for(c=c.fb+e.Ma*c.A;0<d--;){var g=a,f=o,m=n,p=h,y=c;switch(s){case Ds:Zi(g,f,m,p,y);break;case Vs:Qi(g,f,m,p,y);break;case Ws:Qi(g,f,m,p,y),ws(p,y,0,m,1,0);break;case Os:is(g,f,m,p,y);break;case Ms:X(g,f,m,p,y,1);break;case Hs:X(g,f,m,p,y,1),ws(p,y,0,m,1,0);break;case Ns:X(g,f,m,p,y,0);break;case Ys:X(g,f,m,p,y,0),ws(p,y,1,m,1,0);break;case Gs:es(g,f,m,p,y);break;case $s:es(g,f,m,p,y),Ss(p,y,m,1,0);break;case Bs:ts(g,f,m,p,y);break;default:ci(0)}o+=l,c+=u}e.Ma+=r}else alert("todo:EmitRescaledRowsYUVA");ci(e.Ma<=i.height)}}e.C=t,ci(e.C<=e.i)}function me(e){var t;if(0<e.ua)return 0;for(t=0;t<e.Wb;++t){var i=e.Ya[t].G,s=e.Ya[t].H;if(0<i[1][s[1]+0].g||0<i[2][s[2]+0].g||0<i[3][s[3]+0].g)return 0}return 1}function pe(e,t,i,s,n,r){if(0!=e.Z){var a=e.qd,o=e.rd;for(ci(null!=mn[e.Z]);t<i;++t)mn[e.Z](a,o,s,n,s,n,r),a=s,o=n,n+=r;e.qd=a,e.rd=o}}function ye(e,t){var i=e.l.ma,s=0==i.Z||1==i.Z?e.l.j:e.C;s=e.C<s?s:e.C;if(ci(t<=e.l.o),t>s){var n=e.l.width,r=i.ca,a=i.tb+n*s,o=e.V,l=e.Ba+e.c*s,h=e.gc;ci(1==e.ab),ci(3==h[0].hc),zi(h[0],s,t,o,l,r,a),pe(i,s,t,r,a,n)}e.C=e.Ma=t}function Te(e,t,i,s,n,r,a){var o=e.$/s,l=e.$%s,h=e.m,c=e.s,u=i+e.$,d=u;n=i+s*n;var g=i+s*r,T=280+c.ua,_=e.Pb?o:16777216,x=0<c.ua?c.Wa:null,w=c.wc,S=u<g?de(c,l,o):null;ci(e.C<r),ci(g<=n);var v=!1;e:for(;;){for(;v||u<g;){var E=0;if(o>=_){var b=u-i;ci((_=e).Pb),_.wd=_.m,_.xd=b,0<_.s.ua&&C(_.s.Wa,_.s.vb),_=o+Zs}if(l&w||(S=de(c,l,o)),ci(null!=S),S.Qb&&(t[u]=S.qb,v=!0),!v)if(y(h),S.jc){E=h,b=t;var I=u,A=S.pd[f(E)&Mi-1];ci(S.jc),256>A.g?(p(E,E.u+A.g),b[I]=A.value,E=0):(p(E,E.u+A.g-256),ci(256<=A.value),E=A.value),0==E&&(v=!0)}else E=ce(S.G[0],S.H[0],h);if(h.h)break;if(v||256>E){if(!v)if(S.nd)t[u]=(S.qb|E<<8)>>>0;else{if(y(h),v=ce(S.G[1],S.H[1],h),y(h),b=ce(S.G[2],S.H[2],h),I=ce(S.G[3],S.H[3],h),h.h)break;t[u]=(I<<24|v<<16|E<<8|b)>>>0}if(v=!1,++u,++l>=s&&(l=0,++o,null!=a&&o<=r&&!(o%16)&&a(e,o),null!=x))for(;d<u;)E=t[d++],x.X[(506832829*E&4294967295)>>>x.Mb]=E}else if(280>E){if(E=le(E-256,h),b=ce(S.G[4],S.H[4],h),y(h),b=he(s,b=le(b,h)),h.h)break;if(u-i<b||n-u<E)break e;for(I=0;I<E;++I)t[u+I]=t[u+I-b];for(u+=E,l+=E;l>=s;)l-=s,++o,null!=a&&o<=r&&!(o%16)&&a(e,o);if(ci(u<=n),l&w&&(S=de(c,l,o)),null!=x)for(;d<u;)E=t[d++],x.X[(506832829*E&4294967295)>>>x.Mb]=E}else{if(!(E<T))break e;for(v=E-280,ci(null!=x);d<u;)E=t[d++],x.X[(506832829*E&4294967295)>>>x.Mb]=E;E=u,ci(!(v>>>(b=x).Xa)),t[E]=b.X[v],v=!0}v||ci(h.h==m(h))}if(e.Pb&&h.h&&u<n)ci(e.m.h),e.a=5,e.m=e.wd,e.$=e.xd,0<e.s.ua&&C(e.s.vb,e.s.Wa);else{if(h.h)break e;null!=a&&a(e,o>r?r:o),e.a=0,e.$=u-i}return 1}return e.a=3,0}function _e(e){ci(null!=e),e.vc=null,e.yc=null,e.Ya=null;var t=e.Wa;null!=t&&(t.X=null),e.vb=null,ci(null!=e)}function xe(){var e=new Zt;return null==e?null:(e.a=0,e.xb=fn,z("Predictor","VP8LPredictors"),z("Predictor","VP8LPredictors_C"),z("PredictorAdd","VP8LPredictorsAdd"),z("PredictorAdd","VP8LPredictorsAdd_C"),Ui=N,qi=B,Zi=H,Qi=Y,es=$,ts=U,is=j,self.VP8LMapColor32b=Xi,self.VP8LMapColor8b=Ki,e)}function we(e,t,n,a,o){var l=1,h=[e],c=[t],d=a.m,g=a.s,m=null,T=0;e:for(;;){if(n)for(;l&&u(d,1);){var _=h,x=c,w=a,S=1,v=w.m,E=w.gc[w.ab],C=u(v,2);if(w.Oc&1<<C)l=0;else{switch(w.Oc|=1<<C,E.hc=C,E.Ea=_[0],E.nc=x[0],E.K=[null],++w.ab,ci(4>=w.ab),C){case 0:case 1:E.b=u(v,3)+2,S=we(P(E.Ea,E.b),P(E.nc,E.b),0,w,E.K),E.K=E.K[0];break;case 3:var I,A=u(v,8)+1,k=16<A?0:4<A?1:2<A?2:3;if(_[0]=P(E.Ea,k),E.b=k,I=S=we(A,1,0,w,E.K)){var R,F=A,D=E,V=1<<(8>>D.b),O=fi(V);if(null==O)I=0;else{var M=D.K[0],N=D.w;for(O[0]=D.K[0][0],R=1;R<1*F;++R)O[R]=L(M[N+R],O[R-1]);for(;R<4*V;++R)O[R]=0;D.K[0]=null,D.K[0]=O,I=1}}S=I;break;case 2:break;default:ci(0)}l=S}}if(h=h[0],c=c[0],l&&u(d,1)&&!(l=1<=(T=u(d,4))&&11>=T)){a.a=3;break e}var G;if(G=l)t:{var B,W,H,Y=a,$=h,U=c,j=T,X=n,z=Y.m,K=Y.s,J=[null],q=1,Z=0,Q=qs[j];i:for(;;){if(X&&u(z,1)){var ee=u(z,3)+2,te=P($,ee),ie=P(U,ee),se=te*ie;if(!we(te,ie,0,Y,J))break i;for(J=J[0],K.xc=ee,B=0;B<se;++B){var ne=J[B]>>8&65535;J[B]=ne,ne>=q&&(q=ne+1)}}if(z.h)break i;for(W=0;5>W;++W){var re=Xs[W];!W&&0<j&&(re+=1<<j),Z<re&&(Z=re)}var ae=mi(q*Q,s),oe=q,le=mi(oe,r);if(null==le)var he=null;else ci(65536>=oe),he=le;var ce=fi(Z);if(null==he||null==ce||null==ae){Y.a=1;break i}var de=ae;for(B=H=0;B<q;++B){var ge=he[B],fe=ge.G,me=ge.H,pe=0,ye=1,xe=0;for(W=0;5>W;++W){re=Xs[W],fe[W]=de,me[W]=H,!W&&0<j&&(re+=1<<j);s:{var Se,ve=re,Ee=Y,be=ce,Ce=de,Ie=H,Ae=0,Pe=Ee.m,Le=u(Pe,1);if(gi(be,0,0,ve),Le){var ke=u(Pe,1)+1,Re=u(Pe,1),Fe=u(Pe,0==Re?1:8);be[Fe]=1,2==ke&&(be[Fe=u(Pe,8)]=1);var De=1}else{var Ve=fi(19),Oe=u(Pe,4)+4;if(19<Oe){Ee.a=3;var Me=0;break s}for(Se=0;Se<Oe;++Se)Ve[Ks[Se]]=u(Pe,3);var Ne=void 0,Ge=void 0,Be=Ee,We=Ve,He=ve,Ye=be,$e=0,Ue=Be.m,je=8,Xe=mi(128,s);n:for(;i(Xe,0,7,We,19);){if(u(Ue,1)){var ze=2+2*u(Ue,3);if((Ne=2+u(Ue,ze))>He)break n}else Ne=He;for(Ge=0;Ge<He&&Ne--;){y(Ue);var Ke=Xe[0+(127&f(Ue))];p(Ue,Ue.u+Ke.g);var Je=Ke.value;if(16>Je)Ye[Ge++]=Je,0!=Je&&(je=Je);else{var qe=16==Je,Ze=Je-16,Qe=js[Ze],et=u(Ue,Us[Ze])+Qe;if(Ge+et>He)break n;for(var tt=qe?je:0;0<et--;)Ye[Ge++]=tt}}$e=1;break n}$e||(Be.a=3),De=$e}(De=De&&!Pe.h)&&(Ae=i(Ce,Ie,8,be,ve)),De&&0!=Ae?Me=Ae:(Ee.a=3,Me=0)}if(0==Me)break i;if(ye&&1==zs[W]&&(ye=0==de[H].g),pe+=de[H].g,H+=Me,3>=W){var it,st=ce[0];for(it=1;it<re;++it)ce[it]>st&&(st=ce[it]);xe+=st}}if(ge.nd=ye,ge.Qb=0,ye&&(ge.qb=(fe[3][me[3]+0].value<<24|fe[1][me[1]+0].value<<16|fe[2][me[2]+0].value)>>>0,0==pe&&256>fe[0][me[0]+0].value&&(ge.Qb=1,ge.qb+=fe[0][me[0]+0].value<<8)),ge.jc=!ge.Qb&&6>xe,ge.jc){var nt,rt=ge;for(nt=0;nt<Mi;++nt){var at=nt,ot=rt.pd[at],lt=rt.G[0][rt.H[0]+at];256<=lt.value?(ot.g=lt.g+256,ot.value=lt.value):(ot.g=0,ot.value=0,at>>=ue(lt,8,ot),at>>=ue(rt.G[1][rt.H[1]+at],16,ot),at>>=ue(rt.G[2][rt.H[2]+at],0,ot),ue(rt.G[3][rt.H[3]+at],24,ot))}}}K.vc=J,K.Wb=q,K.Ya=he,K.yc=ae,G=1;break t}G=0}if(!(l=G)){a.a=3;break e}if(0<T){if(g.ua=1<<T,!b(g.Wa,T)){a.a=1,l=0;break e}}else g.ua=0;var ht=a,ct=h,ut=c,dt=ht.s,gt=dt.xc;if(ht.c=ct,ht.i=ut,dt.md=P(ct,gt),dt.wc=0==gt?-1:(1<<gt)-1,n){a.xb=gn;break e}if(null==(m=fi(h*c))){a.a=1,l=0;break e}l=(l=Te(a,m,0,h,c,c,null))&&!d.h;break e}return l?(null!=o?o[0]=m:(ci(null==m),ci(n)),a.$=0,n||_e(g)):_e(g),l}function Se(e,t){var i=e.c*e.i,s=i+t+16*t;return ci(e.c<=t),e.V=fi(s),null==e.V?(e.Ta=null,e.Ua=0,e.a=1,0):(e.Ta=e.V,e.Ua=e.Ba+i+t,1)}function ve(e,t){var i=e.C,s=t-i,n=e.V,r=e.Ba+e.c*i;for(ci(t<=e.l.o);0<s;){var a=16<s?16:s,o=e.l.ma,l=e.l.width,h=l*a,c=o.ca,u=o.tb+l*i,d=e.Ta,g=e.Ua;ge(e,a,n,r),Es(d,g,c,u,h),pe(o,i,i+a,c,u,l),s-=a,n+=a*e.c,i+=a}ci(i==t),e.C=e.Ma=t}function Ee(){this.ub=this.yd=this.td=this.Rb=0}function be(){this.Kd=this.Ld=this.Ud=this.Td=this.i=this.c=0}function Ce(){this.Fb=this.Bb=this.Cb=0,this.Zb=fi(4),this.Lb=fi(4)}function Ie(){this.Yb=function(){var e=[];return function e(t,i,s){for(var n=s[i],r=0;r<n&&(t.push(s.length>i+1?[]:0),!(s.length<i+1));r++)e(t[r],i+1,s)}(e,0,[3,11]),e}()}function Ae(){this.jb=fi(3),this.Wc=pi([4,8],Ie),this.Xc=pi([4,17],Ie)}function Pe(){this.Pc=this.wb=this.Tb=this.zd=0,this.vd=new fi(4),this.od=new fi(4)}function Le(){this.ld=this.La=this.dd=this.tc=0}function ke(){this.Na=this.la=0}function Re(){this.Sc=[0,0],this.Eb=[0,0],this.Qc=[0,0],this.ia=this.lc=0}function Fe(){this.ad=fi(384),this.Za=0,this.Ob=fi(16),this.$b=this.Ad=this.ia=this.Gc=this.Hc=this.Dd=0}function De(){this.uc=this.M=this.Nb=0,this.wa=Array(new Le),this.Y=0,this.ya=Array(new Fe),this.aa=0,this.l=new Ne}function Ve(){this.y=fi(16),this.f=fi(8),this.ea=fi(8)}function Oe(){this.cb=this.a=0,this.sc="",this.m=new d,this.Od=new Ee,this.Kc=new be,this.ed=new Pe,this.Qa=new Ce,this.Ic=this.$c=this.Aa=0,this.D=new De,this.Xb=this.Va=this.Hb=this.zb=this.yb=this.Ub=this.za=0,this.Jc=mi(8,d),this.ia=0,this.pb=mi(4,Re),this.Pa=new Ae,this.Bd=this.kc=0,this.Ac=[],this.Bc=0,this.zc=[0,0,0,0],this.Gd=Array(new Ve),this.Hd=0,this.rb=Array(new ke),this.sb=0,this.wa=Array(new Le),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 Fe),this.L=this.aa=0,this.gd=pi([4,2],Le),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 Me(e,t){return 0>e?0:e>t?t:e}function Ne(){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 Ge(){var e=new Oe;return null!=e&&(e.a=0,e.sc="OK",e.cb=0,e.Xb=0,tn||(tn=Ye)),e}function Be(e,t,i){return 0==e.a&&(e.a=t,e.sc=i,e.cb=0),0}function We(e,t,i){return 3<=i&&157==e[t+0]&&1==e[t+1]&&42==e[t+2]}function He(e,t){if(null==e)return 0;if(e.a=0,e.sc="OK",null==t)return Be(e,2,"null VP8Io passed to VP8GetHeaders()");var i=t.data,s=t.w,n=t.ha;if(4>n)return Be(e,7,"Truncated header.");var r=i[s+0]|i[s+1]<<8|i[s+2]<<16,h=e.Od;if(h.Rb=!(1&r),h.td=r>>1&7,h.yd=r>>4&1,h.ub=r>>5,3<h.td)return Be(e,3,"Incorrect keyframe parameters.");if(!h.yd)return Be(e,4,"Frame not displayable.");s+=3,n-=3;var c=e.Kc;if(h.Rb){if(7>n)return Be(e,7,"cannot parse picture header");if(!We(i,s,n))return Be(e,3,"Bad code word");c.c=16383&(i[s+4]<<8|i[s+3]),c.Td=i[s+4]>>6,c.i=16383&(i[s+6]<<8|i[s+5]),c.Ud=i[s+6]>>6,s+=7,n-=7,e.za=c.c+15>>4,e.Ub=c.i+15>>4,t.width=c.c,t.height=c.i,t.Da=0,t.j=0,t.v=0,t.va=t.width,t.o=t.height,t.da=0,t.ib=t.width,t.hb=t.height,t.U=t.width,t.T=t.height,gi((r=e.Pa).jb,0,255,r.jb.length),ci(null!=(r=e.Qa)),r.Cb=0,r.Bb=0,r.Fb=1,gi(r.Zb,0,0,r.Zb.length),gi(r.Lb,0,0,r.Lb)}if(h.ub>n)return Be(e,7,"bad partition length");a(r=e.m,i,s,h.ub),s+=h.ub,n-=h.ub,h.Rb&&(c.Ld=_(r),c.Kd=_(r)),c=e.Qa;var u,d=e.Pa;if(ci(null!=r),ci(null!=c),c.Cb=_(r),c.Cb){if(c.Bb=_(r),_(r)){for(c.Fb=_(r),u=0;4>u;++u)c.Zb[u]=_(r)?l(r,7):0;for(u=0;4>u;++u)c.Lb[u]=_(r)?l(r,6):0}if(c.Bb)for(u=0;3>u;++u)d.jb[u]=_(r)?o(r,8):255}else c.Bb=0;if(r.Ka)return Be(e,3,"cannot parse segment header");if((c=e.ed).zd=_(r),c.Tb=o(r,6),c.wb=o(r,3),c.Pc=_(r),c.Pc&&_(r)){for(d=0;4>d;++d)_(r)&&(c.vd[d]=l(r,6));for(d=0;4>d;++d)_(r)&&(c.od[d]=l(r,6))}if(e.L=0==c.Tb?0:c.zd?1:2,r.Ka)return Be(e,3,"cannot parse filter header");var g=n;if(n=u=s,s=u+g,c=g,e.Xb=(1<<o(e.m,2))-1,g<3*(d=e.Xb))i=7;else{for(u+=3*d,c-=3*d,g=0;g<d;++g){var f=i[n+0]|i[n+1]<<8|i[n+2]<<16;f>c&&(f=c),a(e.Jc[+g],i,u,f),u+=f,c-=f,n+=3}a(e.Jc[+d],i,u,c),i=u<s?0:5}if(0!=i)return Be(e,i,"cannot parse partitions");for(i=o(u=e.m,7),n=_(u)?l(u,4):0,s=_(u)?l(u,4):0,c=_(u)?l(u,4):0,d=_(u)?l(u,4):0,u=_(u)?l(u,4):0,g=e.Qa,f=0;4>f;++f){if(g.Cb){var m=g.Zb[f];g.Fb||(m+=i)}else{if(0<f){e.pb[f]=e.pb[0];continue}m=i}var p=e.pb[f];p.Sc[0]=Qs[Me(m+n,127)],p.Sc[1]=en[Me(m+0,127)],p.Eb[0]=2*Qs[Me(m+s,127)],p.Eb[1]=101581*en[Me(m+c,127)]>>16,8>p.Eb[1]&&(p.Eb[1]=8),p.Qc[0]=Qs[Me(m+d,117)],p.Qc[1]=en[Me(m+u,127)],p.lc=m+u}if(!h.Rb)return Be(e,4,"Not a key frame.");for(_(r),h=e.Pa,i=0;4>i;++i){for(n=0;8>n;++n)for(s=0;3>s;++s)for(c=0;11>c;++c)d=x(r,ln[i][n][s][c])?o(r,8):an[i][n][s][c],h.Wc[i][n].Yb[s][c]=d;for(n=0;17>n;++n)h.Xc[i][n]=h.Wc[i][hn[n]]}return e.kc=_(r),e.kc&&(e.Bd=o(r,8)),e.cb=1}function Ye(e,t,i,s,n,r,a){var o=t[n].Yb[i];for(i=0;16>n;++n){if(!x(e,o[i+0]))return n;for(;!x(e,o[i+1]);)if(o=t[++n].Yb[0],i=0,16==n)return 16;var l=t[n+1].Yb;if(x(e,o[i+2])){var h=e,c=0;if(x(h,(d=o)[(u=i)+3]))if(x(h,d[u+6])){for(o=0,u=2*(c=x(h,d[u+8]))+(d=x(h,d[u+9+c])),c=0,d=sn[u];d[o];++o)c+=c+x(h,d[o]);c+=3+(8<<u)}else x(h,d[u+7])?(c=7+2*x(h,165),c+=x(h,145)):c=5+x(h,159);else c=x(h,d[u+4])?3+x(h,d[u+5]):2;o=l[2]}else c=1,o=l[1];l=a+nn[n],0>(h=e).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)*s[(0<n)+0]}return 16}function $e(e){var t=e.rb[e.sb-1];t.la=0,t.Na=0,gi(e.zc,0,0,e.zc.length),e.ja=0}function Ue(e,t){if(null==e)return 0;if(null==t)return Be(e,2,"NULL VP8Io parameter in VP8Decode().");if(!e.cb&&!He(e,t))return 0;if(ci(e.cb),null==t.ac||t.ac(t)){t.ob&&(e.L=0);var i=Nn[e.L];if(2==e.L?(e.yb=0,e.zb=0):(e.yb=t.v-i>>4,e.zb=t.j-i>>4,0>e.yb&&(e.yb=0),0>e.zb&&(e.zb=0)),e.Va=t.o+15+i>>4,e.Hb=t.va+15+i>>4,e.Hb>e.za&&(e.Hb=e.za),e.Va>e.Ub&&(e.Va=e.Ub),0<e.L){var s=e.ed;for(i=0;4>i;++i){var n;if(e.Qa.Cb){var r=e.Qa.Lb[i];e.Qa.Fb||(r+=s.Tb)}else r=s.Tb;for(n=0;1>=n;++n){var a=e.gd[i][n],o=r;if(s.Pc&&(o+=s.vd[0],n&&(o+=s.od[0])),0<(o=0>o?0:63<o?63:o)){var l=o;0<s.wb&&((l=4<s.wb?l>>2:l>>1)>9-s.wb&&(l=9-s.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=n}}}i=0}else Be(e,6,"Frame setup failed"),i=e.a;if(i=0==i){if(i){e.$c=0,0<e.Aa||(e.Ic=Bn);e:{i=e.Ic;s=4*(l=e.za);var h=32*l,c=l+1,u=0<e.L?l*(0<e.Aa?2:1):0,d=(2==e.Aa?2:1)*l;if((a=s+832+(n=3*(16*i+Nn[e.L])/2*h)+(r=null!=e.Fa&&0<e.Fa.length?e.Kc.c*e.Kc.i:0))!=a)i=0;else{if(a>e.Vb){if(e.Vb=0,e.Ec=fi(a),e.Fc=0,null==e.Ec){i=Be(e,1,"no memory during frame initialization.");break e}e.Vb=a}a=e.Ec,o=e.Fc,e.Ac=a,e.Bc=o,o+=s,e.Gd=mi(h,Ve),e.Hd=0,e.rb=mi(c+1,ke),e.sb=1,e.wa=u?mi(u,Le):null,e.Y=0,e.D.Nb=0,e.D.wa=e.wa,e.D.Y=e.Y,0<e.Aa&&(e.D.Y+=l),ci(!0),e.oc=a,e.pc=o,o+=832,e.ya=mi(d,Fe),e.aa=0,e.D.ya=e.ya,e.D.aa=e.aa,2==e.Aa&&(e.D.aa+=l),e.R=16*l,e.B=8*l,l=(h=Nn[e.L])*e.R,h=h/2*e.B,e.sa=a,e.ta=o+l,e.qa=e.sa,e.ra=e.ta+16*i*e.R+h,e.Ha=e.qa,e.Ia=e.ra+8*i*e.B+h,e.$c=0,o+=n,e.mb=r?a:null,e.nb=r?o:null,ci(o+r<=e.Fc+e.Vb),$e(e),gi(e.Ac,e.Bc,0,s),i=1}}if(i){if(t.ka=0,t.y=e.sa,t.O=e.ta,t.f=e.qa,t.N=e.ra,t.ea=e.Ha,t.Vd=e.Ia,t.fa=e.R,t.Rc=e.B,t.F=null,t.J=0,!Ps){for(i=-255;255>=i;++i)bs[255+i]=0>i?-i:i;for(i=-1020;1020>=i;++i)Cs[1020+i]=-128>i?-128:127<i?127:i;for(i=-112;112>=i;++i)Is[112+i]=-16>i?-16:15<i?15:i;for(i=-255;510>=i;++i)As[255+i]=0>i?0:255<i?255:i;Ps=1}ss=tt,ns=qe,as=Ze,os=Qe,ls=et,rs=Je,hs=Bt,cs=Wt,us=$t,ds=Ut,gs=Ht,fs=Yt,ms=jt,ps=Xt,ys=Dt,Ts=Vt,_s=Ot,xs=Mt,un[0]=pt,un[1]=st,un[2]=ft,un[3]=mt,un[4]=yt,un[5]=_t,un[6]=Tt,un[7]=xt,un[8]=St,un[9]=wt,cn[0]=ht,cn[1]=rt,cn[2]=at,cn[3]=ot,cn[4]=ct,cn[5]=ut,cn[6]=dt,dn[0]=Ct,dn[1]=nt,dn[2]=vt,dn[3]=Et,dn[4]=At,dn[5]=It,dn[6]=Pt,i=1}else i=0}i&&(i=function(e,t){for(e.M=0;e.M<e.Va;++e.M){var i,s=e.Jc[e.M&e.Xb],n=e.m,r=e;for(i=0;i<r.za;++i){var a=n,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=x(a,o.Pa.jb[0])?2+x(a,o.Pa.jb[2]):x(a,o.Pa.jb[1]):u.$b=0,o.kc&&(u.Ad=x(a,o.Bd)),u.Za=!x(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=on[l[h+f]][m];for(var p=rn[x(a,m[0])];0<p;)p=rn[2*p+x(a,m[p])];m=-p,l[h+f]=m}di(d,g,l,h,4),g+=4,c[0+o]=m}}else m=x(a,156)?x(a,128)?1:3:x(a,163)?2:0,u.Ob[0]=m,gi(l,h,m,4),gi(c,0,m,4);u.Dd=x(a,142)?x(a,114)?x(a,183)?1:3:2:0}if(r.m.Ka)return Be(e,7,"Premature end-of-partition0 encountered.");for(;e.ja<e.za;++e.ja){if(r=s,a=(n=e).rb[n.sb-1],l=n.rb[n.sb+n.ja],i=n.ya[n.aa+n.ja],h=n.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 y,T;if(a=l,l=r,h=n.Pa.Xc,c=n.ya[n.aa+n.ja],u=n.pb[c.$b],o=c.ad,d=0,g=n.rb[n.sb-1],m=f=0,gi(o,d,0,384),c.Za)var _=0,w=h[3];else{p=fi(16);var S=a.Na+g.Na;if(S=tn(l,h[1],S,u.Eb,0,p,0),a.Na=g.Na=(0<S)+0,1<S)ss(p,0,o,d);else{var v=p[0]+3>>3;for(p=0;256>p;p+=16)o[d+p]=v}_=1,w=h[0]}var E=15&a.la,b=15&g.la;for(p=0;4>p;++p){var C=1&b;for(v=T=0;4>v;++v)E=E>>1|(C=(S=tn(l,w,S=C+(1&E),u.Sc,_,o,d))>_)<<7,T=T<<2|(3<S?3:1<S?2:0!=o[d+0]),d+=16;E>>=4,b=b>>1|C<<7,f=(f<<8|T)>>>0}for(w=E,_=b>>4,y=0;4>y;y+=2){for(T=0,E=a.la>>4+y,b=g.la>>4+y,p=0;2>p;++p){for(C=1&b,v=0;2>v;++v)S=C+(1&E),E=E>>1|(C=0<(S=tn(l,h[2],S,u.Qc,0,o,d)))<<3,T=T<<2|(3<S?3:1<S?2:0!=o[d+0]),d+=16;E>>=2,b=b>>1|C<<5}m|=T<<4*y,w|=E<<4<<y,_|=(240&b)<<y}a.la=w,g.la=_,c.Hc=f,c.Gc=m,c.ia=43690&m?0:u.ia,h=!(f|m)}if(0<n.L&&(n.wa[n.Y+n.ja]=n.gd[i.$b][i.Za],n.wa[n.Y+n.ja].La|=!h),r.Ka)return Be(e,7,"Premature end-of-file encountered.")}if($e(e),n=t,r=1,i=(s=e).D,a=0<s.L&&s.M>=s.zb&&s.M<=s.Va,0==s.Aa)e:{if(i.M=s.M,i.uc=a,Ri(s,i),r=1,i=(T=s.D).Nb,a=(m=Nn[s.L])*s.R,l=m/2*s.B,p=16*i*s.R,v=8*i*s.B,h=s.sa,c=s.ta-a+p,u=s.qa,o=s.ra-l+v,d=s.Ha,g=s.Ia-l+v,b=0==(E=T.M),f=E>=s.Va-1,2==s.Aa&&Ri(s,T),T.uc)for(C=(S=s).D.M,ci(S.D.uc),T=S.yb;T<S.Hb;++T){_=T,w=C;var I=(A=(M=S).D).Nb;y=M.R;var A=A.wa[A.Y+_],P=M.sa,L=M.ta+16*I*y+16*_,k=A.dd,R=A.tc;if(0!=R)if(ci(3<=R),1==M.L)0<_&&Ts(P,L,y,R+4),A.La&&xs(P,L,y,R),0<w&&ys(P,L,y,R+4),A.La&&_s(P,L,y,R);else{var F=M.B,D=M.qa,V=M.ra+8*I*F+8*_,O=M.Ha,M=M.Ia+8*I*F+8*_;I=A.ld,0<_&&(cs(P,L,y,R+4,k,I),ds(D,V,O,M,F,R+4,k,I)),A.La&&(fs(P,L,y,R,k,I),ps(D,V,O,M,F,R,k,I)),0<w&&(hs(P,L,y,R+4,k,I),us(D,V,O,M,F,R+4,k,I)),A.La&&(gs(P,L,y,R,k,I),ms(D,V,O,M,F,R,k,I))}}if(s.ia&&alert("todo:DitherRow"),null!=n.put){if(T=16*E,E=16*(E+1),b?(n.y=s.sa,n.O=s.ta+p,n.f=s.qa,n.N=s.ra+v,n.ea=s.Ha,n.W=s.Ia+v):(T-=m,n.y=h,n.O=c,n.f=u,n.N=o,n.ea=d,n.W=g),f||(E-=m),E>n.o&&(E=n.o),n.F=null,n.J=null,null!=s.Fa&&0<s.Fa.length&&T<E&&(n.J=si(s,n,T,E-T),n.F=s.mb,null==n.F&&0==n.F.length)){r=Be(s,3,"Could not decode alpha data.");break e}T<n.j&&(m=n.j-T,T=n.j,ci(!(1&m)),n.O+=s.R*m,n.N+=s.B*(m>>1),n.W+=s.B*(m>>1),null!=n.F&&(n.J+=n.width*m)),T<E&&(n.O+=n.v,n.N+=n.v>>1,n.W+=n.v>>1,null!=n.F&&(n.J+=n.v),n.ka=T-n.j,n.U=n.va-n.v,n.T=E-T,r=n.put(n))}i+1!=s.Ic||f||(di(s.sa,s.ta-a,h,c+16*s.R,a),di(s.qa,s.ra-l,u,o+8*s.B,l),di(s.Ha,s.Ia-l,d,g+8*s.B,l))}if(!r)return Be(e,6,"Output aborted.")}return 1}(e,t)),null!=t.bc&&t.bc(t),i&=1}return i?(e.cb=0,i):0}function je(e,t,i,s,n){n=e[t+i+32*s]+(n>>3),e[t+i+32*s]=-256&n?0>n?0:255:n}function Xe(e,t,i,s,n,r){je(e,t,0,i,s+n),je(e,t,1,i,s+r),je(e,t,2,i,s-r),je(e,t,3,i,s-n)}function ze(e){return(20091*e>>16)+e}function Ke(e,t,i,s){var n,r=0,a=fi(16);for(n=0;4>n;++n){var o=e[t+0]+e[t+8],l=e[t+0]-e[t+8],h=(35468*e[t+4]>>16)-ze(e[t+12]),c=ze(e[t+4])+(35468*e[t+12]>>16);a[r+0]=o+c,a[r+1]=l+h,a[r+2]=l-h,a[r+3]=o-c,r+=4,t++}for(n=r=0;4>n;++n)o=(e=a[r+0]+4)+a[r+8],l=e-a[r+8],h=(35468*a[r+4]>>16)-ze(a[r+12]),je(i,s,0,0,o+(c=ze(a[r+4])+(35468*a[r+12]>>16))),je(i,s,1,0,l+h),je(i,s,2,0,l-h),je(i,s,3,0,o-c),r++,s+=32}function Je(e,t,i,s){var n=e[t+0]+4,r=35468*e[t+4]>>16,a=ze(e[t+4]),o=35468*e[t+1]>>16;Xe(i,s,0,n+a,e=ze(e[t+1]),o),Xe(i,s,1,n+r,e,o),Xe(i,s,2,n-r,e,o),Xe(i,s,3,n-a,e,o)}function qe(e,t,i,s,n){Ke(e,t,i,s),n&&Ke(e,t+16,i,s+4)}function Ze(e,t,i,s){ns(e,t+0,i,s,1),ns(e,t+32,i,s+128,1)}function Qe(e,t,i,s){var n;for(e=e[t+0]+4,n=0;4>n;++n)for(t=0;4>t;++t)je(i,s,t,n,e)}function et(e,t,i,s){e[t+0]&&os(e,t+0,i,s),e[t+16]&&os(e,t+16,i,s+4),e[t+32]&&os(e,t+32,i,s+128),e[t+48]&&os(e,t+48,i,s+128+4)}function tt(e,t,i,s){var n,r=fi(16);for(n=0;4>n;++n){var a=e[t+0+n]+e[t+12+n],o=e[t+4+n]+e[t+8+n],l=e[t+4+n]-e[t+8+n],h=e[t+0+n]-e[t+12+n];r[0+n]=a+o,r[8+n]=a-o,r[4+n]=h+l,r[12+n]=h-l}for(n=0;4>n;++n)a=(e=r[0+4*n]+3)+r[3+4*n],o=r[1+4*n]+r[2+4*n],l=r[1+4*n]-r[2+4*n],h=e-r[3+4*n],i[s+0]=a+o>>3,i[s+16]=h+l>>3,i[s+32]=a-o>>3,i[s+48]=h-l>>3,s+=64}function it(e,t,i){var s,n=t-32,r=Rs,a=255-e[n-1];for(s=0;s<i;++s){var o,l=r,h=a+e[t-1];for(o=0;o<i;++o)e[t+o]=l[h+e[n+o]];t+=32}}function st(e,t){it(e,t,4)}function nt(e,t){it(e,t,8)}function rt(e,t){it(e,t,16)}function at(e,t){var i;for(i=0;16>i;++i)di(e,t+32*i,e,t-32,16)}function ot(e,t){var i;for(i=16;0<i;--i)gi(e,t,e[t-1],16),t+=32}function lt(e,t,i){var s;for(s=0;16>s;++s)gi(t,i+32*s,e,16)}function ht(e,t){var i,s=16;for(i=0;16>i;++i)s+=e[t-1+32*i]+e[t+i-32];lt(s>>5,e,t)}function ct(e,t){var i,s=8;for(i=0;16>i;++i)s+=e[t-1+32*i];lt(s>>4,e,t)}function ut(e,t){var i,s=8;for(i=0;16>i;++i)s+=e[t+i-32];lt(s>>4,e,t)}function dt(e,t){lt(128,e,t)}function gt(e,t,i){return e+2*t+i+2>>2}function ft(e,t){var i,s=t-32;s=new Uint8Array([gt(e[s-1],e[s+0],e[s+1]),gt(e[s+0],e[s+1],e[s+2]),gt(e[s+1],e[s+2],e[s+3]),gt(e[s+2],e[s+3],e[s+4])]);for(i=0;4>i;++i)di(e,t+32*i,s,0,s.length)}function mt(e,t){var i=e[t-1],s=e[t-1+32],n=e[t-1+64],r=e[t-1+96];w(e,t+0,16843009*gt(e[t-1-32],i,s)),w(e,t+32,16843009*gt(i,s,n)),w(e,t+64,16843009*gt(s,n,r)),w(e,t+96,16843009*gt(n,r,r))}function pt(e,t){var i,s=4;for(i=0;4>i;++i)s+=e[t+i-32]+e[t-1+32*i];for(s>>=3,i=0;4>i;++i)gi(e,t+32*i,s,4)}function yt(e,t){var i=e[t-1+0],s=e[t-1+32],n=e[t-1+64],r=e[t-1-32],a=e[t+0-32],o=e[t+1-32],l=e[t+2-32],h=e[t+3-32];e[t+0+96]=gt(s,n,e[t-1+96]),e[t+1+96]=e[t+0+64]=gt(i,s,n),e[t+2+96]=e[t+1+64]=e[t+0+32]=gt(r,i,s),e[t+3+96]=e[t+2+64]=e[t+1+32]=e[t+0+0]=gt(a,r,i),e[t+3+64]=e[t+2+32]=e[t+1+0]=gt(o,a,r),e[t+3+32]=e[t+2+0]=gt(l,o,a),e[t+3+0]=gt(h,l,o)}function Tt(e,t){var i=e[t+1-32],s=e[t+2-32],n=e[t+3-32],r=e[t+4-32],a=e[t+5-32],o=e[t+6-32],l=e[t+7-32];e[t+0+0]=gt(e[t+0-32],i,s),e[t+1+0]=e[t+0+32]=gt(i,s,n),e[t+2+0]=e[t+1+32]=e[t+0+64]=gt(s,n,r),e[t+3+0]=e[t+2+32]=e[t+1+64]=e[t+0+96]=gt(n,r,a),e[t+3+32]=e[t+2+64]=e[t+1+96]=gt(r,a,o),e[t+3+64]=e[t+2+96]=gt(a,o,l),e[t+3+96]=gt(o,l,l)}function _t(e,t){var i=e[t-1+0],s=e[t-1+32],n=e[t-1+64],r=e[t-1-32],a=e[t+0-32],o=e[t+1-32],l=e[t+2-32],h=e[t+3-32];e[t+0+0]=e[t+1+64]=r+a+1>>1,e[t+1+0]=e[t+2+64]=a+o+1>>1,e[t+2+0]=e[t+3+64]=o+l+1>>1,e[t+3+0]=l+h+1>>1,e[t+0+96]=gt(n,s,i),e[t+0+64]=gt(s,i,r),e[t+0+32]=e[t+1+96]=gt(i,r,a),e[t+1+32]=e[t+2+96]=gt(r,a,o),e[t+2+32]=e[t+3+96]=gt(a,o,l),e[t+3+32]=gt(o,l,h)}function xt(e,t){var i=e[t+0-32],s=e[t+1-32],n=e[t+2-32],r=e[t+3-32],a=e[t+4-32],o=e[t+5-32],l=e[t+6-32],h=e[t+7-32];e[t+0+0]=i+s+1>>1,e[t+1+0]=e[t+0+64]=s+n+1>>1,e[t+2+0]=e[t+1+64]=n+r+1>>1,e[t+3+0]=e[t+2+64]=r+a+1>>1,e[t+0+32]=gt(i,s,n),e[t+1+32]=e[t+0+96]=gt(s,n,r),e[t+2+32]=e[t+1+96]=gt(n,r,a),e[t+3+32]=e[t+2+96]=gt(r,a,o),e[t+3+64]=gt(a,o,l),e[t+3+96]=gt(o,l,h)}function wt(e,t){var i=e[t-1+0],s=e[t-1+32],n=e[t-1+64],r=e[t-1+96];e[t+0+0]=i+s+1>>1,e[t+2+0]=e[t+0+32]=s+n+1>>1,e[t+2+32]=e[t+0+64]=n+r+1>>1,e[t+1+0]=gt(i,s,n),e[t+3+0]=e[t+1+32]=gt(s,n,r),e[t+3+32]=e[t+1+64]=gt(n,r,r),e[t+3+64]=e[t+2+64]=e[t+0+96]=e[t+1+96]=e[t+2+96]=e[t+3+96]=r}function St(e,t){var i=e[t-1+0],s=e[t-1+32],n=e[t-1+64],r=e[t-1+96],a=e[t-1-32],o=e[t+0-32],l=e[t+1-32],h=e[t+2-32];e[t+0+0]=e[t+2+32]=i+a+1>>1,e[t+0+32]=e[t+2+64]=s+i+1>>1,e[t+0+64]=e[t+2+96]=n+s+1>>1,e[t+0+96]=r+n+1>>1,e[t+3+0]=gt(o,l,h),e[t+2+0]=gt(a,o,l),e[t+1+0]=e[t+3+32]=gt(i,a,o),e[t+1+32]=e[t+3+64]=gt(s,i,a),e[t+1+64]=e[t+3+96]=gt(n,s,i),e[t+1+96]=gt(r,n,s)}function vt(e,t){var i;for(i=0;8>i;++i)di(e,t+32*i,e,t-32,8)}function Et(e,t){var i;for(i=0;8>i;++i)gi(e,t,e[t-1],8),t+=32}function bt(e,t,i){var s;for(s=0;8>s;++s)gi(t,i+32*s,e,8)}function Ct(e,t){var i,s=8;for(i=0;8>i;++i)s+=e[t+i-32]+e[t-1+32*i];bt(s>>4,e,t)}function It(e,t){var i,s=4;for(i=0;8>i;++i)s+=e[t+i-32];bt(s>>3,e,t)}function At(e,t){var i,s=4;for(i=0;8>i;++i)s+=e[t-1+32*i];bt(s>>3,e,t)}function Pt(e,t){bt(128,e,t)}function Lt(e,t,i){var s=e[t-i],n=e[t+0],r=3*(n-s)+Ls[1020+e[t-2*i]-e[t+i]],a=ks[112+(r+4>>3)];e[t-i]=Rs[255+s+ks[112+(r+3>>3)]],e[t+0]=Rs[255+n-a]}function kt(e,t,i,s){var n=e[t+0],r=e[t+i];return Fs[255+e[t-2*i]-e[t-i]]>s||Fs[255+r-n]>s}function Rt(e,t,i,s){return 4*Fs[255+e[t-i]-e[t+0]]+Fs[255+e[t-2*i]-e[t+i]]<=s}function Ft(e,t,i,s,n){var r=e[t-3*i],a=e[t-2*i],o=e[t-i],l=e[t+0],h=e[t+i],c=e[t+2*i],u=e[t+3*i];return 4*Fs[255+o-l]+Fs[255+a-h]>s?0:Fs[255+e[t-4*i]-r]<=n&&Fs[255+r-a]<=n&&Fs[255+a-o]<=n&&Fs[255+u-c]<=n&&Fs[255+c-h]<=n&&Fs[255+h-l]<=n}function Dt(e,t,i,s){var n=2*s+1;for(s=0;16>s;++s)Rt(e,t+s,i,n)&&Lt(e,t+s,i)}function Vt(e,t,i,s){var n=2*s+1;for(s=0;16>s;++s)Rt(e,t+s*i,1,n)&&Lt(e,t+s*i,1)}function Ot(e,t,i,s){var n;for(n=3;0<n;--n)Dt(e,t+=4*i,i,s)}function Mt(e,t,i,s){var n;for(n=3;0<n;--n)Vt(e,t+=4,i,s)}function Nt(e,t,i,s,n,r,a,o){for(r=2*r+1;0<n--;){if(Ft(e,t,i,r,a))if(kt(e,t,i,o))Lt(e,t,i);else{var l=e,h=t,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=Ls[1020+3*(g-d)+Ls[1020+u-f]])+63>>7,y=18*T+63>>7,T=9*T+63>>7;l[h-3*c]=Rs[255+l[h-3*c]+T],l[h-2*c]=Rs[255+u+y],l[h-c]=Rs[255+d+p],l[h+0]=Rs[255+g-p],l[h+c]=Rs[255+f-y],l[h+2*c]=Rs[255+m-T]}t+=s}}function Gt(e,t,i,s,n,r,a,o){for(r=2*r+1;0<n--;){if(Ft(e,t,i,r,a))if(kt(e,t,i,o))Lt(e,t,i);else{var l=e,h=t,c=i,u=l[h-c],d=l[h+0],g=l[h+c],f=ks[112+((m=3*(d-u))+4>>3)],m=ks[112+(m+3>>3)],p=f+1>>1;l[h-2*c]=Rs[255+l[h-2*c]+p],l[h-c]=Rs[255+u+m],l[h+0]=Rs[255+d-f],l[h+c]=Rs[255+g-p]}t+=s}}function Bt(e,t,i,s,n,r){Nt(e,t,i,1,16,s,n,r)}function Wt(e,t,i,s,n,r){Nt(e,t,1,i,16,s,n,r)}function Ht(e,t,i,s,n,r){var a;for(a=3;0<a;--a)Gt(e,t+=4*i,i,1,16,s,n,r)}function Yt(e,t,i,s,n,r){var a;for(a=3;0<a;--a)Gt(e,t+=4,1,i,16,s,n,r)}function $t(e,t,i,s,n,r,a,o){Nt(e,t,n,1,8,r,a,o),Nt(i,s,n,1,8,r,a,o)}function Ut(e,t,i,s,n,r,a,o){Nt(e,t,1,n,8,r,a,o),Nt(i,s,1,n,8,r,a,o)}function jt(e,t,i,s,n,r,a,o){Gt(e,t+4*n,n,1,8,r,a,o),Gt(i,s+4*n,n,1,8,r,a,o)}function Xt(e,t,i,s,n,r,a,o){Gt(e,t+4,1,n,8,r,a,o),Gt(i,s+4,1,n,8,r,a,o)}function zt(){this.ba=new Z,this.ec=[],this.cc=[],this.Mc=[],this.Dc=this.Nc=this.dc=this.fc=0,this.Oa=new ee,this.memory=0,this.Ib="OutputFunc",this.Jb="OutputAlphaFunc",this.Nd="OutputRowFunc"}function Kt(){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 Jt(){this.nc=this.Ea=this.b=this.hc=0,this.K=[],this.w=0}function qt(){this.ua=0,this.Wa=new I,this.vb=new I,this.md=this.xc=this.wc=0,this.vc=[],this.Wb=0,this.Ya=new r,this.yc=new s}function Zt(){this.xb=this.a=0,this.l=new Ne,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 qt,this.ab=0,this.gc=mi(4,Jt),this.Oc=0}function Qt(){this.Lc=this.Z=this.$a=this.i=this.c=0,this.l=new Ne,this.ic=0,this.ca=[],this.tb=0,this.qd=null,this.rd=0}function ei(e,t,i,s,n,r,a){for(e=null==e?0:e[t+0],t=0;t<a;++t)n[r+t]=e+i[s+t]&255,e=n[r+t]}function ti(e,t,i,s,n,r,a){var o;if(null==e)ei(null,null,i,s,n,r,a);else for(o=0;o<a;++o)n[r+o]=e[t+o]+i[s+o]&255}function ii(e,t,i,s,n,r,a){if(null==e)ei(null,null,i,s,n,r,a);else{var o,l=e[t+0],h=l,c=l;for(o=0;o<a;++o)h=c+(l=e[t+o])-h,c=i[s+o]+(-256&h?0>h?0:255:h)&255,h=l,n[r+o]=c}}function si(e,t,i,s){var n=t.width,r=t.o;if(ci(null!=e&&null!=t),0>i||0>=s||i+s>r)return null;if(!e.Cc){if(null==e.ga){var a;if(e.ga=new Qt,(a=null==e.ga)||(a=t.width*t.o,ci(0==e.Gb.length),e.Gb=fi(a),e.Uc=0,null==e.Gb?a=0:(e.mb=e.Gb,e.nb=e.Uc,e.rc=null,a=1),a=!a),!a){a=e.ga;var o=e.Fa,l=e.P,c=e.qc,u=e.mb,d=e.nb,g=l+1,f=c-1,p=a.l;if(ci(null!=o&&null!=u&&null!=t),mn[0]=null,mn[1]=ei,mn[2]=ti,mn[3]=ii,a.ca=u,a.tb=d,a.c=t.width,a.i=t.height,ci(0<a.c&&0<a.i),1>=c)t=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)t=0;else if(p.put=re,p.ac=ne,p.bc=ae,p.ma=a,p.width=t.width,p.height=t.height,p.Da=t.Da,p.v=t.v,p.va=t.va,p.j=t.j,p.o=t.o,a.$a)e:{ci(1==a.$a),t=xe();t:for(;;){if(null==t){t=0;break e}if(ci(null!=a),a.mc=t,t.c=a.c,t.i=a.i,t.l=a.l,t.l.ma=a,t.l.width=a.c,t.l.height=a.i,t.a=0,h(t.m,o,g,f),!we(a.c,a.i,1,t,null))break t;if(1==t.ab&&3==t.gc[0].hc&&me(t.s)?(a.ic=1,o=t.c*t.i,t.Ta=null,t.Ua=0,t.V=fi(o),t.Ba=0,null==t.V?(t.a=1,t=0):t=1):(a.ic=0,t=Se(t,a.c)),!t)break t;t=1;break e}a.mc=null,t=0}else t=f>=a.c*a.i;a=!t}if(a)return null;1!=e.ga.Lc?e.Ga=0:s=r-i}ci(null!=e.ga),ci(i+s<=r);e:{if(t=(o=e.ga).c,r=o.l.o,0==o.$a){if(g=e.rc,f=e.Vc,p=e.Fa,l=e.P+1+i*t,c=e.mb,u=e.nb+i*t,ci(l<=e.P+e.qc),0!=o.Z)for(ci(null!=mn[o.Z]),a=0;a<s;++a)mn[o.Z](g,f,p,l,c,u,t),g=c,f=u,u+=t,l+=t;else for(a=0;a<s;++a)di(c,u,p,l,t),g=c,f=u,u+=t,l+=t;e.rc=g,e.Vc=f}else{if(ci(null!=o.mc),t=i+s,ci(null!=(a=o.mc)),ci(t<=a.i),a.C>=t)t=1;else if(o.ic||li(),o.ic){o=a.V,g=a.Ba,f=a.c;var T=a.i,_=(p=1,l=a.$/f,c=a.$%f,u=a.m,d=a.s,a.$),x=f*T,w=f*t,S=d.wc,v=_<w?de(d,c,l):null;ci(_<=x),ci(t<=T),ci(me(d));t:for(;;){for(;!u.h&&_<w;){if(c&S||(v=de(d,c,l)),ci(null!=v),y(u),256>(T=ce(v.G[0],v.H[0],u)))o[g+_]=T,++_,++c>=f&&(c=0,++l<=t&&!(l%16)&&ye(a,l));else{if(!(280>T)){p=0;break t}T=le(T-256,u);var E,b=ce(v.G[4],v.H[4],u);if(y(u),!(_>=(b=he(f,b=le(b,u)))&&x-_>=T)){p=0;break t}for(E=0;E<T;++E)o[g+_+E]=o[g+_+E-b];for(_+=T,c+=T;c>=f;)c-=f,++l<=t&&!(l%16)&&ye(a,l);_<w&&c&S&&(v=de(d,c,l))}ci(u.h==m(u))}ye(a,l>t?t:l);break t}!p||u.h&&_<x?(p=0,a.a=u.h?5:3):a.$=_,t=p}else t=Te(a,a.V,a.Ba,a.c,a.i,t,ve);if(!t){s=0;break e}}i+s>=r&&(e.Cc=1),s=1}if(!s)return null;if(e.Cc&&(null!=(s=e.ga)&&(s.mc=null),e.ga=null,0<e.Ga))return alert("todo:WebPDequantizeLevels"),null}return e.nb+i*n}function ni(e,t,i,s,n,r){for(;0<n--;){var a,o=e,l=t+(i?1:0),h=e,c=t+(i?0:3);for(a=0;a<s;++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)}t+=r}}function ri(e,t,i,s,n){for(;0<s--;){var r;for(r=0;r<i;++r){var a=e[t+2*r+0],o=15&(h=e[t+2*r+1]),l=4369*o,h=(240&h|h>>4)*l>>16;e[t+2*r+0]=(240&a|a>>4)*l>>16&240|(15&a|a<<4)*l>>16>>4&15,e[t+2*r+1]=240&h|o}t+=n}}function ai(e,t,i,s,n,r,a,o){var l,h,c=255;for(h=0;h<n;++h){for(l=0;l<s;++l){var u=e[t+l];r[a+4*l]=u,c&=u}t+=i,a+=o}return 255!=c}function oi(e,t,i,s,n){var r;for(r=0;r<n;++r)i[s+r]=e[t+r]>>8}function li(){ws=ni,Ss=ri,vs=ai,Es=oi}function hi(e,t,i){self[e]=function(e,s,n,r,a,o,l,h,c,u,d,g,f,m,p,y,T){var _,x=T-1>>1,w=a[o+0]|l[h+0]<<16,S=c[u+0]|d[g+0]<<16;ci(null!=e);var v=3*w+S+131074>>2;for(t(e[s+0],255&v,v>>16,f,m),null!=n&&(v=3*S+w+131074>>2,t(n[r+0],255&v,v>>16,p,y)),_=1;_<=x;++_){var E=a[o+_]|l[h+_]<<16,b=c[u+_]|d[g+_]<<16,C=w+E+S+b+524296,I=C+2*(E+S)>>3;v=I+w>>1,w=(C=C+2*(w+b)>>3)+E>>1,t(e[s+2*_-1],255&v,v>>16,f,m+(2*_-1)*i),t(e[s+2*_-0],255&w,w>>16,f,m+(2*_-0)*i),null!=n&&(v=C+S>>1,w=I+b>>1,t(n[r+2*_-1],255&v,v>>16,p,y+(2*_-1)*i),t(n[r+2*_+0],255&w,w>>16,p,y+(2*_+0)*i)),w=E,S=b}1&T||(v=3*w+S+131074>>2,t(e[s+T-1],255&v,v>>16,f,m+(T-1)*i),null!=n&&(v=3*S+w+131074>>2,t(n[r+T-1],255&v,v>>16,p,y+(T-1)*i)))}}function yi(){pn[Ds]=yn,pn[Vs]=_n,pn[Os]=Tn,pn[Ms]=xn,pn[Ns]=wn,pn[Gs]=Sn,pn[Bs]=vn,pn[Ws]=_n,pn[Hs]=xn,pn[Ys]=wn,pn[$s]=Sn}function Ti(e){return e&~Pn?0>e?0:255:e>>An}function _i(e,t){return Ti((19077*e>>8)+(26149*t>>8)-14234)}function xi(e,t,i){return Ti((19077*e>>8)-(6419*t>>8)-(13320*i>>8)+8708)}function wi(e,t){return Ti((19077*e>>8)+(33050*t>>8)-17685)}function Si(e,t,i,s,n){s[n+0]=_i(e,i),s[n+1]=xi(e,t,i),s[n+2]=wi(e,t)}function vi(e,t,i,s,n){s[n+0]=wi(e,t),s[n+1]=xi(e,t,i),s[n+2]=_i(e,i)}function Ei(e,t,i,s,n){var r=xi(e,t,i);t=r<<3&224|wi(e,t)>>3,s[n+0]=248&_i(e,i)|r>>5,s[n+1]=t}function bi(e,t,i,s,n){var r=240&wi(e,t)|15;s[n+0]=240&_i(e,i)|xi(e,t,i)>>4,s[n+1]=r}function Ci(e,t,i,s,n){s[n+0]=255,Si(e,t,i,s,n+1)}function Ii(e,t,i,s,n){vi(e,t,i,s,n),s[n+3]=255}function Ai(e,t,i,s,n){Si(e,t,i,s,n),s[n+3]=255}function Me(e,t){return 0>e?0:e>t?t:e}function Pi(e,t,i){self[e]=function(e,s,n,r,a,o,l,h,c){for(var u=h+(-2&c)*i;h!=u;)t(e[s+0],n[r+0],a[o+0],l,h),t(e[s+1],n[r+0],a[o+0],l,h+i),s+=2,++r,++o,h+=2*i;1&c&&t(e[s+0],n[r+0],a[o+0],l,h)}}function Li(e,t,i){return 0==i?0==e?0==t?6:5:0==t?4:0:i}function ki(e,t,i,s,n){switch(e>>>30){case 3:ns(t,i,s,n,0);break;case 2:rs(t,i,s,n);break;case 1:os(t,i,s,n)}}function Ri(e,t){var i,s,n=t.M,r=t.Nb,a=e.oc,o=e.pc+40,l=e.oc,h=e.pc+584,c=e.oc,u=e.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<n?a[o-1-32]=l[h-1-32]=c[u-1-32]=129:(gi(a,o-32-1,127,21),gi(l,h-32-1,127,9),gi(c,u-32-1,127,9)),s=0;s<e.za;++s){var d=t.ya[t.aa+s];if(0<s){for(i=-1;16>i;++i)di(a,o+32*i-4,a,o+32*i+12,4);for(i=-1;8>i;++i)di(l,h+32*i-4,l,h+32*i+4,4),di(c,u+32*i-4,c,u+32*i+4,4)}var g=e.Gd,f=e.Hd+s,m=d.ad,p=d.Hc;if(0<n&&(di(a,o-32,g[f].y,0,16),di(l,h-32,g[f].f,0,8),di(c,u-32,g[f].ea,0,8)),d.Za){var y=a,T=o-32+16;for(0<n&&(s>=e.za-1?gi(y,T,g[f].y[15],4):di(y,T,g[f+1].y,0,4)),i=0;4>i;i++)y[T+128+i]=y[T+256+i]=y[T+384+i]=y[T+0+i];for(i=0;16>i;++i,p<<=2)y=a,T=o+Mn[i],un[d.Ob[i]](y,T),ki(p,m,16*+i,y,T)}else if(y=Li(s,n,d.Ob[0]),cn[y](a,o),0!=p)for(i=0;16>i;++i,p<<=2)ki(p,m,16*+i,a,o+Mn[i]);for(i=d.Gc,y=Li(s,n,d.Dd),dn[y](l,h),dn[y](c,u),p=m,y=l,T=h,255&(d=i>>0)&&(170&d?as(p,256,y,T):ls(p,256,y,T)),d=c,p=u,255&(i>>=8)&&(170&i?as(m,320,d,p):ls(m,320,d,p)),n<e.Ub-1&&(di(g[f].y,0,a,o+480,16),di(g[f].f,0,l,h+224,8),di(g[f].ea,0,c,u+224,8)),i=8*r*e.B,g=e.sa,f=e.ta+16*s+16*r*e.R,m=e.qa,d=e.ra+8*s+i,p=e.Ha,y=e.Ia+8*s+i,i=0;16>i;++i)di(g,f+i*e.R,a,o+32*i,16);for(i=0;8>i;++i)di(m,d+i*e.B,l,h+32*i,8),di(p,y+i*e.B,c,u+32*i,8)}}function Fi(e,t,i,s,n,r,a,o,l){var c=[0],u=[0],d=0,f=null!=l?l.kd:0,m=null!=l?l:new Kt;if(null==e||12>i)return 7;m.data=e,m.w=t,m.ha=i,t=[t],i=[i],m.gb=[m.gb];e:{var p=t,y=i,T=m.gb;if(ci(null!=e),ci(null!=y),ci(null!=T),T[0]=0,12<=y[0]&&!ui(e,p[0],"RIFF")){if(ui(e,p[0]+8,"WEBP")){T=3;break e}var _=E(e,p[0]+4);if(12>_||4294967286<_){T=3;break e}if(f&&_>y[0]-8){T=7;break e}T[0]=_,p[0]+=12,y[0]-=12}T=0}if(0!=T)return T;for(_=0<m.gb[0],i=i[0];;){e:{var x=e;y=t,T=i;var w=c,S=u,b=p=[0];if((A=d=[d])[0]=0,8>T[0])T=7;else{if(!ui(x,y[0],"VP8X")){if(10!=E(x,y[0]+4)){T=3;break e}if(18>T[0]){T=7;break e}var C=E(x,y[0]+8),I=1+v(x,y[0]+12);if(2147483648<=I*(x=1+v(x,y[0]+15))){T=3;break e}null!=b&&(b[0]=C),null!=w&&(w[0]=I),null!=S&&(S[0]=x),y[0]+=18,T[0]-=18,A[0]=1}T=0}}if(d=d[0],p=p[0],0!=T)return T;if(y=!!(2&p),!_&&d)return 3;if(null!=r&&(r[0]=!!(16&p)),null!=a&&(a[0]=y),null!=o&&(o[0]=0),a=c[0],p=u[0],d&&y&&null==l){T=0;break}if(4>i){T=7;break}if(_&&d||!_&&!d&&!ui(e,t[0],"ALPH")){i=[i],m.na=[m.na],m.P=[m.P],m.Sa=[m.Sa];e:{C=e,T=t,_=i;var A=m.gb;w=m.na,S=m.P,b=m.Sa;I=22,ci(null!=C),ci(null!=_),x=T[0];var P=_[0];for(ci(null!=w),ci(null!=b),w[0]=null,S[0]=null,b[0]=0;;){if(T[0]=x,_[0]=P,8>P){T=7;break e}var L=E(C,x+4);if(4294967286<L){T=3;break e}var k=8+L+1&-2;if(I+=k,0<A&&I>A){T=3;break e}if(!ui(C,x,"VP8 ")||!ui(C,x,"VP8L")){T=0;break e}if(P[0]<k){T=7;break e}ui(C,x,"ALPH")||(w[0]=C,S[0]=x+8,b[0]=L),x+=k,P-=k}}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];e:if(A=e,T=t,_=i,w=m.gb[0],S=m.Ja,b=m.xa,C=T[0],x=!ui(A,C,"VP8 "),I=!ui(A,C,"VP8L"),ci(null!=A),ci(null!=_),ci(null!=S),ci(null!=b),8>_[0])T=7;else{if(x||I){if(A=E(A,C+4),12<=w&&A>w-12){T=3;break e}if(f&&A>_[0]-8){T=7;break e}S[0]=A,T[0]+=8,_[0]-=8,b[0]=I}else b[0]=5<=_[0]&&47==A[C+0]&&!(A[C+4]>>5),S[0]=_[0];T=0}if(i=i[0],m.Ja=m.Ja[0],m.xa=m.xa[0],t=t[0],0!=T)break;if(4294967286<m.Ja)return 3;if(null==o||y||(o[0]=m.xa?2:1),a=[a],p=[p],m.xa){if(5>i){T=7;break}o=a,f=p,y=r,null==e||5>i?e=0:5<=i&&47==e[t+0]&&!(e[t+4]>>5)?(_=[0],A=[0],w=[0],h(S=new g,e,t,i),oe(S,_,A,w)?(null!=o&&(o[0]=_[0]),null!=f&&(f[0]=A[0]),null!=y&&(y[0]=w[0]),e=1):e=0):e=0}else{if(10>i){T=7;break}o=p,null==e||10>i||!We(e,t+3,i-3)?e=0:(f=e[t+0]|e[t+1]<<8|e[t+2]<<16,y=16383&(e[t+7]<<8|e[t+6]),e=16383&(e[t+9]<<8|e[t+8]),1&f||3<(f>>1&7)||!(f>>4&1)||f>>5>=m.Ja||!y||!e?e=0:(a&&(a[0]=y),o&&(o[0]=e),e=1))}if(!e)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=t-l.w,ci(4294967286>t-l.w),ci(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!=s&&(s[0]=a),null!=n&&(n[0]=p),0):T}function Di(e,t,i){var s=t.width,n=t.height,r=0,a=0,o=s,l=n;if(t.Da=null!=e&&0<e.Da,t.Da&&(o=e.cd,l=e.bd,r=e.v,a=e.j,11>i||(r&=-2,a&=-2),0>r||0>a||0>=o||0>=l||r+o>s||a+l>n))return 0;if(t.v=r,t.j=a,t.va=r+o,t.o=a+l,t.U=o,t.T=l,t.da=null!=e&&0<e.da,t.da){if(!A(o,l,i=[e.ib],r=[e.hb]))return 0;t.ib=i[0],t.hb=r[0]}return t.ob=null!=e&&e.ob,t.Kb=null==e||!e.Sd,t.da&&(t.ob=t.ib<3*s/4&&t.hb<3*n/4,t.Kb=0),1}function Vi(e){if(null==e)return 2;if(11>e.S){var t=e.f.RGBA;t.fb+=(e.height-1)*t.A,t.A=-t.A}else t=e.f.kb,e=e.height,t.O+=(e-1)*t.fa,t.fa=-t.fa,t.N+=(e-1>>1)*t.Ab,t.Ab=-t.Ab,t.W+=(e-1>>1)*t.Db,t.Db=-t.Db,null!=t.F&&(t.J+=(e-1)*t.lb,t.lb=-t.lb);return 0}function Oi(e,t,i,s){if(null==s||0>=e||0>=t)return 2;if(null!=i){if(i.Da){var n=i.cd,r=i.bd,a=-2&i.v,o=-2&i.j;if(0>a||0>o||0>=n||0>=r||a+n>e||o+r>t)return 2;e=n,t=r}if(i.da){if(!A(e,t,n=[i.ib],r=[i.hb]))return 2;e=n[0],t=r[0]}}s.width=e,s.height=t;e:{var l=s.width,h=s.height;if(e=s.S,0>=l||0>=h||!(e>=Ds&&13>e))e=2;else{if(0>=s.Rd&&null==s.sd){a=r=n=t=0;var c=(o=l*Wn[e])*h;if(11>e||(r=(h+1)/2*(t=(l+1)/2),12==e&&(a=(n=l)*h)),null==(h=fi(c+2*r+a))){e=1;break e}s.sd=h,11>e?((l=s.f.RGBA).eb=h,l.fb=0,l.A=o,l.size=c):((l=s.f.kb).y=h,l.O=0,l.fa=o,l.Fd=c,l.f=h,l.N=0+c,l.Ab=t,l.Cd=r,l.ea=h,l.W=0+c+r,l.Db=t,l.Ed=r,12==e&&(l.F=h,l.J=0+c+2*r),l.Tc=a,l.lb=n)}if(t=1,n=s.S,r=s.width,a=s.height,n>=Ds&&13>n)if(11>n)e=s.f.RGBA,t&=(o=Math.abs(e.A))*(a-1)+r<=e.size,t&=o>=r*Wn[n],t&=null!=e.eb;else{e=s.f.kb,o=(r+1)/2,c=(a+1)/2,l=Math.abs(e.fa);h=Math.abs(e.Ab);var u=Math.abs(e.Db),d=Math.abs(e.lb),g=d*(a-1)+r;t&=l*(a-1)+r<=e.Fd,t&=h*(c-1)+o<=e.Cd,t=(t&=u*(c-1)+o<=e.Ed)&l>=r&h>=o&u>=o,t&=null!=e.y,t&=null!=e.f,t&=null!=e.ea,12==n&&(t&=d>=r,t&=g<=e.Tc,t&=null!=e.F)}else t=0;e=t?0:2}}return 0!=e||null!=i&&i.fd&&(e=Vi(s)),e}var Mi=64,Ni=[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],Gi=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];k("Predictor0","PredictorAdd0"),self.Predictor0=function(){return 4278190080},self.Predictor1=function(e){return e},self.Predictor2=function(e,t,i){return t[i+0]},self.Predictor3=function(e,t,i){return t[i+1]},self.Predictor4=function(e,t,i){return t[i-1]},self.Predictor5=function(e,t,i){return F(F(e,t[i+1]),t[i+0])},self.Predictor6=function(e,t,i){return F(e,t[i-1])},self.Predictor7=function(e,t,i){return F(e,t[i+0])},self.Predictor8=function(e,t,i){return F(t[i-1],t[i+0])},self.Predictor9=function(e,t,i){return F(t[i+0],t[i+1])},self.Predictor10=function(e,t,i){return F(F(e,t[i-1]),F(t[i+0],t[i+1]))},self.Predictor11=function(e,t,i){var s=t[i+0];return 0>=O(s>>24&255,e>>24&255,(t=t[i-1])>>24&255)+O(s>>16&255,e>>16&255,t>>16&255)+O(s>>8&255,e>>8&255,t>>8&255)+O(255&s,255&e,255&t)?s:e},self.Predictor12=function(e,t,i){var s=t[i+0];return(D((e>>24&255)+(s>>24&255)-((t=t[i-1])>>24&255))<<24|D((e>>16&255)+(s>>16&255)-(t>>16&255))<<16|D((e>>8&255)+(s>>8&255)-(t>>8&255))<<8|D((255&e)+(255&s)-(255&t)))>>>0},self.Predictor13=function(e,t,i){var s=t[i-1];return(V((e=F(e,t[i+0]))>>24&255,s>>24&255)<<24|V(e>>16&255,s>>16&255)<<16|V(e>>8&255,s>>8&255)<<8|V(e>>0&255,s>>0&255))>>>0};var Yi=self.PredictorAdd0;self.PredictorAdd1=M,k("Predictor2","PredictorAdd2"),k("Predictor3","PredictorAdd3"),k("Predictor4","PredictorAdd4"),k("Predictor5","PredictorAdd5"),k("Predictor6","PredictorAdd6"),k("Predictor7","PredictorAdd7"),k("Predictor8","PredictorAdd8"),k("Predictor9","PredictorAdd9"),k("Predictor10","PredictorAdd10"),k("Predictor11","PredictorAdd11"),k("Predictor12","PredictorAdd12"),k("Predictor13","PredictorAdd13");var $i=self.PredictorAdd2;W("ColorIndexInverseTransform","MapARGB","32b",(function(e){return e>>8&255}),(function(e){return e})),W("VP8LColorIndexInverseTransformAlpha","MapAlpha","8b",(function(e){return e}),(function(e){return e>>8&255}));var Ui,ji=self.ColorIndexInverseTransform,Xi=self.MapARGB,zi=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,es,ts,is,ss,ns,rs,as,os,ls,hs,cs,us,ds,gs,fs,ms,ps,ys,Ts,_s,xs,ws,Ss,vs,Es,bs=fi(511),Cs=fi(2041),Is=fi(225),As=fi(767),Ps=0,Ls=Cs,ks=Is,Rs=As,Fs=bs,Ds=0,Vs=1,Os=2,Ms=3,Ns=4,Gs=5,Bs=6,Ws=7,Hs=8,Ys=9,$s=10,Us=[2,3,7],js=[3,3,11],Xs=[280,256,256,256,40],zs=[0,1,1,1,0],Ks=[17,18,0,1,2,3,4,5,16,6,7,8,9,10,11,12,13,14,15],Js=[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],qs=[2954,2956,2958,2962,2970,2986,3018,3082,3212,3468,3980,5004],Zs=8,Qs=[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],en=[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],tn=null,sn=[[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]],nn=[0,1,4,8,5,2,3,6,9,12,13,10,7,11,14,15],rn=[-0,1,-1,2,-2,3,4,6,-3,5,-4,-5,-6,7,-7,8,-8,-9],an=[[[[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]]]],on=[[[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]]],ln=[[[[255,255,255,255,255,255,255,255,255,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]]]],hn=[0,1,2,3,6,4,5,6,6,6,6,6,6,6,6,7,0],cn=[],un=[],dn=[],gn=1,fn=2,mn=[],pn=[];hi("UpsampleRgbLinePair",Si,3),hi("UpsampleBgrLinePair",vi,3),hi("UpsampleRgbaLinePair",Ai,4),hi("UpsampleBgraLinePair",Ii,4),hi("UpsampleArgbLinePair",Ci,4),hi("UpsampleRgba4444LinePair",bi,2),hi("UpsampleRgb565LinePair",Ei,2);var yn=window.UpsampleRgbLinePair,Tn=window.UpsampleBgrLinePair,_n=window.UpsampleRgbaLinePair,xn=window.UpsampleBgraLinePair,wn=window.UpsampleArgbLinePair,Sn=window.UpsampleRgba4444LinePair,vn=window.UpsampleRgb565LinePair,En=16,bn=1<<En-1,Cn=-227,In=482,An=6,Pn=(256<<An)-1,Ln=0,kn=fi(256),Rn=fi(256),Fn=fi(256),Dn=fi(256),Vn=fi(In-Cn),On=fi(In-Cn);Pi("YuvToRgbRow",Si,3),Pi("YuvToBgrRow",vi,3),Pi("YuvToRgbaRow",Ai,4),Pi("YuvToBgraRow",Ii,4),Pi("YuvToArgbRow",Ci,4),Pi("YuvToRgba4444Row",bi,2),Pi("YuvToRgb565Row",Ei,2);var Mn=[0,4,8,12,128,132,136,140,256,260,264,268,384,388,392,396],Nn=[0,2,8],Gn=[8,7,6,4,4,2,2,2,1,1,1,1],Bn=1;this.WebPDecodeRGBA=function(e,t,i,s,n){var r=Vs,a=new zt,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==e)var d=2;else ci(null!=u),d=Fi(e,t,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!=s&&(s[0]=o.width),null!=n&&(n[0]=o.height);e:{if(s=new Ne,(n=new Kt).data=e,n.w=t,n.ha=i,n.kd=1,t=[0],ci(null!=n),(0==(e=Fi(n.data,n.w,n.ha,null,null,null,t,null,n))||7==e)&&t[0]&&(e=4),0==(t=e)){if(ci(null!=a),s.data=n.data,s.w=n.w+n.offset,s.ha=n.ha-n.offset,s.put=re,s.ac=ne,s.bc=ae,s.ma=a,n.xa){if(null==(e=xe())){a=1;break e}if(function(e,t){var i=[0],s=[0],n=[0];t:for(;;){if(null==e)return 0;if(null==t)return e.a=2,0;if(e.l=t,e.a=0,h(e.m,t.data,t.w,t.ha),!oe(e.m,i,s,n)){e.a=3;break t}if(e.xb=fn,t.width=i[0],t.height=s[0],!we(i[0],s[0],1,e,null))break t;return 1}return ci(0!=e.a),0}(e,s)){if(s=0==(t=Oi(s.width,s.height,a.Oa,a.ba))){t:{s=e;i:for(;;){if(null==s){s=0;break t}if(ci(null!=s.s.yc),ci(null!=s.s.Ya),ci(0<s.s.Wb),ci(null!=(i=s.l)),ci(null!=(n=i.ma)),0!=s.xb){if(s.ca=n.ba,s.tb=n.tb,ci(null!=s.ca),!Di(n.Oa,i,Ms)){s.a=2;break i}if(!Se(s,i.width))break i;if(i.da)break i;if((i.da||K(s.ca.S))&&li(),11>s.ca.S||(alert("todo:WebPInitConvertARGBToYUV"),null!=s.ca.f.kb.F&&li()),s.Pb&&0<s.s.ua&&null==s.s.vb.X&&!b(s.s.vb,s.s.Wa.Xa)){s.a=1;break i}s.xb=0}if(!Te(s,s.V,s.Ba,s.c,s.i,i.o,fe))break i;n.Dc=s.Ma,s=1;break t}ci(0!=s.a),s=0}s=!s}s&&(t=e.a)}else t=e.a}else{if(null==(e=new Ge)){a=1;break e}if(e.Fa=n.na,e.P=n.P,e.qc=n.Sa,He(e,s)){if(0==(t=Oi(s.width,s.height,a.Oa,a.ba))){if(e.Aa=0,i=a.Oa,ci(null!=(n=e)),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=n.pb[c]).lc&&(d.ia=l*Gn[0>d.lc?0:d.lc]>>3),u|=d.ia;u&&(alert("todo:VP8InitRandom"),n.ia=1)}n.Ga=i.Id,100<n.Ga?n.Ga=100:0>n.Ga&&(n.Ga=0)}Ue(e,s)||(t=e.a)}}else t=e.a}0==t&&null!=a.Oa&&a.Oa.fd&&(t=Vi(a.ba))}a=t}r=0!=a?null:11>r?o.f.RGBA.eb:o.f.kb.y}else r=null;return r};var Wn=[3,4,3,4,4,2,2,4,4,4,2,1,1]},new window.WebPDecoder,window.WebPRiffParser=function(e,t){var i={},s=0,n=!1,r=0,a=0;if(i.frames=[],!function(e,t,i,s){for(var n=0;n<s;n++)if(e[t+n]!=i.charCodeAt(n))return!0;return!1}(e,t,"RIFF",4)){for(_i(e,t+=4),t+=8;t<e.length;){var o=yi(e,t),l=_i(e,t+=4);t+=4;var h=l+(1&l);switch(o){case"VP8 ":case"VP8L":void 0===i.frames[s]&&(i.frames[s]={}),(d=i.frames[s]).src_off=n?a:t-8,d.src_size=r+l+8,s++,n&&(n=!1,r=0,a=0);break;case"VP8X":(d=i.header={}).feature_flags=e[t];var c=t+4;d.canvas_width=1+Ti(e,c),c+=3,d.canvas_height=1+Ti(e,c),c+=3;break;case"ALPH":n=!0,r=h+8,a=t-8;break;case"ANIM":(d=i.header).bgcolor=_i(e,t),c=t+4,d.loop_count=(g=e)[(f=c)+0]<<0|g[f+1]<<8,c+=2;break;case"ANMF":var u,d;(d=i.frames[s]={}).offset_x=2*Ti(e,t),t+=3,d.offset_y=2*Ti(e,t),t+=3,d.width=1+Ti(e,t),t+=3,d.height=1+Ti(e,t),t+=3,d.duration=Ti(e,t),t+=3,u=e[t++],d.dispose=1&u,d.blend=u>>1&1}"ANMF"!=o&&(t+=h)}var g,f;return i}},window.ApicTools={parseGIF:e,decompressFrames:t},F.FlexSetNames={NoSet:1,Auto:2,Row:3,RowReverse:4,Column:5,ColumnReverse:6,NoWrap:7,Wrap:8,WrapReverse:9,FlexStart:10,FlexEnd:11,Center:12,SpaceBetween:13,SpaceAround:14,SpaceEvenly:15,Stretch:16,Baseline:17},F.FlexContainerProps=class{constructor(){this.flexDirection=F.FlexSetNames.Row,this.flexWrap=F.FlexSetNames.NoWrap,this.justifyContent=F.FlexSetNames.FlexStart,this.alignItems=F.FlexSetNames.Center,this.alignContent=F.FlexSetNames.FlexStart}},F.FlexItemProps=class{constructor(){this.alignSelf=F.FlexSetNames.NoSet,this.flexGrow=0}},console.log("Using JsView HTML Forge");let xi=F;class wi{static StringToInt32(e){let t=P.InvalidInt32,i=parseInt(e);return 0==isNaN(i)&&(t=i),t}static StringTrim(e){return e.trim()}static StringStartsWith(e,t){return e.startsWith(t)}static StringEndsWith(e,t){return e.endsWith(t)}static StringSplit(e,t=" ",i=0,s=0,n=!1){e||(e=""),0==s&&(s=e.length-1);let r=(e=e.substring(i,s+1)).trim().split(t),a=[];for(let e of r)e&&(n&&(e=e.trim(),0==e.length)||a.push(e));return a}static MergeBrackets(e,t=null){let i=[],s="",n=null,r=null,a=0,o=!1;for(let l of e){let e=0;for(;e<l.length;)if(a>0){let t=l.indexOf(")",e),i=l.indexOf("(",e);if(-1!=i&&(-1==t||i<t))a++,e=i+1;else{if(!(t>=0))break;a--,e=t+1}}else{let t=l.indexOf("(",e);if(-1==t)break;a++,e=t+1}o?(t&&(s+=t),s+=l):null!=n?(s+=n,t&&(s+=t),s+=l,n=null,o=!0):n=l,0==a&&(o?(r=s,s=""):r=l,i.push(r),n=null,o=!1)}return i}static ConvertToInt32(e,t){if(t.is(P.DataType.Null))return 0;if(t.is(P.DataType.String)){const e=t.get();if(""===e)return 0;if(wi.StringTrim(e),wi.StringEndsWith(e,"px")){const t='JsView Warning: Using px will make style performance lower, you can directly use numbers instead of "'+e+'".';console.warn(t)}return wi.StringToInt32(e)}return t.is(P.DataType.Int32)||t.is(P.DataType.Float)?t.get():(E(_.InvalidArgument,P.InvalidInt32,["Failed to convert style ",e,"=",t.toString(),", value type is supported."]),P.InvalidInt32)}static ConvertToFloat(e,t){return t.is(P.DataType.Null)?P.InvalidFloat:t.is(P.DataType.String)&&""===t.get()?0:t.is(P.DataType.Int32)||t.is(P.DataType.Float)?t.get():(E(_.InvalidArgument,P.InvalidFloat,["Failed to convert style ",e,"=",t.toString(),", value type is supported."]),P.InvalidFloat)}static ConvertToString(e,t,i=!1){if(t.is(P.DataType.Null))return P.InvalidPointer;0==t.is(P.DataType.String)&&E(_.InvalidArgument,P.InvalidPointer,["Failed to convert style ",e,"=",t.toString(),", type is not string."]);let s=t.get();return null==s||s.length<=0?P.InvalidPointer:(i&&(s=s.toUpperCase()),s)}static ConvertToCorner(e,t){if(t.is(P.DataType.Null))return P.InvalidPointer;let i=null;if(t.is(P.DataType.Int32)){const e=t.get();i=new P.CornerImpl(String(e)),i.topLeft=e,i.topRight=e,i.bottomRight=e,i.bottomLeft=e}else if(t.is(P.DataType.String)){const e=t.get();if(null==e||e.length<=0)return P.InvalidPointer;const s=wi.StringSplit(e),n=s.length;i=new P.CornerImpl(e),i.topLeft=n>0?parseInt(s[0]):0,i.topRight=n>1?parseInt(s[1]):i.topLeft,i.bottomRight=n>2?parseInt(s[2]):i.topLeft,i.bottomLeft=n>3?parseInt(s[3]):i.bottomRight}else E(_.InvalidArgument,P.InvalidPointer,["Failed to convert style ",e,"=",t.toString(),", type is not number or string."]);return i}static ConvertToRect(e,t){if(t.is(P.DataType.Null))return P.InvalidPointer;0==t.is(P.DataType.String)&&E(_.InvalidArgument,P.InvalidPointer,["Failed to convert style "+e+"="+t+", value type is not string."]);const i=t.get();if(null==i||i.length<=0)return P.InvalidPointer;const s=new P.RectImpl(i),n=wi.StringSplit(i),r=n.length;return s.top=r>0?parseInt(n[0]):0,s.right=r>1?parseInt(n[1]):s.top,s.bottom=r>2?parseInt(n[2]):s.top,s.left=r>3?parseInt(n[3]):s.right,s}static ConvertToAnimation(e,t,i=null){if(t.is(P.DataType.Null))return P.InvalidPointer;0==t.is(P.DataType.String)&&E(_.InvalidArgument,P.InvalidPointer,["Failed to convert style ",e,"=",t.toString(),", type is not string."]);const s=t.get();if(null==s||s.length<=0)return P.InvalidPointer;if(null!=i&&null!=i.rawValue&&i.rawValue==s)return i;return wi.ParseToAnimation(s)}static ConvertToTransition(e,t,i=null){if(t.is(P.DataType.Null))return P.InvalidPointer;0==t.is(P.DataType.String)&&E(_.InvalidArgument,P.InvalidPointer,["Failed to convert style ",e,"=",t.toString(),", type is not string."]);const s=t.get();if(null==s||s.length<=0)return P.InvalidPointer;if(null!=i&&null!=i.rawValue&&i.rawValue==s)return i;let n=[];const r=wi.StringSplit(s,",");for(let e=0;e<r.length;e++)if(r[e].indexOf("(")>=0){let t=e;for(;t<r.length&&r[t].indexOf(")")<0;)t++;let i="";for(let s=e;s<=t;s++)s!=e&&(i+=","),i+=r[s];e=t,n.push(i)}else n.push(r[e]);const a=new P.TransitionImpl(s);for(const t of n){const i=wi.ConvertToAnimation(e,new P(t));if(null!=i&&(a.animationMap.set(i.name,i),"all"==i?.name)){const e=["opacity","left","top","width","height","transform"];for(const t of e)a.animationMap.set(t,i)}}return a}static ConvertToTextShadow(e,t){if(t.is(P.DataType.Null))return P.InvalidPointer;0==t.is(P.DataType.String)&&E(_.InvalidArgument,P.InvalidPointer,["Failed to convert style ",e,"=",t.toString(),", type is not string."]);const i=t.get();if(null==i||i.length<=0)return P.InvalidPointer;const s=new P.TextShadowImpl(i),n=wi.StringSplit(i);n.length>0&&(s.hShadow=parseInt(n[0])),n.length>1&&(s.vShadow=parseInt(n[1])),n.length>2&&(s.blur=parseInt(n[2]));let r=-1;return 3==n.length?r=2:n.length>3&&(r=3),r>0&&(s.color=n[r]),s}static ConvertToWebkitTextStroke(e,t){if(t.is(P.DataType.Null))return P.InvalidPointer;0==t.is(P.DataType.String)&&E(_.InvalidArgument,P.InvalidPointer,["Failed to convert style ",e,"=",t.toString(),", type is not string."]);const i=t.get();if(null==i||i.length<=0)return P.InvalidPointer;const s=new P.WebkitTextStrokeImpl(i),n=wi.StringSplit(i);return n.length>0&&(s.length=parseInt(n[0])),n.length>1&&(s.color=n[1]),s}static ConvertToBorderImage(e,t){if(t.is(P.DataType.Null))return P.InvalidPointer;0==t.is(P.DataType.String)&&E(_.InvalidArgument,P.InvalidPointer,["Failed to convert style ",e,"=",t.toString(),", type is not string."]);const i=t.get();if(null==i||i.length<=0)return P.InvalidPointer;const s=new P.BorderImageImpl(i),n=wi.StringSplit(i),r=n.length;return r>0&&(s.source=n[0]),r>1&&(s.slice=wi.ConvertToRect(e,new P(n[1]))),s}static ConvertToBackgroundImage(e,t){if(t.is(P.DataType.Null))return P.InvalidPointer;0==t.is(P.DataType.String)&&E(_.InvalidArgument,P.InvalidPointer,["Failed to convert style ",e,"=",t.toString(),", type is not string."]);let i=t.get();if(null==i||i.length<=0)return P.InvalidPointer;const s=new P.BackgroundImageImpl(i),n="linear-gradient(";if(0==i.indexOf(n)){i=wi.StringTrim(i),s.type=P.BackgroundImageImpl.eType.LINEAR_GRADIENT,s.linearGradient=new P.BackgroundImageImpl.LinearGradient,s.urlPath=i;let e=wi.StringSplit(i,",",16,i.length-2);e=wi.MergeBrackets(e,",");let n=e.length;if(n>0){let t=e[0];if(-1!=t.indexOf("to ")){e.splice(0,1);let i=e.length;-1!=t.indexOf("left")?(s.linearGradient.fromX=i+1,s.linearGradient.toX=0):-1!=t.indexOf("right")?(s.linearGradient.fromX=0,s.linearGradient.toX=i+1):(s.linearGradient.fromX=0,s.linearGradient.toX=0),-1!=t.indexOf("top")?(s.linearGradient.fromY=i+1,s.linearGradient.toY=0):-1!=t.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=${t}`),null;let r=1/e.length,a=e.length;for(let t=0;t<a;t++){let i=e[t];i=wi.StringTrim(i);let n=new xi.LinearGradientTexture.StopPoint;n.color=i,n.stopPosition=t!=a-1?t*r:1,s.linearGradient.stops.push(n)}}else s.type=P.BackgroundImageImpl.eType.URL_PATH,s.urlPath=i;return s}static ConvertToFlexEnum(e,t){let i=t.toString();return"flexDirection"==e?"row"==i?xi.FlexSetNames.Row:"row-reverse"==i?xi.FlexSetNames.RowReverse:"column"==i?xi.FlexSetNames.Column:"column-reverse"==i?xi.FlexSetNames.ColumnReverse:(console.warn("Unknown flexDirection value="+i),P.InvalidInt32):"flexWrap"==e?"nowrap"==i?xi.FlexSetNames.NoWrap:"wrap"==i?xi.FlexSetNames.Wrap:"wrap-reverse"==i?xi.FlexSetNames.WrapReverse:(console.warn("Unknown flexWrap value="+i),P.InvalidInt32):"justifyContent"==e?"flex-start"==i?xi.FlexSetNames.FlexStart:"flex-end"==i?xi.FlexSetNames.FlexEnd:"center"==i?xi.FlexSetNames.Center:(console.warn("Unknown justifyContent value="+i),P.InvalidInt32):"alignItems"==e?"stretch"==i?xi.FlexSetNames.Stretch:"flex-start"==i?xi.FlexSetNames.FlexStart:"flex-end"==i?xi.FlexSetNames.FlexEnd:"center"==i?xi.FlexSetNames.Center:(console.warn("Unknown alignItems value="+i),P.InvalidInt32):"alignContent"==e?"flex-start"==i?xi.FlexSetNames.FlexStart:"flex-end"==i?xi.FlexSetNames.FlexEnd:"center"==i?xi.FlexSetNames.Center:(console.warn("Unknown alignContent value="+i),P.InvalidInt32):"alignSelf"==e?"stretch"==i?xi.FlexSetNames.Stretch:"flex-start"==i?xi.FlexSetNames.FlexStart:"flex-end"==i?xi.FlexSetNames.FlexEnd:"center"==i?xi.FlexSetNames.Center:(console.warn("Unknown alignSelf value="+i),P.InvalidInt32):P.InvalidInt32}static ParseToAnimation(e){const t=wi.StringTrim(e);let i=[];const s=t.indexOf("cubic-bezier");if(s>=0){const e=t.indexOf(")"),n=t.substring(s,e-1),r=wi.StringSplit(t,n);for(const e of r){const t=wi.StringSplit(e);i=[...i,...t]}i.push(n)}else i=wi.StringSplit(t);let n="",r=0,a=1,o=t.indexOf("alternate")>=0;for(var l=2;l<i.length;l++){if("infinite"==i[l]){a=-1;continue}let e=wi.ParseToTimeMs(i[l]);0==isNaN(e)?r=e:(e=wi.ParseToFloat(i[l]),0==isNaN(e)?a=e:n=i[l])}const h=i.length>1?wi.ParseToTimeMs(i[1]):0,c=new P.AnimationImpl(t);return c.name=i.length>0?i[0]:"",c.duration=h,c.timingFunction=wi.ParseToEasing(n,h),c.delay=r,c.iterationCount=a,c.direction=o,c}static ParseToTimeMs(e){if(0==wi.StringEndsWith(e,"s"))return NaN;let t=wi.ParseToFloat(e);return wi.StringEndsWith(e,"ms")?t*=1:wi.StringEndsWith(e,"s")&&(t*=1e3),t}static ParseToFloat(e){const t=wi.StringTrim(e);return parseFloat(t)}static ParseToEasing(e,t){let i=null;return e.indexOf("ease")>=0?i=e.indexOf("-in-out")>=0?F.Easing.Circular.InOut:e.indexOf("-out")>=0?F.Easing.Circular.Out:e.indexOf("-in")>=0?F.Easing.Circular.In:F.Easing.Circular.InOut:e.indexOf("linear")>=0?i=null:e.indexOf("cubic-bezier")>=0?i=wi.ParseToEasingBezier(e,t):e.indexOf("steps")>=0&&(i=wi.ParseToEasingSteps(e)),i}static ParseToEasingBezier(e,t){let i=e.indexOf("(");i>=0&&(e=e.substring(i+1));let s=wi.StringSplit(e,","),n={x1:s.length>0?parseFloat(s[0]):0,y1:s.length>1?parseFloat(s[1]):0,x2:s.length>2?parseFloat(s[2]):0,y2:s.length>3?parseFloat(s[3]):0};return new F.BezierEasing(n.x1,n.y1,n.x2,n.y2,t)}static ParseToEasingSteps(e){let t=e.indexOf("(");t>=0&&(e=e.substring(t+1));let i=wi.StringSplit(e,","),s={steps:i.length>0?parseInt(i[0]):1,type:i.length>1?i[1].includes("start")?0:1:0};return new F.StepsEasing(s.steps,s.type)}constructor(){throw new Error("new StyleGroup() is forbidden.")}}class Si{static IsInheritedProp(e){return e==A.Text.Color||e==A.Text.FontFamily||e==A.Text.FontSize||e==A.Text.FontStyle||e==A.Text.FontWeight||e==A.Text.LineHeight||e==A.Text.TextAlign||e==A.Text.TextOverflow||e==A.Text.TextShadow||e==A.Text.WebkitTextStroke||e==A.Text.WhiteSpace||e==A.Text.WordWrap||e==A.Text.Direction||e==A.Text.JsvTextEmoji||e==A.Text.JsvTextLatex||e==A.Text.JsvTextAlignMinWidth||e==A.Text.JsvTextVerticalAlign||e==A.Text.JsvTextLineAlign||e==A.Text.JsvTextInnerDirection}constructor(){this.changedStyleGroups=new Set,this.lockedPropNames=new Set,this.layout=void 0,this.background=void 0,this.flex=void 0,this.effect=void 0,this.text=void 0,this.motion=void 0}setPropValue(e,t,i){if(0==i&&1==this.isPropNameLocked(e))return _.CssStyleNotChanged;const s=this.setValue(e,t);return null==s?_.CssStyleNotChanged:(this.changedStyleGroups.add(s),this.needUpdateTransition(e)&&this.changedStyleGroups.add(R.Motion.Name),i&&this.lockedPropNames.add(e),0)}getPropValue(e){return this.getValue(e)}hasPropValue(e){return this.hasValue(e)}hasPropGroup(e){return e==R.Layout.Name?null!=this.layout:e==R.Background.Name?null!=this.background:e==R.Effect.Name?null!=this.effect:e==R.Text.Name?null!=this.text:e==R.Motion.Name&&null!=this.motion}isPropNameLocked(e){return 1==this.lockedPropNames.has(e)}addChangedStyleGroup(e){return e!=R.Layout.Name&&e!=R.Background.Name&&e!=R.Effect.Name&&e!=R.Text.Name&&e!=R.Motion.Name&&v(_.InvalidArgument),this.changedStyleGroups.add(e),0}getChangedStyleGroups(){return this.changedStyleGroups}clearChangedStyleGroups(){this.changedStyleGroups.clear()}setValue(e,t){let i=null;return e==A.Layout.Left||e==A.Layout.Top||e==A.Layout.Width||e==A.Layout.Height?i=this.setLayoutValue(e,t):e==A.Flex.FlexDirection||e==A.Flex.FlexWrap||e==A.Flex.JustifyContent||e==A.Flex.AlignItems||e==A.Flex.AlignContent||e==A.Flex.AlignSelf||e==A.Flex.FlexGrow?i=this.setFlexValue(e,t):e==A.Background.BackgroundColor||e==A.Background.BackgroundImage||e==A.Background.BorderRadius?i=this.setBackgroundValue(e,t):e==A.Effect.BackfaceVisibility||e==A.Effect.BorderImage||e==A.Effect.BorderImageWidth||e==A.Effect.BorderImageOutset||e==A.Effect.Display||e==A.Effect.ObjectFit||e==A.Effect.Opacity||e==A.Effect.Overflow||e==A.Effect.Perspective||e==A.Effect.PerspectiveOrigin||e==A.Effect.Transform||e==A.Effect.TransformOrigin||e==A.Effect.TransformStyle||e==A.Effect.Visibility||e==A.Effect.ZIndex?i=this.setEffectValue(e,t):e==A.Text.Color||e==A.Text.FontFamily||e==A.Text.FontSize||e==A.Text.FontStyle||e==A.Text.FontWeight||e==A.Text.TextAlign||e==A.Text.TextOverflow||e==A.Text.TextShadow||e==A.Text.LineHeight||e==A.Text.WebkitTextStroke||e==A.Text.WhiteSpace||e==A.Text.WordWrap||e==A.Text.Direction||e==A.Text.JsvTextEmoji||e==A.Text.JsvTextLatex||e==A.Text.JsvTextAlignMinWidth||e==A.Text.JsvTextVerticalAlign||e==A.Text.JsvTextLineAlign||e==A.Text.JsvTextInnerDirection?i=this.setTextValue(e,t):e==A.Motion.Animation||e==A.Motion.Transition||e==A.Motion.AnimationFillMode?i=this.setMotionValue(e,t):E(_.UnimplementedError,null),null!=i&&this.changedStyleGroups.add(i),i}getValue(e){let t;return e==A.Layout.Left||e==A.Layout.Top||e==A.Layout.Width||e==A.Layout.Height?t=this.getLayoutValue(e):e==A.Flex.FlexDirection||e==A.Flex.FlexWrap||e==A.Flex.JustifyContent||e==A.Flex.AlignItems||e==A.Flex.AlignContent||e==A.Flex.AlignSelf||e==A.Flex.FlexGrow?t=this.getFlexValue(e):e==A.Background.BackgroundColor||e==A.Background.BackgroundImage||e==A.Background.BorderRadius?t=this.getBackgroundValue(e):e==A.Effect.BackfaceVisibility||e==A.Effect.BorderImage||e==A.Effect.BorderImageWidth||e==A.Effect.BorderImageOutset||e==A.Effect.Display||e==A.Effect.ObjectFit||e==A.Effect.Opacity||e==A.Effect.Overflow||e==A.Effect.Perspective||e==A.Effect.PerspectiveOrigin||e==A.Effect.Transform||e==A.Effect.TransformOrigin||e==A.Effect.TransformStyle||e==A.Effect.Visibility||e==A.Effect.ZIndex?t=this.getEffectValue(e):e==A.Text.Color||e==A.Text.FontFamily||e==A.Text.FontSize||e==A.Text.FontStyle||e==A.Text.FontWeight||e==A.Text.TextAlign||e==A.Text.TextOverflow||e==A.Text.TextShadow||e==A.Text.LineHeight||e==A.Text.WebkitTextStroke||e==A.Text.WhiteSpace||e==A.Text.WordWrap||e==A.Text.Direction||e==A.Text.JsvTextEmoji||e==A.Text.JsvTextLatex||e==A.Text.JsvTextAlignMinWidth||e==A.Text.JsvTextVerticalAlign||e==A.Text.JsvTextLineAlign||e==A.Text.JsvTextInnerDirection?t=this.getTextValue(e):e==A.Motion.Animation||e==A.Motion.Transition||e==A.Motion.AnimationFillMode?t=this.getMotionValue(e):(E(_.UnimplementedError,null),t=new P),t}hasValue(e){let t=!1;return e==A.Layout.Left||e==A.Layout.Top||e==A.Layout.Width||e==A.Layout.Height?t=this.hasLayoutValue(e):e==A.Flex.FlexDirection||e==A.Flex.FlexWrap||e==A.Flex.JustifyContent||e==A.Flex.AlignItems||e==A.Flex.AlignContent||e==A.Flex.AlignSelf||e==A.Flex.FlexGrow?t=this.hasFlexValue(e):e==A.Background.BackgroundColor||e==A.Background.BackgroundImage||e==A.Background.BorderRadius?t=this.hasBackgroundValue(e):e==A.Effect.BackfaceVisibility||e==A.Effect.BorderImage||e==A.Effect.BorderImageWidth||e==A.Effect.BorderImageOutset||e==A.Effect.Display||e==A.Effect.ObjectFit||e==A.Effect.Overflow||e==A.Effect.Perspective||e==A.Effect.PerspectiveOrigin||e==A.Effect.Transform||e==A.Effect.TransformOrigin||e==A.Effect.TransformStyle||e==A.Effect.Visibility||e==A.Effect.ZIndex?t=this.hasEffectValue(e):e==A.Text.Color||e==A.Text.FontFamily||e==A.Text.FontSize||e==A.Text.FontStyle||e==A.Text.FontWeight||e==A.Text.TextAlign||e==A.Text.TextOverflow||e==A.Text.TextShadow||e==A.Text.LineHeight||e==A.Text.WebkitTextStroke||e==A.Text.WhiteSpace||e==A.Text.WordWrap||e==A.Text.Direction||e==A.Text.JsvTextEmoji||e==A.Text.JsvTextLatex||e==A.Text.JsvTextAlignMinWidth||e==A.Text.JsvTextVerticalAlign||e==A.Text.JsvTextLineAlign||e==A.Text.JsvTextInnerDirection?t=this.hasTextValue(e):e!=A.Motion.Animation&&e!=A.Motion.Transition&&e!=A.Motion.AnimationFillMode||(t=this.hasMotionValue(e)),t}setLayoutValue(e,t){const i=(e,t)=>{const i=t;return this.layout[e]==i==0&&(this.layout[e]=i,!0)};this.ensureGroupExist(R.Layout.Name);let s=!1;if(e==A.Layout.Height)s=i("height",wi.ConvertToInt32(e,t));else if(e==A.Layout.Left)s=i("left",wi.ConvertToInt32(e,t));else if(e==A.Layout.Top)s=i("top",wi.ConvertToInt32(e,t));else{if(e!=A.Layout.Width)throw new Error;s=i("width",wi.ConvertToInt32(e,t))}return s?R.Layout.Name:null}getLayoutValue(e){const t=e=>this.layout?new P(this.layout[e]):new P;if(e==A.Layout.Height)return t("height");if(e==A.Layout.Left)return t("left");if(e==A.Layout.Top)return t("top");if(e==A.Layout.Width)return t("width");throw new Error}hasLayoutValue(e){const t=e=>!(!this.layout||this.layout[e]==P.InvalidInt32);if(e==A.Layout.Height)return t("height");if(e==A.Layout.Left)return t("left");if(e==A.Layout.Top)return t("top");if(e==A.Layout.Width)return t("width");throw new Error}setFlexValue(e,t){const i=(e,t)=>{const i=t;return this.flex[e]==i==0&&(this.flex[e]=i,!0)};this.ensureGroupExist(R.Flex.Name);let s=!1;if(e==A.Flex.FlexDirection)s=i("flexDirection",wi.ConvertToFlexEnum(e,t));else if(e==A.Flex.FlexWrap)s=i("flexWrap",wi.ConvertToFlexEnum(e,t));else if(e==A.Flex.JustifyContent)s=i("justifyContent",wi.ConvertToFlexEnum(e,t));else if(e==A.Flex.AlignItems)s=i("alignItems",wi.ConvertToFlexEnum(e,t));else if(e==A.Flex.AlignContent)s=i("alignContent",wi.ConvertToFlexEnum(e,t));else if(e==A.Flex.AlignSelf)s=i("alignSelf",wi.ConvertToFlexEnum(e,t));else{if(e!=A.Flex.FlexGrow)throw new Error;s=i("flexGrow",wi.ConvertToFloat(e,t))}return s?R.Flex.Name:null}getFlexValue(e){const t=e=>this.flex?new P(this.flex[e]):new P;if(e==A.Flex.FlexDirection)return t("flexDirection");if(e==A.Flex.FlexWrap)return t("flexWrap");if(e==A.Flex.JustifyContent)return t("justifyContent");if(e==A.Flex.AlignItems)return t("alignItems");if(e==A.Flex.AlignContent)return t("alignContent");if(e==A.Flex.AlignSelf)return t("alignSelf");if(e==A.Flex.FlexGrow)return t("flexGrow");throw new Error}hasFlexValue(e){const t=e=>!(!this.flex||this.flex[e]==P.InvalidInt32);if(e==A.Flex.FlexDirection)return t("flexDirection");if(e==A.Flex.FlexWrap)return t("flexWrap");if(e==A.Flex.JustifyContent)return t("justifyContent");if(e==A.Flex.AlignItems)return t("alignItems");if(e==A.Flex.AlignContent)return t("alignContent");if(e==A.Flex.AlignSelf)return t("alignSelf");if(e==A.Flex.FlexGrow)return!(!this.flex||this.flex[e]==P.InvalidFloat);throw new Error}setBackgroundValue(e,t){const i=(e,t)=>{const i=t;return this.background[e]==i==0&&(this.background[e]=i,!0)};this.ensureGroupExist(R.Background.Name);let s=!1;if(e==A.Background.BackgroundColor)s=i("backgroundColor",wi.ConvertToString(e,t));else if(e==A.Background.BackgroundImage)s=i("backgroundImage",wi.ConvertToBackgroundImage(e,t));else{if(e!=A.Background.BorderRadius)throw new Error;s=i("borderRadius",wi.ConvertToCorner(e,t))}return s?R.Background.Name:null}getBackgroundValue(e){const t=e=>this.background?new P(this.background[e]):new P;if(e==A.Background.BackgroundColor)return t("backgroundColor");if(e==A.Background.BackgroundImage)return t("backgroundImage");if(e==A.Background.BorderRadius)return t("borderRadius");throw new Error}hasBackgroundValue(e){const t=e=>!(!this.background||this.background[e]==P.InvalidPointer);if(e==A.Background.BackgroundColor)return t("backgroundColor");if(e==A.Background.BackgroundImage)return t("backgroundImage");if(e==A.Background.BorderRadius)return t("borderRadius");throw new Error}setEffectValue(e,t){const i=(e,t)=>{const i=t;return this.effect[e]==i==0&&(this.effect[e]=i,!0)};this.ensureGroupExist(R.Effect.Name);let s=!1;if(e==A.Effect.BackfaceVisibility)s=i("backfaceVisibility",wi.ConvertToString(e,t));else if(e==A.Effect.BorderImage)s=i("borderImage",wi.ConvertToBorderImage(e,t));else if(e==A.Effect.BorderImageWidth)s=i("borderImageWidth",wi.ConvertToRect(e,t));else if(e==A.Effect.BorderImageOutset)s=i("borderImageOutset",wi.ConvertToRect(e,t));else if(e==A.Effect.Display)s=i("display",wi.ConvertToString(e,t));else if(e==A.Effect.ObjectFit)s=i("objectFit",wi.ConvertToString(e,t));else if(e==A.Effect.Opacity)s=i("opacity",wi.ConvertToFloat(e,t));else if(e==A.Effect.Overflow)s=i("overflow",wi.ConvertToString(e,t));else if(e==A.Effect.Perspective)s=i("perspective",wi.ConvertToInt32(e,t));else if(e==A.Effect.PerspectiveOrigin)s=i("perspectiveOrigin",wi.ConvertToInt32(e,t));else if(e==A.Effect.Transform)s=i("transform",wi.ConvertToString(e,t));else if(e==A.Effect.TransformOrigin)s=i("transformOrigin",wi.ConvertToString(e,t));else if(e==A.Effect.TransformStyle)s=i("transformStyle",wi.ConvertToString(e,t));else if(e==A.Effect.Visibility)s=i("visibility",wi.ConvertToString(e,t));else{if(e!=A.Effect.ZIndex)throw new Error;s=i("zIndex",wi.ConvertToInt32(e,t))}return s?R.Effect.Name:null}getEffectValue(e){const t=e=>this.effect?new P(this.effect[e]):new P;if(e==A.Effect.BackfaceVisibility)return t("backfaceVisibility");if(e==A.Effect.BorderImage)return t("borderImage");if(e==A.Effect.BorderImageWidth)return t("borderImageWidth");if(e==A.Effect.BorderImageOutset)return t("borderImageOutset");if(e==A.Effect.Display)return t("display");if(e==A.Effect.ObjectFit)return t("objectFit");if(e==A.Effect.Opacity)return t("opacity");if(e==A.Effect.Overflow)return t("overflow");if(e==A.Effect.Perspective)return t("perspective");if(e==A.Effect.PerspectiveOrigin)return t("perspectiveOrigin");if(e==A.Effect.Transform)return t("transform");if(e==A.Effect.TransformOrigin)return t("transformOrigin");if(e==A.Effect.TransformStyle)return t("transformStyle");if(e==A.Effect.Visibility)return t("visibility");if(e==A.Effect.ZIndex)return t("zIndex");throw new Error}hasEffectValue(e){const t=(e,t)=>!(!this.effect||this.effect[e]==t);if(e==A.Effect.BackfaceVisibility)return t("backfaceVisibility",P.InvalidInt32);if(e==A.Effect.BorderImage)return t("borderImage",P.InvalidPointer);if(e==A.Effect.BorderImageWidth)return t("borderImageWidth",P.InvalidPointer);if(e==A.Effect.BorderImageOutset)return t("borderImageOutset",P.InvalidPointer);if(e==A.Effect.Display)return t("display",P.InvalidPointer);if(e==A.Effect.ObjectFit)return t("objectFit",P.InvalidPointer);if(e==A.Effect.Overflow)return t("overflow",P.InvalidPointer);if(e==A.Effect.Perspective)return t("perspective",P.InvalidInt32);if(e==A.Effect.PerspectiveOrigin)return t("perspectiveOrigin",P.InvalidInt32);if(e==A.Effect.Transform)return t("transform",P.InvalidPointer);if(e==A.Effect.TransformOrigin)return t("transformOrigin",P.InvalidPointer);if(e==A.Effect.TransformStyle)return t("transformStyle",P.InvalidPointer);if(e==A.Effect.Visibility)return t("visibility",P.InvalidPointer);if(e==A.Effect.ZIndex)return t("zIndex",P.InvalidInt32);throw new Error}setTextValue(e,t){const i=(e,t)=>{const i=t;return this.text[e]==i==0&&(this.text[e]=i,!0)};this.ensureGroupExist(R.Text.Name);let s=!1;if(e==A.Text.Color)s=i("color",wi.ConvertToString(e,t));else if(e==A.Text.FontFamily)s=i("fontFamily",wi.ConvertToString(e,t));else if(e==A.Text.FontSize)s=i("fontSize",wi.ConvertToInt32(e,t));else if(e==A.Text.FontStyle)s=i("fontStyle",wi.ConvertToString(e,t));else if(e==A.Text.FontWeight)s=i("fontWeight",wi.ConvertToString(e,t));else if(e==A.Text.LineHeight)s=i("lineHeight",wi.ConvertToInt32(e,t));else if(e==A.Text.TextAlign)s=i("textAlign",wi.ConvertToString(e,t));else if(e==A.Text.TextOverflow)s=i("textOverflow",wi.ConvertToString(e,t));else if(e==A.Text.TextShadow)s=i("textShadow",wi.ConvertToTextShadow(e,t));else if(e==A.Text.WebkitTextStroke)s=i("webkitTextStroke",wi.ConvertToWebkitTextStroke(e,t));else if(e==A.Text.WhiteSpace)s=i("whiteSpace",wi.ConvertToString(e,t));else if(e==A.Text.WordWrap)s=i("wordWrap",wi.ConvertToString(e,t));else if(e==A.Text.Direction)s=i("direction",wi.ConvertToString(e,t));else if(e==A.Text.JsvTextEmoji)s=i("jsvTextEmoji",wi.ConvertToInt32(e,t));else if(e==A.Text.JsvTextLatex)s=i("jsvTextLatex",wi.ConvertToInt32(e,t));else if(e==A.Text.JsvTextAlignMinWidth)s=i("jsvTextAlignMinWidth",wi.ConvertToInt32(e,t));else if(e==A.Text.JsvTextVerticalAlign)s=i("jsvTextVerticalAlign",wi.ConvertToString(e,t));else if(e==A.Text.JsvTextLineAlign)s=i("jsvTextLineAlign",wi.ConvertToString(e,t));else{if(e!=A.Text.JsvTextInnerDirection)throw new Error;s=i("jsvTextInnerDirection",wi.ConvertToString(e,t))}return s?R.Text.Name:null}getTextValue(e){const t=e=>this.text?new P(this.text[e]):new P;if(e==A.Text.Color)return t("color");if(e==A.Text.FontFamily)return t("fontFamily");if(e==A.Text.FontSize)return t("fontSize");if(e==A.Text.FontStyle)return t("fontStyle");if(e==A.Text.FontWeight)return t("fontWeight");if(e==A.Text.LineHeight)return t("lineHeight");if(e==A.Text.TextAlign)return t("textAlign");if(e==A.Text.TextOverflow)return t("textOverflow");if(e==A.Text.TextShadow)return t("textShadow");if(e==A.Text.WebkitTextStroke)return t("webkitTextStroke");if(e==A.Text.WhiteSpace)return t("whiteSpace");if(e==A.Text.WordWrap)return t("wordWrap");if(e==A.Text.Direction)return t("direction");if(e==A.Text.JsvTextEmoji)return t("jsvTextEmoji");if(e==A.Text.JsvTextLatex)return t("jsvTextLatex");if(e==A.Text.JsvTextAlignMinWidth)return t("jsvTextAlignMinWidth");if(e==A.Text.JsvTextVerticalAlign)return t("jsvTextVerticalAlign");if(e==A.Text.JsvTextLineAlign)return t("jsvTextLineAlign");if(e==A.Text.JsvTextInnerDirection)return t("jsvTextInnerDirection");throw new Error}hasTextValue(e){const t=(e,t)=>!(!this.text||this.text[e]==t);if(e==A.Text.Color)return t("color",P.InvalidPointer);if(e==A.Text.FontFamily)return t("fontFamily",P.InvalidPointer);if(e==A.Text.FontSize)return t("fontSize",P.InvalidInt32);if(e==A.Text.FontStyle)return t("fontStyle",P.InvalidPointer);if(e==A.Text.FontWeight)return t("fontWeight",P.InvalidPointer);if(e==A.Text.LineHeight)return t("lineHeight",P.InvalidInt32);if(e==A.Text.TextAlign)return t("textAlign",P.InvalidPointer);if(e==A.Text.TextOverflow)return t("textOverflow",P.InvalidPointer);if(e==A.Text.TextShadow)return t("textShadow",P.InvalidPointer);if(e==A.Text.WebkitTextStroke)return t("webkitTextStroke",P.InvalidPointer);if(e==A.Text.WhiteSpace)return t("whiteSpace",P.InvalidPointer);if(e==A.Text.WordWrap)return t("wordWrap",P.InvalidPointer);if(e==A.Text.Direction)return t("direction",P.InvalidPointer);if(e==A.Text.JsvTextEmoji)return t("jsvTextEmoji",P.InvalidInt32);if(e==A.Text.JsvTextLatex)return t("jsvTextLatex",P.InvalidInt32);if(e==A.Text.JsvTextAlignMinWidth)return t("jsvTextAlignMinWidth",P.InvalidInt32);if(e==A.Text.JsvTextVerticalAlign)return t("jsvTextVerticalAlign",P.InvalidPointer);if(e==A.Text.JsvTextLineAlign)return t("jsvTextLineAlign",P.InvalidPointer);if(e==A.Text.JsvTextInnerDirection)return t("jsvTextInnerDirection",P.InvalidPointer);throw new Error}setMotionValue(e,t){const i=(e,t)=>{const i=t;return this.motion[e]==i==0&&(this.motion[e]=i,!0)};this.ensureGroupExist(R.Motion.Name);let s=!1;if(e==A.Motion.Animation)s=i("animation",wi.ConvertToAnimation(e,t,this.motion.animation));else if(e==A.Motion.Transition)s=i("transition",wi.ConvertToTransition(e,t,this.motion.transition));else{if(e!=A.Motion.AnimationFillMode)throw new Error;s=i("animationFillMode",wi.ConvertToString(e,t))}return s?R.Motion.Name:null}getMotionValue(e){const t=e=>this.motion?new P(this.motion[e]):new P;if(e==A.Motion.Animation)return t("animation");if(e==A.Motion.Transition)return t("transition");if(e==A.Motion.AnimationFillMode)return t("animationFillMode");throw new Error}hasMotionValue(e){const t=e=>!(!this.motion||this.motion[e]==P.InvalidPointer);if(e==A.Motion.Animation)return t("animation");if(e==A.Motion.Transition)return t("transition");if(e==A.Motion.AnimationFillMode)return t("animationFillMode");throw new Error}needUpdateTransition(e){return null!=this.motion&&null==this.motion.animation&&null!=this.motion.transition&&(e==A.Layout.Height||e==A.Layout.Left||e==A.Layout.Top||e==A.Layout.Width||e==A.Effect.Transform)}ensureGroupExist(e){e==R.Layout.Name&&null==this.layout?this.layout=new R.Layout:e==R.Flex.Name&&null==this.flex?this.flex=new R.Flex:e==R.Background.Name&&null==this.background?this.background=new R.Background:e==R.Effect.Name&&null==this.effect?this.effect=new R.Effect:e==R.Text.Name&&null==this.text?this.text=new R.Text:e==R.Motion.Name&&null==this.motion&&(this.motion=new R.Motion)}}var vi,Ei,bi;class Ci{constructor(e){this.classNames="",this.classAttributes=new Set,this.classStyleManager=e}getManager(){return this.classStyleManager}setClassNames(e){return null==e&&(e=""),this.classNames==e?_.CssClassNotChanged:(this.classNames=e,0)}getClassNames(){return this.classNames}appendClassAttribute(e){return this.classAttributes.has(e)?_.CssClassNotChanged:(this.classAttributes.add(e),0)}mergeClassAttributes(e){for(let t of e.classAttributes)this.classAttributes.add(t);return 0}hasClassAttribute(e){return this.classAttributes.has(e)}getClassAttributes(){return this.classAttributes}getClassDeclarations(e){if(0==this.classNames.length)return null;let t="";t+=this.classNames,t+=" @ ";for(const e of this.classAttributes)t+=e+" ";const i=t;let s=this.classStyleManager.findStyleClassCache(i);return null==s&&(s=this.makeClassDeclarations(e),this.classStyleManager.appendStyleClassCache(i,s)),s}getKeyframes(e){if(0==e.length)return"";const t=this.classStyleManager.getKeyframes(this.classAttributes,e);return 0==t.length?"":t}static CastToStyleValue(e){let t;return null==e||Number(e)===e||"string"==typeof e?t=new P(e):"boolean"==typeof e?t=new P(Number(e)):(E(_.UnimplementedError,null),t=new P),t}static ParseDeclarations(e,t,i){let s=new Map;for(let n of t){if(0==e.has(i))continue;const t=e.get(i);if(0==t.has(n))continue;const r=t.get(n);let a;a=r instanceof String==0?r:Ci.ParseDeclarationsFromString(r),s=new Map([...s,...a])}return s}static ParseDeclarationsFromString(e){let t=new Map;const i=JSON.parse(e);for(const[e,s]of Object.entries(i)){const i=A.ToConst(e);if(null==i){console.error("Unsupported style name: "+e);continue}if(i==A.Effect.ObjectFit||i==A.Effect.Overflow){console.warn("Unimplemented style name: "+i+", please set the "+i+" attribute directly in the element's style.");continue}const n=Ci.CastToStyleValue(s);t.set(i,n)}return t}makeClassDeclarations(e){let t=new Map;const i=this.classStyleManager.getStyleSheets(),s=this.getNestedClassCombine(e),n=Ci.ParseDeclarations(i,s,Ci.Manager.StyleSheetKeyGlobal);for(const[e,i]of n)t.set(e,i);for(const e of this.classAttributes){const n=Ci.ParseDeclarations(i,s,e);for(const[e,i]of n)t.set(e,i)}return t}getNestedClassCombine(e){const t=wi.StringSplit(this.classNames),i=[];for(const e of t)i.push("."+e);for(let t=e.length-1;t>=0;t--){const s=e[t],n=i.length,r=wi.StringSplit(s);for(const e of r)for(let t=0;t<n;t++){const s=i[t];i.push("."+e+" "+s)}}return i}}Ci.Manager=(T(vi=class{constructor(){this.styleSheetMap=new Map,this.parsedStyleClassCache=new Map,this.propVariableMap=new Map}declareStyleSheets(e){for(const[t,i]of Object.entries(e)){let e=0;e=parseInt(t,16),0==this.styleSheetMap.has(e)&&this.styleSheetMap.set(e,new Map);const s=this.styleSheetMap.get(e);for(const[e,t]of Object.entries(i))if(s.has(e)&&console.warn('StyleSheets class "'+e+'" already exists, overwrite it with the new value.'),t.includes("@keyframes"))s.set(e,t);else{const i=Ci.ParseDeclarationsFromString(t);s.set(e,i)}}return 0}undeclareStyleSheets(e){for(const[t,i]of Object.entries(e)){let e=0;if(e=parseInt(t,16),0==this.styleSheetMap.has(e))continue;const s=this.styleSheetMap.get(e);for(const[e,t]of Object.entries(i))s.delete(e)}return 0}getStyleSheets(){return this.styleSheetMap}appendStyleClassCache(e,t){this.parsedStyleClassCache.set(e,t)}findStyleClassCache(e){const t=this.parsedStyleClassCache.get(e);return null==t?null:t}clearStyleClassCache(){this.parsedStyleClassCache.clear()}watchVariable(e,t,i,s,n){let r=A.ToConst(t);x(null!=r,_.InvalidArgument);let a=this.getVariableInfo(s);if(x(null!=a,_.InvalidArgument),0==a.watchListenerMap.has(e)){const t=new Set;a.watchListenerMap.set(e,t)}const o=a.watchListenerMap.get(e),l=new Ci.Manager.VariableInfo.WatchListener;if(l.propName=r,l.listener=i,o.add(l),0==a.value.is(P.DataType.Null)){const e=i(r,a.value,n);if(e==_.CssStyleNotChanged)return e;v(e)}return 0}watchKeyframeVariables(e,t,i,s,n){const r=this.getRawKeyframes(e.classAttributes,s);if(0==r.length)return 0;const a=new Set;let o=this.getKeyframesVarNames(r,a);v(o);for(const s of a)o=this.watchVariable(e,t,i,s,n),v(o);return 0}unwatchVariable(e,t){for(const[i,s]of this.propVariableMap){if(0==s.watchListenerMap.has(e))continue;let i=s.watchListenerMap.get(e);for(const e of i)if(e.propName!=t){i.delete(e);break}}return 0}unwatchAllVariables(e){for(const[t,i]of this.propVariableMap)i.watchListenerMap.delete(e)}setVariable(e,t,i){let s=this.getVariableInfo(e);x(null!=s,_.InvalidArgument),s.value=t;for(const[e,n]of s.watchListenerMap)for(const e of n){let s=new Set;const n=e.listener(e.propName,t,s);if(n==_.CssStyleNotChanged)return n;v(n);for(const e of s)i.add(e)}return 0}insertKeyFrame(e,t){const i=this.styleSheetMap.get(Ci.Manager.StyleSheetKeyGlobal);w(i,null),i?.set(e,t)}removeKeyFrame(e){const t=this.styleSheetMap.get(Ci.Manager.StyleSheetKeyGlobal);if(w(t,null),t?.has(e)){t.delete(e);const i=document.styleSheets[0],s=i.cssRules;for(let t=s.length-1;t>=0;t--)if(s[t].name===e){i.deleteRule(t);break}}}getKeyframes(e,t){if(0==t.length)return"";const i=this.getRawKeyframes(e,t);if(0==i.length)return"";const s=new Set;if(E(this.getKeyframesVarNames(i,s),""),0==s.size)return i;let n=i;for(const e of s){const t=this.getVariableInfo(e);w(null!=t,""),r=e,a=t.value.toString(),n=n.replaceAll(r,a)}var r,a;return n}getRawKeyframes(e,t){if(0==t.length)return Ci.Manager.ConstEmptyString;if(0==this.styleSheetMap.has(Ci.Manager.StyleSheetKeyGlobal))return Ci.Manager.ConstEmptyString;const i=this.styleSheetMap.get(Ci.Manager.StyleSheetKeyGlobal);for(const s of e){const e=t+"-"+s.toString(16).padStart(8,"0");if(0==i.has(e))continue;return i.get(e)}if(i.has(t)){return i.get(t)}return Ci.Manager.ConstEmptyString}getKeyframesVarNames(e,t){t.clear();let i=e;const s=/var\([\s\S]+?\)/;let n;for(;null!==(n=s.exec(i));)t.add(n[0]),i=i.substring(n.index+n[0].length);return 0}getVariableInfo(e){let t=k.FormatVariableName(e);if(x(null!=t,null),0==this.propVariableMap.has(t)){const e=new Ci.Manager.VariableInfo;this.propVariableMap.set(t,e)}let i=this.propVariableMap.get(t);return i}},"Manager"),vi.StyleSheetKeyGlobal=0,vi.VariableInfo=(T(Ei=class{constructor(){this.value=new P,this.watchListenerMap=new Map}},"VariableInfo"),Ei.WatchListener=class{},Ei),vi.ConstEmptyString="",vi);class Ii{static STYLE_PROPERTY_GETTER(e,t,i){let s=new P;return e.getProperty(t,s)>=0?s.get():i}constructor(e,t){this.lastCssClassKeySet=new Set,this.elementDelegate=e,this.style=new Si,this.styleClass=new Ci(t)}finalize(){this.styleClass.getManager().unwatchAllVariables(this.styleClass)}hasPropGroup(e){return this.style.hasPropGroup(e)}setProperty(e,t,i){let s=e;0==k.IsVariable(e)&&(s=A.ToConst(e)),x(s,_.UnsupportedError),i.clear();return this.setStyleInheritedProperty(s,t,!0,i)}getProperty(e,t){const i=A.ToConst(e);x(i,_.UnsupportedError);return this.getStyleInheritedProperty(i,t)}setClassNames(e){const t=this.styleClass.setClassNames(e);return x(t>=0||t==_.CssClassNotChanged,t),0}getClassNames(){return this.styleClass.getClassNames()}appendClassAttribute(e){const t=this.styleClass.appendClassAttribute(e);return t==_.CssClassNotChanged||v(t),0}mergeClassAttributes(e){return v(this.styleClass.mergeClassAttributes(e.styleClass)),0}getKeyframes(e){const t=this.styleClass.getKeyframes(e);return w(null!=t,null,["Failed to get keyframes:"+e]),t}getNestedClassNames(e){const t=this.elementDelegate;x(null!=t,_.InvalidElement);const i=t.parentNode;x(null!=i,_.InvalidElement);const s=i.styleDelegate,n=this.styleClass.getClassAttributes();let r=[];for(const e of n){const t=[];v(s.getNestedClassNamesRecursive(e,t)),(r.length<=0||r.length>t.length)&&(r=t)}for(const t of r)e.push(t);if(e.length>5){let e="JsView: Low performance warning: ";e+="It is recommended that the nesting of style classes in a single vue file should less than 6.",e+="You can avoid this risk by splitting the vue file.",console.warn(e)}return 0}updateClassDeclarations(e,t){t.clear();const i=this.lastCssClassKeySet,s=new Set,n=this.styleClass.getClassDeclarations(e);if(null!=n)for(const[e,r]of n){let n=this.setStyleInheritedProperty(e,r,!1,t);n==_.CssStyleNotChanged&&(n=0),b(n),s.add(e),i.delete(e)}let r=new P;for(const e of i){let i=this.setStyleInheritedProperty(e,r,!1,t);i==_.CssStyleNotChanged&&(i=0),b(i)}this.lastCssClassKeySet=s}addChangedStyleGroup(e){return this.style.addChangedStyleGroup(e)}getChangedStyleGroups(){return this.style.getChangedStyleGroups()}clearChangedStyleGroups(){this.style.clearChangedStyleGroups()}jsvValidHeight(){return Ii.STYLE_PROPERTY_GETTER(this,A.Layout.Height,0)}height(){return Ii.STYLE_PROPERTY_GETTER(this,A.Layout.Height,P.InvalidInt32)}left(){return Ii.STYLE_PROPERTY_GETTER(this,A.Layout.Left,0)}top(){return Ii.STYLE_PROPERTY_GETTER(this,A.Layout.Top,0)}jsvValidWidth(){return Ii.STYLE_PROPERTY_GETTER(this,A.Layout.Width,0)}width(){return Ii.STYLE_PROPERTY_GETTER(this,A.Layout.Width,P.InvalidInt32)}flexDirection(){return Ii.STYLE_PROPERTY_GETTER(this,A.Flex.FlexDirection,P.InvalidInt32)}flexWrap(){return Ii.STYLE_PROPERTY_GETTER(this,A.Flex.FlexWrap,P.InvalidInt32)}justifyContent(){return Ii.STYLE_PROPERTY_GETTER(this,A.Flex.JustifyContent,P.InvalidInt32)}alignItems(){return Ii.STYLE_PROPERTY_GETTER(this,A.Flex.AlignItems,P.InvalidInt32)}alignContent(){return Ii.STYLE_PROPERTY_GETTER(this,A.Flex.AlignContent,P.InvalidInt32)}alignSelf(){return Ii.STYLE_PROPERTY_GETTER(this,A.Flex.AlignSelf,P.InvalidInt32)}flexGrow(){return Ii.STYLE_PROPERTY_GETTER(this,A.Flex.FlexGrow,P.InvalidFloat)}backgroundColor(){return Ii.STYLE_PROPERTY_GETTER(this,A.Background.BackgroundColor,null)}backgroundImage(){return Ii.STYLE_PROPERTY_GETTER(this,A.Background.BackgroundImage,null)}borderRadius(){return Ii.STYLE_PROPERTY_GETTER(this,A.Background.BorderRadius,null)}backfaceVisibility(){return Ii.STYLE_PROPERTY_GETTER(this,A.Effect.BackfaceVisibility,null)}borderImage(){return Ii.STYLE_PROPERTY_GETTER(this,A.Effect.BorderImage,null)}borderImageWidth(){return Ii.STYLE_PROPERTY_GETTER(this,A.Effect.BorderImageWidth,null)}borderImageOutset(){return Ii.STYLE_PROPERTY_GETTER(this,A.Effect.BorderImageOutset,null)}display(){return Ii.STYLE_PROPERTY_GETTER(this,A.Effect.Display,null)}objectFit(){return Ii.STYLE_PROPERTY_GETTER(this,A.Effect.ObjectFit,null)}opacity(){return Ii.STYLE_PROPERTY_GETTER(this,A.Effect.Opacity,1)}overflow(){return Ii.STYLE_PROPERTY_GETTER(this,A.Effect.Overflow,null)}perspective(){return Ii.STYLE_PROPERTY_GETTER(this,A.Effect.Perspective,0)}perspectiveOrigin(){return Ii.STYLE_PROPERTY_GETTER(this,A.Effect.PerspectiveOrigin,null)}transform(){return Ii.STYLE_PROPERTY_GETTER(this,A.Effect.Transform,null)}transformOrigin(){return Ii.STYLE_PROPERTY_GETTER(this,A.Effect.TransformOrigin,null)}transformStyle(){return Ii.STYLE_PROPERTY_GETTER(this,A.Effect.TransformStyle,null)}visibility(){return Ii.STYLE_PROPERTY_GETTER(this,A.Effect.Visibility,null)}zIndex(){return Ii.STYLE_PROPERTY_GETTER(this,A.Effect.ZIndex,0)}color(){return Ii.STYLE_PROPERTY_GETTER(this,A.Text.Color,L.Text.Color)}fontFamily(){return Ii.STYLE_PROPERTY_GETTER(this,A.Text.FontFamily,L.Text.FontFamily)}fontSize(){return Ii.STYLE_PROPERTY_GETTER(this,A.Text.FontSize,L.Text.FontSize)}fontStyle(){return Ii.STYLE_PROPERTY_GETTER(this,A.Text.FontStyle,L.Text.FontStyle)}fontWeight(){return Ii.STYLE_PROPERTY_GETTER(this,A.Text.FontWeight,L.Text.FontWeight)}lineHeight(){return Ii.STYLE_PROPERTY_GETTER(this,A.Text.LineHeight,L.Text.LineHeight)}textAlign(){return Ii.STYLE_PROPERTY_GETTER(this,A.Text.TextAlign,L.Text.TextAlign)}textOverflow(){return Ii.STYLE_PROPERTY_GETTER(this,A.Text.TextOverflow,L.Text.TextOverflow)}textShadow(){return Ii.STYLE_PROPERTY_GETTER(this,A.Text.TextShadow,L.Text.TextShadow)}webkitTextStroke(){return Ii.STYLE_PROPERTY_GETTER(this,A.Text.WebkitTextStroke,L.Text.WebkitTextStroke)}whiteSpace(){return Ii.STYLE_PROPERTY_GETTER(this,A.Text.WhiteSpace,L.Text.WhiteSpace)}wordWrap(){return Ii.STYLE_PROPERTY_GETTER(this,A.Text.WordWrap,L.Text.WordWrap)}direction(){return Ii.STYLE_PROPERTY_GETTER(this,A.Text.Direction,L.Text.Direction)}jsvTextEmoji(){return Ii.STYLE_PROPERTY_GETTER(this,A.Text.JsvTextEmoji,L.Text.JsvTextEmoji)}jsvTextLatex(){return Ii.STYLE_PROPERTY_GETTER(this,A.Text.JsvTextLatex,L.Text.JsvTextLatex)}jsvTextAlignMinWidth(){return Ii.STYLE_PROPERTY_GETTER(this,A.Text.JsvTextAlignMinWidth,L.Text.JsvTextAlignMinWidth)}jsvTextVerticalAlign(){return Ii.STYLE_PROPERTY_GETTER(this,A.Text.JsvTextVerticalAlign,L.Text.JsvTextVerticalAlign)}jsvTextLineAlign(){return Ii.STYLE_PROPERTY_GETTER(this,A.Text.JsvTextLineAlign,L.Text.JsvTextLineAlign)}jsvTextInnerDirection(){return Ii.STYLE_PROPERTY_GETTER(this,A.Text.JsvTextInnerDirection,L.Text.JsvTextInnerDirection)}animation(){return Ii.STYLE_PROPERTY_GETTER(this,A.Motion.Animation,null)}transition(){return Ii.STYLE_PROPERTY_GETTER(this,A.Motion.Transition,null)}animationFillMode(){return Ii.STYLE_PROPERTY_GETTER(this,A.Motion.AnimationFillMode,null)}static OnVariableChanged(e,t,i,s){const n=e;if(t==A.Motion.Animation){const e=n.elementDelegate;x(null!=e,_.InvalidElement),n.addChangedStyleGroup(R.Motion.Name),s.add(e.nativeId)}else{const e=n.setStyleInheritedProperty(t,i,!1,s);if(e==_.CssStyleNotChanged)return e;v(e)}return 0}setStyleInheritedProperty(e,t,i,s){const n=this.styleClass.getManager();let r=_.UnknownError;if(k.IsVariable(e))r=n.setVariable(e,t,s);else if(k.IsVariable(t))r=n.watchVariable(this.styleClass,e,Ii.OnVariableChanged.bind(null,this),t.get(),s);else{if(r=this.style.setPropValue(e,t,i),r==_.CssStyleNotChanged)return r;if(v(r),e==A.Motion.Animation){i&&(r=n.unwatchVariable(this.styleClass,e),v(r));const t=this.style.getPropValue(e);t.is(P.DataType.Animation)&&(r=n.watchKeyframeVariables(this.styleClass,e,Ii.OnVariableChanged.bind(null,this),t.get().name,s),v(r))}}if(r==_.CssStyleNotChanged)return r;v(r);const a=this.elementDelegate;x(null!=a,_.InvalidElement),s.add(a.nativeId);const o=(e,t,i)=>{for(const s of t.childNodes)s.styleDelegate.style.hasPropValue(e)||o(e,s,i);const s=t instanceof Mi?t:null;null!=s&&0!=s.getTextContent().length&&(t.styleDelegate.addChangedStyleGroup(R.Text.Name),i.add(t.nativeId))};return Si.IsInheritedProp(e)&&o(e,a,s),0}getStyleInheritedProperty(e,t){if(t.reset(this.style.getPropValue(e)),0==t.is(P.DataType.Null))return 0;if(0==Si.IsInheritedProp(e))return _.CssStyleNotExists;const i=this.elementDelegate;x(null!=i,_.InvalidElement);const s=i.parentNode;if(null==s)return _.CssStyleNotExists;const n=s.styleDelegate.getStyleInheritedProperty(e,t);return n<0?n:0}getNestedClassNamesRecursive(e,t){const i=this.elementDelegate;if(x(null!=i,_.InvalidElement),0==this.styleClass.hasClassAttribute(e))return 0;const s=i.parentNode;x(null!=s,_.InvalidElement);v(s.styleDelegate.getNestedClassNamesRecursive(e,t));const n=this.styleClass.getClassNames();return n.length<=0||t.push(n),0}}class Ai{constructor(e){let t=-1;null==e?t=Ai.DataType.Null:Number(e)===e&&e%1==0?t=Ai.DataType.Int32:Number(e)===e&&e%1!=0?t=Ai.DataType.Float:"string"==typeof e&&(t=Ai.DataType.String),this.data=new Ai.DataInfo,e!=Ai.InvalidInt32&&e!=Ai.InvalidFloat&&e!=Ai.InvalidPointer?this.data.value=e:this.data.value=null,this.data.index=t}is(e){return this.data.index==e}get(){return this.data.value}reset(e){this.data.value=e.data.value,this.data.index=e.data.index}equals(e){return this.data.value===e.data.value&&this.data.index===e.data.index}}Ai.DataType=(T(bi=class{},"DataType"),bi.Null=0,bi.Int32=1,bi.Float=2,bi.String=3,bi),Ai.InvalidInt32=Number.MIN_VALUE,Ai.InvalidFloat=Number.NaN,Ai.InvalidPointer=null,Ai.DataInfo=class{constructor(){this.value=null,this.index=-1}};class Pi{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(e){return this._PersistMap.get(e)}putPersistPack(e,t){Pi._putPack(this._PersistMap,this._PersistTrackList,this._PersistIdx,e,t),this._PersistIdx=(this._PersistIdx+1)%this._PersistMax}getTempPack(e){return this._TempMap.get(e)}putTempPack(e,t){Pi._putPack(this._TempMap,this._TempTrackList,this._TempIdx,e,t),this._TempIdx=(this._TempIdx+1)%this._TempMax}static _putPack(e,t,i,s,n){let r=t[i];r&&(e.delete(r),t[i]=s),e.set(s,n)}}let Li=new Pi;var ki,Ri;class Fi{GetAnimationManager(){}GetRootView(){return new F.RootView}GetTextureManager(){return window.JsvCode.ForgeHandles.TextureManager}GetTextureSetting(e,t){return new F.ExternalTextureSetting(e,t)}GetRenderBridge(){return Fi.sRenderBridge}}Fi.ClipView=F.ClipView,Fi.LayoutView=F.LayoutView,Fi.NinePatchView=F.NinePatchView,Fi.ViewRoundCornerMask=F.ViewRoundCornerMask,Fi.AnimationListener=F.AnimationListener,Fi.sRenderBridge=F.sRenderBridge,Fi.TextureInstantLoad={AUTO:F.TextureInstantLoad.AUTO,SYNC:F.TextureInstantLoad.SYNC,ASYNC:F.TextureInstantLoad.ASYNC},Fi.FlexContainerProps=F.FlexContainerProps,Fi.FlexSetNames=F.FlexSetNames,Fi.FlexItemProps=F.FlexItemProps,Fi.Animation=class{constructor(){}Cancel(){this.animation.Cancel()}Enable(e){this.animation.Enable(e)}EnableDelay(e){this.animation.EnableDelay(e)}SetAnimationListener(e){this.animation.SetAnimationListener(e)}SetRepeat(e){this.animation.SetRepeat(e)}Start(e){this.animation.Start(e)}},Fi.AnimationCssKeyframes=class extends F.CssKeyframeAnimation{constructor(e,t){super(t.keyframes,t.duration,t.easing,t.width,t.height)}},Fi.AnimationCssTransition=(T(ki=class extends F.CssTransitionAnimation{constructor(e,t){let i=[];for(const e of t){let t={name:e.name,dur:e.duration,tf:e.easing?.Package(),dly:e.delay,from:e.from.data,to:e.to.data};i.push(t)}super(i)}},"AnimationCssTransition"),ki.Value=class{constructor(e){this.data=e}},ki),Fi.AnimationManager=(T(Ri=class{},"AnimationManager"),Ri.AnimationEnable={ReleaseAfterEndCallback:1,KeepTransform:2,AckFinalProgress:4,AckRepeat:8},Ri),Fi.AnimationEnable=F.AnimationEnable,Fi.TextUtils=class{static GetTextWidth(e,t,i,s,n,r){return F.sTextUtils.GetTextWidth(t,i,s,n,r)}static GetOneLineTextDrawWidth(e,t,i,s,n,r,a){F.sTextUtils.GetOneLineTextDrawWidth(t,i,s,n,r,a)}static BuildTextView(e,t,i,s,n,r,a,o,l,h,c){return F.sTextUtils.BuildTextView(e,t,i.GetStylePack(),s,{width:n,height:r},0!=a?a:null,o,l,0!=h,0!=c)}},Fi.TextStyleCache=class{constructor(){this.stylePackData={}}UpdateShadow(e,t,i,s){this.stylePackData.shadow={shadowOffsetX:e,shadowOffsetY:t,shadowBlur:i,shadowColor:s}}UpdateStroke(e,t){this.stylePackData.stroke={strokeWidth:e,strokeColor:t}}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 e=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 t=Li.getTempPack(e);t||(t=F.sTextStyleCache.StyleToPack(this.stylePackData),Li.putTempPack(e,t)),this.textStylePack=t}GetStylePack(){return this.textStylePack}},Fi.LayoutView.eVisibility={VIEW_HIDDEN:"hidden",VIEW_VISIBLE:"visible"};class Di{constructor(e,t,i){this.name=e,this.value=t,this.viewType=i}}class Vi{static MakeShared(e,t,i,s){const n=new s(e,t);return n.styleDelegate=new Ii(n,i),n}bindToForgeRootView(e){this.forgeMainView=e.GetRootView(),this.forgeMaskView=this.forgeMainView}insertForgeView(e,t,i){t.ensureForgeMaskView(e);const s=this.forgeMainView.InsertView(t.forgeMaskView,i?i.forgeMaskView:null);S(s||void 0===s),this.linkChild(e,t,i)}removeForgeView(e,t){this.forgeMainView.RemoveView(t.forgeMaskView),this.unlinkChild(e,t)}linkChild(e,t,i){this.childNodes.push(t),t.parentNode=this,(t.attrStore.extendClassAttributeDepth>0||t.hasExtendClassAttributeChildren)&&(this.hasExtendClassAttributeChildren=!0)}unlinkChild(e,t){const i=this.childNodes.indexOf(t);this.childNodes.splice(i,1),t.parentNode=void 0}moveForgeView(e,t,i,s){t.unlinkChild(e,i),this.linkChild(e,i,s),(t.forgeMaskView?t.forgeMaskView:t.forgeMainView).MoveChildView(i.forgeMaskView,this.forgeMainView,s?s.forgeMaskView:null),console.log("moving child")}reOrderForgeView(e,t,i){this.forgeMainView.ReOrderChildView(t.forgeMaskView,i?i.forgeMaskView:null)}addEventListener(e,t,i){if(null==this.eventInfoMap&&(this.eventInfoMap=new Map),0==this.eventInfoMap.has(e)){const i=new Vi.EventInfo;i.listener=t,this.eventInfoMap.set(e,i)}this.eventInfoMap.get(e).count++;const s=this.tryDealWithCustomEvent(e,i);return v(s),s}removeEventListener(e,t){if(null==this.eventInfoMap)return;if(0==this.eventInfoMap.has(e))return;const i=this.eventInfoMap.get(e);i.count--,i.count<=0&&this.eventInfoMap.delete(e)}setAttribute(e,t,i){let s=_.UnsupportedError;if(wi.StringStartsWith(t,"data-v-"))s=this.appendStyleClassAttribute(t),v(s),s=Vi.State.NeedRefreshCssClassAttribute;else if(wi.StringStartsWith(t,"class"))s=this.styleDelegate.setClassNames(i),v(s),s=Vi.State.NeedRefreshCssClass;else if(wi.StringStartsWith(t,"data-jsv-extend-class-attr")){const e=wi.StringToInt32(i);x(e!=P.InvalidInt32,_.InvalidArgument),s=this.setExtendClassAttributeDepth(e),v(s),s=Vi.State.NeedRefreshCssClass}else wi.StringStartsWith(t,"data-jsv-flex-container")&&(this.enableAsFlexContainer(),s=Vi.State.NeedRefreshCssClassAttribute);return v(s),s}getExtendClassAttributeChildren(e,t=0){if(this.attrStore.extendClassAttributeDepth==t)return e.add(this),0;if(0==this.hasExtendClassAttributeChildren)return 0;for(let i of this.childNodes){if(i.attrStore.extendClassAttributeDepth<=0&&0==i.hasExtendClassAttributeChildren)continue;v(i.getExtendClassAttributeChildren(e,t+1))}return 0}onCssStyleChanged(e){const t=this.styleDelegate.getChangedStyleGroups();return t.has(R.Layout.Name)&&this.onFlushViewLayout(e),t.has(R.Flex.Name)&&this.onFlushViewFlex(e),t.has(R.Background.Name)&&this.onFlushViewBackground(e),t.has(R.Effect.Name)&&this.onFlushViewEffect(e),t.has(R.Motion.Name)&&this.onFlushViewMotion(e),this.styleDelegate.clearChangedStyleGroups(),0}onAllChangeFinished(e){if(null==this.onAllChangeFinishTasks)return 0;for(const e of this.onAllChangeFinishTasks)e();return this.onAllChangeFinishTasks=void 0,0}handleAfterAllChangeFinish(e){null==this.onAllChangeFinishTasks&&(this.onAllChangeFinishTasks=[]),this.onAllChangeFinishTasks.push(e)}setForgeViewInnerProps(e,t,i,s){return 1==i?this.forgeMaskView?this.forgeMaskView.SetElementProp(e,t,s):this.forgeInnerPropsCacheList.push(new Di(t,s,i)):this.forgeMainView.SetElementProp(e,t,s),0}getElementView(e){return e?this.forgeMaskView:this.forgeMainView}setClientWidth(e,t){this.clientWidth=t}getClientWidth(e){return this.clientWidth<0?this.styleDelegate.width():this.clientWidth}setClientHeight(e,t){this.clientHeight=t}getClientHeight(e){return this.clientHeight>0?this.clientHeight:this.styleDelegate.jsvValidHeight()}constructor(e,t){this.childNodes=[],this.parentNode=void 0,this.forgeAnimation=null,this.eventInfoMap=void 0,this.onAllChangeFinishTasks=void 0,this.attrStore=new Vi.AttrStore,this.hasExtendClassAttributeChildren=!1,this.transitionSetInfo=new Vi.TransitionSetInfo,this.flexEnabled=!1,this.clientWidth=-1,this.clientHeight=-1,this.forgeInnerPropsCacheList=[],this.nativeId=t,this.forgeMainView=new Fi.LayoutView,this.forgeMaskView=this.forgeMainView}sendEvent(e,t){if(null==this.eventInfoMap||0==this.eventInfoMap.has(e))return;console.log("ElementDelegate.sendEvent(). event="+e);const i=this.eventInfoMap.get(e);let s=[];s.push(new Ai(this.nativeId)),s.push(new Ai(e));for(const e of t)s.push(e);i.listener(s)}getObjectFitClipStatus(e){return!1}flushMaskViewClip(e){if(null==this.forgeMaskView)return;const t=this.forgeMaskView instanceof Fi.ClipView?this.forgeMaskView:null;if(null==t)return;let i={left:0,top:0,width:0,height:0,autoSizeClip:!1,useScissors:!1};if(!this.getObjectFitClipStatus(i)){const e=this.styleDelegate.overflow();null!=e&&"hidden"==e&&(i.autoSizeClip=!0,i.useScissors=!0)}i.autoSizeClip?t.SetWholeSizeScissor(i.useScissors,!0):t.SetClipRect(i.left,i.top,i.width,i.height,i.useScissors)}onFlushViewLayout(e){if(0==this.styleDelegate.hasPropGroup(R.Layout.Name))return;const t=this.styleDelegate.left(),i=this.styleDelegate.top(),s=this.styleDelegate.jsvValidWidth(),n=this.styleDelegate.jsvValidHeight();this.forgeMaskView.ResetLayoutParams({x:t,y:i,width:s,height:n}),this.forgeMaskView!=this.forgeMainView&&this.forgeMainView.ResetLayoutParams({x:0,y:0,width:s,height:n})}onFlushViewFlex(e){if(!this.flexEnabled)return;const t=this.styleDelegate.flexDirection(),i=this.styleDelegate.flexWrap(),s=this.styleDelegate.justifyContent(),n=this.styleDelegate.alignItems(),r=this.styleDelegate.alignContent();let a=new Fi.FlexContainerProps;a.flexDirection=t!=P.InvalidInt32?t:a.flexDirection,a.flexWrap=i!=P.InvalidInt32?i:a.flexWrap,a.justifyContent=s!=P.InvalidInt32?s:a.justifyContent,a.alignItems=n!=P.InvalidInt32?n:a.alignItems,a.alignContent=r!=P.InvalidInt32?r:a.alignContent,this.forgeMainView.ResetFlexContainerCell(a);const o=this.styleDelegate.alignSelf(),l=this.styleDelegate.flexGrow();if(o==P.InvalidInt32&&isNaN(l))this.forgeMainView.ResetFlexItemCell(null);else{let e=new Fi.FlexItemProps;e.alignSelf=o!=P.InvalidInt32?o:e.alignSelf,e.flexGrow=isNaN(l)?e.flexGrow:l,this.forgeMainView.ResetFlexItemCell(e)}}onFlushViewBackground(e){if(0==this.styleDelegate.hasPropGroup(R.Background.Name))return;const t=e.GetTextureManager(),i=this.styleDelegate.backgroundColor(),s=this.styleDelegate.backgroundImage(),n=this.styleDelegate.borderRadius();let r,a=null;s&&s.urlPath&&0!=s.urlPath.length&&(s.type==P.BackgroundImageImpl.eType.LINEAR_GRADIENT?(a=t.GetNamedCachedTexture(s.urlPath),null==a&&(a=t.CreateCssGradientColorTexture(s.urlPath,s.linearGradient.fromX,s.linearGradient.fromY,s.linearGradient.toX,s.linearGradient.toY,s.linearGradient.stops))):a=t.GetImage(s.urlPath,null)),i&&0!=i.length&&(null==a?a=t.GetColorTextureCached(i):console.warn(`Ignore color(${i}) when image(${s?.urlPath}) set(id=${this.nativeId})`)),n&&(r=new Fi.ViewRoundCornerMask(n.topLeft,n.topRight,n.bottomLeft,n.bottomRight)),this.forgeMainView.ResetTexture(a,r)}onFlushViewEffect(e){if(0==this.styleDelegate.hasPropGroup(R.Effect.Name))return;const t=this.styleDelegate.visibility();let i=t&&"hidden"==t?Fi.LayoutView.eVisibility.VIEW_HIDDEN:Fi.LayoutView.eVisibility.VIEW_VISIBLE;"none"==this.styleDelegate.display()&&(i=Fi.LayoutView.eVisibility.VIEW_HIDDEN),this.forgeMaskView.SetVisibility(i),this.flushMaskViewClip(e);const s=this.styleDelegate.perspective();if(s>0){const e=this.styleDelegate.perspectiveOrigin();this.forgeMainView.SetPerspective(s,e)}const n=this.styleDelegate.backfaceVisibility();n&&this.forgeMainView.SetBackfaceVisibility("visible"==n);const r=this.styleDelegate.opacity();isNaN(r)||1==r||this.setOpacity(r),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(e){if(null!=this.forgeAnimation&&(this.forgeAnimation.Cancel(),this.forgeAnimation=null),0==this.styleDelegate.hasPropGroup(R.Motion.Name))return;let t="",i="";const s=this.styleDelegate.animation(),n=this.styleDelegate.transition(),r=this.styleDelegate.animationFillMode();if(null!=s&&null!=n&&console.warn("ElementDelegate","Cannot set both animation and transition on a single element at the same time."),null!=s){t="animation",i=s.name;const n=this.styleDelegate.getKeyframes(s.name);this.forgeAnimation=this.makeAnimation(e,s,n),"forwards"===r&&this.forgeAnimation.Enable(Fi.AnimationManager.AnimationEnable.KeepTransform)}if(null!=n&&null==this.forgeAnimation){const i=e.GetRenderBridge().GetSwapCount();if(this.transitionSetInfo.alreadySet&&this.transitionSetInfo.swapCount!=i)t="transition",this.forgeAnimation=this.makeTransition(e,n);else{for(const[e,t]of n.animationMap){let t=new P;const i=A.ToConst(e);null!=i&&(this.styleDelegate.getProperty(i,t),this.attrStore.transitionStyleMap.set(e,t))}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 e=this.makeForgeAnimationListener(t,i);null!=e&&this.forgeAnimation.SetAnimationListener(e),this.forgeMaskView.StartAnimation(this.forgeAnimation)}}tryDealWithCustomEvent(e,t){if("jsv-getbound"===e){x(t.has("jsvtoken"),_.InvalidArgument);const i=t.get("jsvtoken"),s=()=>{const t=this;null!=t?t.getBoundingClientRect(e,i,t.forgeMainView):console.error("ElementDelegate.tryDealWithCustomEvent(), Element has been released.")};return this.handleAfterAllChangeFinish(s),Vi.State.NeedCallPostProcess}return 0}setOpacity(e){1!=e&&console.error("Error: not support opacity for performance issue(only <img>) value="+e)}static parsePerformAttr(e,t,i){return!(!wi.StringStartsWith(e,"data-jsv-perf-")||"data-jsv-perf-loadtex"!=e)&&(i.outTexInstantLoad="sync"==t?Fi.TextureInstantLoad.SYNC:"async"==t?Fi.TextureInstantLoad.ASYNC:Fi.TextureInstantLoad.AUTO,i.outParseResult=Vi.State.NeedRefreshCssClassAttribute,!0)}makeAnimation(e,t,i){if(null==t||null==i)return null;const s=this.styleDelegate.jsvValidWidth(),n=this.styleDelegate.jsvValidHeight();let r={keyframes:i,duration:t.duration,easing:t.timingFunction,width:s,height:n,left:this.styleDelegate.left(),top:this.styleDelegate.top()};const a=new Fi.AnimationCssKeyframes(e.GetAnimationManager(),r);return a.EnableDelay(t.delay),a.SetRepeat(t.iterationCount),a.Enable(Fi.AnimationEnable.ReleaseAfterEndCallback),a}makeTransition(e,t){if(null==t)return this.attrStore.transitionStyleMap.clear(),null;let i=[];for(const[e,s]of t.animationMap){if(null==s)continue;const t=this.attrStore.transitionStyleMap.get(e)??new P;let n=new P;const r=A.ToConst(e);if(x(r,null,["Failed makeTransition no support:"+e]),this.styleDelegate.getProperty(r,n),n.equals(t))continue;const a={name:e,duration:s.duration,easing:s.timingFunction,delay:s.delay,from:new Fi.AnimationCssTransition.Value,to:new Fi.AnimationCssTransition.Value,origin:""};if(t.is(P.DataType.Int32)){const e=t.get();a.from=new Fi.AnimationCssTransition.Value(e)}else if(t.is(P.DataType.Float)){const e=t.get();a.from=new Fi.AnimationCssTransition.Value(e)}else if(t.is(P.DataType.String)){const e=t.get();a.from=new Fi.AnimationCssTransition.Value(e)}if(n.is(P.DataType.Int32)){const e=n.get();a.to=new Fi.AnimationCssTransition.Value(e)}else if(n.is(P.DataType.Float)){const e=n.get();a.to=new Fi.AnimationCssTransition.Value(e)}else if(n.is(P.DataType.String)){const e=n.get();a.to=new Fi.AnimationCssTransition.Value(e)}e==A.Effect.Transform&&(a.origin=null!=this.styleDelegate.transformOrigin()?this.styleDelegate.transformOrigin():"center center"),i.push(a),this.attrStore.transitionStyleMap.set(e,n)}if(i.length>0){return new Fi.AnimationCssTransition(e.GetAnimationManager(),i)}return null}makeForgeAnimationListener(e,t){const i=new Fi.AnimationListener(null,null,null);return i.OnStart((()=>{const i=e+"start";this.sendEvent(i,[new Ai(t)])})),i.OnRepeat((i=>{const s=e+"iteration";this.sendEvent(s,[new Ai(t)])})),i.OnEnd((i=>{let s;this.forgeAnimation=null,s=i?e+"end":e+"cancel",this.sendEvent(s,[new Ai(t)])})),i}ensureForgeMaskView(e){if(this.forgeMainView.mParentView)return void console.log("ElementDelegate.ensureForgeMaskView(), Failed to ensure forge mask view, main view's parent is not null.");const t=this.styleDelegate.objectFit(),i=this.styleDelegate.overflow();if(null!=t||null!=i?(null!=this.forgeMaskView&&this.forgeMaskView!=this.forgeMainView&&console.error(Vi.TAG,"Jsview: jsvMaskView is conflicting."),this.forgeMaskView=new Fi.ClipView):null==this.forgeMaskView&&(this.forgeMaskView=this.forgeMainView),this.forgeMaskView!==this.forgeMainView&&(this.forgeMaskView.AddView(this.forgeMainView,0,0),this.flexEnabled&&this.forgeMaskView.TransChildFlexInfoPack(this.forgeMainView),this.forgeMaskView.MarkFlexChildrenFromChild0()),this.forgeInnerPropsCacheList.length>0){for(let t of this.forgeInnerPropsCacheList)this.forgeMaskView.SetElementProp(e,t.name,t.value);this.forgeInnerPropsCacheList=[]}}appendStyleClassAttribute(e){const t=e.replace("data-v-","");let i=0;i=parseInt(t,16);let s=this.styleDelegate.appendClassAttribute(i);v(s);const n=new Set;s=this.getExtendClassAttributeChildren(n),v(s);for(let e of n)s=e.styleDelegate.appendClassAttribute(i),v(s);return 0}setExtendClassAttributeDepth(e){if(e<=0)return 0;this.attrStore.extendClassAttributeDepth=e;let t=this;for(let i=0;i<e&&(t=t.parentNode,null!=t);i++);if(t){v(this.styleDelegate.mergeClassAttributes(t.styleDelegate))}return 0}convertObjectFit(e){return e?"fill"==e?"fill":"none"==e?"none":"cover"==e?"cover":"contain"==e?"contain":"scale-down"==e?"scale-down":"fill":"fill"}getBoundingClientRect(e,t,i){if(i){const s=i=>{this.sendEvent(e,[new Ai(i),new Ai(t)])};i.GetBoundingClientRect(s)}else{const i='{"status": -100, "error": target LayoutView is null})';this.sendEvent(e,[new Ai(i),new Ai(t)])}}enableAsFlexContainer(){this.flexEnabled=!0}}Vi.TAG="ElementDelegate",Vi.State={NeedRefreshCssClass:1,NeedRefreshCssClassAttribute:2,NeedCallPostProcess:3},Vi.EventInfo=class{constructor(){this.listener=void 0,this.count=0}},Vi.AttrStore=class{constructor(){this.transitionStyleMap=new Map,this.extendClassAttributeDepth=-1}},Vi.TransitionSetInfo=class{constructor(){this.swapCount=0,this.alreadySet=!1}};class Oi{static isRtl(e){for(let t=0;t<e.length;++t){let i=e.charCodeAt(t);if(32!==i)return i>=1536&&i<=1791}return!1}}class Mi extends Vi{setTextContent(e){this.textContent=e}getTextContent(){return this.textContent}onCssStyleChanged(e){const t=this.styleDelegate.getChangedStyleGroups();return(t.has(R.Text.Name)||t.has(R.Layout.Name)&&this.clientWidth!=this.styleDelegate.jsvValidHeight())&&this.onFlushViewText(e),t.has(R.Effect.Name)&&null!=this.styleDelegate.borderImage()&&this.onFlushViewBorder(e),super.onCssStyleChanged(e)}constructor(e,t){super(e,t),this.textContent="",this.instantLoadSet=Fi.TextureInstantLoad.AUTO}setAttribute(e,t,i){let s,n={};return Vi.parsePerformAttr(t,i,n)?(this.instantLoadSet=n.outTexInstantLoad,s=n.outParseResult,s):(s=super.setAttribute(e,t,i),s)}onFlushViewText(e){if(!this.textContent)return void(this.forgeContentView&&(this.forgeMainView.RemoveView(this.forgeContentView),this.forgeContentView=null));null==this.forgeContentView&&(this.forgeContentView=new Fi.LayoutView,this.forgeMainView.InsertView(this.forgeContentView),this.forgeMainView.MarkFlexSizeFromChild(this.forgeContentView)),this.forgeContentView.ClearViews(),this.clientWidth=0,this.clientHeight=0;let t=e.GetTextureManager(),i=new Fi.TextStyleCache;const s=this.styleDelegate.fontSize();let n=this.styleDelegate.lineHeight();n<=0&&(n=s>0?Math.ceil(1.3*s):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();n>=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(t);const u=this.styleDelegate.height();let d=this.styleDelegate.width(),g=u!=P.InvalidInt32?u:0,f=d==P.InvalidInt32;if(f&&(d=Fi.TextUtils.GetTextWidth(t,this.textContent,i.font,s,i.bold,i.italic)),d<=0)return void console.error(Mi.TAG,"Failed to render text: %s, text width is invalid.");let m=d,p=this.styleDelegate.jsvTextAlignMinWidth();p>0&&m<p&&(m=p);const y=u==P.InvalidInt32||0==u,T=y?(e,t,i)=>{this.clientWidth=e,this.clientHeight=t}:null;let _=Math.floor(d*Fi.sRenderBridge.GetScreenInfo().scaleRatio);if(_>3e3){if(!f)return void console.error(`long text only support style.width=undefine. str=${this.textContent}`);console.log(`text too long, start to break down. width(${_})`),this.forgeTextView=new Fi.LayoutView;const e=[];Fi.TextUtils.GetOneLineTextDrawWidth(t,this.textContent,i.font,s,i.bold,i.italic,e);const o=e[0];let l=0;const h="unset"===i.textInnerDirection?Oi.isRtl(this.textContent):"rtl"===i.textInnerDirection;for(let c=1;c<e.length;c+=3){const u=e[c],d=e[c+1],f=e[c+2],m=this.textContent.slice(u,d);let p=Fi.TextUtils.BuildTextView(t,m,i,0==u?T:null,f,g,s,n,this.instantLoadSet,a,r);const y=h?o-l-f:l;this.forgeTextView.AddView(p,y,0,f,g),l+=f}this.clientWidth=o,this.forgeTextView.ResetLayoutParams({x:0,y:0,width:o,height:g})}else this.forgeTextView=Fi.TextUtils.BuildTextView(t,this.textContent,i,T,m,g,s,n,this.instantLoadSet,a,r),this.clientWidth=d;y&&this.forgeTextView.EnableAutoHeight(),this.forgeContentView.InsertView(this.forgeTextView),this.forgeContentView.MarkFlexSizeFromChild(this.forgeTextView)}ensureForgeMaskView(e){null!=this.styleDelegate.borderImage()&&(this.forgeMaskView=new Fi.NinePatchView),super.ensureForgeMaskView(e)}onFlushViewBorder(e){if(null==this.forgeMaskView)return;const t=this.styleDelegate.borderImage();if(null!=t)if(0==t.source.length)this.forgeMaskView.ResetTexture(null,null);else{const i=e.GetTextureManager(),s=t.source,n=i.GetImage(s,null);this.forgeMaskView.ResetTexture(n,null),this.forgeMaskView.WaitTextureToResize(!0);const r=(e,i,s)=>{const n=this.styleDelegate.borderImageWidth(),r=this.styleDelegate.borderImageOutset();if(null==this.forgeMaskView||null==t.slice||null==n||null==r)return void console.log(Mi.TAG,"Nine patch settings are not complete.");const a=this.forgeMaskView,o=Math.floor(e*n.top/t.slice.top),l=Math.floor(i*n.left/t.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:n?.left,width:Math.max(0,o-2*n.left)}],d=[{start:n.top,width:Math.max(0,l-2*n.top)}];a.SetRepeat(u,d),a.WaitTextureToResize(!1)};n.RegisterLoadImageCallback(r)}}getBoundingClientRect(e,t,i){this.styleDelegate.height()!=P.InvalidInt32&&this.styleDelegate.width()!=P.InvalidInt32||null==this.forgeTextView||(i=this.forgeTextView),super.getBoundingClientRect(e,t,i)}}Mi.TAG="DivDelegate";class Ni extends Vi{constructor(e,t){super(e,t)}}class Gi extends Ni{constructor(e,t){super(e,t)}}class Bi extends Vi{setAttribute(e,t,i){const s=()=>{const t=this;null!=t?t.loadImage(e,t.imgAttrStore.src):console.error("ElementDelegate.tryDealWithCustomEvent(), Element has been released.")};if("src"==t)return this.imgAttrStore.src!==i&&(this.imgAttrStore.sizeApplied=!1,this.imgAttrStore.imageWidth=0,this.imgAttrStore.imageHeight=0),this.imgAttrStore.src=i,this.handleAfterAllChangeFinish(s),Bi.State.NeedCallPostProcess;return 0==this.setTextureAttribute(e,t,i)?(this.handleAfterAllChangeFinish(s),Bi.State.NeedCallPostProcess):super.setAttribute(e,t,i)}onCssStyleChanged(e){const t=this.styleDelegate.getChangedStyleGroups();return(t.has(R.Layout.Name)||t.has(R.Effect.Name))&&this.onFlushViewImage(e),super.onCssStyleChanged(e)}constructor(e,t){super(e,t),this.imageInLoading=!1,this.forgeImageTexture=null,this.imageOperatorKey=null,this.loadCallbackSeq=0,this.imgAttrStore=new Bi.ImgAttrStore,this.forgeImageView=new Fi.LayoutView(null,"img"),this.forgeMainView.InsertView(this.forgeImageView),this.forgeMainView.MarkFlexSizeFromChild(this.forgeImageView)}setForgeViewInnerProps(e,t,i,s){return 1==i?super.setForgeViewInnerProps(e,t,i,s):(this.forgeImageView.SetElementProp(e,t,s),0)}getObjectFitClipStatus(e){if(0!=this.imgAttrStore.imageWidth&&0!=this.imgAttrStore.imageHeight){let t=this.convertObjectFit(this.styleDelegate.objectFit());if("fill"!=t){let i=this.forgeImageView.ApplyObjectFit(this.styleDelegate.jsvValidWidth(),this.styleDelegate.jsvValidHeight(),this.imgAttrStore.imageWidth,this.imgAttrStore.imageHeight,t);if(i)return e.left=i.x,e.top=i.y,e.width=i.width,e.height=i.height,e.autoSizeClip=!1,e.useScissors=!0,!0}}return!1}onFlushViewImage(e){if(0!=this.imgAttrStore.imageWidth&&0!=this.imgAttrStore.imageHeight&&!this.imgAttrStore.sizeApplied){this.flushMaskViewClip(e);let t=this.styleDelegate.jsvValidWidth(),i=this.styleDelegate.jsvValidHeight();0==t&&0!=i?t=this.imgAttrStore.imageWidth*i/this.imgAttrStore.imageHeight:0!=t&&0==i&&(i=this.imgAttrStore.imageHeight*t/this.imgAttrStore.imageWidth),this.clientWidth=t,this.clientHeight=i,this.imgAttrStore.sizeApplied=!0}const t=this.styleDelegate.jsvValidWidth(),i=this.styleDelegate.jsvValidHeight(),s={x:0,y:0,width:t>0?t:this.getClientWidth(e),height:i>0?i:this.getClientHeight(e)};this.forgeImageView.ResetLayoutParams({x:s.x,y:s.y,width:s.width,height:s.height})}setTextureAttribute(e,t,i){let s=_.UnsupportedError;return"dataJsvImgColorSpace"==t||"data-jsv-img-color-space"==t?(this.imageInLoading&&console.log("Failed to set attribute "+t+", this attribute must be set before src"),this.imgAttrStore.dataJsvColorSpace=i,s=0):"dataJsvImgScaledownTex"==t||"data-jsv-img-scaledown-tex"==t?(this.imageInLoading&&console.log("Failed to set attribute "+t+", this attribute must be set before src"),this.imgAttrStore.dataJsvScaleDownTex=""==i||"true"==i,s=0):"data-jsv-img-poster-image"==t&&(this.imageInLoading&&console.log("Failed to set attribute "+t+", this attribute must be set before src"),this.imgAttrStore.dataJsvPosterImage="true"==i,s=0),s}loadImage(e,t){if(null==t)return;this.imgAttrStore.imageWidth=0,this.imgAttrStore.imageHeight=0;let i=0,s=0;1==this.imgAttrStore.dataJsvScaleDownTex&&(i=this.styleDelegate.width(),0==i&&console.error("set dataJsvScaleDownTex while style.width is not set"),s=this.styleDelegate.height(),0==s&&console.error("set dataJsvScaleDownTex while style.height is not set"));let n=e.GetTextureManager();this.forgeImageTexture=n.GetImage2(this.imgAttrStore.src,i,s,this.imgAttrStore.dataJsvColorSpace,null,!1,this.imgAttrStore.dataJsvPosterImage),this.imageInLoading=!0;let r,a=++this.loadCallbackSeq;this.imageOperatorKey=this.forgeImageTexture.RegisterLoadImageCallback(((t,i,s)=>{a==this.loadCallbackSeq&&(this.imgAttrStore.imageWidth=t,this.imgAttrStore.imageHeight=i,this.imageInLoading=!1,this.onFlushViewImage(e),this.sendEvent("load",[new Ai(t),new Ai(i)]))}));let o=this.styleDelegate.borderRadius();o&&(r=new Fi.ViewRoundCornerMask(o.topLeft,o.topRight,o.bottomLeft,o.bottomRight)),this.forgeImageView.ResetTexture(this.forgeImageTexture,r)}getClientWidth(e){const t=super.getClientWidth(e);return t<=0&&this.imgAttrStore.imageWidth>0?this.imgAttrStore.imageWidth:t}getClientHeight(e){const t=super.getClientHeight(e);return t<=0&&this.imgAttrStore.imageHeight>0?this.imgAttrStore.imageHeight:t}setOpacity(e){this.forgeImageView.SetViewOpacity(e)}}Bi.ImgAttrStore=class{constructor(){this.src=void 0,this.imageWidth=0,this.imageHeight=0,this.sizeApplied=!1,this.dataJsvColorSpace="RGBA_8888",this.dataJsvScaleDownTex=!1,this.dataJsvPosterImage=!1}};class Wi extends Ni{onCssStyleChanged(e){return this.styleDelegate.getChangedStyleGroups().has(R.Layout.Name)&&this.onFlushViewHole(e),super.onCssStyleChanged(e)}constructor(e,t){super(e,t)}onFlushViewHole(e){this.forgeMainView.Element.style.backgroundColor="#222222"}}class Hi{static SetForgeFrontToContext(e,t){e.forgeFront=t}static GetForgeFrontFromContext(e){return e.forgeFront}}class Yi{constructor(){this.elementDelegateMap=new Map,this.onEventListener=void 0,this.styleClassMgr=new Ci.Manager}static GetInstance(e){const t=Yi.PlatformBridgeInstanceMap.get(e);if(t)return t;const i=new class extends Yi{};return i.jsviewId=e,Yi.PlatformBridgeInstanceMap.set(e,i),Hi.SetForgeFrontToContext(i,new Fi),window.JsvCode.Debug||(window.JsvCode.Debug={}),window.JsvCode.Debug.PlatformBridge=[],window.JsvCode.Debug.PlatformBridge.push(i),i}static SetOnEventListener(...e){w(e.length>=2,null);const t=e[0],i=e[1],s=Yi.GetInstance(t);return s.onEventListener=new Yi.EventListener,s.onEventListener.jseFunction=i,null}static RunSyncTask(...e){x(e.length>=3,_.BadArgumentSize);const t=e[0],i=e[1],s=e[2],n=e,r=Yi.GetInstance(t),a=Hi.GetForgeFrontFromContext(r);let o=new Ai,l=r.runGetterTaskByType(a,i,s,n,o);if(l<0)throw new Error("Failed to run synctask, error: "+l);return Yi.CastFromUnionValue(o)}static RunLazyTaskList(...e){w(e.length>=2,null);const t=e[0],i=e[1],s=JSON.parse(i),n=Yi.GetInstance(t),r=Hi.GetForgeFrontFromContext(n),a=s,o=new Yi.TaskStash;for(const e of a){const t=e[0],i=e[1],s=e;if(o.removedIdSet.has(i))continue;let a=n.runSetterTaskByType(r,t,i,s,o);if(a==_.CssStyleNotChanged&&(a=0),a<0)throw new Error("Failed to run lazytask, error: "+a)}for(const e of o.removedIdSet)o.cssClassChangedIdSet.delete(e),o.cssStyleChangedIdSet.delete(e),o.postprocessingIdSet.delete(e);const l=n.syncCssClasses(o.cssClassChangedIdSet,o.cssStyleChangedIdSet);o.cssClassChangedIdSet.clear(),function(e,t,i=[]){C(e,_.GetErrorMessage(i),t)}(l,null);for(const e of o.cssStyleChangedIdSet){n.getElementById(e).onCssStyleChanged(r)}o.cssStyleChangedIdSet.clear();for(const e of o.postprocessingIdSet){n.getElementById(e).onAllChangeFinished(r)}return o.postprocessingIdSet.clear(),null}static CastFromUnionValue(e){let t;return e.is(Ai.DataType.String)||e.is(Ai.DataType.Int32)||e.is(Ai.DataType.Float)?t=e.get():e.is(Ai.DataType.Null)?t=null:w(!1,null),t}static AppendToJsonObject(e,t,i){let s,n;if(s=t,i.is(P.DataType.String)){const e=i.get();e&&(n=e)}else if(i.is(P.DataType.Int32)){n=i.get()}else if(i.is(P.DataType.Float)){n=i.get()}else i.is(P.DataType.Null)||v(_.CssStyleBadType);return e[s]=n,0}getElementById(e){let t=null;const i=this.elementDelegateMap.get(e);return null!=i&&(t=i),w(t,null),t}forgeElementGetter(e){let t=null;const i=this.elementDelegateMap.get(e);return null!=i&&(t=i),t}syncCssClasses(e,t){for(const i of e){const s=this.getElementById(i),n=[];this.syncCssClassesRecursive(s,n,e,t)}return this.styleClassMgr.clearStyleClassCache(),0}syncCssClassesRecursive(e,t,i,s){let n=new Set;e.styleDelegate.updateClassDeclarations(t,n);for(const e of n)s.add(e)}runSetterTaskByType(e,t,i,s,n){let r=_.BadTaskType;switch(t){case Yi.TaskType.CreateElement:r=this.createElement(e,i,s);break;case Yi.TaskType.BindElementToRootView:r=this.bindElementToRootView(e,i,s);break;case Yi.TaskType.InsertElementChild:r=this.insertElementChild(e,i,s);break;case Yi.TaskType.RemoveElementChild:r=this.removeElementChild(e,i,s,n);break;case Yi.TaskType.MoveElementChild:r=this.moveElementChild(e,i,s);break;case Yi.TaskType.ReOrderElementChild:r=this.reOrderElementChild(e,i,s);break;case Yi.TaskType.AddElementEventListener:r=this.addElementEventListener(e,i,s,n);break;case Yi.TaskType.RemoveElementEventListener:r=this.removeElementEventListener(e,i,s);break;case Yi.TaskType.SetElementText:r=this.setElementText(e,i,s,n);break;case Yi.TaskType.SetElementAttribute:r=this.setElementAttribute(e,i,s,n);break;case Yi.TaskType.SetForgeViewInnerProps:r=this.setForgeViewInnerProps(e,i,s);break;case Yi.TaskType.InsertKeyFrameDefine:r=this.insertKeyFrame(e,i,s);break;case Yi.TaskType.RemoveKeyFrameDefine:r=this.removeKeyFrame(e,i,s);break;case Yi.TaskType.DeclareStyleSheets:r=this.declareStyleSheets(e,i,s);break;case Yi.TaskType.UndeclareStyleSheets:r=this.undeclareStyleSheets(e,i,s);break;case Yi.TaskType.SetStyleProperty:r=this.setStyleProperty(e,i,s,n)}return v(r),0}runGetterTaskByType(e,t,i,s,n){let r=_.BadTaskType;switch(t){case Yi.TaskType.GetElementBoundingClientStyles:r=this.getElementBoundingClientStyles(e,i,s,n);case Yi.TaskType.GetStyleProperties:r=this.getStyleProperties(e,i,s,n);break;case Yi.TaskType.GetElementAttribute:r=this.getElementAttributes(e,i,s,n);break;case Yi.TaskType.GetRelativePosition:r=this.getRelativePosition(e,i,s,n)}return v(r),0}createElement(e,t,i){const s=i;x(s.length>=3,_.BadArgumentSize);const n=s[2];let r;return r="AUDIO"==n?Vi.MakeShared(e,t,this.styleClassMgr,Gi):"DIV"==n?Vi.MakeShared(e,t,this.styleClassMgr,Mi):"IMG"==n?Vi.MakeShared(e,t,this.styleClassMgr,Bi):"VIDEO"==n?Vi.MakeShared(e,t,this.styleClassMgr,Wi):Vi.MakeShared(e,t,this.styleClassMgr,Vi),this.elementDelegateMap.set(t,r),0}bindElementToRootView(e,t,i){x(i.length>=2,_.BadArgumentSize);return this.getElementById(t).bindToForgeRootView(e),0}insertElementChild(e,t,i){const s=i;x(s.length>=3,_.BadArgumentSize);const n=s[2],r=s.length>=4&&s[3]?s[3]:-1,a=this.getElementById(t),o=this.getElementById(n),l=r>0?this.getElementById(r):void 0;return a.insertForgeView(e,o,l),0}removeElementChild(e,t,i,s){const n=i;x(n.length>=3,_.BadArgumentSize);const r=n[2],a=this.getElementById(t),o=this.getElementById(r),l=(e,t,i)=>{for(const s of e.childNodes)l(s,t,i);e.styleDelegate.finalize(),t.add(e.nativeId),i.delete(e.nativeId)};return l(o,s.removedIdSet,this.elementDelegateMap),a.removeForgeView(e,o),0}moveElementChild(e,t,i){const s=i;x(s.length>=4,_.BadArgumentSize);const n=s[2],r=s[3],a=s.length>=5&&s[4]?s[4]:-1,o=this.getElementById(t),l=this.getElementById(n),h=this.getElementById(r),c=a>0?this.getElementById(a):void 0;return o.moveForgeView(e,l,h,c),0}reOrderElementChild(e,t,i){const s=i;x(s.length>=3,_.BadArgumentSize);const n=s[2],r=s.length>=4&&s[3]?s[3]:-1,a=this.getElementById(t),o=this.getElementById(n),l=r>0?this.getElementById(r):void 0;return a.reOrderForgeView(e,o,l),0}addElementEventListener(e,t,i,s){const n=i;x(n.length>=4,_.BadArgumentSize);const r=n[2],a=new Map;if("object"==typeof n[3]&&null!==n[3]){const e=n[3];for(const[t,i]of Object.entries(e))x("number"==typeof i,_.InvalidArgument),a.set(t,i)}const o=this.getElementById(t).addEventListener(r,((e,t,i)=>{S(Yi.GetInstance(e).onEventListener),setTimeout(t.bind(this,e,i),0)}).bind(this,this.jsviewId,((e,t)=>{const i=Yi.GetInstance(e);if(null==i.onEventListener)return;const s=i.onEventListener.jseFunction;let n=[];for(const e of t){const t=Yi.CastFromUnionValue(e);n.push(t)}s(...n)})),a);return v(o),o==Vi.State.NeedCallPostProcess&&s.postprocessingIdSet.add(t),0}removeElementEventListener(e,t,i){const s=i;x(s.length>=4,_.BadArgumentSize);const n=s[2],r=new Map;if("object"==typeof s[3]&&null!==s[3]){const e=s[3];for(const[t,i]of Object.entries(e))x("number"==typeof i,_.InvalidArgument),r.set(t,i)}return this.getElementById(t).removeEventListener(n,r),0}setElementText(e,t,i,s){const n=i;x(n.length>=3,_.BadArgumentSize);const r=n[2],a=this.getElementById(t),o=a instanceof Mi?a:null;return x(o,_.BadElementType),o.setTextContent(r),o.styleDelegate.addChangedStyleGroup(R.Text.Name),s.cssStyleChangedIdSet.add(o.nativeId),0}setElementAttribute(e,t,i,s){const n=i;x(n.length>=4,_.BadArgumentSize);const r=n[2],a=n[3],o=this.getElementById(t);let l=o.setAttribute(e,r,a);if(v(l),l==Vi.State.NeedRefreshCssClass)s.cssClassChangedIdSet.add(t);else if(l==Vi.State.NeedRefreshCssClassAttribute){s.cssClassChangedIdSet.add(t);const e=new Set;l=o.getExtendClassAttributeChildren(e),v(l);for(const t of e)s.cssClassChangedIdSet.add(t.nativeId)}else l==Vi.State.NeedCallPostProcess&&s.postprocessingIdSet.add(t);return 0}getElementBoundingClientStyles(e,t,i,s){const n=i;x(n.length>=4,_.BadArgumentSize);const r=n[3];x(r,_.InvalidElement);const a=JSON.parse(r),o=this.getElementById(t),l=o.styleDelegate,h={},c=a;for(const e of c){const t=e,i=A.ToConst(t);x(i,_.CssStyleBadName);let s=new P;if(i==A.Layout.Left){let e=l.left(),t=o.parentNode;for(;null!=t;){e+=t.styleDelegate.left(),t=t.parentNode}s=new P(e)}else if(i==A.Layout.Top){let e=l.top(),t=o.parentNode;for(;null!=t;){e+=t.styleDelegate.top(),t=t.parentNode}s=new P(e)}else{let e=l.getProperty(i,s);x(e>=0||_.CssStyleNotExists,e,["Failed to get style ",i])}v(Yi.AppendToJsonObject(h,i,s))}const u=JSON.stringify(h),d=new Ai(u);return s.reset(d),0}declareStyleSheets(e,t,i){const s=i;x(s.length>=2,_.BadArgumentSize);const n=s[2];return v(this.styleClassMgr.declareStyleSheets(n)),0}undeclareStyleSheets(e,t,i){const s=i;x(s.length>=2,_.BadArgumentSize);const n=s[2];return v(this.styleClassMgr.undeclareStyleSheets(n)),0}setStyleProperty(e,t,i,s){const n=i;x(n.length>=3,_.BadArgumentSize);const r=n[2],a=n.length>=4?n[3]:null,o=this.getElementById(t).styleDelegate,l=Ci.CastToStyleValue(a);let h=new Set;const c=o.setProperty(r,l,h);if(c==_.CssStyleNotChanged)return 0;v(c,["Failed to set style ",r]);for(const e of h)s.cssStyleChangedIdSet.add(e);return 0}getStyleProperties(e,t,i,s){const n=i;x(n.length>=4,_.BadArgumentSize);const r=n[3];x(r,_.InvalidElement);const a=JSON.parse(r),o=this.getElementById(t).styleDelegate,l={},h=a;for(const e of h){const t=e,i=A.ToConst(t);x(i,_.CssStyleBadName);const s=new P;let n=o.getProperty(i,s);x(n>=0||_.CssStyleNotExists,n,["Failed to get style ",i]),n=Yi.AppendToJsonObject(l,i,s),v(n)}const c=JSON.stringify(l),u=new Ai(c);return s.reset(u),0}getElementAttributes(e,t,i,s){const n=i;x(n.length>=3,_.BadArgumentSize);const r=n[3],a=this.getElementById(t);if("clientWidth"==r){const t=new Ai(a.getClientWidth(e));s.reset(t)}else if("clientHeight"==r){const t=new Ai(a.getClientHeight(e));s.reset(t)}return 0}getRelativePosition(e,t,i,s){const n=i;x(n.length>=3,_.BadArgumentSize);const r=n[3],a=this.getElementById(t),o=this.getElementById(r);let l=0,h=0,c=a.getClientWidth(e),u=a.getClientHeight(e),d=a;for(;null!=d&&d!=o;)l+=d.styleDelegate.left(),h+=d.styleDelegate.top(),d=d.parentNode;const g=new Ai(JSON.stringify({left:l,top:h,width:c,height:u}));return s.reset(g),0}setForgeViewInnerProps(e,t,i){const s=i;x(s.length>=5,_.BadArgumentSize);const n=s[2],r=s[3],a=s[4];return this.getElementById(t).setForgeViewInnerProps(e,n,r,a)}insertKeyFrame(e,t,i){const s=i;x(s.length>=4,_.BadArgumentSize);const n=s[2],r=s[3];return this.styleClassMgr.insertKeyFrame(n,r),0}removeKeyFrame(e,t,i){const s=i;x(s.length>=3,_.BadArgumentSize);const n=s[2];return this.styleClassMgr.removeKeyFrame(n),0}}Yi.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,ReOrderElementChild:22,DeclareStyleSheets:30,SetStyleProperty:31,GetStyleProperties:32,UndeclareStyleSheets:39,SetForgeViewInnerProps:40,InsertKeyFrameDefine:41,RemoveKeyFrameDefine:42},Yi.TaskStash=class{constructor(){this.removedIdSet=new Set,this.cssClassChangedIdSet=new Set,this.cssStyleChangedIdSet=new Set,this.postprocessingIdSet=new Set}},Yi.EventListener=class{constructor(){this.jseContext=null}},Yi.JsViewId=1,Yi.PlatformBridgeInstanceMap=new Map,Yi.RegisterOriginDocument=function(e){let t=e.createElement("style");t.type="text/css",t.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 ";e.getElementsByTagName("Head")[0].appendChild(t),window.originDocument=e},window.JsvCode.BrowserPlatformDomBridge=Yi,y.LogF=function(e){},y.LogE=function(e){},y.LogW=function(e){},y.LogI=function(e){},y.LogD=function(e){},y.LogM=function(e){},y.ThrowError=function(e){throw new Error(e)},y.Assert=function(e){if(!e)throw new Error("ASSERT!!!!!")},y.EnableLog=function(e){y.LogM=console.log.bind(console),e>0&&(y.LogF=console.error.bind(console)),e>1&&(y.LogE=console.error.bind(console)),e>2&&(y.LogW=console.warn.bind(console)),e>3&&(y.LogI=console.log.bind(console)),e>4&&(y.LogD=console.debug.bind(console))},y.EnableLog(4),y.BaseActivity=class{},console.log("Log debug replace Forge.BaseActivity");{class Cs{constructor(e,t,i){this.PageName=e,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,t&&this.SetContentView(t)}OnRenderFrame(){y.LogE("OnRenderFrame() MUST override")}OnKeyDown(e){return!1}OnKeyUp(e){return!1}DispatchKeyDown(e){if(this._KeyLock)return!0;var t=!1;return Cs.sLastFocusPage=this,this._FocusChild&&(t=this._FocusChild.DispatchKeyDown(e)),t||(t=this.OnKeyDown(e)),t}OnCustomEvent(e){return!1}BubbleCustomEvent(e){this.OnCustomEvent(e)||this._ParentPage&&this._ParentPage.BubbleCustomEvent(e)}DispatchKeyUp(e){if(this._KeyLock)return!0;var t=!1;return this._FocusChild&&(t=this._FocusChild.DispatchKeyUp(e)),t||(t=this.OnKeyUp(e)),t}PrintLastFocusPage(){var e="------"+this.PageName+"\n",t=this._ParentPage;return t&&(e+=t.PrintLastFocusPage()),e}OnMouseDown(e){return!1}EnableTouchDispatcher(){this.TouchDispatcher=new y.TouchDispatcher(this)}DisableTouchDispatcher(){this.TouchDispatcher=null}GetTouchView(){return null}GetSwipeParams(e,t,i){var s=void 0===i||0==i?this._Acc:i,n=e*e/2/s;e<0&&(n=-n);var r=t*t/2/s;return t<0&&(r=-r),{durationX:Math.floor(Math.abs(e/s)),durationY:Math.floor(Math.abs(t/s)),distanceX:n,distanceY:r}}OnTouch(e){return!1}DispatchTouch(e){var t=!1;return this.TouchDispatcher&&(t=this.TouchDispatcher.OnTouch(e)),t}LostTouchFocus(e){}OnJavaKey(e,t){return!0}OnPlatformKey(e,t){return!0}PassPlatformKey(e,t){if(this._KeyLock)return!1;var i=this.OnPlatformKey(e,t);return i&&(i=this.OnJavaKey(e,t)),i}DispatchJavaKey(e,t){if(e==this._ConsumeKeycodeUntilUp)return 1==t&&(this._ConsumeKeycodeUntilUp=-1),y.LogM("Consume Javakey until up keycode="+e+" keyaction="+t),!1;if(this._KeyLock)return!1;-1!=this._ConsumeKeycodeUntilUp&&(y.LogE("ERROR: Other key pressed before locked key release"),this._ConsumeKeycodeUntilUp=-1);var i=this._FocusChild,s=!0;return i&&(s=i.DispatchJavaKey(e,t)),s&&(s=this.PassPlatformKey(e,t)),i!=this._FocusChild&&0==t&&this.CosumeAllKeyUnitlUpForFocusChange(e),s}CosumeAllKeyUnitlUpForFocusChange(e){this._ParentPage?this._ParentPage.CosumeAllKeyUnitlUpForFocusChange(e):this._ConsumeKeycodeUntilUp=e}OnHostActivityGetFocus(){this._ConsumeKeycodeUntilUp=-1}IsFocus(){return!this._ParentPage||this._ParentPage._FocusChild==this}_IsLeafInChain(){return this.IsFocus()&&!this._FocusChild}SetParent(e,t){null!=e?(null!=t&&this.SetContentView(t),e instanceof y.BaseActivity&&(e=e.GetRootPageBase()),this._ParentPage=e,e.SubPages.push(this),this._HostActivity=e._HostActivity,e._IsShowing&&this._AutoShow&&this._OnShowInternal()):y.ThrowError("ERROR: parent is null")}SetParentPage(e){this.SetParent(e)}OnRemoveFromTree(){if(this._ParentPage=null,this.SubPages&&this.SubPages.length>0){for(let e of this.SubPages)e.OnRemoveFromTree();this.SubPages=[]}}RemoveSubPage(e){e==this._FocusChild&&(this._FocusChild=null),e==this._LatestFocusChild&&(this._LatestFocusChild=null);for(var t=0;t<this.SubPages.length;t++)if(e==this.SubPages[t]){e._OnHideInternal(),this.SubPages.splice(t,1);break}}ClearSubPages(){this.SubPages=[],this._FocusChild=null,this._LatestFocusChild=null}GetParentPage(){return this._ParentPage}Focus(e){if(this.IsFocus()){if(!e)return void y.LogI("requestFocus(): Already focused name="+this.PageName);if(this._IsLeafInChain())return void y.LogI("requestFocus(): Already focused name="+this.PageName)}if(Cs.sChangingFocusLock)return void Cs.sDelayedFocusChanges.push(this);if(Cs.sChangingFocusLock=!0,this._ParentPage){for(var t,i=[],s=this;s._ParentPage&&!s.IsFocus();)i.push(s),s=s._ParentPage;t=e&&0==i.length?this._FocusChild:i[i.length-1]._ParentPage._FocusChild;for(var n=[];t;)n.push(t),t=t._FocusChild;for(var r=n.length-1;r>=0;r--)n[r]._BlurInternal();for(r=i.length-1;r>=0;r--)i[r]._FocusInternal();if(e)this._LatestFocusChild=null;else for(var a=i[0];a._LatestFocusChild&&null==a._FocusChild;)a._LatestFocusChild._FocusInternal(),(a=a._FocusChild)||y.ThrowError("ERROR: focus chain is broken")}Cs.sChangingFocusLock=!1;let o=Cs.sDelayedFocusChanges.length;if(o>0){let e=Cs.sDelayedFocusChanges;Cs.sDelayedFocusChanges=[];for(let t=0;t<o;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()):y.LogE("No dispatcher")}_BlurInternal(){this._ParentPage||y.LogE("No dispacher"),this._ParentPage._FocusChild==this?(this._ParentPage._FocusChild=null,this.OnBlur()):y.LogW("Not focus yet, page name="+this.PageName)}GetFocusChild(){return this._FocusChild}Hide(){this._AutoShow=!1,this._OnHideInternal()}Show(e){this._OnShowInternal(),e&&this.Focus()}OnFocus(){y.LogW("No overrided Page OnFocus event, page name="+this.PageName)}OnBlur(){y.LogW("No overrided Page OnBlur event, page name="+this.PageName)}OnShow(){y.LogW("No overrided Page OnShow event, page name="+this.PageName)}OnHide(){y.LogW("No overrided Page OnHide event, page name="+this.PageName)}_OnShowInternal(){for(var e,t=0;t<this.SubPages.length;t++)(e=this.SubPages[t])._AutoShow&&e._OnShowInternal();this._IsShowing||(this._IsShowing=!0,this.OnShow())}_OnHideInternal(){for(var e,t=0;t<this.SubPages.length;t++)(e=this.SubPages[t])._IsShowing&&e._OnHideInternal();this._IsShowing&&(this._IsShowing=!1,this.OnHide())}GetMainView(){return null==this._CVSet&&(this._CVSet=new y.MainViewSetting(null,null)),this._CVSet}GetContentView(){return null==this._CVSet?null:this._CVSet.View}SetContentView(e){null!=e&&(null!=this._CVSet&&this._CVSet.View.BindedPageBase(null),this._CVSet=new y.MainViewSetting(e,null),e.BindedPageBase(this))}OnContentViewLostInternal(){this.OnContentViewLost()}OnContentViewLost(){}GetHostActivity(){return this._HostActivity}SetHostActivity(e){this._HostActivity=e}GetTextureManager(){return null!=this._HostActivity?this._HostActivity.GetTextureManager():null}SetAutoShow(e){this._AutoShow=e}KeyLock(){this._KeyLock=!0}UnKeyLock(){this._KeyLock=!1}}Cs.sLastFocusPage=null,Cs.sChangingFocusLock=!1,Cs.sDelayedFocusChanges=[],y.PageBase=Cs}y.RectArea=Y;F.FreeMoveActionBuilder=class{static SetSpeed(e,t){return{type:"setSpeed",params:{Xspeed:e,Yspeed:t}}}static SetAccel(e,t){return{type:"setAccel",params:{Xacc:e,Yacc:t}}}static StopMoving(){return{type:"stop"}}static StopMovingExact(e,t){return{type:"stopExtract",params:{x:e,y:t}}}static SetArrowSpeed(e,t,i,s){return{type:"setArrowSpeed",params:{arrowTargetX:e,arrowTargetY:t,absSpeedX:i,absSpeedY:s}}}static BrakeToPos(e,t){return{type:"breakToPos",params:{targetX:e,targetY:t}}}static TeleportTo(e,t,i){return{type:"teleportTo",params:{targetX:e,targetY:t,boolean:i}}}static teleportOffset(e,t){return{type:"teleportOffset",params:{offsetX:e,offsetY:t}}}};F.FreeMoveCmdPackBuilder=class{static InitActCmdPack(e,t,i,s){return{t:1,cmds:s,tkn:isNaN(i)?0:i,spdxye:isNaN(e)?0:e,accxye:isNaN(t)?0:t}}static InitStateCmdPack(e){return{t:2,cmd:e}}},F.FreeMoveExternType={},F.FreeMoveExternType.GroupType_FromAction=10,F.FreeMoveExternType.GroupType_ActionAssoc=10;F.FreeMoveConditionSet=class{static ReachPosition(e,t,i){return{type:"Position",params:{x:e,y:t,groupType:i.g,multiTimes:i.m,actionCheckCount:0}}}static ReachSpeed(e,t,i,s){return{type:"Speed",params:{Xspeed:e,Yspeed:t,direction:s,groupType:i.g,multiTimes:i.m,actionCheckCount:0}}}static AcrossPosition(e,t,i){return{type:"acrossPosition",params:{Xposition:e,Yposition:t,groupType:i.g,multiTimes:i.m,actionCheckCount:0}}}static AppendSubCmd(e,t){const i="cmds";e.hasOwnProperty("cmdPacks")?console.error("Error: conflict with command pack list"):(e.hasOwnProperty(i)||(e[i]=[]),e[i].push(t))}static SetCmdList(e,t){t instanceof Array&&(e.hasOwnProperty("cmdPacks")?console.error("Error: conflict with command pack list"):e.cmds=t)}static SetCmdPackList(e,t){t instanceof Array&&(e.hasOwnProperty("cmds")?console.error("Error: conflict with sub-command list"):e.cmdPacks=t)}static InitCommonInfo(){return{g:0,m:!1,s:null}}static UpdateCommonInfo(e,t,i,s){e.g=t??0,e.m=i??!1,e.s=s??null}static AcrossSpeed(e,t,i){return{type:"acrossSpeed",params:{Xspeed:e,Yspeed:t,multiTimes:i.m,groupType:i.g,actionCheckCount:0}}}static OnNexusEvent(e,t,i){return{type:"onNexusEvent",params:{nexusId:e,eventType:t,multiTimes:i.m,groupType:i.g}}}static OnHitBlock(e,t){return{type:"onHitBlock",params:{GID:e,multiTimes:t.m,groupType:t.g,actionCheckCount:0}}}static OnNextTick(e,t){return{type:"onNextTick",params:{gap:e,multiTimes:t.m,groupType:t.g,actionCheckCount:0}}}static OnDragStart(e,t){return{type:"onDragStart",params:{multiTimes:e.m,groupType:e.g}}}static OnDragEnd(e,t){return{type:"onDragEnd",params:{multiTimes:e.m,groupType:e.g}}}static OnTouchDown(e,t){return{type:"onDragDown",params:{multiTimes:e.m,groupType:e.g}}}static OnTouchRelease(e,t){return{type:"onDragRelease",params:{multiTimes:e.m,groupType:e.g}}}static OnFlingStart(e,t){return{type:"onFlingStart",params:{multiTimes:e.m,groupType:e.g}}}static OnFlingProgress(e,t){return{type:"onFlingProgress",params:{multiTimes:e.m,groupType:e.g}}}static OnFlingEnd(e,t){return{type:"onFlingEnd",params:{multiTimes:e.m,groupType:e.g}}}static BoxPosition(e,t,i,s,n){return{type:"boxPosition",params:{multiTimes:n.m,groupType:n.g}}}};const $i=[];let Ui=[];const ji=new Map,Xi=()=>{if(Ui.length>0){let e=[];for(let t=0;t<Ui.length;t++)e.push(Ui[t]);Ui=[];for(const[e,t]of ji)for(let e=0;e<t.length;e++)0==t[e].available&&t.splice(e,1);for(const[e,t]of ji)0==t.length&&ji.delete(e);for(let t=0;t<e.length;t++){const i=ji.get(e[t].params.nexusEventId);for(let s=0;s<i.length;s++){let n=i[s].conditionItem.actions;i[s].conditionItem.params.eventType==e[t].params.eventType&&i[s].animationItem.doCommandInner(n)}}}};F.sRenderBridge.RegisterPerFrameCallback((()=>{for(let e=0;e<$i.length;e++)$i[e].animationRef.Invoking()}));const zi=(e,t,i,s)=>{var n=(t.y-e.y)*(s.x-i.x)-(e.x-t.x)*(i.y-s.y);if(0==n)return!1;var r=((t.x-e.x)*(s.x-i.x)*(i.y-e.y)+(t.y-e.y)*(s.x-i.x)*e.x-(s.y-i.y)*(t.x-e.x)*i.x)/n,a=-((t.y-e.y)*(s.y-i.y)*(i.x-e.x)+(t.x-e.x)*(s.y-i.y)*e.y-(s.x-i.x)*(t.y-e.y)*i.y)/n;return(r-e.x)*(r-t.x)<=0&&(a-e.y)*(a-t.y)<=0&&(r-i.x)*(r-s.x)<=0&&(a-i.y)*(a-s.y)<=0&&{x:r,y:a}};function Ki(e,t,i,s,n){return"Vertical"==n?!(e.y>s.y||t.y<i.y):"Horizontal"==n?!(e.x>s.x||t.x<i.x):void 0}F.FreeMoveAnimation=class extends F.AnimationDelegate{constructor(e){super(),this.targetElement=null,this.position={x:0,y:0},this.style={top:0,left:0},this.acc={accX:0,accY:0},this.speed={speedX:0,speedY:0},this.prevSpeed={speedX:0,speedY:0},this.Echo=[],this._EchoCallbackFunc=e,this.Invoking=this.Invoking.bind(this),this.recordCount=0,this.sweepCount=0,this.timerConditionList=[],this.speedConditionList=[],this.positionConditionList=[],this.envBlockConditionList=[],this.nexusEventList=[],this.envPosition={x:void 0,y:void 0},this.prePosition={x:void 0,y:void 0},this.realPosition={x:void 0,y:void 0},this.realStartPosition={x:void 0,y:void 0}}Start(e){super.Start(e),this.targetElement=e.Element,this.style.left=0,this.style.top=0,this.realStartPosition.x=this.targetElement.getBoundingClientRect().x,this.realStartPosition.y=this.targetElement.getBoundingClientRect().y,this.differenceX=this.realStartPosition.x-this.style.left,this.differenceY=this.realStartPosition.y-this.style.top,$i.push({animationRef:this})}Cancel(){super.Cancel();for(let e=0;e<$i.length;e++)$i[e].animationRef==this&&$i.splice(e,1)}conditionDeal(e){let t=[];for(let i=0;i<e.length;i++)t.push(e[i]);for(let e=0;e<t.length;e++)if(this.testOneCondition(t[e])&&0==t[e].params.multiTimes){if(0==t[e].params.actionCheckCount){t[e].params.actionCheckCount=this.sweepCount;const i=t[e].actions.filter((e=>null!==e));0==t[e].checked&&(t[e].checked=!0,this.doCommandInner(i))}}else if(this.testOneCondition(t[e])&&1==t[e].params.multiTimes){t[e].params.actionCheckCount=this.sweepCount;const i=t[e].actions.filter((e=>null!==e));t[e].checked=!0,this.doCommandInner([{type:"delActionAssocCondition",params:{}}]),this.doCommandInner(i)}}Invoking(){this.realPosition.x=this.targetElement.getBoundingClientRect().x,this.realPosition.y=this.targetElement.getBoundingClientRect().y,this.conditionDeal(this.timerConditionList),this.prevSpeed.speedX=this.speed.speedX,this.prevSpeed.speedY=this.speed.speedY,this.prePosition.x=this.position.x,this.prePosition.y=this.position.y,this.speed.speedX+=this.acc.accX,this.speed.speedY+=this.acc.accY,this.position.y+=this.speed.speedY,this.position.x+=this.speed.speedX,this.conditionDeal(this.speedConditionList);do{Xi()}while(Ui.length>0);if(this.conditionDeal(this.positionConditionList),this.envBlockConditionList.length>0){this.conditionDeal(this.envBlockConditionList);do{Xi()}while(Ui.length>0);if(this.prePosition.x+this.speed.speedX!==this.position.x||this.prePosition.y+this.speed.speedY!==this.position.y){do{Xi()}while(Ui.length>0);this.conditionDeal(this.positionConditionList)}}if(this.targetElement.style.top=this.position.y+"px",this.targetElement.style.left=this.position.x+"px",this.Echo.length>0){let e={retList:this.Echo,xSpd:this.speed.speedX,ySpd:this.speed.speedY,xAcc:this.acc.accX,yAcc:this.acc.accY,xPos:this.position.x,yPos:this.position.y};this._EchoCallbackFunc(JSON.stringify(e)),this.Echo=[]}this.sweepCount++}ParsePackageList(e){let t=[];if(!e)return t;for(let i of e)switch(i.t){case 1:for(let e=0;e<i.cmds.length;e++)t.push({type:i.cmds[e].type,params:i.cmds[e].params});t.unshift({type:"FreshState",params:{spd:i.spdxye,acc:i.accxye}});break;case 2:const e={type:i.cmd.type,params:i.cmd.params};t.push(e)}return t}doCommand(e){const t=this.ParsePackageList(e);this.doCommandInner(t)}doCommandInner(e){for(let t of e)switch(t.type){case"setSpeed":this.setSpeed(t);break;case"setAccel":this.setAcc(t);break;case"stop":this.stopMoving();break;case"newCondition":this.newCondition(t);break;case"FreshState":this.FreshState(t);break;case"setOffset":this.setOffset(t);break;case"callback":t.params();break;case"fireEcho":this.EchoPush(t);break;case"delActionAssocCondition":this.clearGroupTypeCondition();break;case"removeAllCondtions":this.RemoveAllCondtions();break;case"jumpTo":this.jumpToPositon(t);break;case"setArrowSpeed":this.setArrowSpeed(t);break;case"stopExtract":this.stopExtract(t);break;case"fireNexusEvent":this.FireNexusEvent(t);case"breakToPos":this.breakToPos(t);break;case"teleportTo":this.teleportTo(t);break;case"teleportOffset":this.teleportOffset(t);break;case"revertWithHitBlock":this.revertWithHitBlock(t);break;case"removeByGroup":this.removeByGroup(t);break;default:console.error("item的type格式错误",t.type)}e=[]}testOneCondition(e){let t=!1;switch(e.type){case"Position":t=this.checkPosition(e);break;case"Speed":t=this.checkSpeed(e);break;case"acrossPosition":t=this.checkAcrossPosition(e);break;case"acrossSpeed":t=this.checkAcrossSpeed(e);break;case"onNextTick":t=this.onNextTick(e);break;case"onHitBlock":t=this.onHitBlock(e);break;case"boxPosition":t=this.onBoxPostion(e);break;default:console.log("未设定的item类型",e)}return t}FreshState(e){let t=e.params.spd,i=e.params.acc;switch(t){case 1:this.speed.speedY=0;break;case 2:this.speed.speedX=0;break;case 0:this.speed.speedY=0,this.speed.speedX=0}switch(i){case 1:this.acc.accY=0;break;case 2:this.acc.accX=0;break;case 0:this.acc.accY=0,this.acc.accX=0}}setSpeed(e){isNaN(e.params.Xspeed)||(this.speed.speedX=e.params.Xspeed),isNaN(e.params.Yspeed)||(this.speed.speedY=e.params.Yspeed)}setAcc(e){isNaN(e.params.Xacc)||(this.acc.accX=e.params.Xacc),isNaN(e.params.Yacc)||(this.acc.accY=e.params.Yacc)}teleportTo(e){const{targetX:t,targetY:i,boolean:s}=e.params;if(s){const t={params:{offsetX:e.params.targetX,offsetY:e.params.targetY}};this.teleportOffset(t)}else isNaN(t)||(this.targetElement.style.left=`${parseInt(this.style.left)+t}px`,this.position.x=t),isNaN(i)||(this.targetElement.style.top=`${parseInt(this.style.top)+i}px`,this.position.y=i)}teleportOffset(e){const{offsetX:t,offsetY:i}=e.params;isNaN(t)?this.position.x=parseInt(this.targetElement.style.left):(this.targetElement.style.left=`${parseInt(this.position.x)+t}px`,this.position.x+=t),isNaN(i)?this.position.y=parseInt(this.targetElement.style.top):(this.targetElement.style.top=`${parseInt(this.position.y)+i}px`,this.position.y+=i)}setArrowSpeed(e){const{arrowTargetX:t,arrowTargetY:i,absSpeedX:s,absSpeedY:n}=e.params;this.position.x>t&&(this.speed.speedX=-1*s),this.position.x<t&&(this.speed.speedX=1*s),this.position.y>i&&(this.speed.speedY=-1*n),this.position.y<i&&(this.speed.speedY=1*n),t&&i&&s&&null==n&&(this.speed.speedY=this.speed.speedX/(t/i)),t&&i&&null==s&&n&&(this.speed.speedX=this.speed.speedY/(i/t))}jumpToPositon(e){const{xPos:t,yPos:i}=e.params;this.position.x=t,this.targetElement.style.left=`${parseInt(this.style.left)+t}px`,this.position.y=i,this.targetElement.style.top=`${parseInt(this.style.top)+i}px`}RemoveAllCondtions(){if(this.timerConditionList=[],this.speedConditionList=[],this.positionConditionList=[],this.nexusEventList.length>0)for(let e=0;e<this.nexusEventList.length;e++)if(ji.get(this.nexusEventList[e].params.nexusId)){const t=ji.get(this.nexusEventList[e].params.nexusId);for(let i=0;i<t.length;i++)t[i].conditionItem.params.eventType==this.nexusEventList[e].params.eventType&&(t[i].available=!1)}}EchoPush(e){const{msg:t}=e.params;return this.Echo.push({rbTkn:0,eTkn:t}),!0}checkPosition(e){const t=e.params.x,i=e.params.y,s=this.acc.accX,n=this.acc.accY,r=this.speed.speedX,a=this.speed.speedY,o=this.position.x,l=this.position.y;if(void 0!==i){const e=i+this.differenceY;if(n>0){if(a>0){if(l>=i)return!0}else if(a<0)if(e<this.realStartPosition.y){if(l<=i)return!0}else if(l>=i)return!0}else{if(!(n<0))return a>0?l>=i:a<0?l<=i:l==i;if(a<0){if(l<=i)return!0}else if(a>0)if(e>this.realStartPosition.y){if(l>=i)return!0}else if(l<=i)return!0}}if(void 0!==t){const e=t+this.differenceX;if(s>0){if(r>0){if(o>=t)return!0}else if(r<0)if(e<this.realStartPosition.x){if(o<=t)return!0}else if(o>=t)return!0}else{if(!(s<0))return r>0?o>=t:r<0?o<=t:o==t;if(r<0){if(o<=t)return!0}else if(r>0)if(e>this.realStartPosition.x){if(o>=t)return!0}else if(o<=t)return!0}}}checkSpeed(e){const{Xspeed:t,Yspeed:i}=e.params;if(void 0!==t)if(this.acc.accX>0){if(this.speed.speedX>=t)return this.speed.speedX=t,!0}else if(this.acc.accX<0){if(this.speed.speedX<=t)return this.speed.speedX=t,!0}else if(this.speed.speedX==t)return!0;if(void 0!==i)if(this.acc.accY>0){if(this.speed.speedY>=i)return this.speed.speedY=i,!0}else if(this.acc.accY<0){if(this.speed.speedY<=i)return this.speed.speedY=i,!0}else if(this.speed.speedY==i)return!0}checkAcrossPosition(e){const t=e.params.x,i=e.params.y,s=this.position.x,n=this.position.y;return 0===this.counter&&t&&s===t&&i&&n===i?(this.counter++,!1):this.checkPosition(e)}checkAcrossSpeed(e){const{Xspeed:t,Yspeed:i}=e.params;return void 0!==t&&null!==this.prevSpeed.speedX&&(this.prevSpeed.speedX<t&&this.speed.speedX>=t||this.speed.speedX>t&&this.speed.speedX<=t)||void 0!==i&&null!==this.prevSpeed.speedY&&(this.prevSpeed.speedY<i&&this.speed.speedY>=i||this.speed.speedY>i&&this.speed.speedY<=i)}newCondition(e){let t,i=e.params.conditionSet;i.cmdPacks?t=this.ParsePackageList(i.cmdPacks):i.cmds&&(t=i.cmds);let s={type:i.type,params:i.params,actions:t,checked:!1};s.actions.some((e=>!(!e||"stopExtract"!==e.type)&&(e.params=s.params,!0))),"onNexusEvent"===s.type?(this.nexusEventList.push(s),ji.get(s.params.nexusId)||ji.set(s.params.nexusId,[]),ji.get(s.params.nexusId).push({conditionItem:s,animationItem:this,available:!0})):s.type.includes("Speed")?this.speedConditionList.push(s):s.type.includes("Position")?this.testOneCondition(s)?this.doCommandInner(s.actions):this.positionConditionList.push(s):"onNextTick"===s.type?(this.recordCount=this.sweepCount,this.timerConditionList.push(s)):"onHitBlock"===s.type?this.envBlockConditionList.push(s):"onDragDown"===s.type||"onDragEnd"===s.type||"onDragRelease"===s.type||"onFlingStart"===s.type||"onFlingEnd"===s.type||"onFlingProgress"===s.type||"onTouchDown"===s.type||"onTouchRelease"===s.type||console.log("未被收录的条件类型",s)}setOffset(e){const{xOffset:t,yOffset:i}=e.params;isNaN(t)||(this.targetElement.style.left=`${parseInt(this.position.x)+t}px`,this.position.x=parseInt(this.position.x)+t),isNaN(i)||(this.targetElement.style.top=`${parseInt(this.position.y)+i}px`,this.position.y=parseInt(this.position.y)+i)}stopMoving(){this.acc.accX=0,this.acc.accY=0,this.speed.speedX=0,this.speed.speedY=0}stopExtract(e){this.acc.accX=0,this.acc.accY=0,this.speed.speedX=0,this.speed.speedY=0,Math.abs(this.position.x-e.params.x)<Math.abs(this.position.y-e.params.y)||e.params.x&&null==e.params.y?(this.position.x=e.params.x,this.targetElement.style.left=`${this.style.left+e.params.x}px`,this.targetElement.style.top=`${this.style.top+this.position.y}px`,this.style.left=parseInt(this.targetElement.style.left),this.style.top=parseInt(this.targetElement.style.top)):Math.abs(this.position.x-e.params.x)>Math.abs(this.position.y-e.params.y)||e.params.y&&null==e.params.x?(this.position.y=e.params.y,this.targetElement.style.top=`${this.style.top+e.params.y}px`,this.targetElement.style.left=`${this.style.left+this.position.x}px`,this.style.top=parseInt(this.targetElement.style.top),this.style.left=parseInt(this.targetElement.style.left)):Math.abs(this.position.x-e.params.x)==Math.abs(this.position.y-e.params.y)&&(this.position.x=e.params.x,this.position.y=e.params.y,this.targetElement.style.left=`${this.style.left+e.params.x}px`,this.targetElement.style.top=`${this.style.top+e.params.y}px`,this.style.left=parseInt(this.targetElement.style.left),this.style.top=parseInt(this.targetElement.style.top))}FireNexusEvent(e){Ui.push(e)}onNextTick(e){return e.params.gap+this.recordCount==this.sweepCount}breakToPos(e){const{targetX:t,targetY:i}=e.params;if(t&&null==i){let e=2*(t-this.position.x)/this.speed.speedX+1;this.acc.accX=-this.speed.speedX/e}if(i&&null==t){let e=2*(i-this.position.y)/this.speed.speedY+1;this.acc.accY=-this.speed.speedY/e}if(t&&i){const e=t-this.position.x,s=i-this.position.y;let n=2*e/this.speed.speedX+1;this.acc.accX=-this.speed.speedX/n;let r=2*s/this.speed.speedY+1;this.acc.accY=-this.speed.speedY/r}const s={type:"newCondition",params:{conditionSet:{params:{x:t,y:i,groupType:10,multiTimes:!1},type:"Position",cmds:[{params:{groupType:10,multiTimes:!1,x:t,y:i},type:"stopExtract"}]}}};this.newCondition(s)}clearGroupTypeCondition(){this.timerConditionList.forEach(((e,t)=>{10===e.params.groupType&&this.timerConditionList.splice(t,1)})),this.speedConditionList.forEach(((e,t)=>{10===e.params.groupType&&this.speedConditionList.splice(t,1)})),this.positionConditionList.forEach(((e,t)=>{10===e.params.groupType&&this.positionConditionList.splice(t,1)})),this.nexusEventList.forEach(((e,t)=>{10===e.params.groupType&&this.nexusEventList.splice(t,1)}))}onHitBlock(e){let t=!1,i=li.getSensor(e.params.GID);const s=parseInt(this.targetElement.style.width),n=parseInt(this.targetElement.style.height),r=this.differenceX,a=this.differenceY,o=this.prePosition.x+r,l=this.prePosition.y+a,h=this.position.x+r,c=this.position.y+a;return i.forEach(((e,i)=>{if("left"==e.direction){const i={x:o+s,y:l+n},u={x:h+s,y:c+n};let d=zi({x:o+s,y:l},{x:h+s,y:c},{x:e.start.x,y:0},{x:e.end.x,y:1080}),g=zi(i,u,{x:e.start.x,y:0},{x:e.end.x,y:1080});!1!==d&&!1!==g&&Ki(e.start,e.end,d,g,"Vertical")&&(this.envPosition.x=d.x-s-r,this.envPosition.y=d.y-a,t=!0)}else if("top"==e.direction){const i={x:o+s,y:l+n},u={x:h+s,y:c+n};let d=zi({x:o,y:l+n},{x:h,y:c+n},{x:0,y:e.start.y},{x:1920,y:e.end.y}),g=zi(i,u,{x:0,y:e.start.y},{x:1920,y:e.end.y});!1!==d&&!1!==g&&Ki(e.start,e.end,d,g,"Horizontal")&&(this.envPosition.x=d.x-r,this.envPosition.y=d.y-n-a,t=!0)}else if("right"===e.direction){const i={x:o,y:l+n},s={x:h,y:c+n};let u=zi({x:o,y:l},{x:h,y:c},{x:e.start.x,y:0},{x:e.end.x,y:1080}),d=zi(i,s,{x:e.start.x,y:0},{x:e.end.x,y:1080});!1!==u&&!1!==d&&Ki(e.start,e.end,u,d,"Vertical")&&(this.envPosition.x=u.x-r,this.envPosition.y=u.y-a,t=!0)}else if("bottom"===e.direction){const i={x:o+s,y:l},n={x:h+s,y:c};let u=zi({x:o,y:l},{x:h,y:c},{x:0,y:e.start.y},{x:1920,y:e.end.y}),d=zi(i,n,{x:0,y:e.start.y},{x:1920,y:e.end.y});!1!==u&&!1!==d&&Ki(e.start,e.end,u,d,"Horizontal")&&(this.envPosition.x=u.x-r,this.envPosition.y=u.y-a,t=!0)}})),t}onBoxPostion(e){return!1}revertWithHitBlock(){this.position.x=this.envPosition.x,this.position.y=this.envPosition.y}removeByGroup(e){const t=e.params.groupType;this.timerConditionList.length>0&&this.timerConditionList.forEach(((e,i)=>{e.params.groupType==t&&this.timerConditionList.splice(i,1)})),this.speedConditionList.length>0&&this.speedConditionList.forEach(((e,i)=>{e.params.groupType==t&&this.speedConditionList.splice(i,1)})),this.positionConditionList.length>0&&this.positionConditionList.forEach(((e,i)=>{e.params.groupType==t&&this.positionConditionList.splice(i,1)}))}},F.FreeMoveActEvtType={ActEvent_ActFinish:1,ActEvent_Speed_X_Revert:2,ActEvent_Speed_Y_Revert:3};F.FreeMoveStateBuilder=class{static FireEcho(e){return{type:"fireEcho",params:{msg:e}}}static FireNexusEvent(e,t){return isNaN(e)||0==e?null:{type:"fireNexusEvent",params:{nexusEventId:isNaN(t)?0:t,eventType:e}}}static NewCondition(e){return{type:"newCondition",params:{conditionSet:e}}}static DelActionAssocCondition(){return{type:"delActionAssocCondition"}}static SetOffsetPos(e,t){return{type:"setOffset",params:{xOffset:e,yOffset:t}}}static SetPos(e,t){return{type:"jumpTo",params:{xPos:e,yPos:t}}}static RemoveAllCondtions(){return{type:"removeAllCondtions"}}static RevertWithHitBlock(){return{type:"revertWithHitBlock"}}static RemoveByGroup(e){return{type:"removeByGroup",params:{groupType:e}}}static SetHitWallOverflow(){return{type:"setHitWallOverflow"}}static TouchLockSwitch(e,t,i=-1){return{typ:"touchLockSwitch",set:{il:e,dir:t,ut:i}}}},y.sParticleManager=At,y.AnimationListener=Ke,y.TranslateAnimation=ct,y.RotateAnimation=ut,y.ScaleAnimation=dt,y.TranslateFrameAnimation=gt,y.ThrowAnimation=ft,y.AnimationEnable=mt,y.TextureSetting=Ee,y.ExternalTextureSetting=be,y.DragInfo=Le,y.DragSetting=Pe;let Ji=Tt;y.sRenderBridge=Ji;{let Is=[];function As(){if(Is.length>0){for(let e of Is)e.DoAttachToElement();Is=[]}}Ji.AddAfterSwapListener("NewDomView",(()=>{As()}));class Ps extends Fe{constructor(e,t){super(null,"jsv-element-proxy"),this.ProxiedView=null,this._DomNativeId=e,this._UseMaskView=t,this.DelayedCalls=[],this._OnReadyCallbacks=[],Is.push(this)}DoAttachToElement(){let e=y.DomElementGetter?.(this._DomNativeId);if(e){this.ProxiedView=e?.getElementView(this._UseMaskView),this.InvokeDelayCalls();for(const e of this._OnReadyCallbacks)e();this._OnReadyCallbacks=null}else console.log("domProxyView: attached element removed id="+this._DomNativeId)}RegisterOnProxyReady(e){this.ProxiedView?e():"function"==typeof e&&this._OnReadyCallbacks.push(e)}PushDelayCalls(e,t){this.DelayedCalls.push({name:e,args:t})}InvokeDelayCalls(){if(this.DelayedCalls.length>0)for(let e of this.DelayedCalls)this.ProxiedView[e.name].apply(this.ProxiedView,e.args)}HtmlCanAccessElement(){return null!=this.ProxiedView}}function Ls(e,t){let i=new Ps(e,t);return new Proxy(i,{get(e,t){if("string"!=typeof t||t.startsWith("_"))return e[t];if(null!=e.ProxiedView)return void 0!==e.ProxiedView[t]?"function"==typeof e.ProxiedView[t]?e.ProxiedView[t].bind(e.ProxiedView):e.ProxiedView[t]:Reflect.get(e,t);if("function"==typeof e[t]){if("RegisterOnProxyReady"===t)return e[t].bind(e);{let i=e;return(...e)=>{i.PushDelayCalls(t,e),y.sRenderBridge.RequestSwap()}}}console.warn(`proxy not ready to get prop(${t})`)},set(e,t){console.warn("no support set prop")}})}y.NewDomProxyView=Ls}y.LayoutView=class extends Fe{ResetTexture(e){e?super.ResetTexture(e.Texture,e.MaskSetting?.ImageTexture):super.ResetTexture(null)}AddView(e,t){let i=0,s=0,n=0,r=0;t&&(t instanceof y.LayoutParams?(i=t.MarginLeft,s=t.MarginTop,n=t.Width,r=t.Height):(i=isNaN(t.x)?0:t.x,s=isNaN(t.y)?0:t.y,n=isNaN(t.width)?0:t.width,r=isNaN(t.height)?0:t.height)),super.AddView(e,i,s,n,r)}},y.FilterView=Be,y.EditControlView=Ge,y.DragSetting=Pe,y.DragInfo=Le;y.TextureManager=class extends ge{RegisterLoadImageCallback(e,t,i){return super.RegisterLoadImageCallback(((e,s)=>{t({width:e,height:s},i)}))}},y.sViewStore=je,y.ViewInfo=Xe,y.ViewMask=Ce,y.ViewTextureMask=Ie,y.ViewRoundCornerMask=Ae;{class ks{constructor(e,t){this.OnBeginContact=e,this.OnEndContact=t}UpdateImpactCallback(e){this.OnBeginContact=e}UpdateLeaveCallback(e){this.OnEndContact=e}}y.sImpactSensorManager={StartTrace:(e,t,i,s)=>new ei(e,t,i,s),Callback:ks,AutoFroze:ti}}y.ImpactAutoFroze=ti,y.ImpactSensor=ei,y.VisibleSensor=oi,y.TextInputType=He;const qi=window.ForgeFront,Zi=Object.keys(qi);for(let Rs of Zi)Rs in y||(y[Rs]=qi[Rs]);export{y as default};
|
|
2
2
|
|