@shijiu/jsview 1.9.872 → 1.9.874

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- /* eslint-disable */ void 0===window.Forge&&(window.Forge={});var e=window.Forge;class t{static _isUndefined(e,t){let s=void 0===t;return s&&console.error(e+" property is undefined!"),s}static _isUndefinedOrNumber(e,s){return!!t._isUndefined(e,s)||"number"==typeof s}static _keyframesCheck(e,s){t._isUndefined(e,s)||s.indexOf("transform")<0&&s.indexOf("opacity")<0&&console.error("keyframes property is only support transform and opacity, value:",s)}static _objectFit(e,s){if(t._isUndefined(e,s))return;const i="fill contain cover none scale-down";i.indexOf(s)<0&&console.error(" objectFit is only support one of string["+i+"]")}static _clipPathCheck(e,s){t._isUndefined(e,s)||s.startsWith("inset")||console.error("clipPath property is support inset only.")}static _transitionOtherCheck(e,s){t._isUndefined(e,s)||console.error(e+" property is not support, you can use transition property, e.g. transition='width 2s'")}static _transitionCheck(e,s){t._isUndefined(e,s)}static _transformCheck(e,s){t._isUndefined(e,s)||s.length>0&&s.indexOf("translate3d")<0&&s.indexOf("scale3d")<0&&s.indexOf("rotate3d")<0&&s.indexOf("skew")<0&&console.error("transform property's value only support translate3d、scale3d、rotate3d、skew, value:",s)}static _transformOriginCheck(e,s){t._isUndefined(e,s)||s.length>0&&s.indexOf("%")<0&&s.indexOf("left")<0&&s.indexOf("center")<0&&s.indexOf("top")<0&&s.indexOf("right")<0&&s.indexOf("bottom")<0&&console.error("transformOrigin property's value only support XX%、left、top、right, bottom:",s)}static _textOverflowCheck(e,s){if(!t._isUndefined(e,s))switch(s){case"clip":case"ellipsis":break;default:console.error("textOverflow property's value is not support, value:",s)}}static _whiteSpaceCheck(e,s){if(!t._isUndefined(e,s))switch(s){case"normal":case"nowrap":case"pre-wrap":break;default:console.error("whiteSpace property's value is not support, value:",s)}}static _textAlignCheck(e,s){if(!t._isUndefined(e,s))switch(s){case"left":case"right":case"center":case"start":case"end":break;default:console.error("textAlign property's value is not support, value:",s)}}static _lineHeightCheck(e,s){if(!t._isUndefinedOrNumber(e,s))switch(s){case"normal":case"inherit":console.error("lineHeight property's value is support number only, value:",s);break;default:s.indexOf("%")>=0&&console.error("lineHeight property's value is support number only, value:",s)}}static _colorCheck(e,s){t._isUndefined(e,s)||t._checkColorFormat("Color()",s)}static _visibilityCheck(e,s){t._isUndefined(e,s)||"visible"!==s&&"hidden"!==s&&"inherit"!==s&&console.error("visibility property's value is not support, value:",s)}static _displayCheck(e,s){t._isUndefined(e,s)||"block"!==s&&"inline"!==s&&"none"!==s&&"inline-block"!==s&&"inherit"!==s&&""!==s&&console.error("display property's value is not support, value:",s)}static _overflowCheck(e,s){t._isUndefined(e,s)||"visible"!==s&&"hidden"!==s&&console.error("overflow property's value is support visible or hidden only, value:",s)}static _topCheck(e,s){if(!t._isUndefinedOrNumber(e,s))switch(s){case"auto":case"inherit":console.error("top property's value is support number only, value:",s);break;default:s.indexOf("%")>=0&&console.error("top property's value is support number only, value:",s)}}static _leftCheck(e,s){if(!t._isUndefinedOrNumber(e,s))switch(s){case"auto":case"inherit":console.error("left property's value is support number only, value:",s);break;default:s.indexOf("%")>=0&&console.error("left property's value is support number only, value:",s)}}static _heightCheck(e,s){if(!t._isUndefinedOrNumber(e,s))switch(s){case"auto":case"inherit":console.error("height property's value is support number only, value:",s);break;default:s.indexOf("%")>=0&&console.error("height property's value is support number only, value:",s)}}static _widthCheck(e,s){if(!t._isUndefinedOrNumber(e,s))switch(s){case"auto":case"inherit":console.error("width property's value is support number only, value:",s);break;default:s.indexOf("%")>=0&&console.error("width property's value is support number only, value:",s)}}static _backfaceVisibility(e,s){if(!t._isUndefined(e,s))switch(s){case"visible":case"hidden":break;default:console.error("backfaceVisibility property's value is support visible/hidden only, value: ",s)}}static _perspectiveCheck(e,s){t._isUndefined(e,s)}static _WebkitTextStroke(e,s){if(t._isUndefined(e,s))return;s.split(" ").length<2&&console.error("Error: WebkitTextStroke should format of(width color) such as: '1px rgba(255,255,255,1.0)'")}static _zIndexCheck(e,s){t._isUndefined(e,s)||isNaN(s)&&console.error("zIndex property's value is support number only, value: ",s)}static _fontSizeCheck(e,s){if(!t._isUndefined(e,s)&&"number"!=typeof s)switch(s){case"smaller":case"larger":case"inherit":case"x-small":case"xx-small":case"small":case"large":case"medium":case"x-large":case"xx-large":console.error("fontSize property's value is support number only, value:",s);break;default:s.indexOf("%")>=0&&console.error("fontSize property's value is support number only, value:",s)}}static _fontWeightCheck(e,s){t._isUndefined(e,s)||"bold"!==s&&console.error("fontWeight property's value is support bold only, value:",s)}static _fontStyleCheck(e,s){t._isUndefined(e,s)||"italic"!==s&&console.error("fontWeight property's value is support italic only, value:",s)}static _borderRadiusCheck(e,s){if(t._isUndefined(e,s))return;s.split(" ").length>4&&console.error("borderRadius property's value is not support, value:",s)}static _borderImageWidthCheck(e,s){t._isUndefinedOrNumber(e,s)}static _borderImageOutsetCheck(e,s){if(t._isUndefined(e,s))return;s.split(" ").length>4&&console.error("borderImageOutsetCheck property's value is not support, value:",s)}static _borderImageCheck(e,s){t._isUndefined(e,s)||s.indexOf("fill")<0&&console.error("borderImage property's value is not contain fill, e.g. source slice, but value:",s)}static _backgroundOtherCheck(e,t){console.error(e+" property not support, you can use backgroundImage property, e.g. backgroundImage=`url(${iconImgPath})`")}static _backgroundImageCheck(e,s){t._isUndefined(e,s)||"inherit"==s&&console.error("backgroundImage property's value is not support, value:",s)}static _backgroundColorCheck(e,s){if(!t._isUndefined(e,s))return t._checkColorFormat("backgroundColor",s)}static _animationCheck(e,t){}static _animationOtherNotSupport(e,t){console.error(e+" property is not support, you can use animation property, e.g. animation='mymove 5s infinite'")}static _transformStyleCheck(e,s){if(!t._isUndefined(e,s))switch(s){case"flat":case"preserve-3d":break;default:console.error("transformStyle property value is not valid",s)}}static _perspectiveOriginCheck(e,s){t._isUndefined(e,s)||s.length>0&&s.indexOf("%")<0&&s.indexOf("left")<0&&s.indexOf("center")<0&&s.indexOf("top")<0&&s.indexOf("right")<0&&s.indexOf("bottom")<0&&console.error("perspectiveOrigin property's value only support XX%、left、top、right, bottom:",s)}static _textShadowCheck(e,s){if(!t._isUndefined(e,s)&&s.length>0){if(s.replace(/\(.*\)/g,"").split(",").length>1)return void console.error("textShadow: NOT support more than one part settings");const e=s.split(" ");if(4!==e.length&&(5!==e.length||0!==e[4].length)||isNaN(parseInt(e[0]))||isNaN(parseInt(e[1])))console.error('textShadow: format should be "offsetX offsetY blurSize color"(0 0 1 rgba(100,100,100,1)), !NOT space in rgba()');else{if(!(parseFloat(e[2])>0))return void console.error(`textShadow: blur shadow above 0(now=${s})`);if(!t._checkColorFormat("textShadow",e[3]))return}}}static _checkColorFormat(e,t){if(0===t.indexOf("rgba(")||0===t.indexOf("rgb("));else{if(0!==t.indexOf("#"))return console.error(`${e} color value is not valid, need startwith rgba or #, value:[${t}]`),!1;if(7!==t.length)return console.error(`${e} color value's length is not valid, value:${t}`),!1}return!0}static _directionCheck(e,t){return"rtl"===t&&"ltr"===t||(console.error(`${e} direction value is not valid, need rtl or ltr, value:[${t}]`),!1)}static _JsvVideoRotationCheck(e,t){return!isNaN(parseInt(t))||(console.error(`${e} value is not valid, value:${t}`),!1)}static get(e){return t.ValidStyleMap[e]}}t.ValidStyleMap={animation:{check:t._animationCheck},animationName:{check:t._animationOtherNotSupport},animationDuration:{check:t._animationOtherNotSupport},animationTimingFunction:{check:t._animationOtherNotSupport},animationDelay:{check:t._animationOtherNotSupport},animationIterationCount:{check:t._animationOtherNotSupport},animationDirection:{check:t._animationOtherNotSupport},animationPlayState:{check:t._animationOtherNotSupport},animationFillMode:{check:t._animationOtherNotSupport},background:{check:t._backgroundOtherCheck},backgroundColor:{check:t._backgroundColorCheck},backgroundImage:{check:t._backgroundImageCheck},borderImage:{check:t._borderImageCheck},borderImageOutset:{check:t._borderImageOutsetCheck},borderImageWidth:{check:t._borderImageWidthCheck},borderRadius:{check:t._borderRadiusCheck},height:{check:t._heightCheck},width:{check:t._widthCheck},zIndex:{check:t._zIndexCheck},fontFamily:{check:null},fontSize:{check:t._fontSizeCheck},fontStyle:{check:t._fontStyleCheck},fontWeight:{check:t._fontWeightCheck},left:{check:t._leftCheck},overflow:{check:t._overflowCheck},top:{check:t._topCheck},visibility:{check:t._visibilityCheck},display:{check:t._displayCheck},color:{check:t._colorCheck},lineHeight:{check:t._lineHeightCheck},textAlign:{check:t._textAlignCheck},whiteSpace:{check:t._whiteSpaceCheck},textOverflow:{check:t._textOverflowCheck},transform:{check:t._transformCheck},transformOrigin:{check:t._transformOriginCheck},transition:{check:t._transitionCheck},transitionProperty:{check:t._transitionOtherCheck},transitionDuration:{check:t._transitionOtherCheck},transitionTimingFunction:{check:t._transitionOtherCheck},transitionDelay:{check:t._transitionOtherCheck},clipPath:{check:t._clipPathCheck},keyframes:{check:t._keyframesCheck},objectFit:{check:t._objectFit},perspective:{check:t._perspectiveCheck},backfaceVisibility:{check:t._backfaceVisibility},transformStyle:{check:t._transformStyleCheck},perspectiveOrigin:{check:t._perspectiveCheck},WebkitTextStroke:{check:t._WebkitTextStroke},textShadow:{check:t._textShadowCheck},JsvVideoRotation:{check:t._JsvVideoRotationCheck},direction:{check:t._directionCheck}},console.log("Using JsView HTML Hook"),window.originDocument={},window.originDocument.headAppendChild=window.document.head.appendChild.bind(window.document.head),window.originDocument.headRemoveChild=window.document.head.removeChild.bind(window.document.head),window.originDocument.createElement=window.document.createElement.bind(window.document),window.originDocument.createTextNode=window.document.createTextNode.bind(window.document),window.originDocument.createComment=window.document.createComment.bind(window.document),window.originDocument.getElementById=window.document.getElementById.bind(window.document),window.originDocument.getElementsByTagName=window.document.getElementsByTagName.bind(window.document),window.originDocument.querySelector=window.document.querySelector.bind(window.document),window.originDocument.createEvent=window.document.createEvent.bind(window.document),window.originDocument.dispatchEvent=window.document.dispatchEvent.bind(window.document),async function(){const{Document:s,ForgeExtension:i,JsvLazySyncCache:n,Log:r}=await Promise.resolve().then((function(){return q})),o=new s;window.myHook=o,window.document.head.appendChild=o.head.appendChild.bind(o.head),window.document.head.removeChild=o.head.removeChild.bind(o.head),window.document.createElement=o.createElement.bind(o),window.document.createTextNode=o.createTextNode.bind(o),window.document.createComment=o.createComment.bind(o),window.document.getElementById=o.getElementById.bind(o),window.document.getElementsByTagName=o.getElementsByTagName.bind(o),window.document.querySelector=o.querySelector.bind(o),window.document.createEvent=o.createEvent.bind(o),window.document.dispatchEvent=o.dispatchEvent.bind(o),window.document.jsvInitFDivRoot=o.jsvInitFDivRoot.bind(o),window.document.jsvGetFDivRoot=o.jsvGetFDivRoot.bind(o),window.document.jsvAppendStyleSheet=function(e){let t=window.originDocument.createElement("style");t.type="text/css",t.innerHTML=e.jsvTextContent,this.getElementsByTagName("Head")[0].appendChild(t)},window.document.jsvGetKeyFrames=function(e,t){let s="";var i=document.styleSheets;for(let t=0;t<i.length;++t){const n=i[t];if(n.cssRules)for(let t=0;t<n.cssRules.length;++t){let i=n.cssRules[t];if(i&&i.name===e){s=i.cssText;break}}}if(!s){const i=window.JsvCode.Dom.StyleSheets;for(const n of t){if(s=i[`${e}-${n.replace("data-v-","")}`],s){document.jsvAppendStyleSheet({jsvTextContent:s});break}}s||(s=i[e],s&&document.jsvAppendStyleSheet({jsvTextContent:s}))}return s&&document.jsvCheckStyleFormat&&document.jsvCheckStyleFormat("keyframes",s),s};let a=window.navigator.userAgent.toLowerCase();window.jsvInAndroidWebView=a.indexOf("android")>=0,window.jsvInAndroidWebView?window.document.jsvCheckStyleFormat=null:window.document.jsvCheckStyleFormat=function(e,s){if(e.startsWith("--"))return;let i=t.get(e);i?i.check&&s&&i.check(e,s):console.error(e+" property is not support.")},i.TextureManager=new e.TextureManager,i.RootView=new e.RootView,o.jsvUpdateRootElement(i.RootView),e.sRenderBridge.AddWillSwapListener("forgeSwap",(()=>{n.SyncAllCachedProperty(),i.ClearUnusedTexSize()})),window.jsvIsBrowserDebug=!0,window.document.jsvAppendStyleSheet({jsvTextContent:"\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 "})}();class s{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")){let t=e.indexOf("(")+1,s=e.lastIndexOf(")");if("undefined"===(e=e.substring(t,s).trim())||"null"===e||0===e.length)return}if(!0===e.startsWith("data:"))return void(this.href=e);let s=e.indexOf("://");if(!(s<0||s>10)||e.startsWith("./")||e.startsWith("/")||(e="./"+e),!0===e.startsWith("/"))e=document.location.origin+e;else if((!0===e.startsWith("./")||!0===e.startsWith("../"))&&void 0!==window.JsView&&void 0!==window.JsView.Dom.JsSubPath){if(void 0===window.JsView.Dom.__MainPath||"undefined"===window.JsView.Dom.__MainPathRef||window.JsView.Dom.__MainPathRef!==document.location.href){window.JsView.Dom.JsSubPath.startsWith("/")||(window.JsView.Dom.JsSubPath="/"+window.JsView.Dom.JsSubPath),window.JsView.Dom.JsSubPath.endsWith("/")||(window.JsView.Dom.JsSubPath=window.JsView.Dom.JsSubPath+"/"),window.JsView.Dom.__MainPathRef=document.location.href;let e=document.location.pathname.lastIndexOf(window.JsView.Dom.JsSubPath);window.JsView.Dom.__MainPath=document.location.origin+document.location.pathname.substring(0,e)+"/"}let t=window.JsView.Dom.__MainPath;e=e.startsWith("./")?t+e.substring(2):t+e}if(this.href=e,!t)return;let i=this.href,n=i.indexOf("#");n>0&&(this.hash=i.substring(n),i=i.substring(0,n));let r=i.indexOf("?");r>1&&(this.search=i.substring(r),i=i.substring(0,r));let o=i,a=o.indexOf("://");this.protocol=a>0?o.substring(0,a+1):"";let l=a>1?o.substring(a+3):"";if(a=l.indexOf("/"),this.host=a>0?l.substring(0,a):"",this.pathname=a>1?l.substring(a):"",this.origin=a>0?this.protocol+"//"+this.host:"",this.host.startsWith("[")){let e=this.host.indexOf("]");this.hostname=this.host.substring(0,e+1),e=this.host.substring(e+1).indexOf(":"),this.port=e>1?this.host.substring(e+1):""}else{let e=this.host.indexOf(":");this.hostname=e>0?this.host.substring(0,e):this.host,this.port=e>1?this.host.substring(e+1):""}}replace(e){this.href=e}}window.JsView&&window.JsView.registerUriConverter?.((e=>new s(e,!1).href));class i{static SetBackgroundColor(t,s,n){const r=i.TextureManager.GetColorTextureCached(s);let o;n&&(o=new e.ViewRoundCornerMask(n.topLeft,n.topRight,n.bottomLeft,n.bottomRight));const a=new e.ExternalTextureSetting(r,o);t.ResetTexture(a)}static SetBackgroundImage(t,n,r,o,a,l,h){let c,d={};if("string"==typeof n){const e=new s(n);if(e instanceof s==!1)throw Error("Bad Argument.",e);d.url=e.href}else"linear-gradient"==n?.type&&(d.gradient=n);if(d.gradient)if(d.gradient.colors?.length>2){const e=d.gradient.colors,t=[e[0],e[e.length-1]],s=e.slice(1,e.length-1);c=i.TextureManager.CreateLinearGradientTexture(t,s)}else 2==d.gradient.colors?.length?c=i.TextureManager.CreateMiniGradientTexture(!0,d.gradient.colors[0],d.gradient.colors[1],d.gradient.rawValue):console.warn("Failed to create backgroundImage gradient, bad colors.",d.gradient.colors);else d.url&&(c=d.url.includes(".gif")||d.url.includes(".webp")?i.TextureManager.GetGifImage(d.url,!1,null,h):i.TextureManager.GetImage2(d.url,!1,a,l||e.ColorSpace.RGBA_8888));if(c){let s;r&&(s=new e.ViewRoundCornerMask(r.topLeft,r.topRight,r.bottomLeft,r.bottomRight));const i=new e.ExternalTextureSetting(c,s);if(t.ResetTexture(i),o){let e=c.RegisterLoadImageCallback(null,(function(){o({width:c.Width,height:c.Height})}));t.RegisterDetachCallback((()=>{c.UnregisterLoadImageCallback(e)}))}}}static SetMaskedBackgroundImage(t,n,r,o){if("string"==typeof n&&(n=new s(n)),n instanceof s==!1)throw Error("Bad Argument.",n);if("string"==typeof r&&(r=new s(r)),r instanceof s==!1)throw Error("Bad Argument(MaskURL).",r);const a=i.TextureManager.GetImage2(n.href,!1,null,o||e.ColorSpace.RGBA_8888);if(a){const s=i.TextureManager.GetImage2(r.href,!1,null,e.ColorSpace.RGBA_8888),n=new e.ExternalTextureSetting(a,new e.ViewTextureMask(s));t.ResetTexture(n)}}static SetVideoTexture(t,s,n){const r=i.TextureManager.GetColorTexture(s);let o;n&&(o=new e.ViewRoundCornerMask(n.topLeft,n.topRight,n.bottomLeft,n.bottomRight));const a=new e.TextureSetting(r,o);t.ResetTexture(a)}static GetTextWidth(t){return t.str||(t.str=""),t.font||(t.font=e.TextUtils._sDefaultFont),t.size||(t.size=e.TextUtils._sDefaultFontSize),"italic"!==t.italic&&(t.italic=""),"bold"!==t.bold&&(t.bold=""),window.PlatformUtils.GetTextWidth(t)}static RequestSwap(){e.sRenderBridge.RequestSwap()}static SetImgTexSize(e,t){let s={size:t,refNum:0};i.TextureInfo.Cache[e.Source]=s}static RefImgTexSize(e,t){let s=i.TextureInfo.Cache[e.Source];s?(s.refNum>0?s.refNum++:s.refNum=1,t(s.size)):e.RegisterLoadImageCallback(null,(function(){const s={width:e.Width,height:e.Height};t(s);let n=i.TextureInfo.Cache[e.Source];if(n)n.refNum>0?n.refNum++:n.refNum=1;else{let t={size:s,refNum:1};i.TextureInfo.Cache[e.Source]=t}}))}static UnrefImgTexSize(e){if(!e)return;let t=i.TextureInfo.Cache[e.Source];t&&(t.refNum--,t.refNum<=0&&i.TextureInfo.Unused.add(e.Source))}static ClearUnusedTexSize(){for(let e of i.TextureInfo.Unused){let t=i.TextureInfo.Cache[e];t.refNum<-2?(delete i.TextureInfo.Cache[e],i.TextureInfo.Unused.delete(e)):t.refNum<=0?t.refNum--:i.TextureInfo.Unused.delete(e)}}}i.TextureInfo={Cache:{},Unused:new Set},i.TextureManager=null,i.RootView=null,i.RootActivity=null,i.HaltKeyEvent=!1;class n{constructor(e){this.target=null,this.timeStamp=Date.now(),this.type=e}initEvent(e,t,s){this.type=e}}class r extends n{constructor(e){super(e),this.keyCode=-1,this.key=-1,this.repeat=0}static JsvGetKeyFromCode(e){return new Map([[r.KeyCode.Enter,r.Key.Enter],[r.KeyCode.ArrowUp,r.Key.ArrowUp],[r.KeyCode.ArrowDown,r.Key.ArrowDown],[r.KeyCode.ArrowLeft,r.Key.ArrowLeft],[r.KeyCode.ArrowRight,r.Key.ArrowRight]])[e]}}r.Type={KEYDOWN:"keydown",KEYUP:"keyup"},r.Key={Enter:"Enter",ArrowUp:"ArrowUp",ArrowDown:"ArrowDown",ArrowLeft:"ArrowLeft",ArrowRight:"ArrowRight"},r.KeyCode={Enter:13,ArrowUp:38,ArrowDown:40,ArrowLeft:37,ArrowRight:39};let o={cnt:0};class a{constructor(e){this.type=e,this.cachedValues=null,this.onSyncCallback=null}setOnSyncCallback(e){this.onSyncCallback=e,this.syncLastCaches(!0)}setCacheProperty(e,t){this.cachedValues||(this.cachedValues={}),this.cachedValues[e]=t,this.syncLastCaches(!1),i.RequestSwap()}syncLastCaches(e){let t=a.LastModified[this.type];if((e||t!==this)&&(a.LastModified[this.type]=this,t&&t.cachedValues&&"function"==typeof t.onSyncCallback)){let e=t.cachedValues;t.cachedValues=null,t.onSyncCallback(e)}}static SyncAllCachedProperty(){for(let e of Object.values(a.LastModified))e.syncLastCaches(!0);o.cnt=(o.cnt+1)%65535}}a.LastModified={};class l{constructor(t){this.activity=new e.ReactActivity("JsViewForgeActivity",t,this.OnKeyDown.bind(this),this.OnKeyUp.bind(this)),this._Init()}_Init(){console.log("JsViewForgeActivity.OnCreate()."),i.TextureManager=this.activity.GetTextureManager(),i.RootView=new e.LayoutView,i.RootActivity=this.activity,document.jsvUpdateRootElement(i.RootView);let t=null;e.DesignMap&&(t=e.DesignMap());let s=t?t.width:1280,n=Math.floor(9*s/16);this.activity.SetContentView(i.RootView,{x:0,y:0,width:s,height:n}),e.sRenderBridge.AddWillSwapListener("forgeSwap",(()=>{a.SyncAllCachedProperty(),i.ClearUnusedTexSize()})),window.JsView.Dom.Render()}OnKeyDown(e){if(i.HaltKeyEvent){let t=new r(r.Type.KEYDOWN);return t.keyCode=e.keyCode,t.repeat=e.repeat,document.dispatchEvent(t),!0}return!1}OnKeyUp(e){if(i.HaltKeyEvent){let t=new r(r.Type.KEYUP);return t.keyCode=e.keyCode,t.key=r.JsvGetKeyFromCode(t.keyCode),t.repeat=e.repeat,document.dispatchEvent(t),!0}return!1}}window.JsView&&(window.JsView.Dom={DesignMap:null,Render:null,Extension:i,UrlRef:s},window.JsView.React=window.JsView.Dom);class h{static SetLevel(e){switch(h.E=h.W=h.I=h.D=function(){},e){case h.Level.Verbose:h.V=console.debug.bind(console);case h.Level.Debug:h.D=console.debug.bind(console);case h.Level.Info:h.I=console.info.bind(console)}}static Throw(...e){throw console.error(...e),[...e]}}h.E=console.error.bind(console),h.W=console.warn.bind(console),h.I=console.info.bind(console),h.D=function(){},h.V=function(){},h.Level={Error:0,Warning:1,Info:2,Debug:3,Verbose:4};class c{constructor(e){this.ownerDocument=window.document,this.nodeType=e,this.parentNode=void 0,this.childNodes=[],this.jsvEventListener=void 0,this.jsvChildChangedCallback=void 0}jsvGetTagName(){return"Unknown"}appendChild(e){this.childNodes.push(e),e.parentNode=this,this.jsvChildChangedCallback?.()}moveChild(e,t,s){let i=this.childNodes.indexOf(e);i<0&&h.Throw("Failed to call Node.removeChild(), node not found. node=",e),this.childNodes.splice(i,1),e.parentNode=void 0,this.jsvChildChangedCallback?.(),t._insertBeforeInner(e,s)}removeChild(e){for(let t=e.childNodes.length-1;t>=0;t--)e.removeChild(e.childNodes[t]);let t=this.childNodes.indexOf(e);t<0&&h.Throw("Failed to call Node.removeChild(), node not found. node=",e),this.childNodes.splice(t,1),e.parentNode=void 0,this.jsvChildChangedCallback?.()}insertBefore(e,t){this._insertBeforeInner(e,t)}_insertBeforeInner(e,t){let s=this.childNodes.length;void 0===t?h.Throw("TypeError: Failed to execute 'insertBefore' on 'Node': 2 arguments required, but only 1 present."):null!==t&&(s=this.childNodes.indexOf(t)),s<0&&h.Throw("Failed to call Node.insertBefore(), before node not found. beforeNode=",t),this.childNodes.splice(s,0,e),e.parentNode=this,this.jsvChildChangedCallback?.()}get previousSibling(){const e=this.parentNode.childNodes;let t=e.indexOf(this);return t<0&&h.Throw("Failed to call Node.previousSibling(), this node not found. this=",this),e[t-1]}get nextSibling(){const e=this.parentNode.childNodes;let t=e.indexOf(this);return t<0&&h.Throw("Failed to call Node.nextSibling(), this node not found. this=",this),e[t+1]}addEventListener(e,t,s){this.jsvEventListener||(this.jsvEventListener={});let i=this.jsvEventListener[e];i||(i=new Set,this.jsvEventListener[e]=i),i.add(t)}removeEventListener(e,t,s){if(!this.jsvEventListener)return;let i=this.jsvEventListener[e];i&&(i.delete(t),i.size<=0&&this.jsvEventListener.hasOwnProperty(e)&&delete this.jsvEventListener[e],0===Object.values(this.jsvEventListener).length&&(this.jsvEventListener=void 0))}dispatchEvent(e){let t=this.jsvEventListener?.[e.type];if(t){e.target||(e.target=document.activeElement);for(let s of t)s(e)}else this.parentNode?this.parentNode.dispatchEvent(e):console.warn("Node.dispatchEvent() Ignore to dispatch event: "+e.type+". No listener added.")}jsvObserveChildChanged(e){this.jsvChildChangedCallback=e}}c.ELEMENT_NODE=1,c.TEXT_NODE=3,c.COMMENT_NODE=8,c.DOCUMENT_NODE=9,c.NOLAYOUT_NODE=10;class d extends n{}d.Type={FOCUS:"focus",BLUR:"blur"};class u extends n{stopPropagation(){}}class v{static ConvertInt(e){return e?"number"==typeof e?Math.floor(e):"string"==typeof e?parseInt(e):e:e}static ConvertFloat(e){if(!e)return e;if("string"!=typeof e)return e;return parseFloat(e)}static ConvertPx(e){if(!e)return e;if("string"!=typeof e)return e;if("0"===e)return 0;if(e.endsWith("px")){return parseInt(e)}return e}static ConvertRect(e){let t=v.SplitString(e," "),s={top:t.length>0?parseInt(t[0]):0,right:t.length>1?parseInt(t[1]):null,bottom:t.length>2?parseInt(t[2]):null,left:t.length>3?parseInt(t[3]):null};return s.right=s.right||0===s.right?s.right:s.top,s.bottom=s.bottom||0===s.bottom?s.bottom:s.top,s.left=s.left||0===s.left?s.left:s.right,s}static ConvertCorner(e){let t=v.SplitString(e," "),s={topLeft:t.length>0?parseInt(t[0]):0,topRight:t.length>1?parseInt(t[1]):null,bottomRight:t.length>2?parseInt(t[2]):null,bottomLeft:t.length>3?parseInt(t[3]):null};return s.topRight=s.topRight||0===s.topRight?s.topRight:s.topLeft,s.bottomRight=s.bottomRight||0===s.bottomRight?s.bottomRight:s.topLeft,s.bottomLeft=s.bottomLeft||0===s.bottomLeft?s.bottomLeft:s.bottomRight,s}static ConvertSize(e){let t=v.SplitString(e," "),s={width:t.length>0?parseInt(t[0]):0,height:t.length>1?parseInt(t[1]):null};return s.height=s.height||0===s.height?s.height:s.width,s}static ConvertAnimation(e){if(null===e||0===e.length)return null;let t=e.indexOf("cubic-bezier"),s=[];if(t>=0){let i=e.indexOf(")"),n=e.substring(t,i+1),r=v.SplitString(e,n);for(let e of r){let t=v.SplitString(e," ");s=s.concat(t)}s.push(n)}else s=v.SplitString(e," ");let i=null,n=0,r=1,o=e.includes("alternate");for(let e=2;e<s.length;e++){if("infinite"===s[e]){r=-1;continue}let t=v.ConvertTimeMs(s[e]);!1===isNaN(t)?n=t:(t=parseFloat(s[e]),!1===isNaN(t)?r=t:i=s[e])}let a=s.length>1?v.ConvertTimeMs(s[1]):0;return{name:s.length>0?s[0]:"",duration:a,timingFunction:v.ConvertEasing(i,a),delay:n,iterationCount:r,direction:o,originStr:e}}static ConvertTransition(e){if(null==e||0==e.length)return null;let t={},s=new Array,i=e.split(",");for(let e=0;e<i.length;e++)if(i[e].indexOf("(")>=0){let t=e;for(;t<i.length&&i[t].indexOf(")")<0;)t++;let n="";for(let s=e;s<=t;s++)s!=e&&(n+=","),n+=i[s];e=t,s=s.concat(n)}else s=s.concat(i[e]);for(let e of s){let s=v.ConvertAnimation(e);if(t[s.name]=s,"all"==s.name){let e=new Array("opacity","left","top","width","height","transform");for(let i of e)t[i]=s}}return t}static ConvertTimeMs(e){e||(e="");let t=NaN;return(e=e.trim()).endsWith("ms")?t=1:e.endsWith("s")&&(t=1e3),t*=parseFloat(e),t}static ConvertEasing(t,s){let i=e.Easing.Circular.InOut;if(!t)return i;if(t.includes("ease"))i=t.includes("-in-out")?e.Easing.Circular.InOut:t.includes("-out")?e.Easing.Circular.Out:t.includes("-in")?e.Easing.Circular.In:e.Easing.Circular.InOut;else if(t.includes("linear"))i=null;else if(t.includes("cubic-bezier")){let n=v.ConvertBezier(t);i=new e.BezierEasing(n.x1,n.y1,n.x2,n.y2,s)}else if(t.includes("steps")){let s=v.ConvertSteps(t);i=new e.StepsEasing(s.steps,s.type)}return i}static ConvertBezier(e){let t=e.indexOf("(");t>=0&&(e=e.substring(t+1));let s=v.SplitString(e,",");return{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}}static ConvertSteps(e){let t=e.indexOf("(");t>=0&&(e=e.substring(t+1));let s=v.SplitString(e,",");return{steps:s.length>0?parseInt(s[0]):1,type:s.length>1?s[1].includes("start")?0:1:0}}static ConvertOverflow(e,t){return e&&!e.includes("visible")?t.HIDDEN:t.VISIBLE}static ConvertObjectFit(e,t){return"symbol"==typeof e?e:(e||(e=""),e.includes("fill")?t.FILL:e.includes("contain")?t.CONTAIN:e.includes("cover")?t.COVER:e.includes("none")?t.NONE:e.includes("scale-down")?t.SCALEDOWN:t.CONTAIN)}static ConvertGradient(e){if(e||(e=""),!(e=e.trim()).startsWith("linear-gradient")&&!e.startsWith("radial-gradient"))return e;let t={rawValue:e},s=e.replace(/.*?\((.*)\)/,"$1"),i=v.SplitStringOutsideParentheses(s,",");if(e.startsWith("linear-gradient")){if(i[0]?.startsWith("to ")||i[0]?.endsWith("deg"))throw i=i.slice(1),new Error("linear-gradient direction or angle is not supported.");i.length<2?console.error("linear-gradient colors is invalid."):(t.type="linear-gradient",t.colors=i)}else if(e.startsWith("radial-gradient"))throw new Error("radial-gradient is not supported.");return t}static SplitString(e,t){e||(e="");let s=e.trim().split(t);if(" "!==t)return s;let i=[];for(let e of s)e&&i.push(e);return i}static SplitStringOutsideParentheses(e,t){let s=[],i=e.split(t);for(let e=0;e<i.length;e++)if(i[e].indexOf("(")>=0){let n=e;for(;n<i.length&&i[n].indexOf(")")<0;)n++;let r="";for(let s=e;s<=n;s++)s!=e&&(r+=t),r+=i[s];e=n,s=s.concat(r.trim())}else s=s.concat(i[e].trim());return s}}class p{constructor(e){if(this.top=null,this.right=null,this.bottom=null,this.left=null,!e||!1===e.startsWith("inset"))return void console.error("Inset.Parse() InvalidArgs: value=",e);let t=e.indexOf("(")+1,s=e.substring(t),i=v.ConvertRect(s);this.top=i.top,this.right=i.right,this.bottom=i.bottom,this.left=i.left}}class g{constructor(e){if(this.source=null,this.slice=null,this.repeat=null,this.outset=null,this.width=null,!e)return void console.error("BorderImage.constructor() InvalidArgs: value=",e);let t=e.indexOf(")")+1,i=e.substring(0,t),n=e.substring(t);this.source=new s(i),this.slice=v.ConvertRect(n)}}class w{constructor(){this.refStyleObject=new Map,this.value=void 0}static AppendRefStyle(e,t,s){let i=w.jsvGetStyleVar(e);i.refStyleObject.has(t)||i.refStyleObject.set(t,[]),i.refStyleObject.get(t).push(s)}static RemoveRefStyle(e){for(const t of w.VariableMap.values())for(const s of t.refStyleObject.keys())s==e&&t.refStyleObject.delete(e)}static UpdateValue(e,t){let s=w.jsvGetStyleVar(e);s.value=t;for(const[e,t]of s.refStyleObject)for(const s of t)e.jsvSetClassProperty(s)}static GetValue(e){return w.jsvGetStyleVar(e).value}static jsvGetStyleVar(e){e.startsWith("--")&&(e=`var(${e})`),w.VariableMap.has(e)||w.VariableMap.set(e,new w);return w.VariableMap.get(e)}}w.VariableMap=new Map;class f{constructor(){this.jsvStore={},this.jsvLazySyncCache=new a("style"),this.jsvLockedProps={},this.jsvNamedClassArray=null,this.jsvCustomStyles={},this.jsvLazyPrevClassNames=null,this.jsvLazyPrevInheritedClassNames=null,this.jsvLazyClassNames=null,this.jsvLazyInheritedClassNames=null,this.jsvLazyClassAttributes=null}setProperty(e,t){"function"==typeof document.jsvCheckStyleFormat&&document.jsvCheckStyleFormat(e,t),this.jsvLockedProps[e]=!0,t=f.JsvConvertPropValue(e,t),this.jsvUpdateProperty(e,t)}getPropertyValue(e){if(void 0!==this.jsvStore[e])return this.jsvStore[e];let t=this.jsvGetClassPropValue(this.jsvLazyClassNames,this.jsvLazyClassAttributes,e);return t?(e==f.PROP.ANIMATION?t=v.ConvertAnimation(t):e==f.PROP.TRANSITION&&(t=v.ConvertTransition(t)),e==f.PROP.BACKGROUNDIMAGE&&(t=v.ConvertGradient(t)),t):(t=this.jsvGetClassPropValue(this.jsvLazyInheritedClassNames,this.jsvLazyClassAttributes,e),t?(e==f.PROP.ANIMATION?t=v.ConvertAnimation(t):e==f.PROP.TRANSITION&&(t=v.ConvertTransition(t)),e==f.PROP.BACKGROUNDIMAGE&&(t=v.ConvertGradient(t)),t):void 0)}jsvDestory(){w.RemoveRefStyle(this)}jsvUpdateProperty(e,t){let s=this.jsvSetPropertySilently(e,t);s&&this.jsvLazySyncCache.setCacheProperty(s,!0)}jsvSetPropertySilently(e,t){if(e.startsWith("--"))return void w.UpdateValue(e,t);if("string"==typeof t&&t.startsWith("var(--"))return void w.AppendRefStyle(t,this,e);if("animation"===e){if(this.jsvStore[e]?.originStr===t?.originStr)return null}else if(this.jsvStore[e]===t)return null;return this.jsvStore[e]=t,f.JsvGetStyleType(e)}jsvApplyClasses(t,s){if(t)if(t.indexOf("JsvStyle_")<0){s?(this.jsvLazyPrevInheritedClassNames=this.jsvLazyInheritedClassNames,this.jsvLazyInheritedClassNames=t.split(" ")):(this.jsvLazyPrevClassNames=this.jsvLazyClassNames,this.jsvLazyClassNames=t.split(" "));const e=f.TYPE.CLASS_NAME;this.jsvLazySyncCache.setCacheProperty(e,!0)}else if(t){let s=t.split(" "),i={};this.jsvNamedClassArray=new Array(s.length);let n=0;for(let t of s){let s=null;if(e.ReactUtils.StyleClassMap.hasOwnProperty(t)){s=e.ReactUtils.StyleClassMap[t];let n=s.getAttach();if(null==n){let e=s.getStyles();n={altStyles:{},hasTextMajorStyle:0,textPackAttr:null};for(let t in e)n.altStyles[t]=f.JsvConvertPropValue(t,e[t]);s.updateAttach(n)}"text"===s.classType()&&(n.hasTextMajorStyle=2,null===n.textPackAttr&&(n.textPackAttr={textLineAlign:s.getLineAlign(),textVerticalAlign:s.getVerticalAlign()}),this.jsvCustomStyles.textLineAlign=n.textPackAttr.textLineAlign,this.jsvCustomStyles.textVerticalAlign=n.textPackAttr.textVerticalAlign),Object.assign(i,n.altStyles)}else console.error("Error: className not found");this.jsvNamedClassArray[n]=s,n++}for(let e in i)this.jsvLockedProps[e]||this.jsvUpdateProperty(e,i[e])}}jsvAppendClassAttribute(e){this.jsvLazyClassAttributes||(this.jsvLazyClassAttributes=new Set),this.jsvLazyClassAttributes.add(e);const t=f.TYPE.CLASS_NAME;this.jsvLazySyncCache.setCacheProperty(t,!0)}jsvSetClassProperty(e){let t=f.JsvGetStyleType(e);t&&this.jsvLazySyncCache.setCacheProperty(t,!0)}jsvGetClassPropValue(e,t,s){if(!e)return;const i=(e,t,s,i)=>{for(let n=t.length-1;n>=0;n--){let r=t[n];if(s&&(r+="["+s+"]"),!e.hasOwnProperty(r))continue;const o=e[r];if(!o.hasOwnProperty(i))continue;let a=o[i];return"string"==typeof a&&a.startsWith("var(--")&&(a=w.GetValue(a)),a}},n=window.JsvCode.Dom.StyleSheets;for(const r of t??[]){const t=i(n,e,r,s);if(t)return t}return i(n,e,null,s)}jsvGetClassDeclarations(e,t){if(!e)return;const s=(e,t,s)=>{let i={};for(let n=0;n<t.length;n++){let r=t[n];if(s&&(r+="["+s+"]"),!e.hasOwnProperty(r))continue;const o=e[r];Object.assign(i,o)}return i},i=window.JsvCode.Dom.StyleSheets;let n=s(i,e,null);for(const r of t??[]){const t=s(i,e,r);Object.assign(n,t)}return n}jsvUpdateChangedClasses(e,t,s){h.D("jsvGetChangedClassTypes() classNames="+e);let i={};if(t){w.RemoveRefStyle(this);const e=this.jsvGetClassDeclarations(t,s);for(const t of Object.keys(e)){i[f.JsvGetStyleType(t)]=!0}t=null}if(e){const t=this.jsvGetClassDeclarations(e,s);for(const[e,s]of Object.entries(t)){i[f.JsvGetStyleType(e)]=!0,"string"==typeof s&&s.startsWith("var(--")&&w.AppendRefStyle(s,this,e)}}return i}jsvSetChangedListener(e){let t=null;e&&(t=t=>{if(t.hasOwnProperty(f.TYPE.CLASS_NAME)){let e=this.jsvUpdateChangedClasses(this.jsvLazyClassNames,this.jsvLazyPrevClassNames,this.jsvLazyClassAttributes);Object.assign(t,e),e=this.jsvUpdateChangedClasses(this.jsvLazyInheritedClassNames,this.jsvLazyPrevInheritedClassNames,this.jsvLazyClassAttributes),Object.assign(t,e),t[f.TYPE.CLASS_NAME]=void 0}e(t)}),this.jsvLazySyncCache.setOnSyncCallback(t)}static JsvContainsTextMajor(e){for(let t of f.TextClassMajorStyles)if(e.hasOwnProperty(t))return!0;return!1}static JsvGetStyleType(e){switch(e){case f.PROP.LEFT:case f.PROP.RIGHT:case f.PROP.TOP:case f.PROP.BOTTOM:case f.PROP.ZINDEX:return f.TYPE.LAYOUT_POS;case f.PROP.TRANSFORM:case f.PROP.TRANSFORMORIGIN:return f.TYPE.TRANSFORM;case f.PROP.WIDTH:case f.PROP.HEIGHT:case f.PROP.VISIBILITY:case f.PROP.DISPLAY:case f.PROP.CLIPPATH:case f.PROP.OVERFLOW:case f.PROP.OBJECTFIT:case f.PROP.PERSPECTIVE:case f.PROP.PERSPECTIVEORIGIN:case f.PROP.BACKFACEVISIBILITY:case f.PROP.TRANSFORMSTYLE:case f.PROP.JSVVIDEOROTATION:return f.TYPE.LAYOUT_SIZE;case f.PROP.BACKGROUNDCOLOR:case f.PROP.BACKGROUNDIMAGE:case f.PROP.BORDERRADIUS:return f.TYPE.BACKGROUND;case f.PROP.COLOR:case f.PROP.LINEHEIGHT:case f.PROP.WHITESPACE:case f.PROP.FONTFAMILY:case f.PROP.FONTSIZE:case f.PROP.FONTSTYLE:case f.PROP.FONTWEIGHT:case f.PROP.TEXTALIGN:case f.PROP.TEXTSHADOW:case f.PROP.TEXTOVERFLOW:case f.PROP.WEBKITTEXTSTROKE:case f.PROP.DIRECTION:return f.TYPE.FOREGROUND;case f.PROP.BORDERIMAGE:case f.PROP.BORDERIMAGEWIDTH:case f.PROP.BORDERIMAGEOUTSET:return f.TYPE.BORDER;case f.PROP.ANIMATION:return f.TYPE.ANIMATION;case f.PROP.TRANSITION:return f.TYPE.TRANSITION;case f.PROP.OPACITY:break;default:return console.warn("Unknown style type for: "+e),null}}static JsvConvertPropValue(e,t){if(void 0===t)return t;if(e.startsWith("--")||t?.startsWith?.("var(--"))return t;switch(e){case f.PROP.TOP:case f.PROP.BOTTOM:case f.PROP.LEFT:case f.PROP.RIGHT:case f.PROP.WIDTH:case f.PROP.HEIGHT:case f.PROP.JSVVIDEOROTATION:return v.ConvertInt(t);case f.PROP.VISIBILITY:case f.PROP.DISPLAY:return t.toUpperCase();case f.PROP.OVERFLOW:return v.ConvertOverflow(t,f.Overflow);case f.PROP.OBJECTFIT:return v.ConvertObjectFit(t,f.ObjectFit);case f.PROP.TRANSFORM:case f.PROP.TRANSFORMORIGIN:return t;case f.PROP.CLIPPATH:return new p(t);case f.PROP.BORDERIMAGE:return new g(t);case f.PROP.BORDERIMAGEWIDTH:case f.PROP.BORDERIMAGEOUTSET:return v.ConvertRect(t);case f.PROP.BORDERRADIUS:return v.ConvertCorner(t);case f.PROP.ANIMATION:return v.ConvertAnimation(t);case f.PROP.TRANSITION:return v.ConvertTransition(t);case f.PROP.OPACITY:return v.ConvertFloat(t);case f.PROP.BACKGROUNDIMAGE:return v.ConvertGradient(t);default:return v.ConvertPx(t)}}}f.Overflow={HIDDEN:Symbol("hidden"),VISIBLE:Symbol("visible")},f.ObjectFit={FILL:Symbol("fill"),CONTAIN:Symbol("contain"),COVER:Symbol("cover"),NONE:Symbol("none"),SCALEDOWN:Symbol("scale-down")},f.TextClassMajorStyles=new Set(["textOverflow","wordWrap","textShadow","color","fontFamily","fontStyle","fontWeight","textAlign","WebkitTextStroke","direction"]),f.TYPE={LAYOUT_POS:"layout-position",LAYOUT_SIZE:"layout-size",FOREGROUND:"foreground",BACKGROUND:"background",BORDER:"border",ANIMATION:"animation",TRANSFORM:"transform",TRANSITION:"transition",CLASS_NAME:"class-name"},f.PROP={TOP:"top",BOTTOM:"bottom",LEFT:"left",RIGHT:"right",WIDTH:"width",HEIGHT:"height",VISIBILITY:"visibility",DISPLAY:"display",BACKFACEVISIBILITY:"backfaceVisibility",CLIPPATH:"clipPath",OVERFLOW:"overflow",OBJECTFIT:"objectFit",TRANSFORM:"transform",TRANSFORMORIGIN:"transformOrigin",PERSPECTIVE:"perspective",PERSPECTIVEORIGIN:"perspectiveOrigin",ZINDEX:"zIndex",TRANSFORMSTYLE:"transformStyle",BACKGROUNDCOLOR:"backgroundColor",BACKGROUNDIMAGE:"backgroundImage",BORDERRADIUS:"borderRadius",COLOR:"color",LINEHEIGHT:"lineHeight",WHITESPACE:"whiteSpace",FONTFAMILY:"fontFamily",FONTSIZE:"fontSize",FONTSTYLE:"fontStyle",FONTWEIGHT:"fontWeight",TEXTALIGN:"textAlign",TEXTSHADOW:"textShadow",TEXTOVERFLOW:"textOverflow",WEBKITTEXTSTROKE:"WebkitTextStroke",DIRECTION:"direction",BORDERIMAGE:"borderImage",BORDERIMAGEWIDTH:"borderImageWidth",BORDERIMAGEOUTSET:"borderImageOutset",ANIMATION:"animation",TRANSITION:"transition",OPACITY:"opacity",JSVVIDEOROTATION:"JsvVideoRotation"};for(let e in f.PROP){let t=f.PROP[e];Object.defineProperty(f.prototype,t,{set:function(e){this.setProperty(t,e)},get:function(){return this.getPropertyValue(t)}})}let m=null;class y{static getHandlers(e){const t=y.reactEventHandlers(e);return t||(e._vei?e._vei:{})}static reactEventHandlers(e){return null==m&&y._getReactToken(e),e["__reactProps$"+m]??e["__reactEventHandlers$"+m]}static _getReactToken(e){for(let t in e)if(t.indexOf("__reactProps")>=0||t.indexOf("__reactEventHandlers")>=0||t.indexOf("__reactInternalInstance")>=0){let e=t.indexOf("$");m=t.substring(e+1);break}}}class j extends c{constructor(t){super(c.ELEMENT_NODE),this.parentElement=null,this.tagName=this.jsvGetTagName(),this.tagName===j.TAG.STYLE?(this.style=null,this.jsvMainView=null,this.jsvMaskView=null):(this.style=new f,this.jsvMainView=new e.LayoutView,this.jsvMaskView=null),this.jsvAnimation=null,this.jsvStore={transition:null,transitionTmp:null,textContent:null,textStylePack:null,clientWidth:NaN,clientHeight:NaN,textureWidth:NaN,textureHeight:NaN,scopedAttributes:[]},this.jsvAttrChangedLazySync=null,this.instantSwapCallback=null,this.eventHandlers=null,this.jsvInheritClassDepth=null,this.jsvHasInheritClassChildren=!1}appendChild(e){null!=e.parentNode?this._moveChildNode(e,null):(super.appendChild(e),this.jsvInsertChild(e,null))}removeChild(e){this.jsvRemoveChild(e),super.removeChild(e)}insertBefore(e,t){null!=e.parentNode?this._moveChildNode(e,t):(super.insertBefore(e,t),this.jsvInsertChild(e,t))}_moveChildNode(e,t){let s=e.parentNode;if(s.moveChild(e,this,t),e.jsvMaskView){(s.jsvMaskView?s.jsvMaskView:s.jsvMainView).MoveChildView(e.jsvMaskView,this.jsvMaskView?this.jsvMaskView:this.jsvMainView,t?t.jsvMaskView:null),console.log("moving child")}else console.log("moving not forge child")}get childElementCount(){return this.childNodes.length}get firstElementChild(){return this.childNodes.length>0?this.childNodes[0]:null}get lastElementChild(){const e=this.childNodes.length;return e>0?this.childNodes[e-1]:null}set className(e){this.setAttribute("class",e)}setAttribute(e,t){e&&("style"!==e?(this[e]=t,e.startsWith("data-v-")?this._jsvAppendScopedAttribute(e,0):"class"===e?this._jsvSetClassNames(t,0):"jsv-inherit-class"===e?this._jsvSetInheritClassDepth(parseInt(t)):e.startsWith(j.ATTRIBUTE.JSVPREFIX)?(e=e.replace(/-/g,"_"),this.jsvSetAttrLazySync(e,j.ATTRTYPE.JSV)):window.JsView||"id"!==e||this.jsvMainView.Element&&(this.jsvMainView.Element.id=t)):console.warn("directly style setting be ignored"))}jsvSetAttrLazySync(e,t){this.jsvAttrChangedLazySync||(this.jsvAttrChangedLazySync=new a("lazy-attr"),this.parentElement&&this._jsvSetAttrLazySyncCallback()),this.jsvAttrChangedLazySync.setCacheProperty(e,t)}removeAttribute(e){this[e]=void 0,e.startsWith(j.ATTRIBUTE.JSVPREFIX)&&this.jsvSetAttrLazySync(e,j.ATTRTYPE.JSV)}getAttribute(e){return this[e]}hasAttribute(e){return console.log("Element.hasAttribute() name="+e),!!this[e]}getBoundingClientRect(){return null!=this.jsvMainView?this.jsvMainView.GetBoundingClientRect():Promise.reject(new Error("getBoundingClientRect while jsvMainView is null."))}get clientWidth(){return isNaN(this.jsvStore.clientWidth)?this.style.width:this.jsvStore.clientWidth}get clientHeight(){return isNaN(this.jsvStore.clientHeight)?this.style.height:this.jsvStore.clientHeight}focus(){console.log("Element.focus()"),document.activeElement&&document.activeElement.onfocus();let e=document.activeElement;if(document.activeElement=this,e){let t=new d(d.Type.BLUR);t.target=e,document.dispatchEvent(t)}let t=new d(d.Type.FOCUS);document.dispatchEvent(t)}jsvInsertChild(e,t){if(e.parentElement=this,e.nodeType===c.ELEMENT_NODE&&e.tagName!==j.TAG.STYLE){if(!1===document.jsvIsReady)return void console.warn("Element.appendChild() Failed to append child to Forge. jsvIsReady="+document.jsvIsReady);e.jsvOnLoadForgeView(),e.style.jsvSetChangedListener(e.jsvOnStyleChanged.bind(e)),t=this.jsvBackwardFindForgeView(t);let s=e.jsvMaskView.GetLayoutParams();this.jsvMainView.InsertView(e.jsvMaskView,t?t.jsvMaskView:null,s),(e.jsvInheritClassDepth>0||e.jsvHasInheritClassChildren)&&(this.jsvHasInheritClassChildren=!0)}else e.nodeType===c.TEXT_NODE&&(this.textContent=e.textContent)}jsvGetProxyView(e){return e?this.jsvMaskView:this.jsvMainView}jsvRemoveChild(e){e.parentElement=null,e.jsvAttrChangedLazySync=null,e.style?.jsvSetChangedListener(null),e.style?.jsvDestory(),e.jsvAnimation?.Cancel(),e.jsvAnimation=null,e instanceof j&&this.jsvMainView.RemoveView(e.jsvMaskView)}jsvOnLoadForgeView(){if(this.style.clipPath||this.style.overflow||this.style.objectFit){if(this.jsvMaskView)throw Error("Jsview: jsvMaskView is conflicting.");this.jsvMaskView=new e.ClipView}else this.jsvMaskView||(this.jsvMaskView=this.jsvMainView);this.jsvMaskView!==this.jsvMainView&&this.jsvMaskView.AddView(this.jsvMainView);let t=this.jsvCallbackOnUnloadForgeView();t&&this.jsvMainView.RegisterDetachCallback(t),this._jsvSetAttrLazySyncCallback()}_jsvSetAttrLazySyncCallback(){if(this.jsvAttrChangedLazySync){let e=this;this.jsvAttrChangedLazySync.setOnSyncCallback((t=>{let s=null,i=null;for(let n in t)if(e.hasOwnProperty(n))switch(t[n]){case j.ATTRTYPE.JSV:null==s&&(s={}),s[n]=e[n];break;case j.ATTRTYPE.CSS:null==i&&(i={}),i[n]=e[n]}s&&(s=e.jsvSetElementPropOnMask(s),e.jsvSetElementProp(s)),i&&e.jsvOnAttrLazySync(i)}))}}jsvOnAttrLazySync(e){}jsvSetElementProp(e){this.jsvMainView&&this.jsvMainView.SetElementProp(e,i.RootActivity)}jsvSetElementPropOnMask(e){if(e.hasOwnProperty("jsv_poster_on_top")){let{jsv_poster_on_top:t,...s}=e;return this.jsvMaskView.SetElementProp({jsv_poster_on_top:t},i.RootActivity),s}return e}jsvCallbackOnUnloadForgeView(){return null}jsvOnStyleChanged(e){let t=!!e[f.TYPE.LAYOUT_SIZE],s=!1;e[f.TYPE.LAYOUT_POS]&&(t||(this.jsvFlushViewLayout(),s=!0)),e[f.TYPE.LAYOUT_SIZE]&&(this.jsvFlushViewLayout(),s=!0),e[f.TYPE.TRANSFORM]&&!s&&(this.jsvMaskView.ResetCssTransform(this.style.transform,this.style.transformOrigin),this.jsvFlushViewTransition(),s=!0),e[f.TYPE.BACKGROUND]&&this.jsvFlushViewBackground(),e[f.TYPE.ANIMATION]&&this.jsvFlushViewAnimation(),e[f.TYPE.TRANSITION]&&!s&&this.jsvFlushViewTransition(),this.jsvFlushEventHandlers()}jsvFlushEventHandlers(){null===this.eventHandlers&&(this.eventHandlers=y.getHandlers(this),this.eventHandlers&&this.eventHandlers.onClick&&this.jsvMainView&&this.jsvMainView.EnableDivTouch(this,null))}jsvApplyObjectFit(e){return null}jsvFlushViewLayout(){if((this.style.clipPath||this.style.overflow||this.style.objectFit)&&!this.jsvMaskView)return void console.error("Element.jsvFlushViewLayout() InvalidOpt: clippath=",this.style.clipPath);const t={x:isNaN(this.style.left)?0:this.style.left,y:isNaN(this.style.top)?0:this.style.top,width:isNaN(this.style.width)?0:this.style.width,height:isNaN(this.style.height)?0:this.style.height};let s=null;if(this.style.objectFit&&(s=this.jsvApplyObjectFit(t),this.style.objectFit===f.ObjectFit.FILL&&(s=null)),this.jsvMaskView.ResetCssTransform(this.style.transform,this.style.transformOrigin),this.style.perspective&&this.style.perspective>0){let e=this.style.perspectiveOrigin?this.style.perspectiveOrigin:null;this.jsvMainView.SetPerspective(this.style.perspective,e)}if(this.style.backfaceVisibility&&this.jsvMainView.SetBackfaceVisibility("visible"==this.style.backfaceVisibility),this.style.transformStyle&&this.jsvMainView.SetTransformStyle(this.style.transformStyle),this.jsvMaskView.ResetLayoutParams({x:t.x,y:t.y,width:this.clientWidth,height:this.clientHeight}),this.jsvMaskView!==this.jsvMainView){const e={x:0,y:0,width:this.jsvMaskView.LayoutParams.Width,height:this.jsvMaskView.LayoutParams.Height};this.jsvMainView.ResetLayoutParams(e)}let i=this.style.visibility;"NONE"==this.style.display&&(i="HIDDEN"),this.jsvMaskView.SetVisibility(i);let n=null;null!==s&&window.JsView?n={x:s.x,y:s.y,width:s.width,height:s.height}:this.style.clipPath?n={x:this.style.clipPath.left,y:this.style.clipPath.top,width:this.jsvMaskView.LayoutParams.Width-this.style.clipPath.left-this.style.clipPath.right,height:this.jsvMaskView.LayoutParams.Height-this.style.clipPath.top-this.style.clipPath.bottom}:this.style.overflow===f.Overflow.HIDDEN&&null===this.jsvStore.textContent&&(n={x:0,y:0,width:this.style.width,height:this.style.height}),n?this.jsvMaskView.SetClipRect(n.x,n.y,n.width,n.height,!0):this.jsvMaskView instanceof e.ClipView&&this.jsvMaskView.SetClipRect(0,0,0,0,!1),void 0!==this.style.zIndex&&null!==this.style.zIndex&&this.jsvMaskView.SetZIndex(this.style.zIndex),this.jsvFlushViewTransition()}jsvFlushViewBackground(){this.style.backgroundImage?(this.jsvStore.textureWidth=NaN,this.jsvStore.textureHeight=NaN,i.SetBackgroundImage(this.jsvMainView,this.style.backgroundImage,this.style.borderRadius)):this.style.backgroundColor?(this.jsvStore.textureWidth=NaN,this.jsvStore.textureHeight=NaN,i.SetBackgroundColor(this.jsvMainView,this.style.backgroundColor,this.style.borderRadius)):this.jsvMainView.ResetTexture(null)}jsvFlushViewAnimation(){if(this.jsvAnimation&&this.jsvAnimation.Cancel(),!this.style.animation)return;let t=document.jsvGetKeyFrames(this.style.animation.name,this.jsvStore.scopedAttributes);this.jsvAnimation=new e.CssKeyframeAnimation(t,this.style.animation.duration,this.style.animation.timingFunction,this.style.width?this.style.width:this.clientWidth,this.style.height),this.jsvAnimation.EnableDelay(this.style.animation.delay).SetRepeat(this.style.animation.iterationCount),"forwards"===this.style.animationFillMode&&this.jsvAnimation.Enable(e.AnimationEnable.KeepTransform);var s=this;let i=new e.AnimationListener;i.OnEnd((t=>{if(s.jsvAnimation=null,t){let t=new u("animationend");t.target=s,s.dispatchEvent(t),null==s.instantSwapCallback&&(s.instantSwapCallback=e.sRenderBridge.InstantPerformSwap.bind(e.sRenderBridge)),Promise.resolve().then(s.instantSwapCallback)}})),this.jsvAnimation.Enable(e.AnimationEnable.ReleaseAfterEndCallback),this.jsvAnimation.SetAnimationListener(i),this.jsvMaskView.StartAnimation(this.jsvAnimation)}jsvFlushViewTransition(){if(this.style.animation)return;if(null!=this.jsvStore.transitionTmp&&this.jsvStore.transitionTmp.syncTimes!=o.cnt&&-1!=this.jsvStore.transitionTmp.syncTimes){let e=this.jsvStore.transition;this.jsvStore.transition=this.jsvStore.transitionTmp,this.jsvStore.transitionTmp=e,null!=this.jsvStore.transitionTmp&&(this.jsvStore.transitionTmp.syncTimes=-1)}if(this.style.transition){if(this.jsvStore.transition){if(!this._JsvBuildTransition())return}}else this.jsvAnimation&&(this.jsvAnimation.Cancel(),this.jsvAnimation=null);let e=this.jsvStore.transitionTmp;e||(e={left:0,top:0,width:0,height:0,opacity:1,transform:null,syncTimes:-1}),e.left=this.style.left,e.top=this.style.top,e.width=this.style.width,e.height=this.style.height,e.opacity=this.style.opacity,e.transform=this.style.transform,e.syncTimes=o.cnt,this.jsvStore.transitionTmp=e}_JsvBuildTransition(){let t=[];for(let e in this.style.transition){let s=this.jsvStore.transition[e],i=this.style[e];if(s===i)continue;let n=this.style.transition[e],r={name:e,dur:Math.round(n.duration),tf:null,dly:Math.round(n.delay),from:s||"",to:i};"transform"===e&&(r.origin=this.style.transformOrigin?this.style.transformOrigin:"center center"),n.timingFunction&&(r.tf=n.timingFunction.Package()),t.push(r)}if(t.length<=0)return!1;var s=this;let i=new e.AnimationListener;return i.OnEnd((t=>{if(s.jsvAnimation=null,t){let t=new u("transitionend");t.target=s,s.dispatchEvent(t),null==s.instantSwapCallback&&(s.instantSwapCallback=e.sRenderBridge.InstantPerformSwap.bind(e.sRenderBridge)),Promise.resolve().then(s.instantSwapCallback)}})),this.jsvAnimation=new e.CssTransitionAnimation(t),this.jsvAnimation.SetAnimationListener(i),this.jsvMaskView.StartAnimation(this.jsvAnimation),!0}jsvBackwardFindForgeView(e){let t=e;for(;t&&!(t instanceof j);)t=t.nextSibling;return t}static applyObjectFitCommon(e,t,s){if(s&&!isNaN(e.jsvStore.textureWidth)&&!isNaN(e.jsvStore.textureHeight)){const i=e.style.objectFit,n=s.ApplyObjectFit(t.width,t.height,e.jsvStore.textureWidth,e.jsvStore.textureHeight,i,f.ObjectFit);return 0!==t.width&&0!==t.height||0===t.width&&0===t.height||(e.jsvStore.clientWidth=Math.max(t.width,n.width),e.jsvStore.clientHeight=Math.max(t.height,n.height)),n}return null}_jsvAppendScopedAttribute(e,t){if(0!=t&&this.jsvInheritClassDepth!=t||(this.jsvStore.scopedAttributes.push(e),this.jsvStore.clientWidth=NaN,this.jsvStore.clientHeight=NaN,this.style.jsvAppendClassAttribute(e)),this.jsvHasInheritClassChildren){t=this.jsvInheritClassDepth==t?1:t+1;for(const s of this.childNodes)s.jsvInheritClassDepth<=0&&0==s.jsvHasInheritClassChildren||s instanceof j&&(s.jsvStore.scopedAttributes.includes(e)||s._jsvAppendScopedAttribute(e,t))}}_jsvSetClassNames(e,t){if(0!=t&&this.jsvInheritClassDepth!=t||this.style.jsvApplyClasses(e,this.jsvInheritClassDepth==t),this.jsvHasInheritClassChildren){t=this.jsvInheritClassDepth==t?1:t+1;for(const s of this.childNodes)s.jsvInheritClassDepth<=0&&0==s.jsvHasInheritClassChildren||s instanceof j&&s._jsvSetClassNames(e,t)}}_jsvSetInheritClassDepth(e){if(e<=0)return;this.jsvInheritClassDepth=e;let t=this;for(let s=0;s<e&&(t=t.parentNode,t);s++);if(t){for(const s of t.jsvStore.scopedAttributes)this._jsvAppendScopedAttribute(s,e);this._jsvSetClassNames(t.class,e)}}}j.TAG={DIV:"DIV",IMAGE:"IMAGE",LINK:"LINK",STYLE:"STYLE",AUDIO:"AUDIO",VIDEO:"VIDEO",ANCHOR:"A",SVG:"SVG",FDIV:"FDIV",AUDIOTRACK:"AUDIOTRACK"},j.ATTRIBUTE={SRC:"src",JSVPREFIX:"jsv"},j.ATTRTYPE={JSV:Symbol("jsv"),CSS:Symbol("css")};class C extends j{constructor(){super(),console.warn("Warnig: <a> is fake in JsView system"),this.href="",this.protocol="",this.host="",this.search="",this.hash="",this.hostname="",this.port="",this.pathname=""}jsvGetTagName(){return j.TAG.ANCHOR}}class S extends j{constructor(e){super(),this.jsvMediaView=null,this.jsvMedia=null,this.onVisibilityChange=this.onVisibilityChange.bind(this),this.stopByOnHide=!1,this.playBackground=!1,e&&(this.srcValue=e)}addEventListener(e,t,s){e=e.replace(/-/g,""),super.addEventListener(e,t,s),this.jsvAddMediaListener(e)}jsvOnLoaded(){}set src(e){if(e&&"about:null"!==e&&"about:blank"!==e){e=new s(e).href}this.jsvMedia||this.jsvInit(),e!==this.jsvMedia.src&&(this.jsvMedia.src=e,this.srcValue=e)}jsvOnLoadForgeView(){console.log("MediaElement jsvOnLoadForgeView"),super.jsvOnLoadForgeView(),this.jsvMedia||this.jsvInit(),this.registerOnVisibilityChange()}jsvInit(){let e=this.jsvEventListener;if(e)for(var t in e.keys)this.jsvAddMediaListener(t);Promise.resolve().then((()=>{this.jsvMedia&&this.jsvMedia.confirmInitSetup?.()}))}jsvCallbackOnUnloadForgeView(){return this.jsvOnUnloadForgeView.bind(this)}jsvOnUnloadForgeView(){console.log("MediaElement jsvOnUnloadForgeView"),this.unregisterOnVisibilityChange(),this.jsvMediaView&&(this.jsvMediaView=null),this.jsvRelease()}jsvRelease(){this.jsvMedia&&(this.jsvMedia.pause(),this.jsvMedia.unload&&this.jsvMedia.unload(),this.jsvMedia.releaseResource&&(this.jsvMedia.releaseResource(),this.jsvMedia.onPlatformDestroy())),this.jsvEventListener=void 0}jsvAddMediaListener(e){}onJsViewHide(){this.jsvMedia&&(this.jsvMedia.paused||(this.stopByOnHide=!0),this.jsvMedia.unload())}onJsViewShow(){this.jsvMedia||this.jsvInit(),this.jsvMedia.src=this.srcValue,this.stopByOnHide&&(this.stopByOnHide=!1,this.jsvMedia.play())}onVisibilityChange(e){this.playBackground||("show"===e.status?this.onJsViewShow():"hide"===e.status&&this.onJsViewHide())}registerOnVisibilityChange(){window.JsView&&window.JsView.onVisibilityChange(this.onVisibilityChange)}unregisterOnVisibilityChange(){window.JsView&&window.JsView.removeEventCallback(this.onVisibilityChange)}setAttribute(e,t){"jsv_play_background"!==e?super.setAttribute(e,t):this.playBackground="true"===t}}S.HOOKS={Audio:Audio,Video:window._ExtVideo,OffscreenVideo:window._ExtOVP},S.PROP={SetOnly:["autoplay","loop","timeupdateless","predownload"],GetOnly:["duration","paused"],SetAndGet:["currentTime","muted","playbackRate","preload","volume"],Function:["load","pause","play","unload","confirmInitSetup"]};for(let e in S.PROP){let t=S.PROP[e];for(let s of t){let t={};"SetOnly"!==e&&"SetAndGet"!==e||(t.set=function(e){this.jsvMedia||this.jsvInit(),this.jsvMedia[s]=e}),"GetOnly"!==e&&"SetAndGet"!==e||(t.get=function(){return this.jsvMedia||this.jsvInit(),this.jsvMedia[s]}),"Function"===e&&(t=function(...e){return this.jsvMedia||this.jsvInit(),this.jsvMedia[s]?this.jsvMedia[s](...e):null}),t instanceof Function?S.prototype[s]=t:Object.defineProperty(S.prototype,s,t)}}class O extends S{constructor(e){super(e),this.jsvOverrideMedia=!1,console.log("AudioElement.constructor()",this)}jsvGetTagName(){return j.TAG.AUDIO}jsvInit(){this.jsvOverrideMedia||(this.jsvMedia=new S.HOOKS.Audio),super.jsvInit(),this.jsvOnLoaded()}jsvOnLoaded(){this.jsvMediaView=new e.LayoutView,this.jsvMainView.AddView(this.jsvMediaView)}jsvAddMediaListener(e){this.jsvMedia||this.jsvInit(),this.jsvMedia.addEventListener(e,(()=>{let t=new n(e);t.target=this,this.dispatchEvent(t)}))}jsvRelease(){super.jsvRelease(),this.jsvMedia=null}setAttribute(e,t){if("data-jsv-audio-predownload"==e)return this.jsvMedia||this.jsvInit(),void(this.jsvMedia.predownload=!0);super.setAttribute(e,t)}}class T{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){T._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){T._putPack(this._TempMap,this._TempTrackList,this._TempIdx,e,t),this._TempIdx=(this._TempIdx+1)%this._TempMax}static _putPack(e,t,s,i,n){let r=t[s];r&&(e.delete(r),t[s]=i),e.set(i,n)}}let b=new T;class E extends j{constructor(){super(),this.jsvContentView=null,this.jsvRefedImgTex=null,this.jsvTextLatexEnable=!1,this.jsvEmoji=!1,this.jsvTextAlignMinWidth=NaN,this.jsvEmptyRect=null}jsvGetTagName(){return j.TAG.DIV}get textContent(){return this.jsvStore.textContent}set textContent(t){(t||this.jsvStore.textContent)&&(this.jsvStore.textContent=t,this.jsvStore.clientWidth=NaN,this.jsvContentView||(this.jsvContentView=new e.LayoutView,this.jsvMainView.AddView(this.jsvContentView)),this.parentElement&&this.jsvFlushViewForeground())}get clientWidth(){const e=this.style.width;if(e||0===e)return e;if(this.jsvStore.textContent){if(!isNaN(this.jsvStore.clientWidth))return this.jsvStore.clientWidth;const e={str:this.jsvStore.textContent,font:this.style.fontFamily,size:this.style.fontSize,italic:this.style.fontStyle,bold:this.style.fontWeight};return this.jsvStore.clientWidth=i.GetTextWidth(e),this.jsvStore.clientWidth}return super.clientWidth}jsvOnLoadForgeView(){this.style.borderImage&&(this.jsvMaskView=new e.NinePatchView),super.jsvOnLoadForgeView()}jsvCallbackOnUnloadForgeView(){return this.jsvOnUnloadForgeView.bind(this)}jsvOnUnloadForgeView(){i.UnrefImgTexSize(this.jsvRefedImgTex),this.jsvRefedImgTex=null}jsvOnStyleChanged(e){super.jsvOnStyleChanged(e),this.jsvStore.textStylePack=null;let t=!!e[f.TYPE.FOREGROUND];e[f.TYPE.LAYOUT_SIZE]&&(t||this.jsvFlushViewForeground()),e[f.TYPE.FOREGROUND]&&this.jsvFlushViewForeground(),e[f.TYPE.BORDER]&&this.jsvFlushViewBorder()}jsvFlushViewForeground(){if(this.jsvContentView&&(this.jsvContentView.ClearViews(),this.jsvStore.textContent)){let e=void 0===this.style.height||0==this.style.height,t=e?(e,t)=>{this.jsvStore.clientHeight=e.height}:null,s=this.jsvBuildTextView(t);e&&s.EnableAutoHeight(),this.jsvContentView.AddView(s)}}jsvBuildTextView(t){let s=this.jsvStore.textStylePack;if(null===s&&(s=this._jsvGetClassNameCache()),null===s){this.style.jsvCustomStyles.textLineAlign||(this.style.jsvCustomStyles.textLineAlign=this.style.lineHeight?"middle":"top"),this.style.jsvCustomStyles.textVerticalAlign||(this.style.jsvCustomStyles.textVerticalAlign="top");let t=E._jsvStyleToPackData(this.style),i=JSON.stringify(t),n=b.getTempPack(i);n||(n=e.sTextStyleCache.StyleToPack(t),b.putTempPack(i,n)),s=n}this.jsvStore.textStylePack=s;let n=this.style.lineHeight?parseInt(this.style.lineHeight):this.style.fontSize?1.3*this.style.fontSize:14,r=this.style.width,o=!1;if(void 0===r&&(r=this.clientWidth,o=!0),this.jsvTextAlignMinWidth&&r<this.jsvTextAlignMinWidth&&(r=this.jsvTextAlignMinWidth),r>3e3){if(!o)return console.error(`text too long. str=${this.jsvStore.textContent}`),null;console.log(`text too long, start to break down. width(${r})`);let a=new e.LayoutView,l=Math.floor(2048/this.style.fontSize),h=this.jsvStore.textContent.length,c=0,d=0,u={str:null,font:this.style.fontFamily,size:this.style.fontSize,italic:this.style.fontStyle,bold:this.style.fontWeight};for(;h>0;){let r=l<h?l:h,o=this.jsvStore.textContent.substr(c,r);c+=r,u.str=o;let v=i.GetTextWidth(u),p=e.sTextUtils.BuildTextView(i.TextureManager,o,s,0===c?t:null,{width:v,height:this.style.height},this.style.fontSize,n,!0,this.jsvTextLatexEnable,this.jsvEmoji,this.jsvEmptyRect);a.AddView(p,{x:d,y:0,width:v,height:this.style.height}),d+=v,h-=r}return a}return e.sTextUtils.BuildTextView(i.TextureManager,this.jsvStore.textContent,s,t,{width:r,height:this.style.height},this.style.fontSize,n,!0,this.jsvTextLatexEnable,this.jsvEmoji,this.jsvEmptyRect)}_jsvGetClassNameCache(){if(null===this.style.jsvNamedClassArray)return null;if(f.JsvContainsTextMajor(this.style.jsvLockedProps))return null;let t="";for(let e of this.style.jsvNamedClassArray){let s=e.getAttach();0===s.hasTextMajorStyle&&(f.JsvContainsTextMajor(e.getStyles())?s.hasTextMajorStyle=2:s.hasTextMajorStyle=1),2===s.hasTextMajorStyle&&(t+=e.getName())}if(t.length>0){let s=b.getPersistPack(t);if(!s){let i=E._jsvStyleToPackData(this.style);s=e.sTextStyleCache.StyleToPack(i),b.putPersistPack(t,s)}return s}return null}static _jsvStyleToPackData(e){let t={textColor:e.color?e.color:"#000000",font:e.fontFamily,italic:"italic"===e.fontStyle,bold:"bold"===e.fontWeight,hAlign:e.textAlign?e.textAlign:"start",vAlign:e.jsvCustomStyles.textLineAlign?e.jsvCustomStyles.textLineAlign:"middle",vAreaAlign:e.jsvCustomStyles.textVerticalAlign?e.jsvCustomStyles.textVerticalAlign:"top",textOverflow:e.textOverflow?e.textOverflow:"clip",wordWrap:"break-word"===e.wordWrap?"break_word":"normal",direction:"rtl"===e.direction?"rtl":"ltr",textInnerDirection:e.jsvCustomStyles.textInnerDirection?e.jsvCustomStyles.textInnerDirection:"unset"};"nowrap"===e.whiteSpace&&(t.wordWrap="none");let s=e.textShadow?e.textShadow.split(" "):void 0;s&&(t.shadow={shadowOffsetX:parseInt(s[0]),shadowOffsetY:parseInt(s[1]),shadowBlur:parseFloat(s[2]),shadowColor:s[3]});let i=e.WebkitTextStroke?e.WebkitTextStroke.split(" "):void 0;return i&&(t.stroke={strokeWidth:parseInt(i[0]),strokeColor:i[1]}),t}jsvFlushViewBorder(){if(this.jsvMaskView)if(this.style.clipPath)console.error("BorderImage is conflicting with ClipPath.");else if(this.style.borderImage){if(!(this.jsvMaskView instanceof e.NinePatchView))return void console.error("Error: style.borderImage NOT support dynamic adding");let t=v.ConvertPx(this.getAttribute("jsv-borderimage-width")),s=v.ConvertPx(this.getAttribute("jsv-borderimage-height"));if(i.UnrefImgTexSize(this.jsvRefedImgTex),!this.jsvRefedImgTex||this.jsvRefedImgTex.Source!==this.style.borderImage.source.href){let n=t&&s?{width:t,height:s}:null;if(!this.style.borderImage.source.href)return void this.jsvMaskView.ResetTexture(null);this.jsvRefedImgTex=i.TextureManager.GetImage2(this.style.borderImage.source.href,!1,n,e.ColorSpace.RGBA_8888)}t&&s&&(console.log("Custom cache image size with: "+t+"/"+s),i.SetImgTexSize(this.jsvRefedImgTex,{width:t,height:s}));const n=new e.ExternalTextureSetting(this.jsvRefedImgTex);this.jsvMaskView.ResetTexture(n),this.jsvMaskView.WaitTextureToResize(!0),i.RefImgTexSize(this.jsvRefedImgTex,function(e){if(!this.jsvMaskView)return void console.log("Found border view gone");let t=this.style.borderImageWidth,s=this.style.borderImage.slice,i=Math.floor(e.width*t.top/s.top),n=Math.floor(e.height*t.left/s.left);this.jsvMaskView.SetImageDspSize(i,n);let r=this.style.borderImageOutset?this.style.borderImageOutset:v.ConvertRect();this.jsvMaskView.SetPadding({start:r.left,width:Math.max(0,i-r.left-r.right)},{start:r.top,width:Math.max(0,n-r.top-r.bottom)}),this.jsvMaskView.SetRepeat([{start:t.left,width:Math.max(0,i-2*t.left)}],[{start:t.top,width:Math.max(0,n-2*t.top)}]),this.jsvMaskView.WaitTextureToResize(!1)}.bind(this))}}setAttribute(e,t){this.jsvTakeTextAttribute(e,t)||super.setAttribute(e,t)}jsvTakeTextAttribute(e,t){return"jsv_text_vertical_align"===e?(this.style.jsvCustomStyles.textVerticalAlign=t,!0):"jsv_text_line_align"===e?(this.style.jsvCustomStyles.textLineAlign=t,!0):"jsv_text_latex_enable"===e?(this.jsvTextLatexEnable="true"===t,!0):"jsv_text_align_minwidth"===e?(this.jsvTextAlignMinWidth=parseInt(t),!0):"jsv_text_emoji"===e?(this.jsvEmoji="true"===t||!0===t,!0):("jsv_text_empty_rect"===e?this.jsvEmptyRect=JSON.parse(t):"jsv_text_inner_direction"===e&&(this.style.jsvCustomStyles.textInnerDirection=t),!1)}}class R{constructor(e,t){this.RouterDelegate={ref:null},e||(this.RouterDelegate.ref=new _(!1,t))}getNodeByName(e){return this.RouterDelegate.ref.getNodeByName(e)}focusByNameBeforeMount(e,t){return e.includes(".")&&(e=e.split(".")),this.RouterDelegate.ref.focusBeforeMount(e,t)}setFocus(e,t){return this.focusByNameBeforeMount(e,t)}printFocusList(){for(let e in this.RouterDelegate.ref._ChildMap)console.log(`branchName[${e}] ${e===this.RouterDelegate.ref._FocusNodeName?"focused":""}`,this.RouterDelegate.ref._ChildMap[e])}printGlobalLastFocus(){console.log("FocusNode:"),console.log(I.sLastFocus)}getCurrentFocusStack(){const e=[];if(this.RouterDelegate.ref){let t=this.RouterDelegate.ref.getCurrentFocusNode();for(;t&&t instanceof I&&t.RouterDelegate.ref===this.RouterDelegate.ref;)e.push({name:t.BranchName}),t=t.GetParentPage()}else console.error("getCurrentFocusStack failed: router delegate is null.");return e}debugPrintNodes(){console.log("***print focus nodes***");for(let e in this.RouterDelegate.ref._ChildMap)e.includes("__DEFAULT_ID_")||console.log(e,this.RouterDelegate.ref._ChildMap[e]);console.log("***********************")}}class _{constructor(e,t){this._IsTemp=!!e,this._ChildMap={},this._FocusNameBeforeMount=null,this._FocusNodeName=null,this.NameSpace=t}getCurrentFocusNode(){return this._ChildMap[this._FocusNodeName]}getNodeByName(e,t){let s=e.split(".");return this._FindRouterSearchBase(s,t)._GetNodeFromPathArray(s,e)}_FindRouterSearchBase(e,t){if(0==e[0].length){let t,s;for(let e in this._ChildMap){t=this._ChildMap[e];break}do{s=t,t=t.GetParentPage()}while(null!=t);return e.splice(0,1),s.RouterDelegate.ref}return t&&t.AsHub&&t.GetParentPage()?t.GetParentPage().RouterDelegate.ref:this}_GetNodeFromPathArray(e,t){let s=0,i=this;for(;s<e.length-1;){let n=!1;for(let t in i._ChildMap){let r=i._ChildMap[t].RouterDelegate.ref;if(r!=i&&r.NameSpace==e[s]){i=r,s++,n=!0;break}}if(!n)return void console.error(`Error: no found subpath fname=${t}`)}let n=e[s];return i._ChildMap.hasOwnProperty(n)?i._ChildMap[n]:void console.error(`Error: no found fname=${t}`)}add(e,t){if(e.indexOf(".")>=0)console.error("ERROR: FDiv name can not contains '.'");else if(this._ChildMap.hasOwnProperty(e)&&this._ChildMap[e]!==t)console.error(`ERROR: FDiv router branch name duplicated:[${e}]`);else if(this._ChildMap[e]=t,this._FocusNameBeforeMount)if("string"==typeof this._FocusNameBeforeMount)this._FocusNameBeforeMount==e&&(this._FocusNameBeforeMount=null,t.Focus());else{this._FocusNameBeforeMount[0]==e&&(t.RouterDelegate.ref.focusBeforeMount(this._FocusNameBeforeMount.slice(1)),this._FocusNameBeforeMount=null)}}remove(e,t){let s=this._ChildMap[e];s&&s==t&&delete this._ChildMap[e]}rename(e,t){if(!this._ChildMap.hasOwnProperty(e))return void console.error(`ERROR: alter name failed ${e}->${t}`);let s=this._ChildMap[e];delete this._ChildMap[e],this.add(t,s),this._FocusNodeName==e&&(this._FocusNodeName=t)}focusBeforeMount(e,t){let s=!1;if(e.indexOf(".")>=0)return console.error("ERROR: not support name with namespace"),!1;if("string"==typeof e){if(!e.includes(".")){s=!0;let i=this._ChildMap[e];return this._FocusNodeName=e,i?(i.Focus(!t),!0):(this._FocusNameBeforeMount=e,!1)}}else if("object"==typeof e&&Array.isArray(e)&&e.length>0){if(s=!0,1==e.length)return this.focusBeforeMount(e[0]);{let t=e[0],s=this._ChildMap[t];return this._FocusNodeName=t,s?s.RouterDelegate.ref.focusBeforeMount(e.slice(1)):(this._FocusNameBeforeMount=e,!1)}}return s||console.error("illegal name param",e),!1}focus(e,t){let s=this.focusBeforeMount(e,t);return s||console.log("No found branch:"+e),s}forEach(e){for(let t in this._ChildMap)e(this._ChildMap[t],t,this._ChildMap)}printNodes(){console.log(this._ChildMap)}}class I extends e.PageBase{constructor(e){super(e),this._OnKeyDown=null,this._OnKeyUp=null,this._OnFocus=null,this._OnBlur=null,this._DispatchKeyDown=null,this._DispatchKeyUp=null,this._OnCustomerEvent=null,this._DKeyDownProxy=void 0,this._DKeyUpProxy=void 0,this._Mounted=!1,this.BranchName=e,this.AsHub=!1,this.InterfaceHub=null,this.RouterDelegate={ref:null},this._TmpRouter=null,this._OriginDispatchKeyDown=this._OriginDispatchKeyDown.bind(this),this._OriginDispatchKeyUp=this._OriginDispatchKeyUp.bind(this),this._AutoShow=!1}updateMountState(){this._Mounted=!0;let e=this.SubPages;for(let t in e)e[t].updateMountState()}getHub(){return this.InterfaceHub||(this.InterfaceHub=new R(!0),this.InterfaceHub.RouterDelegate=this.RouterDelegate),this.InterfaceHub}setHub(e){this.RouterDelegate.ref?console.error("Error: hub is already setted."):(this.RouterDelegate.ref=e.RouterDelegate.ref,this.AsHub=!0)}_UseParentRouter(e){this.RouterDelegate=e,this.InterfaceHub&&(this.InterfaceHub.RouterDelegate=e)}routerAdd(e,t){t.RouterDelegate.ref||t._UseParentRouter(this.RouterDelegate),this.RouterDelegate.ref||(this.RouterDelegate.ref=new _(!0)),this.RouterDelegate.ref.add(e,t)}routerRenameChild(e,t){this.RouterDelegate.ref.rename(e,t)}printFocusList(){this.RouterDelegate.ref?this.RouterDelegate.ref.printFocusList():console.error("Error: no router")}routerUnbind(){let e;this.AsHub?this.GetParentPage()&&(e=this.GetParentPage().RouterDelegate.ref):e=this.RouterDelegate.ref,e&&e.remove(this.BranchName,this)}setBranchName(e){if(e===this.BranchName)return;let t=this.BranchName;this.BranchName=e,this.PageName=e,this._ParentPage&&this._ParentPage.routerRenameChild(t,e)}setOnKeyDown(e){this._OnKeyDown=e}setOnKeyUp(e){this._OnKeyUp=e}setOnFocus(e){this._OnFocus=e}setOnBlur(e){this._OnBlur=e}setDispatchKeyUp(e){this._DispatchKeyUp=e}setDispatchKeyDown(e){this._DispatchKeyDown=e}setOnCustomerEvent(e){this._OnCustomerEvent=e}setDispatchKeyProxy(e,t){this._DKeyDownProxy=e,this._DKeyUpProxy=t}requestFocus(e){let t=this.RouterDelegate.ref;return this.AsHub&&this.GetParentPage()&&(t=this.GetParentPage().RouterDelegate.ref),t?t.focus(this.BranchName,e):(console.error("error: lost router"),!1)}OnKeyDown(e){return!!this._OnKeyDown&&this._OnKeyDown(e)}OnKeyUp(e){return!!this._OnKeyUp&&this._OnKeyUp(e)}OnCustomerEvent(e){return!!this._OnCustomerEvent&&this._OnCustomerEvent(e)}bubbleCustomerEvent(e){this.BubbleCustomerEvent(e)}dispatchKeyDown(e){return this.DispatchKeyDown(e)}DispatchKeyDown(e){return I.sLastFocus=this,this._DKeyDownProxy?this._DKeyDownProxy(e,this._OriginDispatchKeyDown):this._OriginDispatchKeyDown(e)}_OriginDispatchKeyDown(e){let t=!1;return this._DispatchKeyDown&&(t=this._DispatchKeyDown(e)),!!t||super.DispatchKeyDown(e)}dispatchKeyUp(e){return this.DispatchKeyUp(e)}DispatchKeyUp(e){return this.__DKeyUpProxy?this.__DKeyUpProxy(e,this._OriginDispatchKeyUp):this._OriginDispatchKeyUp(e)}_OriginDispatchKeyUp(e){let t=!1;return this._DispatchKeyUp&&(t=this._DispatchKeyUp(e)),!!t||super.DispatchKeyUp(e)}attachToActivity(e,t){this.AttachToActivity(e,t)}AttachToActivity(e,t){super.SetParent(e,t)}setParent(e){this.SetParent(e)}SetParent(e){if(null!=e&&(super.SetParent(e,null),this._ParentPage._Mounted&&(this.updateMountState(),x()),e instanceof I)){if(this.RouterDelegate.ref&&this.RouterDelegate.ref._IsTemp){let t=this.RouterDelegate.ref;this.RouterDelegate.ref=null,t.forEach(((t,s)=>{e.routerAdd(s,t)}))}e.routerAdd(this.BranchName,this)}}focus(e){this.Focus(e)}Focus(e){if(!this._Mounted)return I.sFocusMemos.push({obj:this,bcf:e}),void console.log("page base tree not build, cache focus");super.Focus(e)}OnFocus(){this._OnFocus&&this._OnFocus()}OnBlur(){this._OnBlur&&this._OnBlur()}onUnMount(){let e=this.GetParentPage();e&&e.RemoveSubPage(this),this.ClearSubPages(),this.routerUnbind()}getName(){let e=this,t=[this.RouterDelegate.ref.NameSpace];this.AsHub||t.push(this.BranchName);let s=this.RouterDelegate.ref;do{if(e=e.GetParentPage(),"__AppRoot__"==t[0])break;e&&e.RouterDelegate.ref!=s&&(s=e.RouterDelegate.ref,t.unshift(s.NameSpace))}while(e);return"__AppRoot__"==t[0]?t[0]="":console.error("ERROR: missing app root"),t.join(".")}getNodeByName(e){return this.RouterDelegate.ref.getNodeByName(e,this)}printFocusNodeList(){this.getHub().printFocusList()}printGlobalLastFocus(){this.getHub().printGlobalLastFocus()}}I.sFocusMemos=[],I.sLastFocus=null,I.sRootPageNode=null;let x=()=>{let e=I.sFocusMemos.length;if(e>0){let t=I.sFocusMemos;I.sFocusMemos=[];for(let s=0;s<e;s++)t[s].obj.Focus(t[s].bcf)}},A=1;class P extends j{constructor(){super(),this.FocusNodeRef=new I("__DEFAULT_ID_"+A++),this.HubRef=void 0}jsvGetTagName(){return j.TAG.FDIV}setAttribute(e,t){if(e)if("fname"===e)t&&this.FocusNodeRef.setBranchName(t);else if("new-namespace"===e&&""!==t&&!this.HubRef){let e=new R(!1,t);this.HubRef=e,this.FocusNodeRef.setHub(e),this.FocusNodeRef.setBranchName(t)}}jsvGetHub(){return this.HubRef}}class N extends j{constructor(e){super(e),this.src=null,this.onerror=null,this.onload=null}setAttribute(e,t){console.log("LinkElement.setAttribute() name="+e+", value=",t),this[e]=t}jsvLoadResource(){let e=!1,t=null;if(null!=this.href){var i=new s(this.href);console.log("Ignore to load link from url="+i.href),e=!0}else console.warn("Failed to load link, href is not exists."),t="NoSrc";this.jsvOnLoadResult(e,t)}jsvOnLoadResult(e,t){if(console.log("jsvOnLoadResult isSuccess:"+e+", errCode:"+t),e){if(this.onload){let e=new n("load");this.onload(e)}}else this.onerror&&this.onerror({type:"jsvErr_"+t,target:this})}}class k extends j{constructor(e){super(e),this.src=null,this.onerror=null,this.onload=null,this.charset=null,this.timeout=120}setAttribute(e,t){console.log("ScriptElement.setAttribute() name="+e+", value=",t),this[e]=t}jsvLoadResource(){if(null!=this.src){var e=new s(this.src);console.log("load script with url="+e.href);var t=this;window.JsView.runJsWithUrl(e.href,!1,((e,s)=>{t.jsvOnLoadResult(e,s)}))}}jsvOnLoadResult(e,t){if(console.log("onLoadResult "+e+" "+t),e){if(this.onload){let e=new n("load");this.onload(e)}}else this.onerror&&this.onerror({type:"jsvErr_"+t,target:this})}}class M extends j{constructor(){super()}appendChild(e){"HTMLScriptElement"==e.constructor.name||"HTMLStyleElement"==e.constructor.name||"HTMLLinkElement"==e.constructor.name?window.originDocument.headAppendChild(e):super.appendChild(e),(e instanceof N||e instanceof k)&&e.jsvLoadResource()}removeChild(e){"HTMLScriptElement"==e.constructor.name||"HTMLStyleElement"==e.constructor.name||"HTMLLinkElement"==e.constructor.name?window.originDocument.headRemoveChild(e):super.removeChild(e)}}class V extends n{constructor(e){super("load")}}class L extends j{constructor(t){super(t),this.jsvImageView=new e.LayoutView(null,"img"),this.jsvMainView.AddView(this.jsvImageView),this._ImageInLoading=!1,this.jsvColorSpace=e.ColorSpace.RGBA_8888,this.jsvScaleDownTex=null,this._HasUserOnLoad=!1,this._OnLoadSeq=1,this._LoadedSrc=null,this.jsvApicAutoPlay=!0}jsvGetTagName(){return j.TAG.IMAGE}setAttribute(e,t){this.jsvTakeTextureAttribute(e,t)||(super.setAttribute(e,t),e===j.ATTRIBUTE.SRC&&this.jsvSetAttrLazySync(e,j.ATTRTYPE.CSS))}jsvSetElementProp(e){this.jsvImageView.SetElementProp(e,i.RootActivity)}jsvCallbackOnUnloadForgeView(){return()=>{if(this._HasUserOnLoad){let e=this.jsvImageView?.TextureSetting?.Texture;e&&e.DisableBackgroundLoad(this)}}}jsvFlushEventHandlers(){if(super.jsvFlushEventHandlers(),this.eventHandlers.onLoad){let e=this.jsvImageView?.TextureSetting?.Texture;e&&(this._HasUserOnLoad=!0,e.EnableBackgroundLoad(this))}else if(this._HasUserOnLoad){let e=this.jsvImageView?.TextureSetting?.Texture;e&&e.DisableBackgroundLoad(this),this._HasUserOnLoad=!1}}jsvTakeTextureAttribute(e,t){return"jsv_img_color_space"==e||"jsvImgColorSpace"==e||"jsv-img-color-space"==e?(this.jsvColorSpace=t,!0):"jsv_img_scaledown_tex"==e||"jsvImgScaledownTex"==e||"jsv-img-scaledown-tex"==e?(""!==t&&void 0!==t||(t="true"),this.jsvScaleDownTex=t,!0):"jsv_disable_apic_autoplay"==e&&(this.jsvApicAutoPlay=!1,!0)}jsvFlushViewLayout(){this._ImageInLoading?(this.jsvImageView.WaitTextureToResize(!0),this.jsvImageView.ResetLayoutParams({x:0,y:0,width:this.style.width,height:this.style.height})):this.jsvImageView.WaitTextureToResize(!1),super.jsvFlushViewLayout()}jsvOnLoaded(e){if(console.log("ImageElement.jsvOnLoaded() imageSize="+JSON.stringify(e)),this._ImageInLoading=!1,this._LoadedSrc=this.src,this.jsvStore.textureWidth=e.width,this.jsvStore.textureHeight=e.height,this.style.jsvLazySyncCache.setCacheProperty(f.TYPE.LAYOUT_SIZE,!0),this._HasUserOnLoad){let e=new V;e.target=this,document.dispatchEvent(e)}}jsvOnAttrLazySync(e){e.hasOwnProperty(j.ATTRIBUTE.SRC)&&this.src!=this._LoadedSrc&&(this._ImageInLoading=!0,this.jsvStore.textureWidth=NaN,this.jsvStore.textureHeight=NaN,this.jsvDrawImage())}jsvOnLoadForgeView(){this.style.objectFit||this.style.jsvSetPropertySilently("objectFit",f.ObjectFit.FILL),super.jsvOnLoadForgeView()}jsvApplyObjectFit(e){return 0!=this.jsvStore.textureWidth&&0!=this.jsvStore.textureHeight||console.warn("warning: size 0 not support object fit, src="+this.src),j.applyObjectFitCommon(this,e,this.jsvImageView)}jsvDrawImage(){if(!this.src)return;let e=null;"true"===this.jsvScaleDownTex&&(this.style&&this.style.width?e={width:this.style.width,height:0}:console.error("set jsvScaleDownTex while style.width is not set. you need to set 'src' prop at the end.")),this._OnLoadSeq++;let t=this._OnLoadSeq;i.SetBackgroundImage(this.jsvImageView,this.src,this.style.borderRadius,(e=>{t===this._OnLoadSeq&&this.jsvOnLoaded(e)}),e,this.jsvColorSpace,this.jsvApicAutoPlay)}}class D extends j{constructor(t){super(),this.jsvMainView=new e.JsvElementView(t)}get textContent(){return this.jsvMainView.textContent}set textContent(e){this.jsvMainView.textContent=e}setAttribute(e,t){super.setAttribute(e,t),this.jsvMainView.setAttribute(e,t)}removeAttribute(e){super.removeAttribute(e),this.jsvMainView.removeAttribute(e)}getAttribute(e){return this.jsvMainView.getAttribute(e)}hasAttribute(e){return this.jsvMainView.hasAttribute(e)}jsvOnStyleChanged(e){super.jsvOnStyleChanged(e)}}class F{constructor(e){let t=e.indexOf(F.KeyFramesFlag)+F.KeyFramesFlag.length,s=e.indexOf("{"),i=e.substring(t,s);this.name=i.trim(),this.cssText=e}}F.KeyFramesFlag="@keyframes";class U{constructor(e){this.jsvCssRules=null,this.jsvTextContent=e}get cssRules(){if(this.jsvCssRules)return this.jsvCssRules;this.jsvCssRules=new Array;if(this.jsvTextContent.indexOf(F.KeyFramesFlag)<0)return this.jsvCssRules;var e=this.jsvTextContent.split(F.KeyFramesFlag);for(let t in e)0!=t&&this.insertRule(F.KeyFramesFlag+e[t]);return this.jsvCssRules}insertRule(e,t){if(void 0===t&&(t=this.jsvCssRules.length),e.indexOf(F.KeyFramesFlag)<0)throw Error("StyleSheet.insertRule() Rule is not supported except keyframes.");let s=new F(e);this.jsvCssRules.splice(t,0,s)}deleteRule(e){this.jsvCssRules.splice(e,1)}}class B extends j{constructor(e){super(e),this.textContent=null}jsvGetTagName(){return j.TAG.STYLE}appendChild(e){super.appendChild(e);let t=new U(e.textContent);document.jsvAppendStyleSheet(t)}removeChild(e){throw super.removeChild(e),Error("Failed to removeChild, unimplement!.")}}class G extends j{}class H extends S{constructor(e){super(e),console.log("VideoElement.constructor()",this),this._EventCache=[],this._UseTexture=!1,this._StartTime=0}jsvGetTagName(){return j.TAG.VIDEO}setAttribute(e,t){("jsv-media-usetexture"!==e||"true"!==t&&!0!==t&&""!==t)&&("jsv_media_usetexture"!==e||"true"!==t)?super.setAttribute(e,t):this._UseTexture=!0}removeAttribute(e){if("jsv-media-usetexture"===e||"jsv_media_usetexture"===e)return this._UseTexture=!1,void console.log("removeAttribute jsv_media_usetexture");super.removeAttribute(e)}jsvFlushViewLayout(){super.jsvFlushViewLayout();let e=this.style.JsvVideoRotation;isNaN(e)&&(e=0),this.style.objectFit&&this.style.objectFit!=f.ObjectFit.CONTAIN&&this.style.objectFit!=f.ObjectFit.FILL&&(console.error("Video rotation is not valid on objectFit=",this.style.objectFit),e=0),this.jsvMedia&&this.jsvMedia.setRotation?.(e,this.style.width,this.style.height,this.style.objectFit==f.ObjectFit.FILL)}jsvAddMediaListener(e){this.jsvMedia?this.jsvMedia.addEventListener(e,(()=>{let t=new n(e);t.target=this,this.dispatchEvent(t)})):this._EventCache.push(e)}jsvFlushVideoView(){this.jsvMediaView&&(this.jsvStore.textureWidth=this.jsvMedia.videoWidth,this.jsvStore.textureHeight=this.jsvMedia.videoHeight,this.style.jsvLazySyncCache.setCacheProperty(f.TYPE.LAYOUT_SIZE,!0))}jsvApplyObjectFit(e){return j.applyObjectFitCommon(this,e,this.jsvMediaView)}jsvInit(){console.log("VideoElement jsvInit"),this._UseTexture?this.jsvMedia=new S.HOOKS.OffscreenVideo:this.jsvMedia=new S.HOOKS.Video,this._EventCache.length>0&&(this._EventCache.map((e=>{this.jsvAddMediaListener(e)})),this._EventCache=[]),this.addEventListener("load",this.jsvOnLoaded.bind(this)),super.jsvInit()}jsvRelease(){super.jsvRelease(),this.jsvMedia=null}jsvOnLoaded(){if(!this.jsvMediaView){let t;if(this._UseTexture){this.jsvMediaView=new e.LayoutView;let s,n=i.TextureManager.GetOffScreenMediaTexture(this.jsvMedia),r=this.style.borderRadius;r&&(s=new e.ViewRoundCornerMask(r.topLeft,r.topRight,r.bottomLeft,r.bottomRight)),t=new e.TextureSetting(n,s)}else{this.jsvMediaView=new e.VideoView(this.jsvMedia);let s=i.TextureManager.GetColorTexture("rgba(0,0,0,0)");t=new e.TextureSetting(s,null,null,!1)}this.jsvMainView.AddView(this.jsvMediaView),this.jsvMediaView.ResetTexture(t)}this.jsvFlushVideoView()}jsvOnLoadForgeView(){this.style.objectFit||this.style.jsvSetPropertySilently("objectFit",f.ObjectFit.CONTAIN),super.jsvOnLoadForgeView()}onJsViewHide(){this._StartTime=this.jsvMedia.currentTime,super.onJsViewHide(),this.jsvMedia.setState("autoPlay",!1,"boolean")}onJsViewShow(){this.jsvMedia||this.jsvInit(),this.jsvMedia.src=this.srcValue,this.jsvMedia.startTime=Math.max(this._StartTime-1,0),this._StartTime=0,this.stopByOnHide&&(this.stopByOnHide=!1,this.jsvMedia.play())}}H.PROP={SetOnly:[],GetOnly:["videoHeight","videoWidth"],SetAndGet:["height","poster","width"]};for(let e in H.PROP){let t=H.PROP[e];for(let s of t){let t={};"SetOnly"!==e&&"SetAndGet"!==e||(t.set=function(e){this.media[s]=e}),"GetOnly"!==e&&"SetAndGet"!==e||(t.get=function(){return this.media[s]}),H.prototype[s]=t}}H.EVENTS=["oncanplay","oncanplaythrough","ondurationchange","onended","onerror","onload","onloadedmetadata","onloadstart","onpause","onplay","onplaying","onprogress","onseeking","onseeked","onstalled","ontimeupdate"];class W extends c{constructor(e){super(c.TEXT_NODE),this.textContent=e}get nodeValue(){return this.textContent}set nodeValue(e){this.textContent=e,this.parentNode&&(this.parentNode.textContent=this.textContent)}}class K extends c{constructor(e){super(c.COMMENT_NODE),this.textContent=e}}let z={};class J{constructor(e,t,s){this._Element=s,z.hasOwnProperty(e)&&console.error(`Warn: FDivRoot duplicate name=${e}`),z[e]=this,this._DoInit(t)}_DoInit(e){let t=this._Element.FocusNodeRef;this._Element.setAttribute("new-namespace","__AppRoot__"),e&&t.setDispatchKeyProxy(e.keyDown,e.keyUp),window.JsView?t.attachToActivity(i.RootActivity,i.RootView):(window.addEventListener("keydown",(e=>{var s=document.activeElement.tagName;s&&"input"===s.toLowerCase()||(t.dispatchKeyDown(e),e.preventDefault&&e.preventDefault())})),window.addEventListener("keyup",(e=>{var s=document.activeElement.tagName;s&&"input"===s.toLowerCase()||(t.dispatchKeyUp(e),e.preventDefault&&e.preventDefault())})))}getElement(){return this._Element}getHub(){return this._Element.jsvGetHub()}onMounted(){this._Element.FocusNodeRef.updateMountState(),x()}}class Y extends O{constructor(e){super(e),console.log("AudioElement.constructor()",this)}jsvGetTagName(){return j.TAG.AUDIOTRACK}jsvInit(){this.jsvMedia=new S.HOOKS.Audio("AudioTrack"),this.jsvOverrideMedia=!0,super.jsvInit()}}class $ extends c{constructor(){super(c.DOCUMENT_NODE),this.location=window.location,this.rootElement=new E,this.rootElement.ownerDocument=this,this.rootElement.id="root",this.activeElement=this.rootElement,this.head=new M,this.styleSheets=new Array,window.JsView&&this.styleSheets.push(new U("@keyframes jsv-basic-slot {}")),this.jsvIsReady=!1}createElement(e){switch(e){case $.FDIV_ELEMENT:return new P;case $.DIV_ELEMENT:return new E;case $.IMG_ELEMENT:return new L;case $.STYLE_ELEMENT:return new B;case $.AUDIO_ELEMENT:return new O;case $.VIDEO_ELEMENT:return new H;case $.LINK_ELEMENT:return window.JsView?new N:window.originDocument.createElement($.LINK_ELEMENT);case $.SCRIPT_ELEMENT:return window.JsView?new k:window.originDocument.createElement($.SCRIPT_ELEMENT);case $.ANCHOR_ELEMENT:return new C;case $.SVG_ELEMENT:return new SVGElement;default:return e==$.JSV_AUDIOTRACK_ELEMENT?new Y:window.JsView?("template"!=e&&console.warn("Document.createElement() unknown name="+e),new G(e)):new D(e.startsWith("jsv")?e:"jsve-"+e)}}createTextNode(e){return new W(e)}createEvent(e){return new n(e)}createComment(e){return new K(e)}getElementById(e){if("root"===e||"app"===e)return this.rootElement;throw Error("Document.getElementById() id="+e+" is UNIMPLEMENTED.")}getElementsByTagName(e){if("head"===e.toLowerCase())return window.JsView?[this.head]:window.originDocument.getElementsByTagName(e);if("link"===e.toLowerCase()||"script"===e.toLowerCase()||"style"===e.toLowerCase())return[];throw Error("Document.getElementsByTagName() name="+e+" is UNIMPLEMENTED.")}querySelector(e){if("root"===e||"#app"===e)return this.rootElement;if("head"===e)return this.head;if("base"===e)return null;if(e.startsWith("style[")&&e.endsWith("]"))return null;if(e.startsWith("link[")&&e.endsWith("]"))return null;throw Error("Document.querySelector() selectors="+e+" is UNIMPLEMENTED.")}querySelectorAll(e){return[]}jsvAppendStyleSheet(e){document.styleSheets.push(e)}jsvGetKeyFrames(e,t){if(window.JsvCode.Dom.StyleSheets){const s=window.JsvCode.Dom.StyleSheets;for(const i of t){const t=s[`${e}-${i.replace("data-v-","")}`];if(t)return t}const i=s[e];if(i)return i}for(let t of this.styleSheets)for(let s of t.cssRules)if(s.name==e)return s.cssText;let s="@keyframes ",i=s+e;for(let e of this.styleSheets){let t=e.jsvTextContent,n=t.indexOf(i);if(n<0)continue;let r=t.indexOf("-keyframes",n+1),o=t.indexOf(s,n+1);o<0&&(o=t.length),r>0&&r<o&&(o=r);let a=t.substring(n,o);return e.insertRule(a,0),a}return null}jsvUpdateRootElement(e){console.log("Document.jsvUpdateRootElement() this.jsvIsReady = true"),this.rootElement.jsvMainView=e,this.jsvIsReady=!0}jsvInitFDivRoot(e,t,s){if(!s){let e=document.createElement("fdiv");this.rootElement.appendChild(e),this.rootElement=e,s=this.rootElement}return new J(e,t,s)}jsvGetFDivRoot(e){return function(e){return z[e]}(e)}set cookie(e){window.__JsvCookies.setCookie(e)}get cookie(){return window.__JsvCookies.getCookie()}}$.ANCHOR_ELEMENT="a",$.AUDIO_ELEMENT="audio",$.DIV_ELEMENT="div",$.IMG_ELEMENT="img",$.LINK_ELEMENT="link",$.SCRIPT_ELEMENT="script",$.STYLE_ELEMENT="style",$.SVG_ELEMENT="svg",$.VIDEO_ELEMENT="video",$.FDIV_ELEMENT="fdiv",$.JSV_AUDIOTRACK_ELEMENT="jsv-audiotrack";class X extends j{jsvGetTagName(){return j.TAG.LINK}}if(window.JsvCode={Dom:{StyleSheets:{}}},window.Audio=O,window.Video=H,window.MutationObserver=class{constructor(e){this.callback=e}observe(e,t){if(!(e instanceof c))throw Error("TypeError: Failed to execute 'observe' on 'MutationObserver': parameter 1 is not of type JsView's 'Node'");for(const e of Object.keys(t))"childList"==e||console.warn("JsView: only childList config is supported! ignore "+e);t.childList&&e.jsvObserveChildChanged((()=>{this.callback?.()}))}disconnect(){this.callback=void 0}},window.JsView){console.log("Declare Dom Proxy."),global.SVGElement=X,global.Element=j;let e=new s(window.JsView.getAppUrl(),!0);window.location.applyUrlInfo?window.location.applyUrlInfo(e):window.location=e,window.addEventListener=function(e,t){},window.document=new $,window.history={},window.navigator={userAgent:"jsview-runtime"},window.HTMLIFrameElement=function(){}}h.I("Using JsView Runtime");var q=Object.freeze({__proto__:null,JsViewForgeApp:class{constructor(t){this._ActivityManager=t;let s=new l(t);t.RegisterActivity(s.activity),t.StartActivity(new e.Intent("JsViewForgeActivity"))}},Document:$,HeadElement:M,ForgeExtension:i,Log:h,gSyncTimesCounter:o,JsvLazySyncCache:a});
1
+ /* eslint-disable */ void 0===window.Forge&&(window.Forge={});var e=window.Forge;class t{static _isUndefined(e,t){let s=void 0===t;return s&&console.error(e+" property is undefined!"),s}static _isUndefinedOrNumber(e,s){return!!t._isUndefined(e,s)||"number"==typeof s}static _keyframesCheck(e,s){t._isUndefined(e,s)||s.indexOf("transform")<0&&s.indexOf("opacity")<0&&console.error("keyframes property is only support transform and opacity, value:",s)}static _objectFit(e,s){if(t._isUndefined(e,s))return;const i="fill contain cover none scale-down";i.indexOf(s)<0&&console.error(" objectFit is only support one of string["+i+"]")}static _clipPathCheck(e,s){t._isUndefined(e,s)||s.startsWith("inset")||console.error("clipPath property is support inset only.")}static _transitionOtherCheck(e,s){t._isUndefined(e,s)||console.error(e+" property is not support, you can use transition property, e.g. transition='width 2s'")}static _transitionCheck(e,s){t._isUndefined(e,s)}static _transformCheck(e,s){t._isUndefined(e,s)||s.length>0&&s.indexOf("translate3d")<0&&s.indexOf("scale3d")<0&&s.indexOf("rotate3d")<0&&s.indexOf("skew")<0&&console.error("transform property's value only support translate3d、scale3d、rotate3d、skew, value:",s)}static _transformOriginCheck(e,s){t._isUndefined(e,s)||s.length>0&&s.indexOf("%")<0&&s.indexOf("left")<0&&s.indexOf("center")<0&&s.indexOf("top")<0&&s.indexOf("right")<0&&s.indexOf("bottom")<0&&console.error("transformOrigin property's value only support XX%、left、top、right, bottom:",s)}static _textOverflowCheck(e,s){if(!t._isUndefined(e,s))switch(s){case"clip":case"ellipsis":break;default:console.error("textOverflow property's value is not support, value:",s)}}static _whiteSpaceCheck(e,s){if(!t._isUndefined(e,s))switch(s){case"normal":case"nowrap":case"pre-wrap":break;default:console.error("whiteSpace property's value is not support, value:",s)}}static _textAlignCheck(e,s){if(!t._isUndefined(e,s))switch(s){case"left":case"right":case"center":case"start":case"end":break;default:console.error("textAlign property's value is not support, value:",s)}}static _lineHeightCheck(e,s){if(!t._isUndefinedOrNumber(e,s))switch(s){case"normal":case"inherit":console.error("lineHeight property's value is support number only, value:",s);break;default:s.indexOf("%")>=0&&console.error("lineHeight property's value is support number only, value:",s)}}static _colorCheck(e,s){t._isUndefined(e,s)||t._checkColorFormat("Color()",s)}static _visibilityCheck(e,s){t._isUndefined(e,s)||"visible"!==s&&"hidden"!==s&&"inherit"!==s&&console.error("visibility property's value is not support, value:",s)}static _displayCheck(e,s){t._isUndefined(e,s)||"block"!==s&&"inline"!==s&&"none"!==s&&"inline-block"!==s&&"inherit"!==s&&""!==s&&console.error("display property's value is not support, value:",s)}static _overflowCheck(e,s){t._isUndefined(e,s)||"visible"!==s&&"hidden"!==s&&console.error("overflow property's value is support visible or hidden only, value:",s)}static _topCheck(e,s){if(!t._isUndefinedOrNumber(e,s))switch(s){case"auto":case"inherit":console.error("top property's value is support number only, value:",s);break;default:s.indexOf("%")>=0&&console.error("top property's value is support number only, value:",s)}}static _leftCheck(e,s){if(!t._isUndefinedOrNumber(e,s))switch(s){case"auto":case"inherit":console.error("left property's value is support number only, value:",s);break;default:s.indexOf("%")>=0&&console.error("left property's value is support number only, value:",s)}}static _heightCheck(e,s){if(!t._isUndefinedOrNumber(e,s))switch(s){case"auto":case"inherit":console.error("height property's value is support number only, value:",s);break;default:s.indexOf("%")>=0&&console.error("height property's value is support number only, value:",s)}}static _widthCheck(e,s){if(!t._isUndefinedOrNumber(e,s))switch(s){case"auto":case"inherit":console.error("width property's value is support number only, value:",s);break;default:s.indexOf("%")>=0&&console.error("width property's value is support number only, value:",s)}}static _backfaceVisibility(e,s){if(!t._isUndefined(e,s))switch(s){case"visible":case"hidden":break;default:console.error("backfaceVisibility property's value is support visible/hidden only, value: ",s)}}static _perspectiveCheck(e,s){t._isUndefined(e,s)}static _WebkitTextStroke(e,s){if(t._isUndefined(e,s))return;s.split(" ").length<2&&console.error("Error: WebkitTextStroke should format of(width color) such as: '1px rgba(255,255,255,1.0)'")}static _zIndexCheck(e,s){t._isUndefined(e,s)||isNaN(s)&&console.error("zIndex property's value is support number only, value: ",s)}static _fontSizeCheck(e,s){if(!t._isUndefined(e,s)&&"number"!=typeof s)switch(s){case"smaller":case"larger":case"inherit":case"x-small":case"xx-small":case"small":case"large":case"medium":case"x-large":case"xx-large":console.error("fontSize property's value is support number only, value:",s);break;default:s.indexOf("%")>=0&&console.error("fontSize property's value is support number only, value:",s)}}static _fontWeightCheck(e,s){t._isUndefined(e,s)||"bold"!==s&&console.error("fontWeight property's value is support bold only, value:",s)}static _fontStyleCheck(e,s){t._isUndefined(e,s)||"italic"!==s&&console.error("fontWeight property's value is support italic only, value:",s)}static _borderRadiusCheck(e,s){if(t._isUndefined(e,s))return;s.split(" ").length>4&&console.error("borderRadius property's value is not support, value:",s)}static _borderImageWidthCheck(e,s){t._isUndefinedOrNumber(e,s)}static _borderImageOutsetCheck(e,s){if(t._isUndefined(e,s))return;s.split(" ").length>4&&console.error("borderImageOutsetCheck property's value is not support, value:",s)}static _borderImageCheck(e,s){t._isUndefined(e,s)||s.indexOf("fill")<0&&console.error("borderImage property's value is not contain fill, e.g. source slice, but value:",s)}static _backgroundOtherCheck(e,t){console.error(e+" property not support, you can use backgroundImage property, e.g. backgroundImage=`url(${iconImgPath})`")}static _backgroundImageCheck(e,s){t._isUndefined(e,s)||"inherit"==s&&console.error("backgroundImage property's value is not support, value:",s)}static _backgroundColorCheck(e,s){if(!t._isUndefined(e,s))return t._checkColorFormat("backgroundColor",s)}static _animationCheck(e,t){}static _animationOtherNotSupport(e,t){console.error(e+" property is not support, you can use animation property, e.g. animation='mymove 5s infinite'")}static _transformStyleCheck(e,s){if(!t._isUndefined(e,s))switch(s){case"flat":case"preserve-3d":break;default:console.error("transformStyle property value is not valid",s)}}static _perspectiveOriginCheck(e,s){t._isUndefined(e,s)||s.length>0&&s.indexOf("%")<0&&s.indexOf("left")<0&&s.indexOf("center")<0&&s.indexOf("top")<0&&s.indexOf("right")<0&&s.indexOf("bottom")<0&&console.error("perspectiveOrigin property's value only support XX%、left、top、right, bottom:",s)}static _textShadowCheck(e,s){if(!t._isUndefined(e,s)&&s.length>0){if(s.replace(/\(.*\)/g,"").split(",").length>1)return void console.error("textShadow: NOT support more than one part settings");const e=s.split(" ");if(4!==e.length&&(5!==e.length||0!==e[4].length)||isNaN(parseInt(e[0]))||isNaN(parseInt(e[1])))console.error('textShadow: format should be "offsetX offsetY blurSize color"(0 0 1 rgba(100,100,100,1)), !NOT space in rgba()');else{if(!(parseFloat(e[2])>0))return void console.error(`textShadow: blur shadow above 0(now=${s})`);if(!t._checkColorFormat("textShadow",e[3]))return}}}static _checkColorFormat(e,t){if(0===t.indexOf("rgba(")||0===t.indexOf("rgb("));else{if(0!==t.indexOf("#"))return console.error(`${e} color value is not valid, need startwith rgba or #, value:[${t}]`),!1;if(7!==t.length)return console.error(`${e} color value's length is not valid, value:${t}`),!1}return!0}static _directionCheck(e,t){return"rtl"===t||"ltr"===t||(console.error(`${e} direction value is not valid, need rtl or ltr, value:[${t}]`),!1)}static _JsvVideoRotationCheck(e,t){return!isNaN(parseInt(t))||(console.error(`${e} value is not valid, value:${t}`),!1)}static get(e){return t.ValidStyleMap[e]}}t.ValidStyleMap={animation:{check:t._animationCheck},animationName:{check:t._animationOtherNotSupport},animationDuration:{check:t._animationOtherNotSupport},animationTimingFunction:{check:t._animationOtherNotSupport},animationDelay:{check:t._animationOtherNotSupport},animationIterationCount:{check:t._animationOtherNotSupport},animationDirection:{check:t._animationOtherNotSupport},animationPlayState:{check:t._animationOtherNotSupport},animationFillMode:{check:t._animationOtherNotSupport},background:{check:t._backgroundOtherCheck},backgroundColor:{check:t._backgroundColorCheck},backgroundImage:{check:t._backgroundImageCheck},borderImage:{check:t._borderImageCheck},borderImageOutset:{check:t._borderImageOutsetCheck},borderImageWidth:{check:t._borderImageWidthCheck},borderRadius:{check:t._borderRadiusCheck},height:{check:t._heightCheck},width:{check:t._widthCheck},zIndex:{check:t._zIndexCheck},fontFamily:{check:null},fontSize:{check:t._fontSizeCheck},fontStyle:{check:t._fontStyleCheck},fontWeight:{check:t._fontWeightCheck},left:{check:t._leftCheck},overflow:{check:t._overflowCheck},top:{check:t._topCheck},visibility:{check:t._visibilityCheck},display:{check:t._displayCheck},color:{check:t._colorCheck},lineHeight:{check:t._lineHeightCheck},textAlign:{check:t._textAlignCheck},whiteSpace:{check:t._whiteSpaceCheck},textOverflow:{check:t._textOverflowCheck},transform:{check:t._transformCheck},transformOrigin:{check:t._transformOriginCheck},transition:{check:t._transitionCheck},transitionProperty:{check:t._transitionOtherCheck},transitionDuration:{check:t._transitionOtherCheck},transitionTimingFunction:{check:t._transitionOtherCheck},transitionDelay:{check:t._transitionOtherCheck},clipPath:{check:t._clipPathCheck},keyframes:{check:t._keyframesCheck},objectFit:{check:t._objectFit},perspective:{check:t._perspectiveCheck},backfaceVisibility:{check:t._backfaceVisibility},transformStyle:{check:t._transformStyleCheck},perspectiveOrigin:{check:t._perspectiveCheck},WebkitTextStroke:{check:t._WebkitTextStroke},textShadow:{check:t._textShadowCheck},JsvVideoRotation:{check:t._JsvVideoRotationCheck},direction:{check:t._directionCheck}},console.log("Using JsView HTML Hook"),window.originDocument={},window.originDocument.headAppendChild=window.document.head.appendChild.bind(window.document.head),window.originDocument.headRemoveChild=window.document.head.removeChild.bind(window.document.head),window.originDocument.createElement=window.document.createElement.bind(window.document),window.originDocument.createTextNode=window.document.createTextNode.bind(window.document),window.originDocument.createComment=window.document.createComment.bind(window.document),window.originDocument.getElementById=window.document.getElementById.bind(window.document),window.originDocument.getElementsByTagName=window.document.getElementsByTagName.bind(window.document),window.originDocument.querySelector=window.document.querySelector.bind(window.document),window.originDocument.createEvent=window.document.createEvent.bind(window.document),window.originDocument.dispatchEvent=window.document.dispatchEvent.bind(window.document),async function(){const{Document:s,ForgeExtension:i,JsvLazySyncCache:n,Log:r}=await Promise.resolve().then((function(){return q})),o=new s;window.myHook=o,window.document.head.appendChild=o.head.appendChild.bind(o.head),window.document.head.removeChild=o.head.removeChild.bind(o.head),window.document.createElement=o.createElement.bind(o),window.document.createTextNode=o.createTextNode.bind(o),window.document.createComment=o.createComment.bind(o),window.document.getElementById=o.getElementById.bind(o),window.document.getElementsByTagName=o.getElementsByTagName.bind(o),window.document.querySelector=o.querySelector.bind(o),window.document.createEvent=o.createEvent.bind(o),window.document.dispatchEvent=o.dispatchEvent.bind(o),window.document.jsvInitFDivRoot=o.jsvInitFDivRoot.bind(o),window.document.jsvGetFDivRoot=o.jsvGetFDivRoot.bind(o),window.document.jsvAppendStyleSheet=function(e){let t=window.originDocument.createElement("style");t.type="text/css",t.innerHTML=e.jsvTextContent,this.getElementsByTagName("Head")[0].appendChild(t)},window.document.jsvGetKeyFrames=function(e,t){let s="";var i=document.styleSheets;for(let t=0;t<i.length;++t){const n=i[t];if(n.cssRules)for(let t=0;t<n.cssRules.length;++t){let i=n.cssRules[t];if(i&&i.name===e){s=i.cssText;break}}}if(!s){const i=window.JsvCode.Dom.StyleSheets;for(const n of t){if(s=i[`${e}-${n.replace("data-v-","")}`],s){document.jsvAppendStyleSheet({jsvTextContent:s});break}}s||(s=i[e],s&&document.jsvAppendStyleSheet({jsvTextContent:s}))}return s&&document.jsvCheckStyleFormat&&document.jsvCheckStyleFormat("keyframes",s),s};let a=window.navigator.userAgent.toLowerCase();window.jsvInAndroidWebView=a.indexOf("android")>=0,window.jsvInAndroidWebView?window.document.jsvCheckStyleFormat=null:window.document.jsvCheckStyleFormat=function(e,s){if(e.startsWith("--"))return;let i=t.get(e);i?i.check&&s&&i.check(e,s):console.error(e+" property is not support.")},i.TextureManager=new e.TextureManager,i.RootView=new e.RootView,o.jsvUpdateRootElement(i.RootView),e.sRenderBridge.AddWillSwapListener("forgeSwap",(()=>{n.SyncAllCachedProperty(),i.ClearUnusedTexSize()})),window.jsvIsBrowserDebug=!0,window.document.jsvAppendStyleSheet({jsvTextContent:"\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 "})}();class s{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")){let t=e.indexOf("(")+1,s=e.lastIndexOf(")");if("undefined"===(e=e.substring(t,s).trim())||"null"===e||0===e.length)return}if(!0===e.startsWith("data:"))return void(this.href=e);let s=e.indexOf("://");if(!(s<0||s>10)||e.startsWith("./")||e.startsWith("/")||(e="./"+e),!0===e.startsWith("/"))e=document.location.origin+e;else if((!0===e.startsWith("./")||!0===e.startsWith("../"))&&void 0!==window.JsView&&void 0!==window.JsView.Dom.JsSubPath){if(void 0===window.JsView.Dom.__MainPath||"undefined"===window.JsView.Dom.__MainPathRef||window.JsView.Dom.__MainPathRef!==document.location.href){window.JsView.Dom.JsSubPath.startsWith("/")||(window.JsView.Dom.JsSubPath="/"+window.JsView.Dom.JsSubPath),window.JsView.Dom.JsSubPath.endsWith("/")||(window.JsView.Dom.JsSubPath=window.JsView.Dom.JsSubPath+"/"),window.JsView.Dom.__MainPathRef=document.location.href;let e=document.location.pathname.lastIndexOf(window.JsView.Dom.JsSubPath);window.JsView.Dom.__MainPath=document.location.origin+document.location.pathname.substring(0,e)+"/"}let t=window.JsView.Dom.__MainPath;e=e.startsWith("./")?t+e.substring(2):t+e}if(this.href=e,!t)return;let i=this.href,n=i.indexOf("#");n>0&&(this.hash=i.substring(n),i=i.substring(0,n));let r=i.indexOf("?");r>1&&(this.search=i.substring(r),i=i.substring(0,r));let o=i,a=o.indexOf("://");this.protocol=a>0?o.substring(0,a+1):"";let l=a>1?o.substring(a+3):"";if(a=l.indexOf("/"),this.host=a>0?l.substring(0,a):"",this.pathname=a>1?l.substring(a):"",this.origin=a>0?this.protocol+"//"+this.host:"",this.host.startsWith("[")){let e=this.host.indexOf("]");this.hostname=this.host.substring(0,e+1),e=this.host.substring(e+1).indexOf(":"),this.port=e>1?this.host.substring(e+1):""}else{let e=this.host.indexOf(":");this.hostname=e>0?this.host.substring(0,e):this.host,this.port=e>1?this.host.substring(e+1):""}}replace(e){this.href=e}}window.JsView&&window.JsView.registerUriConverter?.((e=>new s(e,!1).href));class i{static SetBackgroundColor(t,s,n){const r=i.TextureManager.GetColorTextureCached(s);let o;n&&(o=new e.ViewRoundCornerMask(n.topLeft,n.topRight,n.bottomLeft,n.bottomRight));const a=new e.ExternalTextureSetting(r,o);t.ResetTexture(a)}static SetBackgroundImage(t,n,r,o,a,l,h){let c,d={};if("string"==typeof n){const e=new s(n);if(e instanceof s==!1)throw Error("Bad Argument.",e);d.url=e.href}else"linear-gradient"==n?.type&&(d.gradient=n);if(d.gradient)if(d.gradient.colors?.length>2){const e=d.gradient.colors,t=[e[0],e[e.length-1]],s=e.slice(1,e.length-1);c=i.TextureManager.CreateLinearGradientTexture(t,s)}else 2==d.gradient.colors?.length?c=i.TextureManager.CreateMiniGradientTexture(!0,d.gradient.colors[0],d.gradient.colors[1],d.gradient.rawValue):console.warn("Failed to create backgroundImage gradient, bad colors.",d.gradient.colors);else d.url&&(c=d.url.includes(".gif")||d.url.includes(".webp")?i.TextureManager.GetGifImage(d.url,!1,null,h):i.TextureManager.GetImage2(d.url,!1,a,l||e.ColorSpace.RGBA_8888));if(c){let s;r&&(s=new e.ViewRoundCornerMask(r.topLeft,r.topRight,r.bottomLeft,r.bottomRight));const i=new e.ExternalTextureSetting(c,s);if(t.ResetTexture(i),o){let e=c.RegisterLoadImageCallback(null,(function(){o({width:c.Width,height:c.Height})}));t.RegisterDetachCallback((()=>{c.UnregisterLoadImageCallback(e)}))}}}static SetMaskedBackgroundImage(t,n,r,o){if("string"==typeof n&&(n=new s(n)),n instanceof s==!1)throw Error("Bad Argument.",n);if("string"==typeof r&&(r=new s(r)),r instanceof s==!1)throw Error("Bad Argument(MaskURL).",r);const a=i.TextureManager.GetImage2(n.href,!1,null,o||e.ColorSpace.RGBA_8888);if(a){const s=i.TextureManager.GetImage2(r.href,!1,null,e.ColorSpace.RGBA_8888),n=new e.ExternalTextureSetting(a,new e.ViewTextureMask(s));t.ResetTexture(n)}}static SetVideoTexture(t,s,n){const r=i.TextureManager.GetColorTexture(s);let o;n&&(o=new e.ViewRoundCornerMask(n.topLeft,n.topRight,n.bottomLeft,n.bottomRight));const a=new e.TextureSetting(r,o);t.ResetTexture(a)}static GetTextWidth(t){return t.str||(t.str=""),t.font||(t.font=e.TextUtils._sDefaultFont),t.size||(t.size=e.TextUtils._sDefaultFontSize),"italic"!==t.italic&&(t.italic=""),"bold"!==t.bold&&(t.bold=""),window.PlatformUtils.GetTextWidth(t)}static RequestSwap(){e.sRenderBridge.RequestSwap()}static SetImgTexSize(e,t){let s={size:t,refNum:0};i.TextureInfo.Cache[e.Source]=s}static RefImgTexSize(e,t){let s=i.TextureInfo.Cache[e.Source];s?(s.refNum>0?s.refNum++:s.refNum=1,t(s.size)):e.RegisterLoadImageCallback(null,(function(){const s={width:e.Width,height:e.Height};t(s);let n=i.TextureInfo.Cache[e.Source];if(n)n.refNum>0?n.refNum++:n.refNum=1;else{let t={size:s,refNum:1};i.TextureInfo.Cache[e.Source]=t}}))}static UnrefImgTexSize(e){if(!e)return;let t=i.TextureInfo.Cache[e.Source];t&&(t.refNum--,t.refNum<=0&&i.TextureInfo.Unused.add(e.Source))}static ClearUnusedTexSize(){for(let e of i.TextureInfo.Unused){let t=i.TextureInfo.Cache[e];t.refNum<-2?(delete i.TextureInfo.Cache[e],i.TextureInfo.Unused.delete(e)):t.refNum<=0?t.refNum--:i.TextureInfo.Unused.delete(e)}}}i.TextureInfo={Cache:{},Unused:new Set},i.TextureManager=null,i.RootView=null,i.RootActivity=null,i.HaltKeyEvent=!1,window.ForgeExtension=i;class n{constructor(e){this.target=null,this.timeStamp=Date.now(),this.type=e}initEvent(e,t,s){this.type=e}}class r extends n{constructor(e){super(e),this.keyCode=-1,this.key=-1,this.repeat=0}static JsvGetKeyFromCode(e){return new Map([[r.KeyCode.Enter,r.Key.Enter],[r.KeyCode.ArrowUp,r.Key.ArrowUp],[r.KeyCode.ArrowDown,r.Key.ArrowDown],[r.KeyCode.ArrowLeft,r.Key.ArrowLeft],[r.KeyCode.ArrowRight,r.Key.ArrowRight]])[e]}}r.Type={KEYDOWN:"keydown",KEYUP:"keyup"},r.Key={Enter:"Enter",ArrowUp:"ArrowUp",ArrowDown:"ArrowDown",ArrowLeft:"ArrowLeft",ArrowRight:"ArrowRight"},r.KeyCode={Enter:13,ArrowUp:38,ArrowDown:40,ArrowLeft:37,ArrowRight:39};let o={cnt:0};class a{constructor(e){this.type=e,this.cachedValues=null,this.onSyncCallback=null}setOnSyncCallback(e){this.onSyncCallback=e,this.syncLastCaches(!0)}setCacheProperty(e,t){this.cachedValues||(this.cachedValues={}),this.cachedValues[e]=t,this.syncLastCaches(!1),i.RequestSwap()}syncLastCaches(e){let t=a.LastModified[this.type];if((e||t!==this)&&(a.LastModified[this.type]=this,t&&t.cachedValues&&"function"==typeof t.onSyncCallback)){let e=t.cachedValues;t.cachedValues=null,t.onSyncCallback(e)}}static SyncAllCachedProperty(){for(let e of Object.values(a.LastModified))e.syncLastCaches(!0);o.cnt=(o.cnt+1)%65535}}a.LastModified={};class l{constructor(t){this.activity=new e.ReactActivity("JsViewForgeActivity",t,this.OnKeyDown.bind(this),this.OnKeyUp.bind(this)),this._Init()}_Init(){console.log("JsViewForgeActivity.OnCreate()."),i.TextureManager=this.activity.GetTextureManager(),i.RootView=new e.LayoutView,i.RootActivity=this.activity,document.jsvUpdateRootElement(i.RootView);let t=null;e.DesignMap&&(t=e.DesignMap());let s=t?t.width:1280,n=Math.floor(9*s/16);this.activity.SetContentView(i.RootView,{x:0,y:0,width:s,height:n}),e.sRenderBridge.AddWillSwapListener("forgeSwap",(()=>{a.SyncAllCachedProperty(),i.ClearUnusedTexSize()})),window.JsView.Dom.Render()}OnKeyDown(e){if(i.HaltKeyEvent){let t=new r(r.Type.KEYDOWN);return t.keyCode=e.keyCode,t.repeat=e.repeat,document.dispatchEvent(t),!0}return!1}OnKeyUp(e){if(i.HaltKeyEvent){let t=new r(r.Type.KEYUP);return t.keyCode=e.keyCode,t.key=r.JsvGetKeyFromCode(t.keyCode),t.repeat=e.repeat,document.dispatchEvent(t),!0}return!1}}window.JsView&&(window.JsView.Dom={DesignMap:null,Render:null,Extension:i,UrlRef:s},window.JsView.React=window.JsView.Dom);class h{static SetLevel(e){switch(h.E=h.W=h.I=h.D=function(){},e){case h.Level.Verbose:h.V=console.debug.bind(console);case h.Level.Debug:h.D=console.debug.bind(console);case h.Level.Info:h.I=console.info.bind(console)}}static Throw(...e){throw console.error(...e),[...e]}}h.E=console.error.bind(console),h.W=console.warn.bind(console),h.I=console.info.bind(console),h.D=function(){},h.V=function(){},h.Level={Error:0,Warning:1,Info:2,Debug:3,Verbose:4};class c{constructor(e){this.ownerDocument=window.document,this.nodeType=e,this.parentNode=void 0,this.childNodes=[],this.jsvEventListener=void 0,this.jsvChildChangedCallback=void 0}jsvGetTagName(){return"Unknown"}appendChild(e){this.childNodes.push(e),e.parentNode=this,this.jsvChildChangedCallback?.()}moveChild(e,t,s){let i=this.childNodes.indexOf(e);i<0&&h.Throw("Failed to call Node.removeChild(), node not found. node=",e),this.childNodes.splice(i,1),e.parentNode=void 0,this.jsvChildChangedCallback?.(),t._insertBeforeInner(e,s)}removeChild(e){for(let t=e.childNodes.length-1;t>=0;t--)e.removeChild(e.childNodes[t]);let t=this.childNodes.indexOf(e);t<0&&h.Throw("Failed to call Node.removeChild(), node not found. node=",e),this.childNodes.splice(t,1),e.parentNode=void 0,this.jsvChildChangedCallback?.()}insertBefore(e,t){this._insertBeforeInner(e,t)}_insertBeforeInner(e,t){let s=this.childNodes.length;void 0===t?h.Throw("TypeError: Failed to execute 'insertBefore' on 'Node': 2 arguments required, but only 1 present."):null!==t&&(s=this.childNodes.indexOf(t)),s<0&&h.Throw("Failed to call Node.insertBefore(), before node not found. beforeNode=",t),this.childNodes.splice(s,0,e),e.parentNode=this,this.jsvChildChangedCallback?.()}get previousSibling(){const e=this.parentNode.childNodes;let t=e.indexOf(this);return t<0&&h.Throw("Failed to call Node.previousSibling(), this node not found. this=",this),e[t-1]}get nextSibling(){const e=this.parentNode.childNodes;let t=e.indexOf(this);return t<0&&h.Throw("Failed to call Node.nextSibling(), this node not found. this=",this),e[t+1]}addEventListener(e,t,s){this.jsvEventListener||(this.jsvEventListener={});let i=this.jsvEventListener[e];i||(i=new Set,this.jsvEventListener[e]=i),i.add(t)}removeEventListener(e,t,s){if(!this.jsvEventListener)return;let i=this.jsvEventListener[e];i&&(i.delete(t),i.size<=0&&this.jsvEventListener.hasOwnProperty(e)&&delete this.jsvEventListener[e],0===Object.values(this.jsvEventListener).length&&(this.jsvEventListener=void 0))}dispatchEvent(e){let t=this.jsvEventListener?.[e.type];if(t){e.target||(e.target=document.activeElement);for(let s of t)s(e)}else this.parentNode?this.parentNode.dispatchEvent(e):console.warn("Node.dispatchEvent() Ignore to dispatch event: "+e.type+". No listener added.")}jsvObserveChildChanged(e){this.jsvChildChangedCallback=e}}c.ELEMENT_NODE=1,c.TEXT_NODE=3,c.COMMENT_NODE=8,c.DOCUMENT_NODE=9,c.NOLAYOUT_NODE=10;class d extends n{}d.Type={FOCUS:"focus",BLUR:"blur"};class u extends n{stopPropagation(){}}class v{static ConvertInt(e){return e?"number"==typeof e?Math.floor(e):"string"==typeof e?parseInt(e):e:e}static ConvertFloat(e){if(!e)return e;if("string"!=typeof e)return e;return parseFloat(e)}static ConvertPx(e){if(!e)return e;if("string"!=typeof e)return e;if("0"===e)return 0;if(e.endsWith("px")){return parseInt(e)}return e}static ConvertRect(e){let t=v.SplitString(e," "),s={top:t.length>0?parseInt(t[0]):0,right:t.length>1?parseInt(t[1]):null,bottom:t.length>2?parseInt(t[2]):null,left:t.length>3?parseInt(t[3]):null};return s.right=s.right||0===s.right?s.right:s.top,s.bottom=s.bottom||0===s.bottom?s.bottom:s.top,s.left=s.left||0===s.left?s.left:s.right,s}static ConvertCorner(e){let t=v.SplitString(e," "),s={topLeft:t.length>0?parseInt(t[0]):0,topRight:t.length>1?parseInt(t[1]):null,bottomRight:t.length>2?parseInt(t[2]):null,bottomLeft:t.length>3?parseInt(t[3]):null};return s.topRight=s.topRight||0===s.topRight?s.topRight:s.topLeft,s.bottomRight=s.bottomRight||0===s.bottomRight?s.bottomRight:s.topLeft,s.bottomLeft=s.bottomLeft||0===s.bottomLeft?s.bottomLeft:s.bottomRight,s}static ConvertSize(e){let t=v.SplitString(e," "),s={width:t.length>0?parseInt(t[0]):0,height:t.length>1?parseInt(t[1]):null};return s.height=s.height||0===s.height?s.height:s.width,s}static ConvertAnimation(e){if(null===e||0===e.length)return null;let t=e.indexOf("cubic-bezier"),s=[];if(t>=0){let i=e.indexOf(")"),n=e.substring(t,i+1),r=v.SplitString(e,n);for(let e of r){let t=v.SplitString(e," ");s=s.concat(t)}s.push(n)}else s=v.SplitString(e," ");let i=null,n=0,r=1,o=e.includes("alternate");for(let e=2;e<s.length;e++){if("infinite"===s[e]){r=-1;continue}let t=v.ConvertTimeMs(s[e]);!1===isNaN(t)?n=t:(t=parseFloat(s[e]),!1===isNaN(t)?r=t:i=s[e])}let a=s.length>1?v.ConvertTimeMs(s[1]):0;return{name:s.length>0?s[0]:"",duration:a,timingFunction:v.ConvertEasing(i,a),delay:n,iterationCount:r,direction:o,originStr:e}}static ConvertTransition(e){if(null==e||0==e.length)return null;let t={},s=new Array,i=e.split(",");for(let e=0;e<i.length;e++)if(i[e].indexOf("(")>=0){let t=e;for(;t<i.length&&i[t].indexOf(")")<0;)t++;let n="";for(let s=e;s<=t;s++)s!=e&&(n+=","),n+=i[s];e=t,s=s.concat(n)}else s=s.concat(i[e]);for(let e of s){let s=v.ConvertAnimation(e);if(t[s.name]=s,"all"==s.name){let e=new Array("opacity","left","top","width","height","transform");for(let i of e)t[i]=s}}return t}static ConvertTimeMs(e){e||(e="");let t=NaN;return(e=e.trim()).endsWith("ms")?t=1:e.endsWith("s")&&(t=1e3),t*=parseFloat(e),t}static ConvertEasing(t,s){let i=e.Easing.Circular.InOut;if(!t)return i;if(t.includes("ease"))i=t.includes("-in-out")?e.Easing.Circular.InOut:t.includes("-out")?e.Easing.Circular.Out:t.includes("-in")?e.Easing.Circular.In:e.Easing.Circular.InOut;else if(t.includes("linear"))i=null;else if(t.includes("cubic-bezier")){let n=v.ConvertBezier(t);i=new e.BezierEasing(n.x1,n.y1,n.x2,n.y2,s)}else if(t.includes("steps")){let s=v.ConvertSteps(t);i=new e.StepsEasing(s.steps,s.type)}return i}static ConvertBezier(e){let t=e.indexOf("(");t>=0&&(e=e.substring(t+1));let s=v.SplitString(e,",");return{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}}static ConvertSteps(e){let t=e.indexOf("(");t>=0&&(e=e.substring(t+1));let s=v.SplitString(e,",");return{steps:s.length>0?parseInt(s[0]):1,type:s.length>1?s[1].includes("start")?0:1:0}}static ConvertOverflow(e,t){return e&&!e.includes("visible")?t.HIDDEN:t.VISIBLE}static ConvertObjectFit(e,t){return"symbol"==typeof e?e:(e||(e=""),e.includes("fill")?t.FILL:e.includes("contain")?t.CONTAIN:e.includes("cover")?t.COVER:e.includes("none")?t.NONE:e.includes("scale-down")?t.SCALEDOWN:t.CONTAIN)}static ConvertGradient(e){if(e||(e=""),!(e=e.trim()).startsWith("linear-gradient")&&!e.startsWith("radial-gradient"))return e;let t={rawValue:e},s=e.replace(/.*?\((.*)\)/,"$1"),i=v.SplitStringOutsideParentheses(s,",");if(e.startsWith("linear-gradient")){if(i[0]?.startsWith("to ")||i[0]?.endsWith("deg"))throw i=i.slice(1),new Error("linear-gradient direction or angle is not supported.");i.length<2?console.error("linear-gradient colors is invalid."):(t.type="linear-gradient",t.colors=i)}else if(e.startsWith("radial-gradient"))throw new Error("radial-gradient is not supported.");return t}static SplitString(e,t){e||(e="");let s=e.trim().split(t);if(" "!==t)return s;let i=[];for(let e of s)e&&i.push(e);return i}static SplitStringOutsideParentheses(e,t){let s=[],i=e.split(t);for(let e=0;e<i.length;e++)if(i[e].indexOf("(")>=0){let n=e;for(;n<i.length&&i[n].indexOf(")")<0;)n++;let r="";for(let s=e;s<=n;s++)s!=e&&(r+=t),r+=i[s];e=n,s=s.concat(r.trim())}else s=s.concat(i[e].trim());return s}}class p{constructor(e){if(this.top=null,this.right=null,this.bottom=null,this.left=null,!e||!1===e.startsWith("inset"))return void console.error("Inset.Parse() InvalidArgs: value=",e);let t=e.indexOf("(")+1,s=e.substring(t),i=v.ConvertRect(s);this.top=i.top,this.right=i.right,this.bottom=i.bottom,this.left=i.left}}class g{constructor(e){if(this.source=null,this.slice=null,this.repeat=null,this.outset=null,this.width=null,!e)return void console.error("BorderImage.constructor() InvalidArgs: value=",e);let t=e.indexOf(")")+1,i=e.substring(0,t),n=e.substring(t);this.source=new s(i),this.slice=v.ConvertRect(n)}}class w{constructor(){this.refStyleObject=new Map,this.value=void 0}static AppendRefStyle(e,t,s){let i=w.jsvGetStyleVar(e);i.refStyleObject.has(t)||i.refStyleObject.set(t,[]),i.refStyleObject.get(t).push(s)}static RemoveRefStyle(e){for(const t of w.VariableMap.values())for(const s of t.refStyleObject.keys())s==e&&t.refStyleObject.delete(e)}static UpdateValue(e,t){let s=w.jsvGetStyleVar(e);s.value=t;for(const[e,t]of s.refStyleObject)for(const s of t)e.jsvSetClassProperty(s)}static GetValue(e){return w.jsvGetStyleVar(e).value}static jsvGetStyleVar(e){e.startsWith("--")&&(e=`var(${e})`),w.VariableMap.has(e)||w.VariableMap.set(e,new w);return w.VariableMap.get(e)}}w.VariableMap=new Map;class f{constructor(){this.jsvStore={},this.jsvLazySyncCache=new a("style"),this.jsvLockedProps={},this.jsvNamedClassArray=null,this.jsvCustomStyles={},this.jsvLazyPrevClassNames=null,this.jsvLazyPrevInheritedClassNames=null,this.jsvLazyClassNames=null,this.jsvLazyInheritedClassNames=null,this.jsvLazyClassAttributes=null}setProperty(e,t){"function"==typeof document.jsvCheckStyleFormat&&document.jsvCheckStyleFormat(e,t),this.jsvLockedProps[e]=!0,t=f.JsvConvertPropValue(e,t),this.jsvUpdateProperty(e,t)}getPropertyValue(e){if(void 0!==this.jsvStore[e])return this.jsvStore[e];let t=this.jsvGetClassPropValue(this.jsvLazyClassNames,this.jsvLazyClassAttributes,e);return t?(e==f.PROP.ANIMATION?t=v.ConvertAnimation(t):e==f.PROP.TRANSITION&&(t=v.ConvertTransition(t)),e==f.PROP.BACKGROUNDIMAGE&&(t=v.ConvertGradient(t)),t):(t=this.jsvGetClassPropValue(this.jsvLazyInheritedClassNames,this.jsvLazyClassAttributes,e),t?(e==f.PROP.ANIMATION?t=v.ConvertAnimation(t):e==f.PROP.TRANSITION&&(t=v.ConvertTransition(t)),e==f.PROP.BACKGROUNDIMAGE&&(t=v.ConvertGradient(t)),t):void 0)}jsvDestory(){w.RemoveRefStyle(this)}jsvUpdateProperty(e,t){let s=this.jsvSetPropertySilently(e,t);s&&this.jsvLazySyncCache.setCacheProperty(s,!0)}jsvSetPropertySilently(e,t){if(e.startsWith("--"))return void w.UpdateValue(e,t);if("string"==typeof t&&t.startsWith("var(--"))return void w.AppendRefStyle(t,this,e);if("animation"===e){if(this.jsvStore[e]?.originStr===t?.originStr)return null}else if(this.jsvStore[e]===t)return null;return this.jsvStore[e]=t,f.JsvGetStyleType(e)}jsvApplyClasses(t,s){if(t)if(t.indexOf("JsvStyle_")<0){s?(this.jsvLazyPrevInheritedClassNames=this.jsvLazyInheritedClassNames,this.jsvLazyInheritedClassNames=t.split(" ")):(this.jsvLazyPrevClassNames=this.jsvLazyClassNames,this.jsvLazyClassNames=t.split(" "));const e=f.TYPE.CLASS_NAME;this.jsvLazySyncCache.setCacheProperty(e,!0)}else if(t){let s=t.split(" "),i={};this.jsvNamedClassArray=new Array(s.length);let n=0;for(let t of s){let s=null;if(e.ReactUtils.StyleClassMap.hasOwnProperty(t)){s=e.ReactUtils.StyleClassMap[t];let n=s.getAttach();if(null==n){let e=s.getStyles();n={altStyles:{},hasTextMajorStyle:0,textPackAttr:null};for(let t in e)n.altStyles[t]=f.JsvConvertPropValue(t,e[t]);s.updateAttach(n)}"text"===s.classType()&&(n.hasTextMajorStyle=2,null===n.textPackAttr&&(n.textPackAttr={textLineAlign:s.getLineAlign(),textVerticalAlign:s.getVerticalAlign()}),this.jsvCustomStyles.textLineAlign=n.textPackAttr.textLineAlign,this.jsvCustomStyles.textVerticalAlign=n.textPackAttr.textVerticalAlign),Object.assign(i,n.altStyles)}else console.error("Error: className not found");this.jsvNamedClassArray[n]=s,n++}for(let e in i)this.jsvLockedProps[e]||this.jsvUpdateProperty(e,i[e])}}jsvAppendClassAttribute(e){this.jsvLazyClassAttributes||(this.jsvLazyClassAttributes=new Set),this.jsvLazyClassAttributes.add(e);const t=f.TYPE.CLASS_NAME;this.jsvLazySyncCache.setCacheProperty(t,!0)}jsvSetClassProperty(e){let t=f.JsvGetStyleType(e);t&&this.jsvLazySyncCache.setCacheProperty(t,!0)}jsvGetClassPropValue(e,t,s){if(!e)return;const i=(e,t,s,i)=>{for(let n=t.length-1;n>=0;n--){let r=t[n];if(s&&(r+="["+s+"]"),!e.hasOwnProperty(r))continue;const o=e[r];if(!o.hasOwnProperty(i))continue;let a=o[i];return"string"==typeof a&&a.startsWith("var(--")&&(a=w.GetValue(a)),a}},n=window.JsvCode.Dom.StyleSheets;for(const r of t??[]){const t=i(n,e,r,s);if(t)return t}return i(n,e,null,s)}jsvGetClassDeclarations(e,t){if(!e)return;const s=(e,t,s)=>{let i={};for(let n=0;n<t.length;n++){let r=t[n];if(s&&(r+="["+s+"]"),!e.hasOwnProperty(r))continue;const o=e[r];Object.assign(i,o)}return i},i=window.JsvCode.Dom.StyleSheets;let n=s(i,e,null);for(const r of t??[]){const t=s(i,e,r);Object.assign(n,t)}return n}jsvUpdateChangedClasses(e,t,s){h.D("jsvGetChangedClassTypes() classNames="+e);let i={};if(t){w.RemoveRefStyle(this);const e=this.jsvGetClassDeclarations(t,s);for(const t of Object.keys(e)){i[f.JsvGetStyleType(t)]=!0}t=null}if(e){const t=this.jsvGetClassDeclarations(e,s);for(const[e,s]of Object.entries(t)){i[f.JsvGetStyleType(e)]=!0,"string"==typeof s&&s.startsWith("var(--")&&w.AppendRefStyle(s,this,e)}}return i}jsvSetChangedListener(e){let t=null;e&&(t=t=>{if(t.hasOwnProperty(f.TYPE.CLASS_NAME)){let e=this.jsvUpdateChangedClasses(this.jsvLazyClassNames,this.jsvLazyPrevClassNames,this.jsvLazyClassAttributes);Object.assign(t,e),e=this.jsvUpdateChangedClasses(this.jsvLazyInheritedClassNames,this.jsvLazyPrevInheritedClassNames,this.jsvLazyClassAttributes),Object.assign(t,e),t[f.TYPE.CLASS_NAME]=void 0}e(t)}),this.jsvLazySyncCache.setOnSyncCallback(t)}static JsvContainsTextMajor(e){for(let t of f.TextClassMajorStyles)if(e.hasOwnProperty(t))return!0;return!1}static JsvGetStyleType(e){switch(e){case f.PROP.LEFT:case f.PROP.RIGHT:case f.PROP.TOP:case f.PROP.BOTTOM:case f.PROP.ZINDEX:return f.TYPE.LAYOUT_POS;case f.PROP.TRANSFORM:case f.PROP.TRANSFORMORIGIN:return f.TYPE.TRANSFORM;case f.PROP.WIDTH:case f.PROP.HEIGHT:case f.PROP.VISIBILITY:case f.PROP.DISPLAY:case f.PROP.CLIPPATH:case f.PROP.OVERFLOW:case f.PROP.OBJECTFIT:case f.PROP.PERSPECTIVE:case f.PROP.PERSPECTIVEORIGIN:case f.PROP.BACKFACEVISIBILITY:case f.PROP.TRANSFORMSTYLE:case f.PROP.JSVVIDEOROTATION:return f.TYPE.LAYOUT_SIZE;case f.PROP.BACKGROUNDCOLOR:case f.PROP.BACKGROUNDIMAGE:case f.PROP.BORDERRADIUS:return f.TYPE.BACKGROUND;case f.PROP.COLOR:case f.PROP.LINEHEIGHT:case f.PROP.WHITESPACE:case f.PROP.FONTFAMILY:case f.PROP.FONTSIZE:case f.PROP.FONTSTYLE:case f.PROP.FONTWEIGHT:case f.PROP.TEXTALIGN:case f.PROP.TEXTSHADOW:case f.PROP.TEXTOVERFLOW:case f.PROP.WEBKITTEXTSTROKE:case f.PROP.DIRECTION:return f.TYPE.FOREGROUND;case f.PROP.BORDERIMAGE:case f.PROP.BORDERIMAGEWIDTH:case f.PROP.BORDERIMAGEOUTSET:return f.TYPE.BORDER;case f.PROP.ANIMATION:return f.TYPE.ANIMATION;case f.PROP.TRANSITION:return f.TYPE.TRANSITION;case f.PROP.OPACITY:break;default:return console.warn("Unknown style type for: "+e),null}}static JsvConvertPropValue(e,t){if(void 0===t)return t;if(e.startsWith("--")||t?.startsWith?.("var(--"))return t;switch(e){case f.PROP.TOP:case f.PROP.BOTTOM:case f.PROP.LEFT:case f.PROP.RIGHT:case f.PROP.WIDTH:case f.PROP.HEIGHT:case f.PROP.JSVVIDEOROTATION:return v.ConvertInt(t);case f.PROP.VISIBILITY:case f.PROP.DISPLAY:return t.toUpperCase();case f.PROP.OVERFLOW:return v.ConvertOverflow(t,f.Overflow);case f.PROP.OBJECTFIT:return v.ConvertObjectFit(t,f.ObjectFit);case f.PROP.TRANSFORM:case f.PROP.TRANSFORMORIGIN:return t;case f.PROP.CLIPPATH:return new p(t);case f.PROP.BORDERIMAGE:return new g(t);case f.PROP.BORDERIMAGEWIDTH:case f.PROP.BORDERIMAGEOUTSET:return v.ConvertRect(t);case f.PROP.BORDERRADIUS:return v.ConvertCorner(t);case f.PROP.ANIMATION:return v.ConvertAnimation(t);case f.PROP.TRANSITION:return v.ConvertTransition(t);case f.PROP.OPACITY:return v.ConvertFloat(t);case f.PROP.BACKGROUNDIMAGE:return v.ConvertGradient(t);default:return v.ConvertPx(t)}}}f.Overflow={HIDDEN:Symbol("hidden"),VISIBLE:Symbol("visible")},f.ObjectFit={FILL:Symbol("fill"),CONTAIN:Symbol("contain"),COVER:Symbol("cover"),NONE:Symbol("none"),SCALEDOWN:Symbol("scale-down")},f.TextClassMajorStyles=new Set(["textOverflow","wordWrap","textShadow","color","fontFamily","fontStyle","fontWeight","textAlign","WebkitTextStroke","direction"]),f.TYPE={LAYOUT_POS:"layout-position",LAYOUT_SIZE:"layout-size",FOREGROUND:"foreground",BACKGROUND:"background",BORDER:"border",ANIMATION:"animation",TRANSFORM:"transform",TRANSITION:"transition",CLASS_NAME:"class-name"},f.PROP={TOP:"top",BOTTOM:"bottom",LEFT:"left",RIGHT:"right",WIDTH:"width",HEIGHT:"height",VISIBILITY:"visibility",DISPLAY:"display",BACKFACEVISIBILITY:"backfaceVisibility",CLIPPATH:"clipPath",OVERFLOW:"overflow",OBJECTFIT:"objectFit",TRANSFORM:"transform",TRANSFORMORIGIN:"transformOrigin",PERSPECTIVE:"perspective",PERSPECTIVEORIGIN:"perspectiveOrigin",ZINDEX:"zIndex",TRANSFORMSTYLE:"transformStyle",BACKGROUNDCOLOR:"backgroundColor",BACKGROUNDIMAGE:"backgroundImage",BORDERRADIUS:"borderRadius",COLOR:"color",LINEHEIGHT:"lineHeight",WHITESPACE:"whiteSpace",FONTFAMILY:"fontFamily",FONTSIZE:"fontSize",FONTSTYLE:"fontStyle",FONTWEIGHT:"fontWeight",TEXTALIGN:"textAlign",TEXTSHADOW:"textShadow",TEXTOVERFLOW:"textOverflow",WEBKITTEXTSTROKE:"WebkitTextStroke",DIRECTION:"direction",BORDERIMAGE:"borderImage",BORDERIMAGEWIDTH:"borderImageWidth",BORDERIMAGEOUTSET:"borderImageOutset",ANIMATION:"animation",TRANSITION:"transition",OPACITY:"opacity",JSVVIDEOROTATION:"JsvVideoRotation"};for(let e in f.PROP){let t=f.PROP[e];Object.defineProperty(f.prototype,t,{set:function(e){this.setProperty(t,e)},get:function(){return this.getPropertyValue(t)}})}let m=null;class y{static getHandlers(e){const t=y.reactEventHandlers(e);return t||(e._vei?e._vei:{})}static reactEventHandlers(e){return null==m&&y._getReactToken(e),e["__reactProps$"+m]??e["__reactEventHandlers$"+m]}static _getReactToken(e){for(let t in e)if(t.indexOf("__reactProps")>=0||t.indexOf("__reactEventHandlers")>=0||t.indexOf("__reactInternalInstance")>=0){let e=t.indexOf("$");m=t.substring(e+1);break}}}class j extends c{constructor(t){super(c.ELEMENT_NODE),this.parentElement=null,this.tagName=this.jsvGetTagName(),this.tagName===j.TAG.STYLE?(this.style=null,this.jsvMainView=null,this.jsvMaskView=null):(this.style=new f,this.jsvMainView=new e.LayoutView,this.jsvMaskView=null),this.jsvAnimation=null,this.jsvStore={transition:null,transitionTmp:null,textContent:null,textStylePack:null,clientWidth:NaN,clientHeight:NaN,textureWidth:NaN,textureHeight:NaN,scopedAttributes:[]},this.jsvAttrChangedLazySync=null,this.instantSwapCallback=null,this.eventHandlers=null,this.jsvInheritClassDepth=null,this.jsvHasInheritClassChildren=!1}appendChild(e){null!=e.parentNode?this._moveChildNode(e,null):(super.appendChild(e),this.jsvInsertChild(e,null))}removeChild(e){this.jsvRemoveChild(e),super.removeChild(e)}insertBefore(e,t){null!=e.parentNode?this._moveChildNode(e,t):(super.insertBefore(e,t),this.jsvInsertChild(e,t))}_moveChildNode(e,t){let s=e.parentNode;if(s.moveChild(e,this,t),e.jsvMaskView){(s.jsvMaskView?s.jsvMaskView:s.jsvMainView).MoveChildView(e.jsvMaskView,this.jsvMaskView?this.jsvMaskView:this.jsvMainView,t?t.jsvMaskView:null),console.log("moving child")}else console.log("moving not forge child")}get childElementCount(){return this.childNodes.length}get firstElementChild(){return this.childNodes.length>0?this.childNodes[0]:null}get lastElementChild(){const e=this.childNodes.length;return e>0?this.childNodes[e-1]:null}set className(e){this.setAttribute("class",e)}setAttribute(e,t){e&&("style"!==e?(this[e]=t,e.startsWith("data-v-")?this._jsvAppendScopedAttribute(e,0):"class"===e?this._jsvSetClassNames(t,0):"jsv-inherit-class"===e?this._jsvSetInheritClassDepth(parseInt(t)):e.startsWith(j.ATTRIBUTE.JSVPREFIX)?(e=e.replace(/-/g,"_"),this.jsvSetAttrLazySync(e,j.ATTRTYPE.JSV)):window.JsView||"id"!==e||this.jsvMainView.Element&&(this.jsvMainView.Element.id=t)):console.warn("directly style setting be ignored"))}jsvSetAttrLazySync(e,t){this.jsvAttrChangedLazySync||(this.jsvAttrChangedLazySync=new a("lazy-attr"),this.parentElement&&this._jsvSetAttrLazySyncCallback()),this.jsvAttrChangedLazySync.setCacheProperty(e,t)}removeAttribute(e){this[e]=void 0,e.startsWith(j.ATTRIBUTE.JSVPREFIX)&&this.jsvSetAttrLazySync(e,j.ATTRTYPE.JSV)}getAttribute(e){return this[e]}hasAttribute(e){return console.log("Element.hasAttribute() name="+e),!!this[e]}getBoundingClientRect(){return null!=this.jsvMainView?this.jsvMainView.GetBoundingClientRect():Promise.reject(new Error("getBoundingClientRect while jsvMainView is null."))}get clientWidth(){return isNaN(this.jsvStore.clientWidth)?this.style.width:this.jsvStore.clientWidth}get clientHeight(){return isNaN(this.jsvStore.clientHeight)?this.style.height:this.jsvStore.clientHeight}focus(){console.log("Element.focus()"),document.activeElement&&document.activeElement.onfocus();let e=document.activeElement;if(document.activeElement=this,e){let t=new d(d.Type.BLUR);t.target=e,document.dispatchEvent(t)}let t=new d(d.Type.FOCUS);document.dispatchEvent(t)}jsvInsertChild(e,t){if(e.parentElement=this,e.nodeType===c.ELEMENT_NODE&&e.tagName!==j.TAG.STYLE){if(!1===document.jsvIsReady)return void console.warn("Element.appendChild() Failed to append child to Forge. jsvIsReady="+document.jsvIsReady);e.jsvOnLoadForgeView(),e.style.jsvSetChangedListener(e.jsvOnStyleChanged.bind(e)),t=this.jsvBackwardFindForgeView(t);let s=e.jsvMaskView.GetLayoutParams();this.jsvMainView.InsertView(e.jsvMaskView,t?t.jsvMaskView:null,s),(e.jsvInheritClassDepth>0||e.jsvHasInheritClassChildren)&&(this.jsvHasInheritClassChildren=!0)}else e.nodeType===c.TEXT_NODE&&(this.textContent=e.textContent)}jsvGetProxyView(e){return e?this.jsvMaskView:this.jsvMainView}jsvRemoveChild(e){e.parentElement=null,e.jsvAttrChangedLazySync=null,e.style?.jsvSetChangedListener(null),e.style?.jsvDestory(),e.jsvAnimation?.Cancel(),e.jsvAnimation=null,e instanceof j&&this.jsvMainView.RemoveView(e.jsvMaskView)}jsvOnLoadForgeView(){if(this.style.clipPath||this.style.overflow||this.style.objectFit){if(this.jsvMaskView)throw Error("Jsview: jsvMaskView is conflicting.");this.jsvMaskView=new e.ClipView}else this.jsvMaskView||(this.jsvMaskView=this.jsvMainView);this.jsvMaskView!==this.jsvMainView&&this.jsvMaskView.AddView(this.jsvMainView);let t=this.jsvCallbackOnUnloadForgeView();t&&this.jsvMainView.RegisterDetachCallback(t),this._jsvSetAttrLazySyncCallback()}_jsvSetAttrLazySyncCallback(){if(this.jsvAttrChangedLazySync){let e=this;this.jsvAttrChangedLazySync.setOnSyncCallback((t=>{let s=null,i=null;for(let n in t)if(e.hasOwnProperty(n))switch(t[n]){case j.ATTRTYPE.JSV:null==s&&(s={}),s[n]=e[n];break;case j.ATTRTYPE.CSS:null==i&&(i={}),i[n]=e[n]}s&&(s=e.jsvSetElementPropOnMask(s),e.jsvSetElementProp(s)),i&&e.jsvOnAttrLazySync(i)}))}}jsvOnAttrLazySync(e){}jsvSetElementProp(e){this.jsvMainView&&this.jsvMainView.SetElementProp(e,i.RootActivity)}jsvSetElementPropOnMask(e){if(e.hasOwnProperty("jsv_poster_on_top")){let{jsv_poster_on_top:t,...s}=e;return this.jsvMaskView.SetElementProp({jsv_poster_on_top:t},i.RootActivity),s}return e}jsvCallbackOnUnloadForgeView(){return null}jsvOnStyleChanged(e){let t=!!e[f.TYPE.LAYOUT_SIZE],s=!1;e[f.TYPE.LAYOUT_POS]&&(t||(this.jsvFlushViewLayout(),s=!0)),e[f.TYPE.LAYOUT_SIZE]&&(this.jsvFlushViewLayout(),s=!0),e[f.TYPE.TRANSFORM]&&!s&&(this.jsvMaskView.ResetCssTransform(this.style.transform,this.style.transformOrigin),this.jsvFlushViewTransition(),s=!0),e[f.TYPE.BACKGROUND]&&this.jsvFlushViewBackground(),e[f.TYPE.ANIMATION]&&this.jsvFlushViewAnimation(),e[f.TYPE.TRANSITION]&&!s&&this.jsvFlushViewTransition(),this.jsvFlushEventHandlers()}jsvFlushEventHandlers(){null===this.eventHandlers&&(this.eventHandlers=y.getHandlers(this),this.eventHandlers&&this.eventHandlers.onClick&&this.jsvMainView&&this.jsvMainView.EnableDivTouch(this,null))}jsvApplyObjectFit(e){return null}jsvFlushViewLayout(){if((this.style.clipPath||this.style.overflow||this.style.objectFit)&&!this.jsvMaskView)return void console.error("Element.jsvFlushViewLayout() InvalidOpt: clippath=",this.style.clipPath);const t={x:isNaN(this.style.left)?0:this.style.left,y:isNaN(this.style.top)?0:this.style.top,width:isNaN(this.style.width)?0:this.style.width,height:isNaN(this.style.height)?0:this.style.height};let s=null;if(this.style.objectFit&&(s=this.jsvApplyObjectFit(t),this.style.objectFit===f.ObjectFit.FILL&&(s=null)),this.jsvMaskView.ResetCssTransform(this.style.transform,this.style.transformOrigin),this.style.perspective&&this.style.perspective>0){let e=this.style.perspectiveOrigin?this.style.perspectiveOrigin:null;this.jsvMainView.SetPerspective(this.style.perspective,e)}if(this.style.backfaceVisibility&&this.jsvMainView.SetBackfaceVisibility("visible"==this.style.backfaceVisibility),this.style.transformStyle&&this.jsvMainView.SetTransformStyle(this.style.transformStyle),this.jsvMaskView.ResetLayoutParams({x:t.x,y:t.y,width:this.clientWidth,height:this.clientHeight}),this.jsvMaskView!==this.jsvMainView){const e={x:0,y:0,width:this.jsvMaskView.LayoutParams.Width,height:this.jsvMaskView.LayoutParams.Height};this.jsvMainView.ResetLayoutParams(e)}let i=this.style.visibility;"NONE"==this.style.display&&(i="HIDDEN"),this.jsvMaskView.SetVisibility(i);let n=null;null!==s&&window.JsView?n={x:s.x,y:s.y,width:s.width,height:s.height}:this.style.clipPath?n={x:this.style.clipPath.left,y:this.style.clipPath.top,width:this.jsvMaskView.LayoutParams.Width-this.style.clipPath.left-this.style.clipPath.right,height:this.jsvMaskView.LayoutParams.Height-this.style.clipPath.top-this.style.clipPath.bottom}:this.style.overflow===f.Overflow.HIDDEN&&null===this.jsvStore.textContent&&(n={x:0,y:0,width:this.style.width,height:this.style.height}),n?this.jsvMaskView.SetClipRect(n.x,n.y,n.width,n.height,!0):this.jsvMaskView instanceof e.ClipView&&this.jsvMaskView.SetClipRect(0,0,0,0,!1),void 0!==this.style.zIndex&&null!==this.style.zIndex&&this.jsvMaskView.SetZIndex(this.style.zIndex),this.jsvFlushViewTransition()}jsvFlushViewBackground(){this.style.backgroundImage?(this.jsvStore.textureWidth=NaN,this.jsvStore.textureHeight=NaN,i.SetBackgroundImage(this.jsvMainView,this.style.backgroundImage,this.style.borderRadius)):this.style.backgroundColor?(this.jsvStore.textureWidth=NaN,this.jsvStore.textureHeight=NaN,i.SetBackgroundColor(this.jsvMainView,this.style.backgroundColor,this.style.borderRadius)):this.jsvMainView.ResetTexture(null)}jsvFlushViewAnimation(){if(this.jsvAnimation&&this.jsvAnimation.Cancel(),!this.style.animation)return;let t=document.jsvGetKeyFrames(this.style.animation.name,this.jsvStore.scopedAttributes);this.jsvAnimation=new e.CssKeyframeAnimation(t,this.style.animation.duration,this.style.animation.timingFunction,this.style.width?this.style.width:this.clientWidth,this.style.height),this.jsvAnimation.EnableDelay(this.style.animation.delay).SetRepeat(this.style.animation.iterationCount),"forwards"===this.style.animationFillMode&&this.jsvAnimation.Enable(e.AnimationEnable.KeepTransform);var s=this;let i=new e.AnimationListener;i.OnEnd((t=>{if(s.jsvAnimation=null,t){let t=new u("animationend");t.target=s,s.dispatchEvent(t),null==s.instantSwapCallback&&(s.instantSwapCallback=e.sRenderBridge.InstantPerformSwap.bind(e.sRenderBridge)),Promise.resolve().then(s.instantSwapCallback)}})),this.jsvAnimation.Enable(e.AnimationEnable.ReleaseAfterEndCallback),this.jsvAnimation.SetAnimationListener(i),this.jsvMaskView.StartAnimation(this.jsvAnimation)}jsvFlushViewTransition(){if(this.style.animation)return;if(null!=this.jsvStore.transitionTmp&&this.jsvStore.transitionTmp.syncTimes!=o.cnt&&-1!=this.jsvStore.transitionTmp.syncTimes){let e=this.jsvStore.transition;this.jsvStore.transition=this.jsvStore.transitionTmp,this.jsvStore.transitionTmp=e,null!=this.jsvStore.transitionTmp&&(this.jsvStore.transitionTmp.syncTimes=-1)}if(this.style.transition){if(this.jsvStore.transition){if(!this._JsvBuildTransition())return}}else this.jsvAnimation&&(this.jsvAnimation.Cancel(),this.jsvAnimation=null);let e=this.jsvStore.transitionTmp;e||(e={left:0,top:0,width:0,height:0,opacity:1,transform:null,syncTimes:-1}),e.left=this.style.left,e.top=this.style.top,e.width=this.style.width,e.height=this.style.height,e.opacity=this.style.opacity,e.transform=this.style.transform,e.syncTimes=o.cnt,this.jsvStore.transitionTmp=e}_JsvBuildTransition(){let t=[];for(let e in this.style.transition){let s=this.jsvStore.transition[e],i=this.style[e];if(s===i)continue;let n=this.style.transition[e],r={name:e,dur:Math.round(n.duration),tf:null,dly:Math.round(n.delay),from:s||"",to:i};"transform"===e&&(r.origin=this.style.transformOrigin?this.style.transformOrigin:"center center"),n.timingFunction&&(r.tf=n.timingFunction.Package()),t.push(r)}if(t.length<=0)return!1;var s=this;let i=new e.AnimationListener;return i.OnEnd((t=>{if(s.jsvAnimation=null,t){let t=new u("transitionend");t.target=s,s.dispatchEvent(t),null==s.instantSwapCallback&&(s.instantSwapCallback=e.sRenderBridge.InstantPerformSwap.bind(e.sRenderBridge)),Promise.resolve().then(s.instantSwapCallback)}})),this.jsvAnimation=new e.CssTransitionAnimation(t),this.jsvAnimation.SetAnimationListener(i),this.jsvMaskView.StartAnimation(this.jsvAnimation),!0}jsvBackwardFindForgeView(e){let t=e;for(;t&&!(t instanceof j);)t=t.nextSibling;return t}static applyObjectFitCommon(e,t,s){if(s&&!isNaN(e.jsvStore.textureWidth)&&!isNaN(e.jsvStore.textureHeight)){const i=e.style.objectFit,n=s.ApplyObjectFit(t.width,t.height,e.jsvStore.textureWidth,e.jsvStore.textureHeight,i,f.ObjectFit);return 0!==t.width&&0!==t.height||0===t.width&&0===t.height||(e.jsvStore.clientWidth=Math.max(t.width,n.width),e.jsvStore.clientHeight=Math.max(t.height,n.height)),n}return null}_jsvAppendScopedAttribute(e,t){if(0!=t&&this.jsvInheritClassDepth!=t||(this.jsvStore.scopedAttributes.push(e),this.jsvStore.clientWidth=NaN,this.jsvStore.clientHeight=NaN,this.style.jsvAppendClassAttribute(e)),this.jsvHasInheritClassChildren){t=this.jsvInheritClassDepth==t?1:t+1;for(const s of this.childNodes)s.jsvInheritClassDepth<=0&&0==s.jsvHasInheritClassChildren||s instanceof j&&(s.jsvStore.scopedAttributes.includes(e)||s._jsvAppendScopedAttribute(e,t))}}_jsvSetClassNames(e,t){if(0!=t&&this.jsvInheritClassDepth!=t||this.style.jsvApplyClasses(e,this.jsvInheritClassDepth==t),this.jsvHasInheritClassChildren){t=this.jsvInheritClassDepth==t?1:t+1;for(const s of this.childNodes)s.jsvInheritClassDepth<=0&&0==s.jsvHasInheritClassChildren||s instanceof j&&s._jsvSetClassNames(e,t)}}_jsvSetInheritClassDepth(e){if(e<=0)return;this.jsvInheritClassDepth=e;let t=this;for(let s=0;s<e&&(t=t.parentNode,t);s++);if(t){for(const s of t.jsvStore.scopedAttributes)this._jsvAppendScopedAttribute(s,e);this._jsvSetClassNames(t.class,e)}}}j.TAG={DIV:"DIV",IMAGE:"IMAGE",LINK:"LINK",STYLE:"STYLE",AUDIO:"AUDIO",VIDEO:"VIDEO",ANCHOR:"A",SVG:"SVG",FDIV:"FDIV",AUDIOTRACK:"AUDIOTRACK"},j.ATTRIBUTE={SRC:"src",JSVPREFIX:"jsv"},j.ATTRTYPE={JSV:Symbol("jsv"),CSS:Symbol("css")};class C extends j{constructor(){super(),console.warn("Warnig: <a> is fake in JsView system"),this.href="",this.protocol="",this.host="",this.search="",this.hash="",this.hostname="",this.port="",this.pathname=""}jsvGetTagName(){return j.TAG.ANCHOR}}class S extends j{constructor(e){super(),this.jsvMediaView=null,this.jsvMedia=null,this.onVisibilityChange=this.onVisibilityChange.bind(this),this.stopByOnHide=!1,this.playBackground=!1,e&&(this.srcValue=e)}addEventListener(e,t,s){e=e.replace(/-/g,""),super.addEventListener(e,t,s),this.jsvAddMediaListener(e)}jsvOnLoaded(){}set src(e){if(e&&"about:null"!==e&&"about:blank"!==e){e=new s(e).href}this.jsvMedia||this.jsvInit(),e!==this.jsvMedia.src&&(this.jsvMedia.src=e,this.srcValue=e)}jsvOnLoadForgeView(){console.log("MediaElement jsvOnLoadForgeView"),super.jsvOnLoadForgeView(),this.jsvMedia||this.jsvInit(),this.registerOnVisibilityChange()}jsvInit(){let e=this.jsvEventListener;if(e)for(var t in e.keys)this.jsvAddMediaListener(t);Promise.resolve().then((()=>{this.jsvMedia&&this.jsvMedia.confirmInitSetup?.()}))}jsvCallbackOnUnloadForgeView(){return this.jsvOnUnloadForgeView.bind(this)}jsvOnUnloadForgeView(){console.log("MediaElement jsvOnUnloadForgeView"),this.unregisterOnVisibilityChange(),this.jsvMediaView&&(this.jsvMediaView=null),this.jsvRelease()}jsvRelease(){this.jsvMedia&&(this.jsvMedia.pause(),this.jsvMedia.unload&&this.jsvMedia.unload(),this.jsvMedia.releaseResource&&(this.jsvMedia.releaseResource(),this.jsvMedia.onPlatformDestroy())),this.jsvEventListener=void 0}jsvAddMediaListener(e){}onJsViewHide(){this.jsvMedia&&(this.jsvMedia.paused||(this.stopByOnHide=!0),this.jsvMedia.unload())}onJsViewShow(){this.jsvMedia||this.jsvInit(),this.jsvMedia.src=this.srcValue,this.stopByOnHide&&(this.stopByOnHide=!1,this.jsvMedia.play())}onVisibilityChange(e){this.playBackground||("show"===e.status?this.onJsViewShow():"hide"===e.status&&this.onJsViewHide())}registerOnVisibilityChange(){window.JsView&&window.JsView.onVisibilityChange(this.onVisibilityChange)}unregisterOnVisibilityChange(){window.JsView&&window.JsView.removeEventCallback(this.onVisibilityChange)}setAttribute(e,t){"jsv_play_background"!==e?super.setAttribute(e,t):this.playBackground="true"===t}}S.HOOKS={Audio:Audio,Video:window._ExtVideo,OffscreenVideo:window._ExtOVP},S.PROP={SetOnly:["autoplay","loop","timeupdateless","predownload"],GetOnly:["duration","paused"],SetAndGet:["currentTime","muted","playbackRate","preload","volume"],Function:["load","pause","play","unload","confirmInitSetup"]};for(let e in S.PROP){let t=S.PROP[e];for(let s of t){let t={};"SetOnly"!==e&&"SetAndGet"!==e||(t.set=function(e){this.jsvMedia||this.jsvInit(),this.jsvMedia[s]=e}),"GetOnly"!==e&&"SetAndGet"!==e||(t.get=function(){return this.jsvMedia||this.jsvInit(),this.jsvMedia[s]}),"Function"===e&&(t=function(...e){return this.jsvMedia||this.jsvInit(),this.jsvMedia[s]?this.jsvMedia[s](...e):null}),t instanceof Function?S.prototype[s]=t:Object.defineProperty(S.prototype,s,t)}}class O extends S{constructor(e){super(e),this.jsvOverrideMedia=!1,console.log("AudioElement.constructor()",this)}jsvGetTagName(){return j.TAG.AUDIO}jsvInit(){this.jsvOverrideMedia||(this.jsvMedia=new S.HOOKS.Audio),super.jsvInit(),this.jsvOnLoaded()}jsvOnLoaded(){this.jsvMediaView=new e.LayoutView,this.jsvMainView.AddView(this.jsvMediaView)}jsvAddMediaListener(e){this.jsvMedia||this.jsvInit(),this.jsvMedia.addEventListener(e,(()=>{let t=new n(e);t.target=this,this.dispatchEvent(t)}))}jsvRelease(){super.jsvRelease(),this.jsvMedia=null}setAttribute(e,t){if("data-jsv-audio-predownload"==e)return this.jsvMedia||this.jsvInit(),void(this.jsvMedia.predownload=!0);super.setAttribute(e,t)}}class T{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){T._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){T._putPack(this._TempMap,this._TempTrackList,this._TempIdx,e,t),this._TempIdx=(this._TempIdx+1)%this._TempMax}static _putPack(e,t,s,i,n){let r=t[s];r&&(e.delete(r),t[s]=i),e.set(i,n)}}let b=new T;class E extends j{constructor(){super(),this.jsvContentView=null,this.jsvRefedImgTex=null,this.jsvTextLatexEnable=!1,this.jsvEmoji=!1,this.jsvTextAlignMinWidth=NaN,this.jsvEmptyRect=null}jsvGetTagName(){return j.TAG.DIV}get textContent(){return this.jsvStore.textContent}set textContent(t){(t||this.jsvStore.textContent)&&(this.jsvStore.textContent=t,this.jsvStore.clientWidth=NaN,this.jsvContentView||(this.jsvContentView=new e.LayoutView,this.jsvMainView.AddView(this.jsvContentView)),this.parentElement&&this.jsvFlushViewForeground())}get clientWidth(){const e=this.style.width;if(e||0===e)return e;if(this.jsvStore.textContent){if(!isNaN(this.jsvStore.clientWidth))return this.jsvStore.clientWidth;const e={str:this.jsvStore.textContent,font:this.style.fontFamily,size:this.style.fontSize,italic:this.style.fontStyle,bold:this.style.fontWeight};return this.jsvStore.clientWidth=i.GetTextWidth(e),this.jsvStore.clientWidth}return super.clientWidth}jsvOnLoadForgeView(){this.style.borderImage&&(this.jsvMaskView=new e.NinePatchView),super.jsvOnLoadForgeView()}jsvCallbackOnUnloadForgeView(){return this.jsvOnUnloadForgeView.bind(this)}jsvOnUnloadForgeView(){i.UnrefImgTexSize(this.jsvRefedImgTex),this.jsvRefedImgTex=null}jsvOnStyleChanged(e){super.jsvOnStyleChanged(e),this.jsvStore.textStylePack=null;let t=!!e[f.TYPE.FOREGROUND];e[f.TYPE.LAYOUT_SIZE]&&(t||this.jsvFlushViewForeground()),e[f.TYPE.FOREGROUND]&&this.jsvFlushViewForeground(),e[f.TYPE.BORDER]&&this.jsvFlushViewBorder()}jsvFlushViewForeground(){if(this.jsvContentView&&(this.jsvContentView.ClearViews(),this.jsvStore.textContent)){let e=void 0===this.style.height||0==this.style.height,t=e?(e,t)=>{this.jsvStore.clientHeight=e.height}:null,s=this.jsvBuildTextView(t);e&&s.EnableAutoHeight(),this.jsvContentView.AddView(s)}}jsvBuildTextView(t){let s=this.jsvStore.textStylePack;if(null===s&&(s=this._jsvGetClassNameCache()),null===s){this.style.jsvCustomStyles.textLineAlign||(this.style.jsvCustomStyles.textLineAlign=this.style.lineHeight?"middle":"top"),this.style.jsvCustomStyles.textVerticalAlign||(this.style.jsvCustomStyles.textVerticalAlign="top");let t=E._jsvStyleToPackData(this.style),i=JSON.stringify(t),n=b.getTempPack(i);n||(n=e.sTextStyleCache.StyleToPack(t),b.putTempPack(i,n)),s=n}this.jsvStore.textStylePack=s;let n=this.style.lineHeight?parseInt(this.style.lineHeight):this.style.fontSize?1.3*this.style.fontSize:14,r=this.style.width,o=!1;if(void 0===r&&(r=this.clientWidth,o=!0),this.jsvTextAlignMinWidth&&r<this.jsvTextAlignMinWidth&&(r=this.jsvTextAlignMinWidth),r>3e3){if(!o)return console.error(`text too long. str=${this.jsvStore.textContent}`),null;console.log(`text too long, start to break down. width(${r})`);let a=new e.LayoutView,l=Math.floor(2048/this.style.fontSize),h=this.jsvStore.textContent.length,c=0,d=0,u={str:null,font:this.style.fontFamily,size:this.style.fontSize,italic:this.style.fontStyle,bold:this.style.fontWeight};for(;h>0;){let r=l<h?l:h,o=this.jsvStore.textContent.substr(c,r);c+=r,u.str=o;let v=i.GetTextWidth(u),p=e.sTextUtils.BuildTextView(i.TextureManager,o,s,0===c?t:null,{width:v,height:this.style.height},this.style.fontSize,n,!0,this.jsvTextLatexEnable,this.jsvEmoji,this.jsvEmptyRect);a.AddView(p,{x:d,y:0,width:v,height:this.style.height}),d+=v,h-=r}return a}return e.sTextUtils.BuildTextView(i.TextureManager,this.jsvStore.textContent,s,t,{width:r,height:this.style.height},this.style.fontSize,n,!0,this.jsvTextLatexEnable,this.jsvEmoji,this.jsvEmptyRect)}_jsvGetClassNameCache(){if(null===this.style.jsvNamedClassArray)return null;if(f.JsvContainsTextMajor(this.style.jsvLockedProps))return null;let t="";for(let e of this.style.jsvNamedClassArray){let s=e.getAttach();0===s.hasTextMajorStyle&&(f.JsvContainsTextMajor(e.getStyles())?s.hasTextMajorStyle=2:s.hasTextMajorStyle=1),2===s.hasTextMajorStyle&&(t+=e.getName())}if(t.length>0){let s=b.getPersistPack(t);if(!s){let i=E._jsvStyleToPackData(this.style);s=e.sTextStyleCache.StyleToPack(i),b.putPersistPack(t,s)}return s}return null}static _jsvStyleToPackData(e){let t={textColor:e.color?e.color:"#000000",font:e.fontFamily,italic:"italic"===e.fontStyle,bold:"bold"===e.fontWeight,hAlign:e.textAlign?e.textAlign:"start",vAlign:e.jsvCustomStyles.textLineAlign?e.jsvCustomStyles.textLineAlign:"middle",vAreaAlign:e.jsvCustomStyles.textVerticalAlign?e.jsvCustomStyles.textVerticalAlign:"top",textOverflow:e.textOverflow?e.textOverflow:"clip",wordWrap:"break-word"===e.wordWrap?"break_word":"normal",direction:"rtl"===e.direction?"rtl":"ltr",textInnerDirection:e.jsvCustomStyles.textInnerDirection?e.jsvCustomStyles.textInnerDirection:"unset"};"nowrap"===e.whiteSpace&&(t.wordWrap="none");let s=e.textShadow?e.textShadow.split(" "):void 0;s&&(t.shadow={shadowOffsetX:parseInt(s[0]),shadowOffsetY:parseInt(s[1]),shadowBlur:parseFloat(s[2]),shadowColor:s[3]});let i=e.WebkitTextStroke?e.WebkitTextStroke.split(" "):void 0;return i&&(t.stroke={strokeWidth:parseInt(i[0]),strokeColor:i[1]}),t}jsvFlushViewBorder(){if(this.jsvMaskView)if(this.style.clipPath)console.error("BorderImage is conflicting with ClipPath.");else if(this.style.borderImage){if(!(this.jsvMaskView instanceof e.NinePatchView))return void console.error("Error: style.borderImage NOT support dynamic adding");let t=v.ConvertPx(this.getAttribute("jsv-borderimage-width")),s=v.ConvertPx(this.getAttribute("jsv-borderimage-height"));if(i.UnrefImgTexSize(this.jsvRefedImgTex),!this.jsvRefedImgTex||this.jsvRefedImgTex.Source!==this.style.borderImage.source.href){let n=t&&s?{width:t,height:s}:null;if(!this.style.borderImage.source.href)return void this.jsvMaskView.ResetTexture(null);this.jsvRefedImgTex=i.TextureManager.GetImage2(this.style.borderImage.source.href,!1,n,e.ColorSpace.RGBA_8888)}t&&s&&(console.log("Custom cache image size with: "+t+"/"+s),i.SetImgTexSize(this.jsvRefedImgTex,{width:t,height:s}));const n=new e.ExternalTextureSetting(this.jsvRefedImgTex);this.jsvMaskView.ResetTexture(n),this.jsvMaskView.WaitTextureToResize(!0),i.RefImgTexSize(this.jsvRefedImgTex,function(e){if(!this.jsvMaskView)return void console.log("Found border view gone");let t=this.style.borderImageWidth,s=this.style.borderImage.slice,i=Math.floor(e.width*t.top/s.top),n=Math.floor(e.height*t.left/s.left);this.jsvMaskView.SetImageDspSize(i,n);let r=this.style.borderImageOutset?this.style.borderImageOutset:v.ConvertRect();this.jsvMaskView.SetPadding({start:r.left,width:Math.max(0,i-r.left-r.right)},{start:r.top,width:Math.max(0,n-r.top-r.bottom)}),this.jsvMaskView.SetRepeat([{start:t.left,width:Math.max(0,i-2*t.left)}],[{start:t.top,width:Math.max(0,n-2*t.top)}]),this.jsvMaskView.WaitTextureToResize(!1)}.bind(this))}}setAttribute(e,t){this.jsvTakeTextAttribute(e,t)||super.setAttribute(e,t)}jsvTakeTextAttribute(e,t){return"jsv_text_vertical_align"===e?(this.style.jsvCustomStyles.textVerticalAlign=t,!0):"jsv_text_line_align"===e?(this.style.jsvCustomStyles.textLineAlign=t,!0):"jsv_text_latex_enable"===e?(this.jsvTextLatexEnable="true"===t,!0):"jsv_text_align_minwidth"===e?(this.jsvTextAlignMinWidth=parseInt(t),!0):"jsv_text_emoji"===e?(this.jsvEmoji="true"===t||!0===t,!0):("jsv_text_empty_rect"===e?this.jsvEmptyRect=JSON.parse(t):"jsv_text_inner_direction"===e&&(this.style.jsvCustomStyles.textInnerDirection=t),!1)}}class R{constructor(e,t){this.RouterDelegate={ref:null},e||(this.RouterDelegate.ref=new _(!1,t))}getNodeByName(e){return this.RouterDelegate.ref.getNodeByName(e)}focusByNameBeforeMount(e,t){return e.includes(".")&&(e=e.split(".")),this.RouterDelegate.ref.focusBeforeMount(e,t)}setFocus(e,t){return this.focusByNameBeforeMount(e,t)}printFocusList(){for(let e in this.RouterDelegate.ref._ChildMap)console.log(`branchName[${e}] ${e===this.RouterDelegate.ref._FocusNodeName?"focused":""}`,this.RouterDelegate.ref._ChildMap[e])}printGlobalLastFocus(){console.log("FocusNode:"),console.log(I.sLastFocus)}getCurrentFocusStack(){const e=[];if(this.RouterDelegate.ref){let t=this.RouterDelegate.ref.getCurrentFocusNode();for(;t&&t instanceof I&&t.RouterDelegate.ref===this.RouterDelegate.ref;)e.push({name:t.BranchName}),t=t.GetParentPage()}else console.error("getCurrentFocusStack failed: router delegate is null.");return e}debugPrintNodes(){console.log("***print focus nodes***");for(let e in this.RouterDelegate.ref._ChildMap)e.includes("__DEFAULT_ID_")||console.log(e,this.RouterDelegate.ref._ChildMap[e]);console.log("***********************")}}class _{constructor(e,t){this._IsTemp=!!e,this._ChildMap={},this._FocusNameBeforeMount=null,this._FocusNodeName=null,this.NameSpace=t}getCurrentFocusNode(){return this._ChildMap[this._FocusNodeName]}getNodeByName(e,t){let s=e.split(".");return this._FindRouterSearchBase(s,t)._GetNodeFromPathArray(s,e)}_FindRouterSearchBase(e,t){if(0==e[0].length){let t,s;for(let e in this._ChildMap){t=this._ChildMap[e];break}do{s=t,t=t.GetParentPage()}while(null!=t);return e.splice(0,1),s.RouterDelegate.ref}return t&&t.AsHub&&t.GetParentPage()?t.GetParentPage().RouterDelegate.ref:this}_GetNodeFromPathArray(e,t){let s=0,i=this;for(;s<e.length-1;){let n=!1;for(let t in i._ChildMap){let r=i._ChildMap[t].RouterDelegate.ref;if(r!=i&&r.NameSpace==e[s]){i=r,s++,n=!0;break}}if(!n)return void console.error(`Error: no found subpath fname=${t}`)}let n=e[s];return i._ChildMap.hasOwnProperty(n)?i._ChildMap[n]:void console.error(`Error: no found fname=${t}`)}add(e,t){if(e.indexOf(".")>=0)console.error("ERROR: FDiv name can not contains '.'");else if(this._ChildMap.hasOwnProperty(e)&&this._ChildMap[e]!==t)console.error(`ERROR: FDiv router branch name duplicated:[${e}]`);else if(this._ChildMap[e]=t,this._FocusNameBeforeMount)if("string"==typeof this._FocusNameBeforeMount)this._FocusNameBeforeMount==e&&(this._FocusNameBeforeMount=null,t.Focus());else{this._FocusNameBeforeMount[0]==e&&(t.RouterDelegate.ref.focusBeforeMount(this._FocusNameBeforeMount.slice(1)),this._FocusNameBeforeMount=null)}}remove(e,t){let s=this._ChildMap[e];s&&s==t&&delete this._ChildMap[e]}rename(e,t){if(!this._ChildMap.hasOwnProperty(e))return void console.error(`ERROR: alter name failed ${e}->${t}`);let s=this._ChildMap[e];delete this._ChildMap[e],this.add(t,s),this._FocusNodeName==e&&(this._FocusNodeName=t)}focusBeforeMount(e,t){let s=!1;if(e.indexOf(".")>=0)return console.error("ERROR: not support name with namespace"),!1;if("string"==typeof e){if(!e.includes(".")){s=!0;let i=this._ChildMap[e];return this._FocusNodeName=e,i?(i.Focus(!t),!0):(this._FocusNameBeforeMount=e,!1)}}else if("object"==typeof e&&Array.isArray(e)&&e.length>0){if(s=!0,1==e.length)return this.focusBeforeMount(e[0]);{let t=e[0],s=this._ChildMap[t];return this._FocusNodeName=t,s?s.RouterDelegate.ref.focusBeforeMount(e.slice(1)):(this._FocusNameBeforeMount=e,!1)}}return s||console.error("illegal name param",e),!1}focus(e,t){let s=this.focusBeforeMount(e,t);return s||console.log("No found branch:"+e),s}forEach(e){for(let t in this._ChildMap)e(this._ChildMap[t],t,this._ChildMap)}printNodes(){console.log(this._ChildMap)}}class I extends e.PageBase{constructor(e){super(e),this._OnKeyDown=null,this._OnKeyUp=null,this._OnFocus=null,this._OnBlur=null,this._DispatchKeyDown=null,this._DispatchKeyUp=null,this._OnCustomerEvent=null,this._DKeyDownProxy=void 0,this._DKeyUpProxy=void 0,this._Mounted=!1,this.BranchName=e,this.AsHub=!1,this.InterfaceHub=null,this.RouterDelegate={ref:null},this._TmpRouter=null,this._OriginDispatchKeyDown=this._OriginDispatchKeyDown.bind(this),this._OriginDispatchKeyUp=this._OriginDispatchKeyUp.bind(this),this._AutoShow=!1}updateMountState(){this._Mounted=!0;let e=this.SubPages;for(let t in e)e[t].updateMountState()}getHub(){return this.InterfaceHub||(this.InterfaceHub=new R(!0),this.InterfaceHub.RouterDelegate=this.RouterDelegate),this.InterfaceHub}setHub(e){this.RouterDelegate.ref?console.error("Error: hub is already setted."):(this.RouterDelegate.ref=e.RouterDelegate.ref,this.AsHub=!0)}_UseParentRouter(e){this.RouterDelegate=e,this.InterfaceHub&&(this.InterfaceHub.RouterDelegate=e)}routerAdd(e,t){t.RouterDelegate.ref||t._UseParentRouter(this.RouterDelegate),this.RouterDelegate.ref||(this.RouterDelegate.ref=new _(!0)),this.RouterDelegate.ref.add(e,t)}routerRenameChild(e,t){this.RouterDelegate.ref.rename(e,t)}printFocusList(){this.RouterDelegate.ref?this.RouterDelegate.ref.printFocusList():console.error("Error: no router")}routerUnbind(){let e;this.AsHub?this.GetParentPage()&&(e=this.GetParentPage().RouterDelegate.ref):e=this.RouterDelegate.ref,e&&e.remove(this.BranchName,this)}setBranchName(e){if(e===this.BranchName)return;let t=this.BranchName;this.BranchName=e,this.PageName=e,this._ParentPage&&this._ParentPage.routerRenameChild(t,e)}setOnKeyDown(e){this._OnKeyDown=e}setOnKeyUp(e){this._OnKeyUp=e}setOnFocus(e){this._OnFocus=e}setOnBlur(e){this._OnBlur=e}setDispatchKeyUp(e){this._DispatchKeyUp=e}setDispatchKeyDown(e){this._DispatchKeyDown=e}setOnCustomerEvent(e){this._OnCustomerEvent=e}setDispatchKeyProxy(e,t){this._DKeyDownProxy=e,this._DKeyUpProxy=t}requestFocus(e){let t=this.RouterDelegate.ref;return this.AsHub&&this.GetParentPage()&&(t=this.GetParentPage().RouterDelegate.ref),t?t.focus(this.BranchName,e):(console.error("error: lost router"),!1)}OnKeyDown(e){return!!this._OnKeyDown&&this._OnKeyDown(e)}OnKeyUp(e){return!!this._OnKeyUp&&this._OnKeyUp(e)}OnCustomerEvent(e){return!!this._OnCustomerEvent&&this._OnCustomerEvent(e)}bubbleCustomerEvent(e){this.BubbleCustomerEvent(e)}dispatchKeyDown(e){return this.DispatchKeyDown(e)}DispatchKeyDown(e){return I.sLastFocus=this,this._DKeyDownProxy?this._DKeyDownProxy(e,this._OriginDispatchKeyDown):this._OriginDispatchKeyDown(e)}_OriginDispatchKeyDown(e){let t=!1;return this._DispatchKeyDown&&(t=this._DispatchKeyDown(e)),!!t||super.DispatchKeyDown(e)}dispatchKeyUp(e){return this.DispatchKeyUp(e)}DispatchKeyUp(e){return this.__DKeyUpProxy?this.__DKeyUpProxy(e,this._OriginDispatchKeyUp):this._OriginDispatchKeyUp(e)}_OriginDispatchKeyUp(e){let t=!1;return this._DispatchKeyUp&&(t=this._DispatchKeyUp(e)),!!t||super.DispatchKeyUp(e)}attachToActivity(e,t){this.AttachToActivity(e,t)}AttachToActivity(e,t){super.SetParent(e,t)}setParent(e){this.SetParent(e)}SetParent(e){if(null!=e&&(super.SetParent(e,null),this._ParentPage._Mounted&&(this.updateMountState(),x()),e instanceof I)){if(this.RouterDelegate.ref&&this.RouterDelegate.ref._IsTemp){let t=this.RouterDelegate.ref;this.RouterDelegate.ref=null,t.forEach(((t,s)=>{e.routerAdd(s,t)}))}e.routerAdd(this.BranchName,this)}}focus(e){this.Focus(e)}Focus(e){if(!this._Mounted)return I.sFocusMemos.push({obj:this,bcf:e}),void console.log("page base tree not build, cache focus");super.Focus(e)}OnFocus(){this._OnFocus&&this._OnFocus()}OnBlur(){this._OnBlur&&this._OnBlur()}onUnMount(){let e=this.GetParentPage();e&&e.RemoveSubPage(this),this.ClearSubPages(),this.routerUnbind()}getName(){let e=this,t=[this.RouterDelegate.ref.NameSpace];this.AsHub||t.push(this.BranchName);let s=this.RouterDelegate.ref;do{if(e=e.GetParentPage(),"__AppRoot__"==t[0])break;e&&e.RouterDelegate.ref!=s&&(s=e.RouterDelegate.ref,t.unshift(s.NameSpace))}while(e);return"__AppRoot__"==t[0]?t[0]="":console.error("ERROR: missing app root"),t.join(".")}getNodeByName(e){return this.RouterDelegate.ref.getNodeByName(e,this)}printFocusNodeList(){this.getHub().printFocusList()}printGlobalLastFocus(){this.getHub().printGlobalLastFocus()}}I.sFocusMemos=[],I.sLastFocus=null,I.sRootPageNode=null;let x=()=>{let e=I.sFocusMemos.length;if(e>0){let t=I.sFocusMemos;I.sFocusMemos=[];for(let s=0;s<e;s++)t[s].obj.Focus(t[s].bcf)}},A=1;class P extends j{constructor(){super(),this.FocusNodeRef=new I("__DEFAULT_ID_"+A++),this.HubRef=void 0}jsvGetTagName(){return j.TAG.FDIV}setAttribute(e,t){if(e)if("fname"===e)t&&this.FocusNodeRef.setBranchName(t);else if("new-namespace"===e&&""!==t&&!this.HubRef){let e=new R(!1,t);this.HubRef=e,this.FocusNodeRef.setHub(e),this.FocusNodeRef.setBranchName(t)}}jsvGetHub(){return this.HubRef}}class N extends j{constructor(e){super(e),this.src=null,this.onerror=null,this.onload=null}setAttribute(e,t){console.log("LinkElement.setAttribute() name="+e+", value=",t),this[e]=t}jsvLoadResource(){let e=!1,t=null;if(null!=this.href){var i=new s(this.href);console.log("Ignore to load link from url="+i.href),e=!0}else console.warn("Failed to load link, href is not exists."),t="NoSrc";this.jsvOnLoadResult(e,t)}jsvOnLoadResult(e,t){if(console.log("jsvOnLoadResult isSuccess:"+e+", errCode:"+t),e){if(this.onload){let e=new n("load");this.onload(e)}}else this.onerror&&this.onerror({type:"jsvErr_"+t,target:this})}}class k extends j{constructor(e){super(e),this.src=null,this.onerror=null,this.onload=null,this.charset=null,this.timeout=120}setAttribute(e,t){console.log("ScriptElement.setAttribute() name="+e+", value=",t),this[e]=t}jsvLoadResource(){if(null!=this.src){var e=new s(this.src);console.log("load script with url="+e.href);var t=this;window.JsView.runJsWithUrl(e.href,!1,((e,s)=>{t.jsvOnLoadResult(e,s)}))}}jsvOnLoadResult(e,t){if(console.log("onLoadResult "+e+" "+t),e){if(this.onload){let e=new n("load");this.onload(e)}}else this.onerror&&this.onerror({type:"jsvErr_"+t,target:this})}}class M extends j{constructor(){super()}appendChild(e){"HTMLScriptElement"==e.constructor.name||"HTMLStyleElement"==e.constructor.name||"HTMLLinkElement"==e.constructor.name?window.originDocument.headAppendChild(e):super.appendChild(e),(e instanceof N||e instanceof k)&&e.jsvLoadResource()}removeChild(e){"HTMLScriptElement"==e.constructor.name||"HTMLStyleElement"==e.constructor.name||"HTMLLinkElement"==e.constructor.name?window.originDocument.headRemoveChild(e):super.removeChild(e)}}class V extends n{constructor(e){super("load")}}class L extends j{constructor(t){super(t),this.jsvImageView=new e.LayoutView(null,"img"),this.jsvMainView.AddView(this.jsvImageView),this._ImageInLoading=!1,this.jsvColorSpace=e.ColorSpace.RGBA_8888,this.jsvScaleDownTex=null,this._HasUserOnLoad=!1,this._OnLoadSeq=1,this._LoadedSrc=null,this.jsvApicAutoPlay=!0}jsvGetTagName(){return j.TAG.IMAGE}setAttribute(e,t){this.jsvTakeTextureAttribute(e,t)||(super.setAttribute(e,t),e===j.ATTRIBUTE.SRC&&this.jsvSetAttrLazySync(e,j.ATTRTYPE.CSS))}jsvSetElementProp(e){this.jsvImageView.SetElementProp(e,i.RootActivity)}jsvCallbackOnUnloadForgeView(){return()=>{if(this._HasUserOnLoad){let e=this.jsvImageView?.TextureSetting?.Texture;e&&e.DisableBackgroundLoad(this)}}}jsvFlushEventHandlers(){if(super.jsvFlushEventHandlers(),this.eventHandlers.onLoad){let e=this.jsvImageView?.TextureSetting?.Texture;e&&(this._HasUserOnLoad=!0,e.EnableBackgroundLoad(this))}else if(this._HasUserOnLoad){let e=this.jsvImageView?.TextureSetting?.Texture;e&&e.DisableBackgroundLoad(this),this._HasUserOnLoad=!1}}jsvTakeTextureAttribute(e,t){return"jsv_img_color_space"==e||"jsvImgColorSpace"==e||"jsv-img-color-space"==e?(this.jsvColorSpace=t,!0):"jsv_img_scaledown_tex"==e||"jsvImgScaledownTex"==e||"jsv-img-scaledown-tex"==e?(""!==t&&void 0!==t||(t="true"),this.jsvScaleDownTex=t,!0):"jsv_disable_apic_autoplay"==e&&(this.jsvApicAutoPlay=!1,!0)}jsvFlushViewLayout(){this._ImageInLoading?(this.jsvImageView.WaitTextureToResize(!0),this.jsvImageView.ResetLayoutParams({x:0,y:0,width:this.style.width,height:this.style.height})):this.jsvImageView.WaitTextureToResize(!1),super.jsvFlushViewLayout()}jsvOnLoaded(e){if(console.log("ImageElement.jsvOnLoaded() imageSize="+JSON.stringify(e)),this._ImageInLoading=!1,this._LoadedSrc=this.src,this.jsvStore.textureWidth=e.width,this.jsvStore.textureHeight=e.height,this.style.jsvLazySyncCache.setCacheProperty(f.TYPE.LAYOUT_SIZE,!0),this._HasUserOnLoad){let e=new V;e.target=this,document.dispatchEvent(e)}}jsvOnAttrLazySync(e){e.hasOwnProperty(j.ATTRIBUTE.SRC)&&this.src!=this._LoadedSrc&&(this._ImageInLoading=!0,this.jsvStore.textureWidth=NaN,this.jsvStore.textureHeight=NaN,this.jsvDrawImage())}jsvOnLoadForgeView(){this.style.objectFit||this.style.jsvSetPropertySilently("objectFit",f.ObjectFit.FILL),super.jsvOnLoadForgeView()}jsvApplyObjectFit(e){return 0!=this.jsvStore.textureWidth&&0!=this.jsvStore.textureHeight||console.warn("warning: size 0 not support object fit, src="+this.src),j.applyObjectFitCommon(this,e,this.jsvImageView)}jsvDrawImage(){if(!this.src)return;let e=null;"true"===this.jsvScaleDownTex&&(this.style&&this.style.width?e={width:this.style.width,height:0}:console.error("set jsvScaleDownTex while style.width is not set. you need to set 'src' prop at the end.")),this._OnLoadSeq++;let t=this._OnLoadSeq;i.SetBackgroundImage(this.jsvImageView,this.src,this.style.borderRadius,(e=>{t===this._OnLoadSeq&&this.jsvOnLoaded(e)}),e,this.jsvColorSpace,this.jsvApicAutoPlay)}}class D extends j{constructor(t){super(),this.jsvMainView=new e.JsvElementView(t)}get textContent(){return this.jsvMainView.textContent}set textContent(e){this.jsvMainView.textContent=e}setAttribute(e,t){super.setAttribute(e,t),this.jsvMainView.setAttribute(e,t)}removeAttribute(e){super.removeAttribute(e),this.jsvMainView.removeAttribute(e)}getAttribute(e){return this.jsvMainView.getAttribute(e)}hasAttribute(e){return this.jsvMainView.hasAttribute(e)}jsvOnStyleChanged(e){super.jsvOnStyleChanged(e)}}class F{constructor(e){let t=e.indexOf(F.KeyFramesFlag)+F.KeyFramesFlag.length,s=e.indexOf("{"),i=e.substring(t,s);this.name=i.trim(),this.cssText=e}}F.KeyFramesFlag="@keyframes";class U{constructor(e){this.jsvCssRules=null,this.jsvTextContent=e}get cssRules(){if(this.jsvCssRules)return this.jsvCssRules;this.jsvCssRules=new Array;if(this.jsvTextContent.indexOf(F.KeyFramesFlag)<0)return this.jsvCssRules;var e=this.jsvTextContent.split(F.KeyFramesFlag);for(let t in e)0!=t&&this.insertRule(F.KeyFramesFlag+e[t]);return this.jsvCssRules}insertRule(e,t){if(void 0===t&&(t=this.jsvCssRules.length),e.indexOf(F.KeyFramesFlag)<0)throw Error("StyleSheet.insertRule() Rule is not supported except keyframes.");let s=new F(e);this.jsvCssRules.splice(t,0,s)}deleteRule(e){this.jsvCssRules.splice(e,1)}}class B extends j{constructor(e){super(e),this.textContent=null}jsvGetTagName(){return j.TAG.STYLE}appendChild(e){super.appendChild(e);let t=new U(e.textContent);document.jsvAppendStyleSheet(t)}removeChild(e){throw super.removeChild(e),Error("Failed to removeChild, unimplement!.")}}class G extends j{}class H extends S{constructor(e){super(e),console.log("VideoElement.constructor()",this),this._EventCache=[],this._UseTexture=!1,this._StartTime=0}jsvGetTagName(){return j.TAG.VIDEO}setAttribute(e,t){("jsv-media-usetexture"!==e||"true"!==t&&!0!==t&&""!==t)&&("jsv_media_usetexture"!==e||"true"!==t)?super.setAttribute(e,t):this._UseTexture=!0}removeAttribute(e){if("jsv-media-usetexture"===e||"jsv_media_usetexture"===e)return this._UseTexture=!1,void console.log("removeAttribute jsv_media_usetexture");super.removeAttribute(e)}jsvFlushViewLayout(){super.jsvFlushViewLayout();let e=this.style.JsvVideoRotation;isNaN(e)&&(e=0),this.style.objectFit&&this.style.objectFit!=f.ObjectFit.CONTAIN&&this.style.objectFit!=f.ObjectFit.FILL&&(console.error("Video rotation is not valid on objectFit=",this.style.objectFit),e=0),this.jsvMedia&&this.jsvMedia.setRotation?.(e,this.style.width,this.style.height,this.style.objectFit==f.ObjectFit.FILL)}jsvAddMediaListener(e){this.jsvMedia?this.jsvMedia.addEventListener(e,(()=>{let t=new n(e);t.target=this,this.dispatchEvent(t)})):this._EventCache.push(e)}jsvFlushVideoView(){this.jsvMediaView&&(this.jsvStore.textureWidth=this.jsvMedia.videoWidth,this.jsvStore.textureHeight=this.jsvMedia.videoHeight,this.style.jsvLazySyncCache.setCacheProperty(f.TYPE.LAYOUT_SIZE,!0))}jsvApplyObjectFit(e){return j.applyObjectFitCommon(this,e,this.jsvMediaView)}jsvInit(){console.log("VideoElement jsvInit"),this._UseTexture?this.jsvMedia=new S.HOOKS.OffscreenVideo:this.jsvMedia=new S.HOOKS.Video,this._EventCache.length>0&&(this._EventCache.map((e=>{this.jsvAddMediaListener(e)})),this._EventCache=[]),this.addEventListener("load",this.jsvOnLoaded.bind(this)),super.jsvInit()}jsvRelease(){super.jsvRelease(),this.jsvMedia=null}jsvOnLoaded(){if(!this.jsvMediaView){let t;if(this._UseTexture){this.jsvMediaView=new e.LayoutView;let s,n=i.TextureManager.GetOffScreenMediaTexture(this.jsvMedia),r=this.style.borderRadius;r&&(s=new e.ViewRoundCornerMask(r.topLeft,r.topRight,r.bottomLeft,r.bottomRight)),t=new e.TextureSetting(n,s)}else{this.jsvMediaView=new e.VideoView(this.jsvMedia);let s=i.TextureManager.GetColorTexture("rgba(0,0,0,0)");t=new e.TextureSetting(s,null,null,!1)}this.jsvMainView.AddView(this.jsvMediaView),this.jsvMediaView.ResetTexture(t)}this.jsvFlushVideoView()}jsvOnLoadForgeView(){this.style.objectFit||this.style.jsvSetPropertySilently("objectFit",f.ObjectFit.CONTAIN),super.jsvOnLoadForgeView()}onJsViewHide(){this._StartTime=this.jsvMedia.currentTime,super.onJsViewHide(),this.jsvMedia.setState("autoPlay",!1,"boolean")}onJsViewShow(){this.jsvMedia||this.jsvInit(),this.jsvMedia.src=this.srcValue,this.jsvMedia.startTime=Math.max(this._StartTime-1,0),this._StartTime=0,this.stopByOnHide&&(this.stopByOnHide=!1,this.jsvMedia.play())}}H.PROP={SetOnly:[],GetOnly:["videoHeight","videoWidth"],SetAndGet:["height","poster","width"]};for(let e in H.PROP){let t=H.PROP[e];for(let s of t){let t={};"SetOnly"!==e&&"SetAndGet"!==e||(t.set=function(e){this.media[s]=e}),"GetOnly"!==e&&"SetAndGet"!==e||(t.get=function(){return this.media[s]}),H.prototype[s]=t}}H.EVENTS=["oncanplay","oncanplaythrough","ondurationchange","onended","onerror","onload","onloadedmetadata","onloadstart","onpause","onplay","onplaying","onprogress","onseeking","onseeked","onstalled","ontimeupdate"];class W extends c{constructor(e){super(c.TEXT_NODE),this.textContent=e}get nodeValue(){return this.textContent}set nodeValue(e){this.textContent=e,this.parentNode&&(this.parentNode.textContent=this.textContent)}}class K extends c{constructor(e){super(c.COMMENT_NODE),this.textContent=e}}let z={};class J{constructor(e,t,s){this._Element=s,z.hasOwnProperty(e)&&console.error(`Warn: FDivRoot duplicate name=${e}`),z[e]=this,this._DoInit(t)}_DoInit(e){let t=this._Element.FocusNodeRef;this._Element.setAttribute("new-namespace","__AppRoot__"),e&&t.setDispatchKeyProxy(e.keyDown,e.keyUp),window.JsView?t.attachToActivity(i.RootActivity,i.RootView):(window.addEventListener("keydown",(e=>{var s=document.activeElement.tagName;s&&"input"===s.toLowerCase()||(t.dispatchKeyDown(e),e.preventDefault&&e.preventDefault())})),window.addEventListener("keyup",(e=>{var s=document.activeElement.tagName;s&&"input"===s.toLowerCase()||(t.dispatchKeyUp(e),e.preventDefault&&e.preventDefault())})))}getElement(){return this._Element}getHub(){return this._Element.jsvGetHub()}onMounted(){this._Element.FocusNodeRef.updateMountState(),x()}}class Y extends O{constructor(e){super(e),console.log("AudioElement.constructor()",this)}jsvGetTagName(){return j.TAG.AUDIOTRACK}jsvInit(){this.jsvMedia=new S.HOOKS.Audio("AudioTrack"),this.jsvOverrideMedia=!0,super.jsvInit()}}class $ extends c{constructor(){super(c.DOCUMENT_NODE),this.location=window.location,this.rootElement=new E,this.rootElement.ownerDocument=this,this.rootElement.id="root",this.activeElement=this.rootElement,this.head=new M,this.styleSheets=new Array,window.JsView&&this.styleSheets.push(new U("@keyframes jsv-basic-slot {}")),this.jsvIsReady=!1}createElement(e){switch(e){case $.FDIV_ELEMENT:return new P;case $.DIV_ELEMENT:return new E;case $.IMG_ELEMENT:return new L;case $.STYLE_ELEMENT:return new B;case $.AUDIO_ELEMENT:return new O;case $.VIDEO_ELEMENT:return new H;case $.LINK_ELEMENT:return window.JsView?new N:window.originDocument.createElement($.LINK_ELEMENT);case $.SCRIPT_ELEMENT:return window.JsView?new k:window.originDocument.createElement($.SCRIPT_ELEMENT);case $.ANCHOR_ELEMENT:return new C;case $.SVG_ELEMENT:return new SVGElement;default:return e==$.JSV_AUDIOTRACK_ELEMENT?new Y:window.JsView?("template"!=e&&console.warn("Document.createElement() unknown name="+e),new G(e)):new D(e.startsWith("jsv")?e:"jsve-"+e)}}createTextNode(e){return new W(e)}createEvent(e){return new n(e)}createComment(e){return new K(e)}getElementById(e){if("root"===e||"app"===e)return this.rootElement;throw Error("Document.getElementById() id="+e+" is UNIMPLEMENTED.")}getElementsByTagName(e){if("head"===e.toLowerCase())return window.JsView?[this.head]:window.originDocument.getElementsByTagName(e);if("link"===e.toLowerCase()||"script"===e.toLowerCase()||"style"===e.toLowerCase())return[];throw Error("Document.getElementsByTagName() name="+e+" is UNIMPLEMENTED.")}querySelector(e){if("root"===e||"#app"===e)return this.rootElement;if("head"===e)return this.head;if("base"===e)return null;if(e.startsWith("style[")&&e.endsWith("]"))return null;if(e.startsWith("link[")&&e.endsWith("]"))return null;throw Error("Document.querySelector() selectors="+e+" is UNIMPLEMENTED.")}querySelectorAll(e){return[]}jsvAppendStyleSheet(e){document.styleSheets.push(e)}jsvGetKeyFrames(e,t){if(window.JsvCode.Dom.StyleSheets){const s=window.JsvCode.Dom.StyleSheets;for(const i of t){const t=s[`${e}-${i.replace("data-v-","")}`];if(t)return t}const i=s[e];if(i)return i}for(let t of this.styleSheets)for(let s of t.cssRules)if(s.name==e)return s.cssText;let s="@keyframes ",i=s+e;for(let e of this.styleSheets){let t=e.jsvTextContent,n=t.indexOf(i);if(n<0)continue;let r=t.indexOf("-keyframes",n+1),o=t.indexOf(s,n+1);o<0&&(o=t.length),r>0&&r<o&&(o=r);let a=t.substring(n,o);return e.insertRule(a,0),a}return null}jsvUpdateRootElement(e){console.log("Document.jsvUpdateRootElement() this.jsvIsReady = true"),this.rootElement.jsvMainView=e,this.jsvIsReady=!0}jsvInitFDivRoot(e,t,s){if(!s){let e=document.createElement("fdiv");this.rootElement.appendChild(e),this.rootElement=e,s=this.rootElement}return new J(e,t,s)}jsvGetFDivRoot(e){return function(e){return z[e]}(e)}set cookie(e){window.__JsvCookies.setCookie(e)}get cookie(){return window.__JsvCookies.getCookie()}}$.ANCHOR_ELEMENT="a",$.AUDIO_ELEMENT="audio",$.DIV_ELEMENT="div",$.IMG_ELEMENT="img",$.LINK_ELEMENT="link",$.SCRIPT_ELEMENT="script",$.STYLE_ELEMENT="style",$.SVG_ELEMENT="svg",$.VIDEO_ELEMENT="video",$.FDIV_ELEMENT="fdiv",$.JSV_AUDIOTRACK_ELEMENT="jsv-audiotrack";class X extends j{jsvGetTagName(){return j.TAG.LINK}}if(window.JsvCode={Dom:{StyleSheets:{}}},window.Audio=O,window.Video=H,window.MutationObserver=class{constructor(e){this.callback=e}observe(e,t){if(!(e instanceof c))throw Error("TypeError: Failed to execute 'observe' on 'MutationObserver': parameter 1 is not of type JsView's 'Node'");for(const e of Object.keys(t))"childList"==e||console.warn("JsView: only childList config is supported! ignore "+e);t.childList&&e.jsvObserveChildChanged((()=>{this.callback?.()}))}disconnect(){this.callback=void 0}},window.JsView){console.log("Declare Dom Proxy."),global.SVGElement=X,global.Element=j;let e=new s(window.JsView.getAppUrl(),!0);window.location.applyUrlInfo?window.location.applyUrlInfo(e):window.location=e,window.addEventListener=function(e,t){},window.document=new $,window.history={},window.navigator={userAgent:"jsview-runtime"},window.HTMLIFrameElement=function(){}}h.I("Using JsView Runtime");var q=Object.freeze({__proto__:null,JsViewForgeApp:class{constructor(t){this._ActivityManager=t;let s=new l(t);t.RegisterActivity(s.activity),t.StartActivity(new e.Intent("JsViewForgeActivity"))}},Document:$,HeadElement:M,ForgeExtension:i,Log:h,gSyncTimesCounter:o,JsvLazySyncCache:a});
@@ -1 +1 @@
1
- /* eslint-disable */ void 0===window.Forge&&(window.Forge={});var t=window.Forge;class e{constructor(t,e){if(this.href="",this.origin="",this.protocol="",this.host="",this.hostname="",this.port="",this.pathname="",this.search="",this.hash="",!t)return;if(!0===t.startsWith("url")){let e=t.indexOf("(")+1,s=t.lastIndexOf(")");if("undefined"===(t=t.substring(e,s).trim())||"null"===t||0===t.length)return}if(!0===t.startsWith("data:"))return void(this.href=t);let s=t.indexOf("://");if(!(s<0||s>10)||t.startsWith("./")||t.startsWith("/")||(t="./"+t),!0===t.startsWith("/"))t=document.location.origin+t;else if((!0===t.startsWith("./")||!0===t.startsWith("../"))&&void 0!==window.JsView&&void 0!==window.JsView.Dom.JsSubPath){if(void 0===window.JsView.Dom.__MainPath||"undefined"===window.JsView.Dom.__MainPathRef||window.JsView.Dom.__MainPathRef!==document.location.href){window.JsView.Dom.JsSubPath.startsWith("/")||(window.JsView.Dom.JsSubPath="/"+window.JsView.Dom.JsSubPath),window.JsView.Dom.JsSubPath.endsWith("/")||(window.JsView.Dom.JsSubPath=window.JsView.Dom.JsSubPath+"/"),window.JsView.Dom.__MainPathRef=document.location.href;let t=document.location.pathname.lastIndexOf(window.JsView.Dom.JsSubPath);window.JsView.Dom.__MainPath=document.location.origin+document.location.pathname.substring(0,t)+"/"}let e=window.JsView.Dom.__MainPath;t=t.startsWith("./")?e+t.substring(2):e+t}if(this.href=t,!e)return;let i=this.href,n=i.indexOf("#");n>0&&(this.hash=i.substring(n),i=i.substring(0,n));let r=i.indexOf("?");r>1&&(this.search=i.substring(r),i=i.substring(0,r));let o=i,a=o.indexOf("://");this.protocol=a>0?o.substring(0,a+1):"";let l=a>1?o.substring(a+3):"";if(a=l.indexOf("/"),this.host=a>0?l.substring(0,a):"",this.pathname=a>1?l.substring(a):"",this.origin=a>0?this.protocol+"//"+this.host:"",this.host.startsWith("[")){let t=this.host.indexOf("]");this.hostname=this.host.substring(0,t+1),t=this.host.substring(t+1).indexOf(":"),this.port=t>1?this.host.substring(t+1):""}else{let t=this.host.indexOf(":");this.hostname=t>0?this.host.substring(0,t):this.host,this.port=t>1?this.host.substring(t+1):""}}replace(t){this.href=t}}window.JsView&&window.JsView.registerUriConverter?.((t=>new e(t,!1).href));class s{static SetBackgroundColor(e,i,n){const r=s.TextureManager.GetColorTextureCached(i);let o;n&&(o=new t.ViewRoundCornerMask(n.topLeft,n.topRight,n.bottomLeft,n.bottomRight));const a=new t.ExternalTextureSetting(r,o);e.ResetTexture(a)}static SetBackgroundImage(i,n,r,o,a,l,h){let u,d={};if("string"==typeof n){const t=new e(n);if(t instanceof e==!1)throw Error("Bad Argument.",t);d.url=t.href}else"linear-gradient"==n?.type&&(d.gradient=n);if(d.gradient)if(d.gradient.colors?.length>2){const t=d.gradient.colors,e=[t[0],t[t.length-1]],i=t.slice(1,t.length-1);u=s.TextureManager.CreateLinearGradientTexture(e,i)}else 2==d.gradient.colors?.length?u=s.TextureManager.CreateMiniGradientTexture(!0,d.gradient.colors[0],d.gradient.colors[1],d.gradient.rawValue):console.warn("Failed to create backgroundImage gradient, bad colors.",d.gradient.colors);else d.url&&(u=d.url.includes(".gif")||d.url.includes(".webp")?s.TextureManager.GetGifImage(d.url,!1,null,h):s.TextureManager.GetImage2(d.url,!1,a,l||t.ColorSpace.RGBA_8888));if(u){let e;r&&(e=new t.ViewRoundCornerMask(r.topLeft,r.topRight,r.bottomLeft,r.bottomRight));const s=new t.ExternalTextureSetting(u,e);if(i.ResetTexture(s),o){let t=u.RegisterLoadImageCallback(null,(function(){o({width:u.Width,height:u.Height})}));i.RegisterDetachCallback((()=>{u.UnregisterLoadImageCallback(t)}))}}}static SetMaskedBackgroundImage(i,n,r,o){if("string"==typeof n&&(n=new e(n)),n instanceof e==!1)throw Error("Bad Argument.",n);if("string"==typeof r&&(r=new e(r)),r instanceof e==!1)throw Error("Bad Argument(MaskURL).",r);const a=s.TextureManager.GetImage2(n.href,!1,null,o||t.ColorSpace.RGBA_8888);if(a){const e=s.TextureManager.GetImage2(r.href,!1,null,t.ColorSpace.RGBA_8888),n=new t.ExternalTextureSetting(a,new t.ViewTextureMask(e));i.ResetTexture(n)}}static SetVideoTexture(e,i,n){const r=s.TextureManager.GetColorTexture(i);let o;n&&(o=new t.ViewRoundCornerMask(n.topLeft,n.topRight,n.bottomLeft,n.bottomRight));const a=new t.TextureSetting(r,o);e.ResetTexture(a)}static GetTextWidth(e){return e.str||(e.str=""),e.font||(e.font=t.TextUtils._sDefaultFont),e.size||(e.size=t.TextUtils._sDefaultFontSize),"italic"!==e.italic&&(e.italic=""),"bold"!==e.bold&&(e.bold=""),window.PlatformUtils.GetTextWidth(e)}static RequestSwap(){t.sRenderBridge.RequestSwap()}static SetImgTexSize(t,e){let i={size:e,refNum:0};s.TextureInfo.Cache[t.Source]=i}static RefImgTexSize(t,e){let i=s.TextureInfo.Cache[t.Source];i?(i.refNum>0?i.refNum++:i.refNum=1,e(i.size)):t.RegisterLoadImageCallback(null,(function(){const i={width:t.Width,height:t.Height};e(i);let n=s.TextureInfo.Cache[t.Source];if(n)n.refNum>0?n.refNum++:n.refNum=1;else{let e={size:i,refNum:1};s.TextureInfo.Cache[t.Source]=e}}))}static UnrefImgTexSize(t){if(!t)return;let e=s.TextureInfo.Cache[t.Source];e&&(e.refNum--,e.refNum<=0&&s.TextureInfo.Unused.add(t.Source))}static ClearUnusedTexSize(){for(let t of s.TextureInfo.Unused){let e=s.TextureInfo.Cache[t];e.refNum<-2?(delete s.TextureInfo.Cache[t],s.TextureInfo.Unused.delete(t)):e.refNum<=0?e.refNum--:s.TextureInfo.Unused.delete(t)}}}s.TextureInfo={Cache:{},Unused:new Set},s.TextureManager=null,s.RootView=null,s.RootActivity=null,s.HaltKeyEvent=!1;class i{constructor(t){this.target=null,this.timeStamp=Date.now(),this.type=t}initEvent(t,e,s){this.type=t}}class n extends i{constructor(t){super(t),this.keyCode=-1,this.key=-1,this.repeat=0}static JsvGetKeyFromCode(t){return new Map([[n.KeyCode.Enter,n.Key.Enter],[n.KeyCode.ArrowUp,n.Key.ArrowUp],[n.KeyCode.ArrowDown,n.Key.ArrowDown],[n.KeyCode.ArrowLeft,n.Key.ArrowLeft],[n.KeyCode.ArrowRight,n.Key.ArrowRight]])[t]}}n.Type={KEYDOWN:"keydown",KEYUP:"keyup"},n.Key={Enter:"Enter",ArrowUp:"ArrowUp",ArrowDown:"ArrowDown",ArrowLeft:"ArrowLeft",ArrowRight:"ArrowRight"},n.KeyCode={Enter:13,ArrowUp:38,ArrowDown:40,ArrowLeft:37,ArrowRight:39};let r={cnt:0};class o{constructor(t){this.type=t,this.cachedValues=null,this.onSyncCallback=null}setOnSyncCallback(t){this.onSyncCallback=t,this.syncLastCaches(!0)}setCacheProperty(t,e){this.cachedValues||(this.cachedValues={}),this.cachedValues[t]=e,this.syncLastCaches(!1),s.RequestSwap()}syncLastCaches(t){let e=o.LastModified[this.type];if((t||e!==this)&&(o.LastModified[this.type]=this,e&&e.cachedValues&&"function"==typeof e.onSyncCallback)){let t=e.cachedValues;e.cachedValues=null,e.onSyncCallback(t)}}static SyncAllCachedProperty(){for(let t of Object.values(o.LastModified))t.syncLastCaches(!0);r.cnt=(r.cnt+1)%65535}}o.LastModified={};class a{constructor(e){this.activity=new t.ReactActivity("JsViewForgeActivity",e,this.OnKeyDown.bind(this),this.OnKeyUp.bind(this)),this._Init()}_Init(){console.log("JsViewForgeActivity.OnCreate()."),s.TextureManager=this.activity.GetTextureManager(),s.RootView=new t.LayoutView,s.RootActivity=this.activity,document.jsvUpdateRootElement(s.RootView);let e=null;t.DesignMap&&(e=t.DesignMap());let i=e?e.width:1280,n=Math.floor(9*i/16);this.activity.SetContentView(s.RootView,{x:0,y:0,width:i,height:n}),t.sRenderBridge.AddWillSwapListener("forgeSwap",(()=>{o.SyncAllCachedProperty(),s.ClearUnusedTexSize()})),window.JsView.Dom.Render()}OnKeyDown(t){if(s.HaltKeyEvent){let e=new n(n.Type.KEYDOWN);return e.keyCode=t.keyCode,e.repeat=t.repeat,document.dispatchEvent(e),!0}return!1}OnKeyUp(t){if(s.HaltKeyEvent){let e=new n(n.Type.KEYUP);return e.keyCode=t.keyCode,e.key=n.JsvGetKeyFromCode(e.keyCode),e.repeat=t.repeat,document.dispatchEvent(e),!0}return!1}}class l{constructor(e){this._ActivityManager=e;let s=new a(e);e.RegisterActivity(s.activity),e.StartActivity(new t.Intent("JsViewForgeActivity"))}}window.JsView&&(window.JsView.Dom={DesignMap:null,Render:null,Extension:s,UrlRef:e},window.JsView.React=window.JsView.Dom);class h{static SetLevel(t){switch(h.E=h.W=h.I=h.D=function(){},t){case h.Level.Verbose:h.V=console.debug.bind(console);case h.Level.Debug:h.D=console.debug.bind(console);case h.Level.Info:h.I=console.info.bind(console)}}static Throw(...t){throw console.error(...t),[...t]}}h.E=console.error.bind(console),h.W=console.warn.bind(console),h.I=console.info.bind(console),h.D=function(){},h.V=function(){},h.Level={Error:0,Warning:1,Info:2,Debug:3,Verbose:4};class u{constructor(t){this.ownerDocument=window.document,this.nodeType=t,this.parentNode=void 0,this.childNodes=[],this.jsvEventListener=void 0,this.jsvChildChangedCallback=void 0}jsvGetTagName(){return"Unknown"}appendChild(t){this.childNodes.push(t),t.parentNode=this,this.jsvChildChangedCallback?.()}moveChild(t,e,s){let i=this.childNodes.indexOf(t);i<0&&h.Throw("Failed to call Node.removeChild(), node not found. node=",t),this.childNodes.splice(i,1),t.parentNode=void 0,this.jsvChildChangedCallback?.(),e._insertBeforeInner(t,s)}removeChild(t){for(let e=t.childNodes.length-1;e>=0;e--)t.removeChild(t.childNodes[e]);let e=this.childNodes.indexOf(t);e<0&&h.Throw("Failed to call Node.removeChild(), node not found. node=",t),this.childNodes.splice(e,1),t.parentNode=void 0,this.jsvChildChangedCallback?.()}insertBefore(t,e){this._insertBeforeInner(t,e)}_insertBeforeInner(t,e){let s=this.childNodes.length;void 0===e?h.Throw("TypeError: Failed to execute 'insertBefore' on 'Node': 2 arguments required, but only 1 present."):null!==e&&(s=this.childNodes.indexOf(e)),s<0&&h.Throw("Failed to call Node.insertBefore(), before node not found. beforeNode=",e),this.childNodes.splice(s,0,t),t.parentNode=this,this.jsvChildChangedCallback?.()}get previousSibling(){const t=this.parentNode.childNodes;let e=t.indexOf(this);return e<0&&h.Throw("Failed to call Node.previousSibling(), this node not found. this=",this),t[e-1]}get nextSibling(){const t=this.parentNode.childNodes;let e=t.indexOf(this);return e<0&&h.Throw("Failed to call Node.nextSibling(), this node not found. this=",this),t[e+1]}addEventListener(t,e,s){this.jsvEventListener||(this.jsvEventListener={});let i=this.jsvEventListener[t];i||(i=new Set,this.jsvEventListener[t]=i),i.add(e)}removeEventListener(t,e,s){if(!this.jsvEventListener)return;let i=this.jsvEventListener[t];i&&(i.delete(e),i.size<=0&&this.jsvEventListener.hasOwnProperty(t)&&delete this.jsvEventListener[t],0===Object.values(this.jsvEventListener).length&&(this.jsvEventListener=void 0))}dispatchEvent(t){let e=this.jsvEventListener?.[t.type];if(e){t.target||(t.target=document.activeElement);for(let s of e)s(t)}else this.parentNode?this.parentNode.dispatchEvent(t):console.warn("Node.dispatchEvent() Ignore to dispatch event: "+t.type+". No listener added.")}jsvObserveChildChanged(t){this.jsvChildChangedCallback=t}}u.ELEMENT_NODE=1,u.TEXT_NODE=3,u.COMMENT_NODE=8,u.DOCUMENT_NODE=9,u.NOLAYOUT_NODE=10;class d extends i{}d.Type={FOCUS:"focus",BLUR:"blur"};class c extends i{stopPropagation(){}}class v{static ConvertInt(t){return t?"number"==typeof t?Math.floor(t):"string"==typeof t?parseInt(t):t:t}static ConvertFloat(t){if(!t)return t;if("string"!=typeof t)return t;return parseFloat(t)}static ConvertPx(t){if(!t)return t;if("string"!=typeof t)return t;if("0"===t)return 0;if(t.endsWith("px")){return parseInt(t)}return t}static ConvertRect(t){let e=v.SplitString(t," "),s={top:e.length>0?parseInt(e[0]):0,right:e.length>1?parseInt(e[1]):null,bottom:e.length>2?parseInt(e[2]):null,left:e.length>3?parseInt(e[3]):null};return s.right=s.right||0===s.right?s.right:s.top,s.bottom=s.bottom||0===s.bottom?s.bottom:s.top,s.left=s.left||0===s.left?s.left:s.right,s}static ConvertCorner(t){let e=v.SplitString(t," "),s={topLeft:e.length>0?parseInt(e[0]):0,topRight:e.length>1?parseInt(e[1]):null,bottomRight:e.length>2?parseInt(e[2]):null,bottomLeft:e.length>3?parseInt(e[3]):null};return s.topRight=s.topRight||0===s.topRight?s.topRight:s.topLeft,s.bottomRight=s.bottomRight||0===s.bottomRight?s.bottomRight:s.topLeft,s.bottomLeft=s.bottomLeft||0===s.bottomLeft?s.bottomLeft:s.bottomRight,s}static ConvertSize(t){let e=v.SplitString(t," "),s={width:e.length>0?parseInt(e[0]):0,height:e.length>1?parseInt(e[1]):null};return s.height=s.height||0===s.height?s.height:s.width,s}static ConvertAnimation(t){if(null===t||0===t.length)return null;let e=t.indexOf("cubic-bezier"),s=[];if(e>=0){let i=t.indexOf(")"),n=t.substring(e,i+1),r=v.SplitString(t,n);for(let t of r){let e=v.SplitString(t," ");s=s.concat(e)}s.push(n)}else s=v.SplitString(t," ");let i=null,n=0,r=1,o=t.includes("alternate");for(let t=2;t<s.length;t++){if("infinite"===s[t]){r=-1;continue}let e=v.ConvertTimeMs(s[t]);!1===isNaN(e)?n=e:(e=parseFloat(s[t]),!1===isNaN(e)?r=e:i=s[t])}let a=s.length>1?v.ConvertTimeMs(s[1]):0;return{name:s.length>0?s[0]:"",duration:a,timingFunction:v.ConvertEasing(i,a),delay:n,iterationCount:r,direction:o,originStr:t}}static ConvertTransition(t){if(null==t||0==t.length)return null;let e={},s=new Array,i=t.split(",");for(let t=0;t<i.length;t++)if(i[t].indexOf("(")>=0){let e=t;for(;e<i.length&&i[e].indexOf(")")<0;)e++;let n="";for(let s=t;s<=e;s++)s!=t&&(n+=","),n+=i[s];t=e,s=s.concat(n)}else s=s.concat(i[t]);for(let t of s){let s=v.ConvertAnimation(t);if(e[s.name]=s,"all"==s.name){let t=new Array("opacity","left","top","width","height","transform");for(let i of t)e[i]=s}}return e}static ConvertTimeMs(t){t||(t="");let e=NaN;return(t=t.trim()).endsWith("ms")?e=1:t.endsWith("s")&&(e=1e3),e*=parseFloat(t),e}static ConvertEasing(e,s){let i=t.Easing.Circular.InOut;if(!e)return i;if(e.includes("ease"))i=e.includes("-in-out")?t.Easing.Circular.InOut:e.includes("-out")?t.Easing.Circular.Out:e.includes("-in")?t.Easing.Circular.In:t.Easing.Circular.InOut;else if(e.includes("linear"))i=null;else if(e.includes("cubic-bezier")){let n=v.ConvertBezier(e);i=new t.BezierEasing(n.x1,n.y1,n.x2,n.y2,s)}else if(e.includes("steps")){let s=v.ConvertSteps(e);i=new t.StepsEasing(s.steps,s.type)}return i}static ConvertBezier(t){let e=t.indexOf("(");e>=0&&(t=t.substring(e+1));let s=v.SplitString(t,",");return{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}}static ConvertSteps(t){let e=t.indexOf("(");e>=0&&(t=t.substring(e+1));let s=v.SplitString(t,",");return{steps:s.length>0?parseInt(s[0]):1,type:s.length>1?s[1].includes("start")?0:1:0}}static ConvertOverflow(t,e){return t&&!t.includes("visible")?e.HIDDEN:e.VISIBLE}static ConvertObjectFit(t,e){return"symbol"==typeof t?t:(t||(t=""),t.includes("fill")?e.FILL:t.includes("contain")?e.CONTAIN:t.includes("cover")?e.COVER:t.includes("none")?e.NONE:t.includes("scale-down")?e.SCALEDOWN:e.CONTAIN)}static ConvertGradient(t){if(t||(t=""),!(t=t.trim()).startsWith("linear-gradient")&&!t.startsWith("radial-gradient"))return t;let e={rawValue:t},s=t.replace(/.*?\((.*)\)/,"$1"),i=v.SplitStringOutsideParentheses(s,",");if(t.startsWith("linear-gradient")){if(i[0]?.startsWith("to ")||i[0]?.endsWith("deg"))throw i=i.slice(1),new Error("linear-gradient direction or angle is not supported.");i.length<2?console.error("linear-gradient colors is invalid."):(e.type="linear-gradient",e.colors=i)}else if(t.startsWith("radial-gradient"))throw new Error("radial-gradient is not supported.");return e}static SplitString(t,e){t||(t="");let s=t.trim().split(e);if(" "!==e)return s;let i=[];for(let t of s)t&&i.push(t);return i}static SplitStringOutsideParentheses(t,e){let s=[],i=t.split(e);for(let t=0;t<i.length;t++)if(i[t].indexOf("(")>=0){let n=t;for(;n<i.length&&i[n].indexOf(")")<0;)n++;let r="";for(let s=t;s<=n;s++)s!=t&&(r+=e),r+=i[s];t=n,s=s.concat(r.trim())}else s=s.concat(i[t].trim());return s}}class g{constructor(t){if(this.top=null,this.right=null,this.bottom=null,this.left=null,!t||!1===t.startsWith("inset"))return void console.error("Inset.Parse() InvalidArgs: value=",t);let e=t.indexOf("(")+1,s=t.substring(e),i=v.ConvertRect(s);this.top=i.top,this.right=i.right,this.bottom=i.bottom,this.left=i.left}}class p{constructor(t){if(this.source=null,this.slice=null,this.repeat=null,this.outset=null,this.width=null,!t)return void console.error("BorderImage.constructor() InvalidArgs: value=",t);let s=t.indexOf(")")+1,i=t.substring(0,s),n=t.substring(s);this.source=new e(i),this.slice=v.ConvertRect(n)}}class y{constructor(){this.refStyleObject=new Map,this.value=void 0}static AppendRefStyle(t,e,s){let i=y.jsvGetStyleVar(t);i.refStyleObject.has(e)||i.refStyleObject.set(e,[]),i.refStyleObject.get(e).push(s)}static RemoveRefStyle(t){for(const e of y.VariableMap.values())for(const s of e.refStyleObject.keys())s==t&&e.refStyleObject.delete(t)}static UpdateValue(t,e){let s=y.jsvGetStyleVar(t);s.value=e;for(const[t,e]of s.refStyleObject)for(const s of e)t.jsvSetClassProperty(s)}static GetValue(t){return y.jsvGetStyleVar(t).value}static jsvGetStyleVar(t){t.startsWith("--")&&(t=`var(${t})`),y.VariableMap.has(t)||y.VariableMap.set(t,new y);return y.VariableMap.get(t)}}y.VariableMap=new Map;class w{constructor(){this.jsvStore={},this.jsvLazySyncCache=new o("style"),this.jsvLockedProps={},this.jsvNamedClassArray=null,this.jsvCustomStyles={},this.jsvLazyPrevClassNames=null,this.jsvLazyPrevInheritedClassNames=null,this.jsvLazyClassNames=null,this.jsvLazyInheritedClassNames=null,this.jsvLazyClassAttributes=null}setProperty(t,e){"function"==typeof document.jsvCheckStyleFormat&&document.jsvCheckStyleFormat(t,e),this.jsvLockedProps[t]=!0,e=w.JsvConvertPropValue(t,e),this.jsvUpdateProperty(t,e)}getPropertyValue(t){if(void 0!==this.jsvStore[t])return this.jsvStore[t];let e=this.jsvGetClassPropValue(this.jsvLazyClassNames,this.jsvLazyClassAttributes,t);return e?(t==w.PROP.ANIMATION?e=v.ConvertAnimation(e):t==w.PROP.TRANSITION&&(e=v.ConvertTransition(e)),t==w.PROP.BACKGROUNDIMAGE&&(e=v.ConvertGradient(e)),e):(e=this.jsvGetClassPropValue(this.jsvLazyInheritedClassNames,this.jsvLazyClassAttributes,t),e?(t==w.PROP.ANIMATION?e=v.ConvertAnimation(e):t==w.PROP.TRANSITION&&(e=v.ConvertTransition(e)),t==w.PROP.BACKGROUNDIMAGE&&(e=v.ConvertGradient(e)),e):void 0)}jsvDestory(){y.RemoveRefStyle(this)}jsvUpdateProperty(t,e){let s=this.jsvSetPropertySilently(t,e);s&&this.jsvLazySyncCache.setCacheProperty(s,!0)}jsvSetPropertySilently(t,e){if(t.startsWith("--"))return void y.UpdateValue(t,e);if("string"==typeof e&&e.startsWith("var(--"))return void y.AppendRefStyle(e,this,t);if("animation"===t){if(this.jsvStore[t]?.originStr===e?.originStr)return null}else if(this.jsvStore[t]===e)return null;return this.jsvStore[t]=e,w.JsvGetStyleType(t)}jsvApplyClasses(e,s){if(e)if(e.indexOf("JsvStyle_")<0){s?(this.jsvLazyPrevInheritedClassNames=this.jsvLazyInheritedClassNames,this.jsvLazyInheritedClassNames=e.split(" ")):(this.jsvLazyPrevClassNames=this.jsvLazyClassNames,this.jsvLazyClassNames=e.split(" "));const t=w.TYPE.CLASS_NAME;this.jsvLazySyncCache.setCacheProperty(t,!0)}else if(e){let s=e.split(" "),i={};this.jsvNamedClassArray=new Array(s.length);let n=0;for(let e of s){let s=null;if(t.ReactUtils.StyleClassMap.hasOwnProperty(e)){s=t.ReactUtils.StyleClassMap[e];let n=s.getAttach();if(null==n){let t=s.getStyles();n={altStyles:{},hasTextMajorStyle:0,textPackAttr:null};for(let e in t)n.altStyles[e]=w.JsvConvertPropValue(e,t[e]);s.updateAttach(n)}"text"===s.classType()&&(n.hasTextMajorStyle=2,null===n.textPackAttr&&(n.textPackAttr={textLineAlign:s.getLineAlign(),textVerticalAlign:s.getVerticalAlign()}),this.jsvCustomStyles.textLineAlign=n.textPackAttr.textLineAlign,this.jsvCustomStyles.textVerticalAlign=n.textPackAttr.textVerticalAlign),Object.assign(i,n.altStyles)}else console.error("Error: className not found");this.jsvNamedClassArray[n]=s,n++}for(let t in i)this.jsvLockedProps[t]||this.jsvUpdateProperty(t,i[t])}}jsvAppendClassAttribute(t){this.jsvLazyClassAttributes||(this.jsvLazyClassAttributes=new Set),this.jsvLazyClassAttributes.add(t);const e=w.TYPE.CLASS_NAME;this.jsvLazySyncCache.setCacheProperty(e,!0)}jsvSetClassProperty(t){let e=w.JsvGetStyleType(t);e&&this.jsvLazySyncCache.setCacheProperty(e,!0)}jsvGetClassPropValue(t,e,s){if(!t)return;const i=(t,e,s,i)=>{for(let n=e.length-1;n>=0;n--){let r=e[n];if(s&&(r+="["+s+"]"),!t.hasOwnProperty(r))continue;const o=t[r];if(!o.hasOwnProperty(i))continue;let a=o[i];return"string"==typeof a&&a.startsWith("var(--")&&(a=y.GetValue(a)),a}},n=window.JsvCode.Dom.StyleSheets;for(const r of e??[]){const e=i(n,t,r,s);if(e)return e}return i(n,t,null,s)}jsvGetClassDeclarations(t,e){if(!t)return;const s=(t,e,s)=>{let i={};for(let n=0;n<e.length;n++){let r=e[n];if(s&&(r+="["+s+"]"),!t.hasOwnProperty(r))continue;const o=t[r];Object.assign(i,o)}return i},i=window.JsvCode.Dom.StyleSheets;let n=s(i,t,null);for(const r of e??[]){const e=s(i,t,r);Object.assign(n,e)}return n}jsvUpdateChangedClasses(t,e,s){h.D("jsvGetChangedClassTypes() classNames="+t);let i={};if(e){y.RemoveRefStyle(this);const t=this.jsvGetClassDeclarations(e,s);for(const e of Object.keys(t)){i[w.JsvGetStyleType(e)]=!0}e=null}if(t){const e=this.jsvGetClassDeclarations(t,s);for(const[t,s]of Object.entries(e)){i[w.JsvGetStyleType(t)]=!0,"string"==typeof s&&s.startsWith("var(--")&&y.AppendRefStyle(s,this,t)}}return i}jsvSetChangedListener(t){let e=null;t&&(e=e=>{if(e.hasOwnProperty(w.TYPE.CLASS_NAME)){let t=this.jsvUpdateChangedClasses(this.jsvLazyClassNames,this.jsvLazyPrevClassNames,this.jsvLazyClassAttributes);Object.assign(e,t),t=this.jsvUpdateChangedClasses(this.jsvLazyInheritedClassNames,this.jsvLazyPrevInheritedClassNames,this.jsvLazyClassAttributes),Object.assign(e,t),e[w.TYPE.CLASS_NAME]=void 0}t(e)}),this.jsvLazySyncCache.setOnSyncCallback(e)}static JsvContainsTextMajor(t){for(let e of w.TextClassMajorStyles)if(t.hasOwnProperty(e))return!0;return!1}static JsvGetStyleType(t){switch(t){case w.PROP.LEFT:case w.PROP.RIGHT:case w.PROP.TOP:case w.PROP.BOTTOM:case w.PROP.ZINDEX:return w.TYPE.LAYOUT_POS;case w.PROP.TRANSFORM:case w.PROP.TRANSFORMORIGIN:return w.TYPE.TRANSFORM;case w.PROP.WIDTH:case w.PROP.HEIGHT:case w.PROP.VISIBILITY:case w.PROP.DISPLAY:case w.PROP.CLIPPATH:case w.PROP.OVERFLOW:case w.PROP.OBJECTFIT:case w.PROP.PERSPECTIVE:case w.PROP.PERSPECTIVEORIGIN:case w.PROP.BACKFACEVISIBILITY:case w.PROP.TRANSFORMSTYLE:case w.PROP.JSVVIDEOROTATION:return w.TYPE.LAYOUT_SIZE;case w.PROP.BACKGROUNDCOLOR:case w.PROP.BACKGROUNDIMAGE:case w.PROP.BORDERRADIUS:return w.TYPE.BACKGROUND;case w.PROP.COLOR:case w.PROP.LINEHEIGHT:case w.PROP.WHITESPACE:case w.PROP.FONTFAMILY:case w.PROP.FONTSIZE:case w.PROP.FONTSTYLE:case w.PROP.FONTWEIGHT:case w.PROP.TEXTALIGN:case w.PROP.TEXTSHADOW:case w.PROP.TEXTOVERFLOW:case w.PROP.WEBKITTEXTSTROKE:case w.PROP.DIRECTION:return w.TYPE.FOREGROUND;case w.PROP.BORDERIMAGE:case w.PROP.BORDERIMAGEWIDTH:case w.PROP.BORDERIMAGEOUTSET:return w.TYPE.BORDER;case w.PROP.ANIMATION:return w.TYPE.ANIMATION;case w.PROP.TRANSITION:return w.TYPE.TRANSITION;case w.PROP.OPACITY:break;default:return console.warn("Unknown style type for: "+t),null}}static JsvConvertPropValue(t,e){if(void 0===e)return e;if(t.startsWith("--")||e?.startsWith?.("var(--"))return e;switch(t){case w.PROP.TOP:case w.PROP.BOTTOM:case w.PROP.LEFT:case w.PROP.RIGHT:case w.PROP.WIDTH:case w.PROP.HEIGHT:case w.PROP.JSVVIDEOROTATION:return v.ConvertInt(e);case w.PROP.VISIBILITY:case w.PROP.DISPLAY:return e.toUpperCase();case w.PROP.OVERFLOW:return v.ConvertOverflow(e,w.Overflow);case w.PROP.OBJECTFIT:return v.ConvertObjectFit(e,w.ObjectFit);case w.PROP.TRANSFORM:case w.PROP.TRANSFORMORIGIN:return e;case w.PROP.CLIPPATH:return new g(e);case w.PROP.BORDERIMAGE:return new p(e);case w.PROP.BORDERIMAGEWIDTH:case w.PROP.BORDERIMAGEOUTSET:return v.ConvertRect(e);case w.PROP.BORDERRADIUS:return v.ConvertCorner(e);case w.PROP.ANIMATION:return v.ConvertAnimation(e);case w.PROP.TRANSITION:return v.ConvertTransition(e);case w.PROP.OPACITY:return v.ConvertFloat(e);case w.PROP.BACKGROUNDIMAGE:return v.ConvertGradient(e);default:return v.ConvertPx(e)}}}w.Overflow={HIDDEN:Symbol("hidden"),VISIBLE:Symbol("visible")},w.ObjectFit={FILL:Symbol("fill"),CONTAIN:Symbol("contain"),COVER:Symbol("cover"),NONE:Symbol("none"),SCALEDOWN:Symbol("scale-down")},w.TextClassMajorStyles=new Set(["textOverflow","wordWrap","textShadow","color","fontFamily","fontStyle","fontWeight","textAlign","WebkitTextStroke","direction"]),w.TYPE={LAYOUT_POS:"layout-position",LAYOUT_SIZE:"layout-size",FOREGROUND:"foreground",BACKGROUND:"background",BORDER:"border",ANIMATION:"animation",TRANSFORM:"transform",TRANSITION:"transition",CLASS_NAME:"class-name"},w.PROP={TOP:"top",BOTTOM:"bottom",LEFT:"left",RIGHT:"right",WIDTH:"width",HEIGHT:"height",VISIBILITY:"visibility",DISPLAY:"display",BACKFACEVISIBILITY:"backfaceVisibility",CLIPPATH:"clipPath",OVERFLOW:"overflow",OBJECTFIT:"objectFit",TRANSFORM:"transform",TRANSFORMORIGIN:"transformOrigin",PERSPECTIVE:"perspective",PERSPECTIVEORIGIN:"perspectiveOrigin",ZINDEX:"zIndex",TRANSFORMSTYLE:"transformStyle",BACKGROUNDCOLOR:"backgroundColor",BACKGROUNDIMAGE:"backgroundImage",BORDERRADIUS:"borderRadius",COLOR:"color",LINEHEIGHT:"lineHeight",WHITESPACE:"whiteSpace",FONTFAMILY:"fontFamily",FONTSIZE:"fontSize",FONTSTYLE:"fontStyle",FONTWEIGHT:"fontWeight",TEXTALIGN:"textAlign",TEXTSHADOW:"textShadow",TEXTOVERFLOW:"textOverflow",WEBKITTEXTSTROKE:"WebkitTextStroke",DIRECTION:"direction",BORDERIMAGE:"borderImage",BORDERIMAGEWIDTH:"borderImageWidth",BORDERIMAGEOUTSET:"borderImageOutset",ANIMATION:"animation",TRANSITION:"transition",OPACITY:"opacity",JSVVIDEOROTATION:"JsvVideoRotation"};for(let t in w.PROP){let e=w.PROP[t];Object.defineProperty(w.prototype,e,{set:function(t){this.setProperty(e,t)},get:function(){return this.getPropertyValue(e)}})}let f=null;class j{static getHandlers(t){const e=j.reactEventHandlers(t);return e||(t._vei?t._vei:{})}static reactEventHandlers(t){return null==f&&j._getReactToken(t),t["__reactProps$"+f]??t["__reactEventHandlers$"+f]}static _getReactToken(t){for(let e in t)if(e.indexOf("__reactProps")>=0||e.indexOf("__reactEventHandlers")>=0||e.indexOf("__reactInternalInstance")>=0){let t=e.indexOf("$");f=e.substring(t+1);break}}}class m extends u{constructor(e){super(u.ELEMENT_NODE),this.parentElement=null,this.tagName=this.jsvGetTagName(),this.tagName===m.TAG.STYLE?(this.style=null,this.jsvMainView=null,this.jsvMaskView=null):(this.style=new w,this.jsvMainView=new t.LayoutView,this.jsvMaskView=null),this.jsvAnimation=null,this.jsvStore={transition:null,transitionTmp:null,textContent:null,textStylePack:null,clientWidth:NaN,clientHeight:NaN,textureWidth:NaN,textureHeight:NaN,scopedAttributes:[]},this.jsvAttrChangedLazySync=null,this.instantSwapCallback=null,this.eventHandlers=null,this.jsvInheritClassDepth=null,this.jsvHasInheritClassChildren=!1}appendChild(t){null!=t.parentNode?this._moveChildNode(t,null):(super.appendChild(t),this.jsvInsertChild(t,null))}removeChild(t){this.jsvRemoveChild(t),super.removeChild(t)}insertBefore(t,e){null!=t.parentNode?this._moveChildNode(t,e):(super.insertBefore(t,e),this.jsvInsertChild(t,e))}_moveChildNode(t,e){let s=t.parentNode;if(s.moveChild(t,this,e),t.jsvMaskView){(s.jsvMaskView?s.jsvMaskView:s.jsvMainView).MoveChildView(t.jsvMaskView,this.jsvMaskView?this.jsvMaskView:this.jsvMainView,e?e.jsvMaskView:null),console.log("moving child")}else console.log("moving not forge child")}get childElementCount(){return this.childNodes.length}get firstElementChild(){return this.childNodes.length>0?this.childNodes[0]:null}get lastElementChild(){const t=this.childNodes.length;return t>0?this.childNodes[t-1]:null}set className(t){this.setAttribute("class",t)}setAttribute(t,e){t&&("style"!==t?(this[t]=e,t.startsWith("data-v-")?this._jsvAppendScopedAttribute(t,0):"class"===t?this._jsvSetClassNames(e,0):"jsv-inherit-class"===t?this._jsvSetInheritClassDepth(parseInt(e)):t.startsWith(m.ATTRIBUTE.JSVPREFIX)?(t=t.replace(/-/g,"_"),this.jsvSetAttrLazySync(t,m.ATTRTYPE.JSV)):window.JsView||"id"!==t||this.jsvMainView.Element&&(this.jsvMainView.Element.id=e)):console.warn("directly style setting be ignored"))}jsvSetAttrLazySync(t,e){this.jsvAttrChangedLazySync||(this.jsvAttrChangedLazySync=new o("lazy-attr"),this.parentElement&&this._jsvSetAttrLazySyncCallback()),this.jsvAttrChangedLazySync.setCacheProperty(t,e)}removeAttribute(t){this[t]=void 0,t.startsWith(m.ATTRIBUTE.JSVPREFIX)&&this.jsvSetAttrLazySync(t,m.ATTRTYPE.JSV)}getAttribute(t){return this[t]}hasAttribute(t){return console.log("Element.hasAttribute() name="+t),!!this[t]}getBoundingClientRect(){return null!=this.jsvMainView?this.jsvMainView.GetBoundingClientRect():Promise.reject(new Error("getBoundingClientRect while jsvMainView is null."))}get clientWidth(){return isNaN(this.jsvStore.clientWidth)?this.style.width:this.jsvStore.clientWidth}get clientHeight(){return isNaN(this.jsvStore.clientHeight)?this.style.height:this.jsvStore.clientHeight}focus(){console.log("Element.focus()"),document.activeElement&&document.activeElement.onfocus();let t=document.activeElement;if(document.activeElement=this,t){let e=new d(d.Type.BLUR);e.target=t,document.dispatchEvent(e)}let e=new d(d.Type.FOCUS);document.dispatchEvent(e)}jsvInsertChild(t,e){if(t.parentElement=this,t.nodeType===u.ELEMENT_NODE&&t.tagName!==m.TAG.STYLE){if(!1===document.jsvIsReady)return void console.warn("Element.appendChild() Failed to append child to Forge. jsvIsReady="+document.jsvIsReady);t.jsvOnLoadForgeView(),t.style.jsvSetChangedListener(t.jsvOnStyleChanged.bind(t)),e=this.jsvBackwardFindForgeView(e);let s=t.jsvMaskView.GetLayoutParams();this.jsvMainView.InsertView(t.jsvMaskView,e?e.jsvMaskView:null,s),(t.jsvInheritClassDepth>0||t.jsvHasInheritClassChildren)&&(this.jsvHasInheritClassChildren=!0)}else t.nodeType===u.TEXT_NODE&&(this.textContent=t.textContent)}jsvGetProxyView(t){return t?this.jsvMaskView:this.jsvMainView}jsvRemoveChild(t){t.parentElement=null,t.jsvAttrChangedLazySync=null,t.style?.jsvSetChangedListener(null),t.style?.jsvDestory(),t.jsvAnimation?.Cancel(),t.jsvAnimation=null,t instanceof m&&this.jsvMainView.RemoveView(t.jsvMaskView)}jsvOnLoadForgeView(){if(this.style.clipPath||this.style.overflow||this.style.objectFit){if(this.jsvMaskView)throw Error("Jsview: jsvMaskView is conflicting.");this.jsvMaskView=new t.ClipView}else this.jsvMaskView||(this.jsvMaskView=this.jsvMainView);this.jsvMaskView!==this.jsvMainView&&this.jsvMaskView.AddView(this.jsvMainView);let e=this.jsvCallbackOnUnloadForgeView();e&&this.jsvMainView.RegisterDetachCallback(e),this._jsvSetAttrLazySyncCallback()}_jsvSetAttrLazySyncCallback(){if(this.jsvAttrChangedLazySync){let t=this;this.jsvAttrChangedLazySync.setOnSyncCallback((e=>{let s=null,i=null;for(let n in e)if(t.hasOwnProperty(n))switch(e[n]){case m.ATTRTYPE.JSV:null==s&&(s={}),s[n]=t[n];break;case m.ATTRTYPE.CSS:null==i&&(i={}),i[n]=t[n]}s&&(s=t.jsvSetElementPropOnMask(s),t.jsvSetElementProp(s)),i&&t.jsvOnAttrLazySync(i)}))}}jsvOnAttrLazySync(t){}jsvSetElementProp(t){this.jsvMainView&&this.jsvMainView.SetElementProp(t,s.RootActivity)}jsvSetElementPropOnMask(t){if(t.hasOwnProperty("jsv_poster_on_top")){let{jsv_poster_on_top:e,...i}=t;return this.jsvMaskView.SetElementProp({jsv_poster_on_top:e},s.RootActivity),i}return t}jsvCallbackOnUnloadForgeView(){return null}jsvOnStyleChanged(t){let e=!!t[w.TYPE.LAYOUT_SIZE],s=!1;t[w.TYPE.LAYOUT_POS]&&(e||(this.jsvFlushViewLayout(),s=!0)),t[w.TYPE.LAYOUT_SIZE]&&(this.jsvFlushViewLayout(),s=!0),t[w.TYPE.TRANSFORM]&&!s&&(this.jsvMaskView.ResetCssTransform(this.style.transform,this.style.transformOrigin),this.jsvFlushViewTransition(),s=!0),t[w.TYPE.BACKGROUND]&&this.jsvFlushViewBackground(),t[w.TYPE.ANIMATION]&&this.jsvFlushViewAnimation(),t[w.TYPE.TRANSITION]&&!s&&this.jsvFlushViewTransition(),this.jsvFlushEventHandlers()}jsvFlushEventHandlers(){null===this.eventHandlers&&(this.eventHandlers=j.getHandlers(this),this.eventHandlers&&this.eventHandlers.onClick&&this.jsvMainView&&this.jsvMainView.EnableDivTouch(this,null))}jsvApplyObjectFit(t){return null}jsvFlushViewLayout(){if((this.style.clipPath||this.style.overflow||this.style.objectFit)&&!this.jsvMaskView)return void console.error("Element.jsvFlushViewLayout() InvalidOpt: clippath=",this.style.clipPath);const e={x:isNaN(this.style.left)?0:this.style.left,y:isNaN(this.style.top)?0:this.style.top,width:isNaN(this.style.width)?0:this.style.width,height:isNaN(this.style.height)?0:this.style.height};let s=null;if(this.style.objectFit&&(s=this.jsvApplyObjectFit(e),this.style.objectFit===w.ObjectFit.FILL&&(s=null)),this.jsvMaskView.ResetCssTransform(this.style.transform,this.style.transformOrigin),this.style.perspective&&this.style.perspective>0){let t=this.style.perspectiveOrigin?this.style.perspectiveOrigin:null;this.jsvMainView.SetPerspective(this.style.perspective,t)}if(this.style.backfaceVisibility&&this.jsvMainView.SetBackfaceVisibility("visible"==this.style.backfaceVisibility),this.style.transformStyle&&this.jsvMainView.SetTransformStyle(this.style.transformStyle),this.jsvMaskView.ResetLayoutParams({x:e.x,y:e.y,width:this.clientWidth,height:this.clientHeight}),this.jsvMaskView!==this.jsvMainView){const t={x:0,y:0,width:this.jsvMaskView.LayoutParams.Width,height:this.jsvMaskView.LayoutParams.Height};this.jsvMainView.ResetLayoutParams(t)}let i=this.style.visibility;"NONE"==this.style.display&&(i="HIDDEN"),this.jsvMaskView.SetVisibility(i);let n=null;null!==s&&window.JsView?n={x:s.x,y:s.y,width:s.width,height:s.height}:this.style.clipPath?n={x:this.style.clipPath.left,y:this.style.clipPath.top,width:this.jsvMaskView.LayoutParams.Width-this.style.clipPath.left-this.style.clipPath.right,height:this.jsvMaskView.LayoutParams.Height-this.style.clipPath.top-this.style.clipPath.bottom}:this.style.overflow===w.Overflow.HIDDEN&&null===this.jsvStore.textContent&&(n={x:0,y:0,width:this.style.width,height:this.style.height}),n?this.jsvMaskView.SetClipRect(n.x,n.y,n.width,n.height,!0):this.jsvMaskView instanceof t.ClipView&&this.jsvMaskView.SetClipRect(0,0,0,0,!1),void 0!==this.style.zIndex&&null!==this.style.zIndex&&this.jsvMaskView.SetZIndex(this.style.zIndex),this.jsvFlushViewTransition()}jsvFlushViewBackground(){this.style.backgroundImage?(this.jsvStore.textureWidth=NaN,this.jsvStore.textureHeight=NaN,s.SetBackgroundImage(this.jsvMainView,this.style.backgroundImage,this.style.borderRadius)):this.style.backgroundColor?(this.jsvStore.textureWidth=NaN,this.jsvStore.textureHeight=NaN,s.SetBackgroundColor(this.jsvMainView,this.style.backgroundColor,this.style.borderRadius)):this.jsvMainView.ResetTexture(null)}jsvFlushViewAnimation(){if(this.jsvAnimation&&this.jsvAnimation.Cancel(),!this.style.animation)return;let e=document.jsvGetKeyFrames(this.style.animation.name,this.jsvStore.scopedAttributes);this.jsvAnimation=new t.CssKeyframeAnimation(e,this.style.animation.duration,this.style.animation.timingFunction,this.style.width?this.style.width:this.clientWidth,this.style.height),this.jsvAnimation.EnableDelay(this.style.animation.delay).SetRepeat(this.style.animation.iterationCount),"forwards"===this.style.animationFillMode&&this.jsvAnimation.Enable(t.AnimationEnable.KeepTransform);var s=this;let i=new t.AnimationListener;i.OnEnd((e=>{if(s.jsvAnimation=null,e){let e=new c("animationend");e.target=s,s.dispatchEvent(e),null==s.instantSwapCallback&&(s.instantSwapCallback=t.sRenderBridge.InstantPerformSwap.bind(t.sRenderBridge)),Promise.resolve().then(s.instantSwapCallback)}})),this.jsvAnimation.Enable(t.AnimationEnable.ReleaseAfterEndCallback),this.jsvAnimation.SetAnimationListener(i),this.jsvMaskView.StartAnimation(this.jsvAnimation)}jsvFlushViewTransition(){if(this.style.animation)return;if(null!=this.jsvStore.transitionTmp&&this.jsvStore.transitionTmp.syncTimes!=r.cnt&&-1!=this.jsvStore.transitionTmp.syncTimes){let t=this.jsvStore.transition;this.jsvStore.transition=this.jsvStore.transitionTmp,this.jsvStore.transitionTmp=t,null!=this.jsvStore.transitionTmp&&(this.jsvStore.transitionTmp.syncTimes=-1)}if(this.style.transition){if(this.jsvStore.transition){if(!this._JsvBuildTransition())return}}else this.jsvAnimation&&(this.jsvAnimation.Cancel(),this.jsvAnimation=null);let t=this.jsvStore.transitionTmp;t||(t={left:0,top:0,width:0,height:0,opacity:1,transform:null,syncTimes:-1}),t.left=this.style.left,t.top=this.style.top,t.width=this.style.width,t.height=this.style.height,t.opacity=this.style.opacity,t.transform=this.style.transform,t.syncTimes=r.cnt,this.jsvStore.transitionTmp=t}_JsvBuildTransition(){let e=[];for(let t in this.style.transition){let s=this.jsvStore.transition[t],i=this.style[t];if(s===i)continue;let n=this.style.transition[t],r={name:t,dur:Math.round(n.duration),tf:null,dly:Math.round(n.delay),from:s||"",to:i};"transform"===t&&(r.origin=this.style.transformOrigin?this.style.transformOrigin:"center center"),n.timingFunction&&(r.tf=n.timingFunction.Package()),e.push(r)}if(e.length<=0)return!1;var s=this;let i=new t.AnimationListener;return i.OnEnd((e=>{if(s.jsvAnimation=null,e){let e=new c("transitionend");e.target=s,s.dispatchEvent(e),null==s.instantSwapCallback&&(s.instantSwapCallback=t.sRenderBridge.InstantPerformSwap.bind(t.sRenderBridge)),Promise.resolve().then(s.instantSwapCallback)}})),this.jsvAnimation=new t.CssTransitionAnimation(e),this.jsvAnimation.SetAnimationListener(i),this.jsvMaskView.StartAnimation(this.jsvAnimation),!0}jsvBackwardFindForgeView(t){let e=t;for(;e&&!(e instanceof m);)e=e.nextSibling;return e}static applyObjectFitCommon(t,e,s){if(s&&!isNaN(t.jsvStore.textureWidth)&&!isNaN(t.jsvStore.textureHeight)){const i=t.style.objectFit,n=s.ApplyObjectFit(e.width,e.height,t.jsvStore.textureWidth,t.jsvStore.textureHeight,i,w.ObjectFit);return 0!==e.width&&0!==e.height||0===e.width&&0===e.height||(t.jsvStore.clientWidth=Math.max(e.width,n.width),t.jsvStore.clientHeight=Math.max(e.height,n.height)),n}return null}_jsvAppendScopedAttribute(t,e){if(0!=e&&this.jsvInheritClassDepth!=e||(this.jsvStore.scopedAttributes.push(t),this.jsvStore.clientWidth=NaN,this.jsvStore.clientHeight=NaN,this.style.jsvAppendClassAttribute(t)),this.jsvHasInheritClassChildren){e=this.jsvInheritClassDepth==e?1:e+1;for(const s of this.childNodes)s.jsvInheritClassDepth<=0&&0==s.jsvHasInheritClassChildren||s instanceof m&&(s.jsvStore.scopedAttributes.includes(t)||s._jsvAppendScopedAttribute(t,e))}}_jsvSetClassNames(t,e){if(0!=e&&this.jsvInheritClassDepth!=e||this.style.jsvApplyClasses(t,this.jsvInheritClassDepth==e),this.jsvHasInheritClassChildren){e=this.jsvInheritClassDepth==e?1:e+1;for(const s of this.childNodes)s.jsvInheritClassDepth<=0&&0==s.jsvHasInheritClassChildren||s instanceof m&&s._jsvSetClassNames(t,e)}}_jsvSetInheritClassDepth(t){if(t<=0)return;this.jsvInheritClassDepth=t;let e=this;for(let s=0;s<t&&(e=e.parentNode,e);s++);if(e){for(const s of e.jsvStore.scopedAttributes)this._jsvAppendScopedAttribute(s,t);this._jsvSetClassNames(e.class,t)}}}m.TAG={DIV:"DIV",IMAGE:"IMAGE",LINK:"LINK",STYLE:"STYLE",AUDIO:"AUDIO",VIDEO:"VIDEO",ANCHOR:"A",SVG:"SVG",FDIV:"FDIV",AUDIOTRACK:"AUDIOTRACK"},m.ATTRIBUTE={SRC:"src",JSVPREFIX:"jsv"},m.ATTRTYPE={JSV:Symbol("jsv"),CSS:Symbol("css")};class S extends m{constructor(){super(),console.warn("Warnig: <a> is fake in JsView system"),this.href="",this.protocol="",this.host="",this.search="",this.hash="",this.hostname="",this.port="",this.pathname=""}jsvGetTagName(){return m.TAG.ANCHOR}}class C extends m{constructor(t){super(),this.jsvMediaView=null,this.jsvMedia=null,this.onVisibilityChange=this.onVisibilityChange.bind(this),this.stopByOnHide=!1,this.playBackground=!1,t&&(this.srcValue=t)}addEventListener(t,e,s){t=t.replace(/-/g,""),super.addEventListener(t,e,s),this.jsvAddMediaListener(t)}jsvOnLoaded(){}set src(t){if(t&&"about:null"!==t&&"about:blank"!==t){t=new e(t).href}this.jsvMedia||this.jsvInit(),t!==this.jsvMedia.src&&(this.jsvMedia.src=t,this.srcValue=t)}jsvOnLoadForgeView(){console.log("MediaElement jsvOnLoadForgeView"),super.jsvOnLoadForgeView(),this.jsvMedia||this.jsvInit(),this.registerOnVisibilityChange()}jsvInit(){let t=this.jsvEventListener;if(t)for(var e in t.keys)this.jsvAddMediaListener(e);Promise.resolve().then((()=>{this.jsvMedia&&this.jsvMedia.confirmInitSetup?.()}))}jsvCallbackOnUnloadForgeView(){return this.jsvOnUnloadForgeView.bind(this)}jsvOnUnloadForgeView(){console.log("MediaElement jsvOnUnloadForgeView"),this.unregisterOnVisibilityChange(),this.jsvMediaView&&(this.jsvMediaView=null),this.jsvRelease()}jsvRelease(){this.jsvMedia&&(this.jsvMedia.pause(),this.jsvMedia.unload&&this.jsvMedia.unload(),this.jsvMedia.releaseResource&&(this.jsvMedia.releaseResource(),this.jsvMedia.onPlatformDestroy())),this.jsvEventListener=void 0}jsvAddMediaListener(t){}onJsViewHide(){this.jsvMedia&&(this.jsvMedia.paused||(this.stopByOnHide=!0),this.jsvMedia.unload())}onJsViewShow(){this.jsvMedia||this.jsvInit(),this.jsvMedia.src=this.srcValue,this.stopByOnHide&&(this.stopByOnHide=!1,this.jsvMedia.play())}onVisibilityChange(t){this.playBackground||("show"===t.status?this.onJsViewShow():"hide"===t.status&&this.onJsViewHide())}registerOnVisibilityChange(){window.JsView&&window.JsView.onVisibilityChange(this.onVisibilityChange)}unregisterOnVisibilityChange(){window.JsView&&window.JsView.removeEventCallback(this.onVisibilityChange)}setAttribute(t,e){"jsv_play_background"!==t?super.setAttribute(t,e):this.playBackground="true"===e}}C.HOOKS={Audio:Audio,Video:window._ExtVideo,OffscreenVideo:window._ExtOVP},C.PROP={SetOnly:["autoplay","loop","timeupdateless","predownload"],GetOnly:["duration","paused"],SetAndGet:["currentTime","muted","playbackRate","preload","volume"],Function:["load","pause","play","unload","confirmInitSetup"]};for(let t in C.PROP){let e=C.PROP[t];for(let s of e){let e={};"SetOnly"!==t&&"SetAndGet"!==t||(e.set=function(t){this.jsvMedia||this.jsvInit(),this.jsvMedia[s]=t}),"GetOnly"!==t&&"SetAndGet"!==t||(e.get=function(){return this.jsvMedia||this.jsvInit(),this.jsvMedia[s]}),"Function"===t&&(e=function(...t){return this.jsvMedia||this.jsvInit(),this.jsvMedia[s]?this.jsvMedia[s](...t):null}),e instanceof Function?C.prototype[s]=e:Object.defineProperty(C.prototype,s,e)}}class T extends C{constructor(t){super(t),this.jsvOverrideMedia=!1,console.log("AudioElement.constructor()",this)}jsvGetTagName(){return m.TAG.AUDIO}jsvInit(){this.jsvOverrideMedia||(this.jsvMedia=new C.HOOKS.Audio),super.jsvInit(),this.jsvOnLoaded()}jsvOnLoaded(){this.jsvMediaView=new t.LayoutView,this.jsvMainView.AddView(this.jsvMediaView)}jsvAddMediaListener(t){this.jsvMedia||this.jsvInit(),this.jsvMedia.addEventListener(t,(()=>{let e=new i(t);e.target=this,this.dispatchEvent(e)}))}jsvRelease(){super.jsvRelease(),this.jsvMedia=null}setAttribute(t,e){if("data-jsv-audio-predownload"==t)return this.jsvMedia||this.jsvInit(),void(this.jsvMedia.predownload=!0);super.setAttribute(t,e)}}class O{constructor(){this._PersistMap=new Map,this._PersistMax=300,this._PersistIdx=0,this._PersistTrackList=new Array(this._PersistMax),this._TempMap=new Map,this._TempMax=50,this._TempIdx=0,this._TempTrackList=new Array(this._TempMax)}getPersistPack(t){return this._PersistMap.get(t)}putPersistPack(t,e){O._putPack(this._PersistMap,this._PersistTrackList,this._PersistIdx,t,e),this._PersistIdx=(this._PersistIdx+1)%this._PersistMax}getTempPack(t){return this._TempMap.get(t)}putTempPack(t,e){O._putPack(this._TempMap,this._TempTrackList,this._TempIdx,t,e),this._TempIdx=(this._TempIdx+1)%this._TempMax}static _putPack(t,e,s,i,n){let r=e[s];r&&(t.delete(r),e[s]=i),t.set(i,n)}}let E=new O;class R extends m{constructor(){super(),this.jsvContentView=null,this.jsvRefedImgTex=null,this.jsvTextLatexEnable=!1,this.jsvEmoji=!1,this.jsvTextAlignMinWidth=NaN,this.jsvEmptyRect=null}jsvGetTagName(){return m.TAG.DIV}get textContent(){return this.jsvStore.textContent}set textContent(e){(e||this.jsvStore.textContent)&&(this.jsvStore.textContent=e,this.jsvStore.clientWidth=NaN,this.jsvContentView||(this.jsvContentView=new t.LayoutView,this.jsvMainView.AddView(this.jsvContentView)),this.parentElement&&this.jsvFlushViewForeground())}get clientWidth(){const t=this.style.width;if(t||0===t)return t;if(this.jsvStore.textContent){if(!isNaN(this.jsvStore.clientWidth))return this.jsvStore.clientWidth;const t={str:this.jsvStore.textContent,font:this.style.fontFamily,size:this.style.fontSize,italic:this.style.fontStyle,bold:this.style.fontWeight};return this.jsvStore.clientWidth=s.GetTextWidth(t),this.jsvStore.clientWidth}return super.clientWidth}jsvOnLoadForgeView(){this.style.borderImage&&(this.jsvMaskView=new t.NinePatchView),super.jsvOnLoadForgeView()}jsvCallbackOnUnloadForgeView(){return this.jsvOnUnloadForgeView.bind(this)}jsvOnUnloadForgeView(){s.UnrefImgTexSize(this.jsvRefedImgTex),this.jsvRefedImgTex=null}jsvOnStyleChanged(t){super.jsvOnStyleChanged(t),this.jsvStore.textStylePack=null;let e=!!t[w.TYPE.FOREGROUND];t[w.TYPE.LAYOUT_SIZE]&&(e||this.jsvFlushViewForeground()),t[w.TYPE.FOREGROUND]&&this.jsvFlushViewForeground(),t[w.TYPE.BORDER]&&this.jsvFlushViewBorder()}jsvFlushViewForeground(){if(this.jsvContentView&&(this.jsvContentView.ClearViews(),this.jsvStore.textContent)){let t=void 0===this.style.height||0==this.style.height,e=t?(t,e)=>{this.jsvStore.clientHeight=t.height}:null,s=this.jsvBuildTextView(e);t&&s.EnableAutoHeight(),this.jsvContentView.AddView(s)}}jsvBuildTextView(e){let i=this.jsvStore.textStylePack;if(null===i&&(i=this._jsvGetClassNameCache()),null===i){this.style.jsvCustomStyles.textLineAlign||(this.style.jsvCustomStyles.textLineAlign=this.style.lineHeight?"middle":"top"),this.style.jsvCustomStyles.textVerticalAlign||(this.style.jsvCustomStyles.textVerticalAlign="top");let e=R._jsvStyleToPackData(this.style),s=JSON.stringify(e),n=E.getTempPack(s);n||(n=t.sTextStyleCache.StyleToPack(e),E.putTempPack(s,n)),i=n}this.jsvStore.textStylePack=i;let n=this.style.lineHeight?parseInt(this.style.lineHeight):this.style.fontSize?1.3*this.style.fontSize:14,r=this.style.width,o=!1;if(void 0===r&&(r=this.clientWidth,o=!0),this.jsvTextAlignMinWidth&&r<this.jsvTextAlignMinWidth&&(r=this.jsvTextAlignMinWidth),r>3e3){if(!o)return console.error(`text too long. str=${this.jsvStore.textContent}`),null;console.log(`text too long, start to break down. width(${r})`);let a=new t.LayoutView,l=Math.floor(2048/this.style.fontSize),h=this.jsvStore.textContent.length,u=0,d=0,c={str:null,font:this.style.fontFamily,size:this.style.fontSize,italic:this.style.fontStyle,bold:this.style.fontWeight};for(;h>0;){let r=l<h?l:h,o=this.jsvStore.textContent.substr(u,r);u+=r,c.str=o;let v=s.GetTextWidth(c),g=t.sTextUtils.BuildTextView(s.TextureManager,o,i,0===u?e:null,{width:v,height:this.style.height},this.style.fontSize,n,!0,this.jsvTextLatexEnable,this.jsvEmoji,this.jsvEmptyRect);a.AddView(g,{x:d,y:0,width:v,height:this.style.height}),d+=v,h-=r}return a}return t.sTextUtils.BuildTextView(s.TextureManager,this.jsvStore.textContent,i,e,{width:r,height:this.style.height},this.style.fontSize,n,!0,this.jsvTextLatexEnable,this.jsvEmoji,this.jsvEmptyRect)}_jsvGetClassNameCache(){if(null===this.style.jsvNamedClassArray)return null;if(w.JsvContainsTextMajor(this.style.jsvLockedProps))return null;let e="";for(let t of this.style.jsvNamedClassArray){let s=t.getAttach();0===s.hasTextMajorStyle&&(w.JsvContainsTextMajor(t.getStyles())?s.hasTextMajorStyle=2:s.hasTextMajorStyle=1),2===s.hasTextMajorStyle&&(e+=t.getName())}if(e.length>0){let s=E.getPersistPack(e);if(!s){let i=R._jsvStyleToPackData(this.style);s=t.sTextStyleCache.StyleToPack(i),E.putPersistPack(e,s)}return s}return null}static _jsvStyleToPackData(t){let e={textColor:t.color?t.color:"#000000",font:t.fontFamily,italic:"italic"===t.fontStyle,bold:"bold"===t.fontWeight,hAlign:t.textAlign?t.textAlign:"start",vAlign:t.jsvCustomStyles.textLineAlign?t.jsvCustomStyles.textLineAlign:"middle",vAreaAlign:t.jsvCustomStyles.textVerticalAlign?t.jsvCustomStyles.textVerticalAlign:"top",textOverflow:t.textOverflow?t.textOverflow:"clip",wordWrap:"break-word"===t.wordWrap?"break_word":"normal",direction:"rtl"===t.direction?"rtl":"ltr",textInnerDirection:t.jsvCustomStyles.textInnerDirection?t.jsvCustomStyles.textInnerDirection:"unset"};"nowrap"===t.whiteSpace&&(e.wordWrap="none");let s=t.textShadow?t.textShadow.split(" "):void 0;s&&(e.shadow={shadowOffsetX:parseInt(s[0]),shadowOffsetY:parseInt(s[1]),shadowBlur:parseFloat(s[2]),shadowColor:s[3]});let i=t.WebkitTextStroke?t.WebkitTextStroke.split(" "):void 0;return i&&(e.stroke={strokeWidth:parseInt(i[0]),strokeColor:i[1]}),e}jsvFlushViewBorder(){if(this.jsvMaskView)if(this.style.clipPath)console.error("BorderImage is conflicting with ClipPath.");else if(this.style.borderImage){if(!(this.jsvMaskView instanceof t.NinePatchView))return void console.error("Error: style.borderImage NOT support dynamic adding");let e=v.ConvertPx(this.getAttribute("jsv-borderimage-width")),i=v.ConvertPx(this.getAttribute("jsv-borderimage-height"));if(s.UnrefImgTexSize(this.jsvRefedImgTex),!this.jsvRefedImgTex||this.jsvRefedImgTex.Source!==this.style.borderImage.source.href){let n=e&&i?{width:e,height:i}:null;if(!this.style.borderImage.source.href)return void this.jsvMaskView.ResetTexture(null);this.jsvRefedImgTex=s.TextureManager.GetImage2(this.style.borderImage.source.href,!1,n,t.ColorSpace.RGBA_8888)}e&&i&&(console.log("Custom cache image size with: "+e+"/"+i),s.SetImgTexSize(this.jsvRefedImgTex,{width:e,height:i}));const n=new t.ExternalTextureSetting(this.jsvRefedImgTex);this.jsvMaskView.ResetTexture(n),this.jsvMaskView.WaitTextureToResize(!0),s.RefImgTexSize(this.jsvRefedImgTex,function(t){if(!this.jsvMaskView)return void console.log("Found border view gone");let e=this.style.borderImageWidth,s=this.style.borderImage.slice,i=Math.floor(t.width*e.top/s.top),n=Math.floor(t.height*e.left/s.left);this.jsvMaskView.SetImageDspSize(i,n);let r=this.style.borderImageOutset?this.style.borderImageOutset:v.ConvertRect();this.jsvMaskView.SetPadding({start:r.left,width:Math.max(0,i-r.left-r.right)},{start:r.top,width:Math.max(0,n-r.top-r.bottom)}),this.jsvMaskView.SetRepeat([{start:e.left,width:Math.max(0,i-2*e.left)}],[{start:e.top,width:Math.max(0,n-2*e.top)}]),this.jsvMaskView.WaitTextureToResize(!1)}.bind(this))}}setAttribute(t,e){this.jsvTakeTextAttribute(t,e)||super.setAttribute(t,e)}jsvTakeTextAttribute(t,e){return"jsv_text_vertical_align"===t?(this.style.jsvCustomStyles.textVerticalAlign=e,!0):"jsv_text_line_align"===t?(this.style.jsvCustomStyles.textLineAlign=e,!0):"jsv_text_latex_enable"===t?(this.jsvTextLatexEnable="true"===e,!0):"jsv_text_align_minwidth"===t?(this.jsvTextAlignMinWidth=parseInt(e),!0):"jsv_text_emoji"===t?(this.jsvEmoji="true"===e||!0===e,!0):("jsv_text_empty_rect"===t?this.jsvEmptyRect=JSON.parse(e):"jsv_text_inner_direction"===t&&(this.style.jsvCustomStyles.textInnerDirection=e),!1)}}class A{constructor(t,e){this.RouterDelegate={ref:null},t||(this.RouterDelegate.ref=new P(!1,e))}getNodeByName(t){return this.RouterDelegate.ref.getNodeByName(t)}focusByNameBeforeMount(t,e){return t.includes(".")&&(t=t.split(".")),this.RouterDelegate.ref.focusBeforeMount(t,e)}setFocus(t,e){return this.focusByNameBeforeMount(t,e)}printFocusList(){for(let t in this.RouterDelegate.ref._ChildMap)console.log(`branchName[${t}] ${t===this.RouterDelegate.ref._FocusNodeName?"focused":""}`,this.RouterDelegate.ref._ChildMap[t])}printGlobalLastFocus(){console.log("FocusNode:"),console.log(I.sLastFocus)}getCurrentFocusStack(){const t=[];if(this.RouterDelegate.ref){let e=this.RouterDelegate.ref.getCurrentFocusNode();for(;e&&e instanceof I&&e.RouterDelegate.ref===this.RouterDelegate.ref;)t.push({name:e.BranchName}),e=e.GetParentPage()}else console.error("getCurrentFocusStack failed: router delegate is null.");return t}debugPrintNodes(){console.log("***print focus nodes***");for(let t in this.RouterDelegate.ref._ChildMap)t.includes("__DEFAULT_ID_")||console.log(t,this.RouterDelegate.ref._ChildMap[t]);console.log("***********************")}}class P{constructor(t,e){this._IsTemp=!!t,this._ChildMap={},this._FocusNameBeforeMount=null,this._FocusNodeName=null,this.NameSpace=e}getCurrentFocusNode(){return this._ChildMap[this._FocusNodeName]}getNodeByName(t,e){let s=t.split(".");return this._FindRouterSearchBase(s,e)._GetNodeFromPathArray(s,t)}_FindRouterSearchBase(t,e){if(0==t[0].length){let e,s;for(let t in this._ChildMap){e=this._ChildMap[t];break}do{s=e,e=e.GetParentPage()}while(null!=e);return t.splice(0,1),s.RouterDelegate.ref}return e&&e.AsHub&&e.GetParentPage()?e.GetParentPage().RouterDelegate.ref:this}_GetNodeFromPathArray(t,e){let s=0,i=this;for(;s<t.length-1;){let n=!1;for(let e in i._ChildMap){let r=i._ChildMap[e].RouterDelegate.ref;if(r!=i&&r.NameSpace==t[s]){i=r,s++,n=!0;break}}if(!n)return void console.error(`Error: no found subpath fname=${e}`)}let n=t[s];return i._ChildMap.hasOwnProperty(n)?i._ChildMap[n]:void console.error(`Error: no found fname=${e}`)}add(t,e){if(t.indexOf(".")>=0)console.error("ERROR: FDiv name can not contains '.'");else if(this._ChildMap.hasOwnProperty(t)&&this._ChildMap[t]!==e)console.error(`ERROR: FDiv router branch name duplicated:[${t}]`);else if(this._ChildMap[t]=e,this._FocusNameBeforeMount)if("string"==typeof this._FocusNameBeforeMount)this._FocusNameBeforeMount==t&&(this._FocusNameBeforeMount=null,e.Focus());else{this._FocusNameBeforeMount[0]==t&&(e.RouterDelegate.ref.focusBeforeMount(this._FocusNameBeforeMount.slice(1)),this._FocusNameBeforeMount=null)}}remove(t,e){let s=this._ChildMap[t];s&&s==e&&delete this._ChildMap[t]}rename(t,e){if(!this._ChildMap.hasOwnProperty(t))return void console.error(`ERROR: alter name failed ${t}->${e}`);let s=this._ChildMap[t];delete this._ChildMap[t],this.add(e,s),this._FocusNodeName==t&&(this._FocusNodeName=e)}focusBeforeMount(t,e){let s=!1;if(t.indexOf(".")>=0)return console.error("ERROR: not support name with namespace"),!1;if("string"==typeof t){if(!t.includes(".")){s=!0;let i=this._ChildMap[t];return this._FocusNodeName=t,i?(i.Focus(!e),!0):(this._FocusNameBeforeMount=t,!1)}}else if("object"==typeof t&&Array.isArray(t)&&t.length>0){if(s=!0,1==t.length)return this.focusBeforeMount(t[0]);{let e=t[0],s=this._ChildMap[e];return this._FocusNodeName=e,s?s.RouterDelegate.ref.focusBeforeMount(t.slice(1)):(this._FocusNameBeforeMount=t,!1)}}return s||console.error("illegal name param",t),!1}focus(t,e){let s=this.focusBeforeMount(t,e);return s||console.log("No found branch:"+t),s}forEach(t){for(let e in this._ChildMap)t(this._ChildMap[e],e,this._ChildMap)}printNodes(){console.log(this._ChildMap)}}class I extends t.PageBase{constructor(t){super(t),this._OnKeyDown=null,this._OnKeyUp=null,this._OnFocus=null,this._OnBlur=null,this._DispatchKeyDown=null,this._DispatchKeyUp=null,this._OnCustomerEvent=null,this._DKeyDownProxy=void 0,this._DKeyUpProxy=void 0,this._Mounted=!1,this.BranchName=t,this.AsHub=!1,this.InterfaceHub=null,this.RouterDelegate={ref:null},this._TmpRouter=null,this._OriginDispatchKeyDown=this._OriginDispatchKeyDown.bind(this),this._OriginDispatchKeyUp=this._OriginDispatchKeyUp.bind(this),this._AutoShow=!1}updateMountState(){this._Mounted=!0;let t=this.SubPages;for(let e in t)t[e].updateMountState()}getHub(){return this.InterfaceHub||(this.InterfaceHub=new A(!0),this.InterfaceHub.RouterDelegate=this.RouterDelegate),this.InterfaceHub}setHub(t){this.RouterDelegate.ref?console.error("Error: hub is already setted."):(this.RouterDelegate.ref=t.RouterDelegate.ref,this.AsHub=!0)}_UseParentRouter(t){this.RouterDelegate=t,this.InterfaceHub&&(this.InterfaceHub.RouterDelegate=t)}routerAdd(t,e){e.RouterDelegate.ref||e._UseParentRouter(this.RouterDelegate),this.RouterDelegate.ref||(this.RouterDelegate.ref=new P(!0)),this.RouterDelegate.ref.add(t,e)}routerRenameChild(t,e){this.RouterDelegate.ref.rename(t,e)}printFocusList(){this.RouterDelegate.ref?this.RouterDelegate.ref.printFocusList():console.error("Error: no router")}routerUnbind(){let t;this.AsHub?this.GetParentPage()&&(t=this.GetParentPage().RouterDelegate.ref):t=this.RouterDelegate.ref,t&&t.remove(this.BranchName,this)}setBranchName(t){if(t===this.BranchName)return;let e=this.BranchName;this.BranchName=t,this.PageName=t,this._ParentPage&&this._ParentPage.routerRenameChild(e,t)}setOnKeyDown(t){this._OnKeyDown=t}setOnKeyUp(t){this._OnKeyUp=t}setOnFocus(t){this._OnFocus=t}setOnBlur(t){this._OnBlur=t}setDispatchKeyUp(t){this._DispatchKeyUp=t}setDispatchKeyDown(t){this._DispatchKeyDown=t}setOnCustomerEvent(t){this._OnCustomerEvent=t}setDispatchKeyProxy(t,e){this._DKeyDownProxy=t,this._DKeyUpProxy=e}requestFocus(t){let e=this.RouterDelegate.ref;return this.AsHub&&this.GetParentPage()&&(e=this.GetParentPage().RouterDelegate.ref),e?e.focus(this.BranchName,t):(console.error("error: lost router"),!1)}OnKeyDown(t){return!!this._OnKeyDown&&this._OnKeyDown(t)}OnKeyUp(t){return!!this._OnKeyUp&&this._OnKeyUp(t)}OnCustomerEvent(t){return!!this._OnCustomerEvent&&this._OnCustomerEvent(t)}bubbleCustomerEvent(t){this.BubbleCustomerEvent(t)}dispatchKeyDown(t){return this.DispatchKeyDown(t)}DispatchKeyDown(t){return I.sLastFocus=this,this._DKeyDownProxy?this._DKeyDownProxy(t,this._OriginDispatchKeyDown):this._OriginDispatchKeyDown(t)}_OriginDispatchKeyDown(t){let e=!1;return this._DispatchKeyDown&&(e=this._DispatchKeyDown(t)),!!e||super.DispatchKeyDown(t)}dispatchKeyUp(t){return this.DispatchKeyUp(t)}DispatchKeyUp(t){return this.__DKeyUpProxy?this.__DKeyUpProxy(t,this._OriginDispatchKeyUp):this._OriginDispatchKeyUp(t)}_OriginDispatchKeyUp(t){let e=!1;return this._DispatchKeyUp&&(e=this._DispatchKeyUp(t)),!!e||super.DispatchKeyUp(t)}attachToActivity(t,e){this.AttachToActivity(t,e)}AttachToActivity(t,e){super.SetParent(t,e)}setParent(t){this.SetParent(t)}SetParent(t){if(null!=t&&(super.SetParent(t,null),this._ParentPage._Mounted&&(this.updateMountState(),b()),t instanceof I)){if(this.RouterDelegate.ref&&this.RouterDelegate.ref._IsTemp){let e=this.RouterDelegate.ref;this.RouterDelegate.ref=null,e.forEach(((e,s)=>{t.routerAdd(s,e)}))}t.routerAdd(this.BranchName,this)}}focus(t){this.Focus(t)}Focus(t){if(!this._Mounted)return I.sFocusMemos.push({obj:this,bcf:t}),void console.log("page base tree not build, cache focus");super.Focus(t)}OnFocus(){this._OnFocus&&this._OnFocus()}OnBlur(){this._OnBlur&&this._OnBlur()}onUnMount(){let t=this.GetParentPage();t&&t.RemoveSubPage(this),this.ClearSubPages(),this.routerUnbind()}getName(){let t=this,e=[this.RouterDelegate.ref.NameSpace];this.AsHub||e.push(this.BranchName);let s=this.RouterDelegate.ref;do{if(t=t.GetParentPage(),"__AppRoot__"==e[0])break;t&&t.RouterDelegate.ref!=s&&(s=t.RouterDelegate.ref,e.unshift(s.NameSpace))}while(t);return"__AppRoot__"==e[0]?e[0]="":console.error("ERROR: missing app root"),e.join(".")}getNodeByName(t){return this.RouterDelegate.ref.getNodeByName(t,this)}printFocusNodeList(){this.getHub().printFocusList()}printGlobalLastFocus(){this.getHub().printGlobalLastFocus()}}I.sFocusMemos=[],I.sLastFocus=null,I.sRootPageNode=null;let b=()=>{let t=I.sFocusMemos.length;if(t>0){let e=I.sFocusMemos;I.sFocusMemos=[];for(let s=0;s<t;s++)e[s].obj.Focus(e[s].bcf)}},M=1;class N extends m{constructor(){super(),this.FocusNodeRef=new I("__DEFAULT_ID_"+M++),this.HubRef=void 0}jsvGetTagName(){return m.TAG.FDIV}setAttribute(t,e){if(t)if("fname"===t)e&&this.FocusNodeRef.setBranchName(e);else if("new-namespace"===t&&""!==e&&!this.HubRef){let t=new A(!1,e);this.HubRef=t,this.FocusNodeRef.setHub(t),this.FocusNodeRef.setBranchName(e)}}jsvGetHub(){return this.HubRef}}class V extends m{constructor(t){super(t),this.src=null,this.onerror=null,this.onload=null}setAttribute(t,e){console.log("LinkElement.setAttribute() name="+t+", value=",e),this[t]=e}jsvLoadResource(){let t=!1,s=null;if(null!=this.href){var i=new e(this.href);console.log("Ignore to load link from url="+i.href),t=!0}else console.warn("Failed to load link, href is not exists."),s="NoSrc";this.jsvOnLoadResult(t,s)}jsvOnLoadResult(t,e){if(console.log("jsvOnLoadResult isSuccess:"+t+", errCode:"+e),t){if(this.onload){let t=new i("load");this.onload(t)}}else this.onerror&&this.onerror({type:"jsvErr_"+e,target:this})}}class x extends m{constructor(t){super(t),this.src=null,this.onerror=null,this.onload=null,this.charset=null,this.timeout=120}setAttribute(t,e){console.log("ScriptElement.setAttribute() name="+t+", value=",e),this[t]=e}jsvLoadResource(){if(null!=this.src){var t=new e(this.src);console.log("load script with url="+t.href);var s=this;window.JsView.runJsWithUrl(t.href,!1,((t,e)=>{s.jsvOnLoadResult(t,e)}))}}jsvOnLoadResult(t,e){if(console.log("onLoadResult "+t+" "+e),t){if(this.onload){let t=new i("load");this.onload(t)}}else this.onerror&&this.onerror({type:"jsvErr_"+e,target:this})}}class _ extends m{constructor(){super()}appendChild(t){"HTMLScriptElement"==t.constructor.name||"HTMLStyleElement"==t.constructor.name||"HTMLLinkElement"==t.constructor.name?window.originDocument.headAppendChild(t):super.appendChild(t),(t instanceof V||t instanceof x)&&t.jsvLoadResource()}removeChild(t){"HTMLScriptElement"==t.constructor.name||"HTMLStyleElement"==t.constructor.name||"HTMLLinkElement"==t.constructor.name?window.originDocument.headRemoveChild(t):super.removeChild(t)}}class L extends i{constructor(t){super("load")}}class D extends m{constructor(e){super(e),this.jsvImageView=new t.LayoutView(null,"img"),this.jsvMainView.AddView(this.jsvImageView),this._ImageInLoading=!1,this.jsvColorSpace=t.ColorSpace.RGBA_8888,this.jsvScaleDownTex=null,this._HasUserOnLoad=!1,this._OnLoadSeq=1,this._LoadedSrc=null,this.jsvApicAutoPlay=!0}jsvGetTagName(){return m.TAG.IMAGE}setAttribute(t,e){this.jsvTakeTextureAttribute(t,e)||(super.setAttribute(t,e),t===m.ATTRIBUTE.SRC&&this.jsvSetAttrLazySync(t,m.ATTRTYPE.CSS))}jsvSetElementProp(t){this.jsvImageView.SetElementProp(t,s.RootActivity)}jsvCallbackOnUnloadForgeView(){return()=>{if(this._HasUserOnLoad){let t=this.jsvImageView?.TextureSetting?.Texture;t&&t.DisableBackgroundLoad(this)}}}jsvFlushEventHandlers(){if(super.jsvFlushEventHandlers(),this.eventHandlers.onLoad){let t=this.jsvImageView?.TextureSetting?.Texture;t&&(this._HasUserOnLoad=!0,t.EnableBackgroundLoad(this))}else if(this._HasUserOnLoad){let t=this.jsvImageView?.TextureSetting?.Texture;t&&t.DisableBackgroundLoad(this),this._HasUserOnLoad=!1}}jsvTakeTextureAttribute(t,e){return"jsv_img_color_space"==t||"jsvImgColorSpace"==t||"jsv-img-color-space"==t?(this.jsvColorSpace=e,!0):"jsv_img_scaledown_tex"==t||"jsvImgScaledownTex"==t||"jsv-img-scaledown-tex"==t?(""!==e&&void 0!==e||(e="true"),this.jsvScaleDownTex=e,!0):"jsv_disable_apic_autoplay"==t&&(this.jsvApicAutoPlay=!1,!0)}jsvFlushViewLayout(){this._ImageInLoading?(this.jsvImageView.WaitTextureToResize(!0),this.jsvImageView.ResetLayoutParams({x:0,y:0,width:this.style.width,height:this.style.height})):this.jsvImageView.WaitTextureToResize(!1),super.jsvFlushViewLayout()}jsvOnLoaded(t){if(console.log("ImageElement.jsvOnLoaded() imageSize="+JSON.stringify(t)),this._ImageInLoading=!1,this._LoadedSrc=this.src,this.jsvStore.textureWidth=t.width,this.jsvStore.textureHeight=t.height,this.style.jsvLazySyncCache.setCacheProperty(w.TYPE.LAYOUT_SIZE,!0),this._HasUserOnLoad){let t=new L;t.target=this,document.dispatchEvent(t)}}jsvOnAttrLazySync(t){t.hasOwnProperty(m.ATTRIBUTE.SRC)&&this.src!=this._LoadedSrc&&(this._ImageInLoading=!0,this.jsvStore.textureWidth=NaN,this.jsvStore.textureHeight=NaN,this.jsvDrawImage())}jsvOnLoadForgeView(){this.style.objectFit||this.style.jsvSetPropertySilently("objectFit",w.ObjectFit.FILL),super.jsvOnLoadForgeView()}jsvApplyObjectFit(t){return 0!=this.jsvStore.textureWidth&&0!=this.jsvStore.textureHeight||console.warn("warning: size 0 not support object fit, src="+this.src),m.applyObjectFitCommon(this,t,this.jsvImageView)}jsvDrawImage(){if(!this.src)return;let t=null;"true"===this.jsvScaleDownTex&&(this.style&&this.style.width?t={width:this.style.width,height:0}:console.error("set jsvScaleDownTex while style.width is not set. you need to set 'src' prop at the end.")),this._OnLoadSeq++;let e=this._OnLoadSeq;s.SetBackgroundImage(this.jsvImageView,this.src,this.style.borderRadius,(t=>{e===this._OnLoadSeq&&this.jsvOnLoaded(t)}),t,this.jsvColorSpace,this.jsvApicAutoPlay)}}class F extends m{constructor(e){super(),this.jsvMainView=new t.JsvElementView(e)}get textContent(){return this.jsvMainView.textContent}set textContent(t){this.jsvMainView.textContent=t}setAttribute(t,e){super.setAttribute(t,e),this.jsvMainView.setAttribute(t,e)}removeAttribute(t){super.removeAttribute(t),this.jsvMainView.removeAttribute(t)}getAttribute(t){return this.jsvMainView.getAttribute(t)}hasAttribute(t){return this.jsvMainView.hasAttribute(t)}jsvOnStyleChanged(t){super.jsvOnStyleChanged(t)}}class k{constructor(t){let e=t.indexOf(k.KeyFramesFlag)+k.KeyFramesFlag.length,s=t.indexOf("{"),i=t.substring(e,s);this.name=i.trim(),this.cssText=t}}k.KeyFramesFlag="@keyframes";class B{constructor(t){this.jsvCssRules=null,this.jsvTextContent=t}get cssRules(){if(this.jsvCssRules)return this.jsvCssRules;this.jsvCssRules=new Array;if(this.jsvTextContent.indexOf(k.KeyFramesFlag)<0)return this.jsvCssRules;var t=this.jsvTextContent.split(k.KeyFramesFlag);for(let e in t)0!=e&&this.insertRule(k.KeyFramesFlag+t[e]);return this.jsvCssRules}insertRule(t,e){if(void 0===e&&(e=this.jsvCssRules.length),t.indexOf(k.KeyFramesFlag)<0)throw Error("StyleSheet.insertRule() Rule is not supported except keyframes.");let s=new k(t);this.jsvCssRules.splice(e,0,s)}deleteRule(t){this.jsvCssRules.splice(t,1)}}class G extends m{constructor(t){super(t),this.textContent=null}jsvGetTagName(){return m.TAG.STYLE}appendChild(t){super.appendChild(t);let e=new B(t.textContent);document.jsvAppendStyleSheet(e)}removeChild(t){throw super.removeChild(t),Error("Failed to removeChild, unimplement!.")}}class U extends m{}class H extends C{constructor(t){super(t),console.log("VideoElement.constructor()",this),this._EventCache=[],this._UseTexture=!1,this._StartTime=0}jsvGetTagName(){return m.TAG.VIDEO}setAttribute(t,e){("jsv-media-usetexture"!==t||"true"!==e&&!0!==e&&""!==e)&&("jsv_media_usetexture"!==t||"true"!==e)?super.setAttribute(t,e):this._UseTexture=!0}removeAttribute(t){if("jsv-media-usetexture"===t||"jsv_media_usetexture"===t)return this._UseTexture=!1,void console.log("removeAttribute jsv_media_usetexture");super.removeAttribute(t)}jsvFlushViewLayout(){super.jsvFlushViewLayout();let t=this.style.JsvVideoRotation;isNaN(t)&&(t=0),this.style.objectFit&&this.style.objectFit!=w.ObjectFit.CONTAIN&&this.style.objectFit!=w.ObjectFit.FILL&&(console.error("Video rotation is not valid on objectFit=",this.style.objectFit),t=0),this.jsvMedia&&this.jsvMedia.setRotation?.(t,this.style.width,this.style.height,this.style.objectFit==w.ObjectFit.FILL)}jsvAddMediaListener(t){this.jsvMedia?this.jsvMedia.addEventListener(t,(()=>{let e=new i(t);e.target=this,this.dispatchEvent(e)})):this._EventCache.push(t)}jsvFlushVideoView(){this.jsvMediaView&&(this.jsvStore.textureWidth=this.jsvMedia.videoWidth,this.jsvStore.textureHeight=this.jsvMedia.videoHeight,this.style.jsvLazySyncCache.setCacheProperty(w.TYPE.LAYOUT_SIZE,!0))}jsvApplyObjectFit(t){return m.applyObjectFitCommon(this,t,this.jsvMediaView)}jsvInit(){console.log("VideoElement jsvInit"),this._UseTexture?this.jsvMedia=new C.HOOKS.OffscreenVideo:this.jsvMedia=new C.HOOKS.Video,this._EventCache.length>0&&(this._EventCache.map((t=>{this.jsvAddMediaListener(t)})),this._EventCache=[]),this.addEventListener("load",this.jsvOnLoaded.bind(this)),super.jsvInit()}jsvRelease(){super.jsvRelease(),this.jsvMedia=null}jsvOnLoaded(){if(!this.jsvMediaView){let e;if(this._UseTexture){this.jsvMediaView=new t.LayoutView;let i,n=s.TextureManager.GetOffScreenMediaTexture(this.jsvMedia),r=this.style.borderRadius;r&&(i=new t.ViewRoundCornerMask(r.topLeft,r.topRight,r.bottomLeft,r.bottomRight)),e=new t.TextureSetting(n,i)}else{this.jsvMediaView=new t.VideoView(this.jsvMedia);let i=s.TextureManager.GetColorTexture("rgba(0,0,0,0)");e=new t.TextureSetting(i,null,null,!1)}this.jsvMainView.AddView(this.jsvMediaView),this.jsvMediaView.ResetTexture(e)}this.jsvFlushVideoView()}jsvOnLoadForgeView(){this.style.objectFit||this.style.jsvSetPropertySilently("objectFit",w.ObjectFit.CONTAIN),super.jsvOnLoadForgeView()}onJsViewHide(){this._StartTime=this.jsvMedia.currentTime,super.onJsViewHide(),this.jsvMedia.setState("autoPlay",!1,"boolean")}onJsViewShow(){this.jsvMedia||this.jsvInit(),this.jsvMedia.src=this.srcValue,this.jsvMedia.startTime=Math.max(this._StartTime-1,0),this._StartTime=0,this.stopByOnHide&&(this.stopByOnHide=!1,this.jsvMedia.play())}}H.PROP={SetOnly:[],GetOnly:["videoHeight","videoWidth"],SetAndGet:["height","poster","width"]};for(let t in H.PROP){let e=H.PROP[t];for(let s of e){let e={};"SetOnly"!==t&&"SetAndGet"!==t||(e.set=function(t){this.media[s]=t}),"GetOnly"!==t&&"SetAndGet"!==t||(e.get=function(){return this.media[s]}),H.prototype[s]=e}}H.EVENTS=["oncanplay","oncanplaythrough","ondurationchange","onended","onerror","onload","onloadedmetadata","onloadstart","onpause","onplay","onplaying","onprogress","onseeking","onseeked","onstalled","ontimeupdate"];class W extends u{constructor(t){super(u.TEXT_NODE),this.textContent=t}get nodeValue(){return this.textContent}set nodeValue(t){this.textContent=t,this.parentNode&&(this.parentNode.textContent=this.textContent)}}class K extends u{constructor(t){super(u.COMMENT_NODE),this.textContent=t}}let J={};class z{constructor(t,e,s){this._Element=s,J.hasOwnProperty(t)&&console.error(`Warn: FDivRoot duplicate name=${t}`),J[t]=this,this._DoInit(e)}_DoInit(t){let e=this._Element.FocusNodeRef;this._Element.setAttribute("new-namespace","__AppRoot__"),t&&e.setDispatchKeyProxy(t.keyDown,t.keyUp),window.JsView?e.attachToActivity(s.RootActivity,s.RootView):(window.addEventListener("keydown",(t=>{var s=document.activeElement.tagName;s&&"input"===s.toLowerCase()||(e.dispatchKeyDown(t),t.preventDefault&&t.preventDefault())})),window.addEventListener("keyup",(t=>{var s=document.activeElement.tagName;s&&"input"===s.toLowerCase()||(e.dispatchKeyUp(t),t.preventDefault&&t.preventDefault())})))}getElement(){return this._Element}getHub(){return this._Element.jsvGetHub()}onMounted(){this._Element.FocusNodeRef.updateMountState(),b()}}class Y extends T{constructor(t){super(t),console.log("AudioElement.constructor()",this)}jsvGetTagName(){return m.TAG.AUDIOTRACK}jsvInit(){this.jsvMedia=new C.HOOKS.Audio("AudioTrack"),this.jsvOverrideMedia=!0,super.jsvInit()}}class X extends u{constructor(){super(u.DOCUMENT_NODE),this.location=window.location,this.rootElement=new R,this.rootElement.ownerDocument=this,this.rootElement.id="root",this.activeElement=this.rootElement,this.head=new _,this.styleSheets=new Array,window.JsView&&this.styleSheets.push(new B("@keyframes jsv-basic-slot {}")),this.jsvIsReady=!1}createElement(t){switch(t){case X.FDIV_ELEMENT:return new N;case X.DIV_ELEMENT:return new R;case X.IMG_ELEMENT:return new D;case X.STYLE_ELEMENT:return new G;case X.AUDIO_ELEMENT:return new T;case X.VIDEO_ELEMENT:return new H;case X.LINK_ELEMENT:return window.JsView?new V:window.originDocument.createElement(X.LINK_ELEMENT);case X.SCRIPT_ELEMENT:return window.JsView?new x:window.originDocument.createElement(X.SCRIPT_ELEMENT);case X.ANCHOR_ELEMENT:return new S;case X.SVG_ELEMENT:return new SVGElement;default:return t==X.JSV_AUDIOTRACK_ELEMENT?new Y:window.JsView?("template"!=t&&console.warn("Document.createElement() unknown name="+t),new U(t)):new F(t.startsWith("jsv")?t:"jsve-"+t)}}createTextNode(t){return new W(t)}createEvent(t){return new i(t)}createComment(t){return new K(t)}getElementById(t){if("root"===t||"app"===t)return this.rootElement;throw Error("Document.getElementById() id="+t+" is UNIMPLEMENTED.")}getElementsByTagName(t){if("head"===t.toLowerCase())return window.JsView?[this.head]:window.originDocument.getElementsByTagName(t);if("link"===t.toLowerCase()||"script"===t.toLowerCase()||"style"===t.toLowerCase())return[];throw Error("Document.getElementsByTagName() name="+t+" is UNIMPLEMENTED.")}querySelector(t){if("root"===t||"#app"===t)return this.rootElement;if("head"===t)return this.head;if("base"===t)return null;if(t.startsWith("style[")&&t.endsWith("]"))return null;if(t.startsWith("link[")&&t.endsWith("]"))return null;throw Error("Document.querySelector() selectors="+t+" is UNIMPLEMENTED.")}querySelectorAll(t){return[]}jsvAppendStyleSheet(t){document.styleSheets.push(t)}jsvGetKeyFrames(t,e){if(window.JsvCode.Dom.StyleSheets){const s=window.JsvCode.Dom.StyleSheets;for(const i of e){const e=s[`${t}-${i.replace("data-v-","")}`];if(e)return e}const i=s[t];if(i)return i}for(let e of this.styleSheets)for(let s of e.cssRules)if(s.name==t)return s.cssText;let s="@keyframes ",i=s+t;for(let t of this.styleSheets){let e=t.jsvTextContent,n=e.indexOf(i);if(n<0)continue;let r=e.indexOf("-keyframes",n+1),o=e.indexOf(s,n+1);o<0&&(o=e.length),r>0&&r<o&&(o=r);let a=e.substring(n,o);return t.insertRule(a,0),a}return null}jsvUpdateRootElement(t){console.log("Document.jsvUpdateRootElement() this.jsvIsReady = true"),this.rootElement.jsvMainView=t,this.jsvIsReady=!0}jsvInitFDivRoot(t,e,s){if(!s){let t=document.createElement("fdiv");this.rootElement.appendChild(t),this.rootElement=t,s=this.rootElement}return new z(t,e,s)}jsvGetFDivRoot(t){return function(t){return J[t]}(t)}set cookie(t){window.__JsvCookies.setCookie(t)}get cookie(){return window.__JsvCookies.getCookie()}}X.ANCHOR_ELEMENT="a",X.AUDIO_ELEMENT="audio",X.DIV_ELEMENT="div",X.IMG_ELEMENT="img",X.LINK_ELEMENT="link",X.SCRIPT_ELEMENT="script",X.STYLE_ELEMENT="style",X.SVG_ELEMENT="svg",X.VIDEO_ELEMENT="video",X.FDIV_ELEMENT="fdiv",X.JSV_AUDIOTRACK_ELEMENT="jsv-audiotrack";class $ extends m{jsvGetTagName(){return m.TAG.LINK}}if(window.JsvCode={Dom:{StyleSheets:{}}},window.Audio=T,window.Video=H,window.MutationObserver=class{constructor(t){this.callback=t}observe(t,e){if(!(t instanceof u))throw Error("TypeError: Failed to execute 'observe' on 'MutationObserver': parameter 1 is not of type JsView's 'Node'");for(const t of Object.keys(e))"childList"==t||console.warn("JsView: only childList config is supported! ignore "+t);e.childList&&t.jsvObserveChildChanged((()=>{this.callback?.()}))}disconnect(){this.callback=void 0}},window.JsView){console.log("Declare Dom Proxy."),global.SVGElement=$,global.Element=m;let t=new e(window.JsView.getAppUrl(),!0);window.location.applyUrlInfo?window.location.applyUrlInfo(t):window.location=t,window.addEventListener=function(t,e){},window.document=new X,window.history={},window.navigator={userAgent:"jsview-runtime"},window.HTMLIFrameElement=function(){}}h.I("Using JsView Runtime");export{X as Document,s as ForgeExtension,_ as HeadElement,l as JsViewForgeApp,o as JsvLazySyncCache,h as Log,r as gSyncTimesCounter};
1
+ /* eslint-disable */ void 0===window.Forge&&(window.Forge={});var t=window.Forge;class e{constructor(t,e){if(this.href="",this.origin="",this.protocol="",this.host="",this.hostname="",this.port="",this.pathname="",this.search="",this.hash="",!t)return;if(!0===t.startsWith("url")){let e=t.indexOf("(")+1,s=t.lastIndexOf(")");if("undefined"===(t=t.substring(e,s).trim())||"null"===t||0===t.length)return}if(!0===t.startsWith("data:"))return void(this.href=t);let s=t.indexOf("://");if(!(s<0||s>10)||t.startsWith("./")||t.startsWith("/")||(t="./"+t),!0===t.startsWith("/"))t=document.location.origin+t;else if((!0===t.startsWith("./")||!0===t.startsWith("../"))&&void 0!==window.JsView&&void 0!==window.JsView.Dom.JsSubPath){if(void 0===window.JsView.Dom.__MainPath||"undefined"===window.JsView.Dom.__MainPathRef||window.JsView.Dom.__MainPathRef!==document.location.href){window.JsView.Dom.JsSubPath.startsWith("/")||(window.JsView.Dom.JsSubPath="/"+window.JsView.Dom.JsSubPath),window.JsView.Dom.JsSubPath.endsWith("/")||(window.JsView.Dom.JsSubPath=window.JsView.Dom.JsSubPath+"/"),window.JsView.Dom.__MainPathRef=document.location.href;let t=document.location.pathname.lastIndexOf(window.JsView.Dom.JsSubPath);window.JsView.Dom.__MainPath=document.location.origin+document.location.pathname.substring(0,t)+"/"}let e=window.JsView.Dom.__MainPath;t=t.startsWith("./")?e+t.substring(2):e+t}if(this.href=t,!e)return;let i=this.href,n=i.indexOf("#");n>0&&(this.hash=i.substring(n),i=i.substring(0,n));let r=i.indexOf("?");r>1&&(this.search=i.substring(r),i=i.substring(0,r));let o=i,a=o.indexOf("://");this.protocol=a>0?o.substring(0,a+1):"";let l=a>1?o.substring(a+3):"";if(a=l.indexOf("/"),this.host=a>0?l.substring(0,a):"",this.pathname=a>1?l.substring(a):"",this.origin=a>0?this.protocol+"//"+this.host:"",this.host.startsWith("[")){let t=this.host.indexOf("]");this.hostname=this.host.substring(0,t+1),t=this.host.substring(t+1).indexOf(":"),this.port=t>1?this.host.substring(t+1):""}else{let t=this.host.indexOf(":");this.hostname=t>0?this.host.substring(0,t):this.host,this.port=t>1?this.host.substring(t+1):""}}replace(t){this.href=t}}window.JsView&&window.JsView.registerUriConverter?.((t=>new e(t,!1).href));class s{static SetBackgroundColor(e,i,n){const r=s.TextureManager.GetColorTextureCached(i);let o;n&&(o=new t.ViewRoundCornerMask(n.topLeft,n.topRight,n.bottomLeft,n.bottomRight));const a=new t.ExternalTextureSetting(r,o);e.ResetTexture(a)}static SetBackgroundImage(i,n,r,o,a,l,h){let u,d={};if("string"==typeof n){const t=new e(n);if(t instanceof e==!1)throw Error("Bad Argument.",t);d.url=t.href}else"linear-gradient"==n?.type&&(d.gradient=n);if(d.gradient)if(d.gradient.colors?.length>2){const t=d.gradient.colors,e=[t[0],t[t.length-1]],i=t.slice(1,t.length-1);u=s.TextureManager.CreateLinearGradientTexture(e,i)}else 2==d.gradient.colors?.length?u=s.TextureManager.CreateMiniGradientTexture(!0,d.gradient.colors[0],d.gradient.colors[1],d.gradient.rawValue):console.warn("Failed to create backgroundImage gradient, bad colors.",d.gradient.colors);else d.url&&(u=d.url.includes(".gif")||d.url.includes(".webp")?s.TextureManager.GetGifImage(d.url,!1,null,h):s.TextureManager.GetImage2(d.url,!1,a,l||t.ColorSpace.RGBA_8888));if(u){let e;r&&(e=new t.ViewRoundCornerMask(r.topLeft,r.topRight,r.bottomLeft,r.bottomRight));const s=new t.ExternalTextureSetting(u,e);if(i.ResetTexture(s),o){let t=u.RegisterLoadImageCallback(null,(function(){o({width:u.Width,height:u.Height})}));i.RegisterDetachCallback((()=>{u.UnregisterLoadImageCallback(t)}))}}}static SetMaskedBackgroundImage(i,n,r,o){if("string"==typeof n&&(n=new e(n)),n instanceof e==!1)throw Error("Bad Argument.",n);if("string"==typeof r&&(r=new e(r)),r instanceof e==!1)throw Error("Bad Argument(MaskURL).",r);const a=s.TextureManager.GetImage2(n.href,!1,null,o||t.ColorSpace.RGBA_8888);if(a){const e=s.TextureManager.GetImage2(r.href,!1,null,t.ColorSpace.RGBA_8888),n=new t.ExternalTextureSetting(a,new t.ViewTextureMask(e));i.ResetTexture(n)}}static SetVideoTexture(e,i,n){const r=s.TextureManager.GetColorTexture(i);let o;n&&(o=new t.ViewRoundCornerMask(n.topLeft,n.topRight,n.bottomLeft,n.bottomRight));const a=new t.TextureSetting(r,o);e.ResetTexture(a)}static GetTextWidth(e){return e.str||(e.str=""),e.font||(e.font=t.TextUtils._sDefaultFont),e.size||(e.size=t.TextUtils._sDefaultFontSize),"italic"!==e.italic&&(e.italic=""),"bold"!==e.bold&&(e.bold=""),window.PlatformUtils.GetTextWidth(e)}static RequestSwap(){t.sRenderBridge.RequestSwap()}static SetImgTexSize(t,e){let i={size:e,refNum:0};s.TextureInfo.Cache[t.Source]=i}static RefImgTexSize(t,e){let i=s.TextureInfo.Cache[t.Source];i?(i.refNum>0?i.refNum++:i.refNum=1,e(i.size)):t.RegisterLoadImageCallback(null,(function(){const i={width:t.Width,height:t.Height};e(i);let n=s.TextureInfo.Cache[t.Source];if(n)n.refNum>0?n.refNum++:n.refNum=1;else{let e={size:i,refNum:1};s.TextureInfo.Cache[t.Source]=e}}))}static UnrefImgTexSize(t){if(!t)return;let e=s.TextureInfo.Cache[t.Source];e&&(e.refNum--,e.refNum<=0&&s.TextureInfo.Unused.add(t.Source))}static ClearUnusedTexSize(){for(let t of s.TextureInfo.Unused){let e=s.TextureInfo.Cache[t];e.refNum<-2?(delete s.TextureInfo.Cache[t],s.TextureInfo.Unused.delete(t)):e.refNum<=0?e.refNum--:s.TextureInfo.Unused.delete(t)}}}s.TextureInfo={Cache:{},Unused:new Set},s.TextureManager=null,s.RootView=null,s.RootActivity=null,s.HaltKeyEvent=!1,window.ForgeExtension=s;class i{constructor(t){this.target=null,this.timeStamp=Date.now(),this.type=t}initEvent(t,e,s){this.type=t}}class n extends i{constructor(t){super(t),this.keyCode=-1,this.key=-1,this.repeat=0}static JsvGetKeyFromCode(t){return new Map([[n.KeyCode.Enter,n.Key.Enter],[n.KeyCode.ArrowUp,n.Key.ArrowUp],[n.KeyCode.ArrowDown,n.Key.ArrowDown],[n.KeyCode.ArrowLeft,n.Key.ArrowLeft],[n.KeyCode.ArrowRight,n.Key.ArrowRight]])[t]}}n.Type={KEYDOWN:"keydown",KEYUP:"keyup"},n.Key={Enter:"Enter",ArrowUp:"ArrowUp",ArrowDown:"ArrowDown",ArrowLeft:"ArrowLeft",ArrowRight:"ArrowRight"},n.KeyCode={Enter:13,ArrowUp:38,ArrowDown:40,ArrowLeft:37,ArrowRight:39};let r={cnt:0};class o{constructor(t){this.type=t,this.cachedValues=null,this.onSyncCallback=null}setOnSyncCallback(t){this.onSyncCallback=t,this.syncLastCaches(!0)}setCacheProperty(t,e){this.cachedValues||(this.cachedValues={}),this.cachedValues[t]=e,this.syncLastCaches(!1),s.RequestSwap()}syncLastCaches(t){let e=o.LastModified[this.type];if((t||e!==this)&&(o.LastModified[this.type]=this,e&&e.cachedValues&&"function"==typeof e.onSyncCallback)){let t=e.cachedValues;e.cachedValues=null,e.onSyncCallback(t)}}static SyncAllCachedProperty(){for(let t of Object.values(o.LastModified))t.syncLastCaches(!0);r.cnt=(r.cnt+1)%65535}}o.LastModified={};class a{constructor(e){this.activity=new t.ReactActivity("JsViewForgeActivity",e,this.OnKeyDown.bind(this),this.OnKeyUp.bind(this)),this._Init()}_Init(){console.log("JsViewForgeActivity.OnCreate()."),s.TextureManager=this.activity.GetTextureManager(),s.RootView=new t.LayoutView,s.RootActivity=this.activity,document.jsvUpdateRootElement(s.RootView);let e=null;t.DesignMap&&(e=t.DesignMap());let i=e?e.width:1280,n=Math.floor(9*i/16);this.activity.SetContentView(s.RootView,{x:0,y:0,width:i,height:n}),t.sRenderBridge.AddWillSwapListener("forgeSwap",(()=>{o.SyncAllCachedProperty(),s.ClearUnusedTexSize()})),window.JsView.Dom.Render()}OnKeyDown(t){if(s.HaltKeyEvent){let e=new n(n.Type.KEYDOWN);return e.keyCode=t.keyCode,e.repeat=t.repeat,document.dispatchEvent(e),!0}return!1}OnKeyUp(t){if(s.HaltKeyEvent){let e=new n(n.Type.KEYUP);return e.keyCode=t.keyCode,e.key=n.JsvGetKeyFromCode(e.keyCode),e.repeat=t.repeat,document.dispatchEvent(e),!0}return!1}}class l{constructor(e){this._ActivityManager=e;let s=new a(e);e.RegisterActivity(s.activity),e.StartActivity(new t.Intent("JsViewForgeActivity"))}}window.JsView&&(window.JsView.Dom={DesignMap:null,Render:null,Extension:s,UrlRef:e},window.JsView.React=window.JsView.Dom);class h{static SetLevel(t){switch(h.E=h.W=h.I=h.D=function(){},t){case h.Level.Verbose:h.V=console.debug.bind(console);case h.Level.Debug:h.D=console.debug.bind(console);case h.Level.Info:h.I=console.info.bind(console)}}static Throw(...t){throw console.error(...t),[...t]}}h.E=console.error.bind(console),h.W=console.warn.bind(console),h.I=console.info.bind(console),h.D=function(){},h.V=function(){},h.Level={Error:0,Warning:1,Info:2,Debug:3,Verbose:4};class u{constructor(t){this.ownerDocument=window.document,this.nodeType=t,this.parentNode=void 0,this.childNodes=[],this.jsvEventListener=void 0,this.jsvChildChangedCallback=void 0}jsvGetTagName(){return"Unknown"}appendChild(t){this.childNodes.push(t),t.parentNode=this,this.jsvChildChangedCallback?.()}moveChild(t,e,s){let i=this.childNodes.indexOf(t);i<0&&h.Throw("Failed to call Node.removeChild(), node not found. node=",t),this.childNodes.splice(i,1),t.parentNode=void 0,this.jsvChildChangedCallback?.(),e._insertBeforeInner(t,s)}removeChild(t){for(let e=t.childNodes.length-1;e>=0;e--)t.removeChild(t.childNodes[e]);let e=this.childNodes.indexOf(t);e<0&&h.Throw("Failed to call Node.removeChild(), node not found. node=",t),this.childNodes.splice(e,1),t.parentNode=void 0,this.jsvChildChangedCallback?.()}insertBefore(t,e){this._insertBeforeInner(t,e)}_insertBeforeInner(t,e){let s=this.childNodes.length;void 0===e?h.Throw("TypeError: Failed to execute 'insertBefore' on 'Node': 2 arguments required, but only 1 present."):null!==e&&(s=this.childNodes.indexOf(e)),s<0&&h.Throw("Failed to call Node.insertBefore(), before node not found. beforeNode=",e),this.childNodes.splice(s,0,t),t.parentNode=this,this.jsvChildChangedCallback?.()}get previousSibling(){const t=this.parentNode.childNodes;let e=t.indexOf(this);return e<0&&h.Throw("Failed to call Node.previousSibling(), this node not found. this=",this),t[e-1]}get nextSibling(){const t=this.parentNode.childNodes;let e=t.indexOf(this);return e<0&&h.Throw("Failed to call Node.nextSibling(), this node not found. this=",this),t[e+1]}addEventListener(t,e,s){this.jsvEventListener||(this.jsvEventListener={});let i=this.jsvEventListener[t];i||(i=new Set,this.jsvEventListener[t]=i),i.add(e)}removeEventListener(t,e,s){if(!this.jsvEventListener)return;let i=this.jsvEventListener[t];i&&(i.delete(e),i.size<=0&&this.jsvEventListener.hasOwnProperty(t)&&delete this.jsvEventListener[t],0===Object.values(this.jsvEventListener).length&&(this.jsvEventListener=void 0))}dispatchEvent(t){let e=this.jsvEventListener?.[t.type];if(e){t.target||(t.target=document.activeElement);for(let s of e)s(t)}else this.parentNode?this.parentNode.dispatchEvent(t):console.warn("Node.dispatchEvent() Ignore to dispatch event: "+t.type+". No listener added.")}jsvObserveChildChanged(t){this.jsvChildChangedCallback=t}}u.ELEMENT_NODE=1,u.TEXT_NODE=3,u.COMMENT_NODE=8,u.DOCUMENT_NODE=9,u.NOLAYOUT_NODE=10;class d extends i{}d.Type={FOCUS:"focus",BLUR:"blur"};class c extends i{stopPropagation(){}}class v{static ConvertInt(t){return t?"number"==typeof t?Math.floor(t):"string"==typeof t?parseInt(t):t:t}static ConvertFloat(t){if(!t)return t;if("string"!=typeof t)return t;return parseFloat(t)}static ConvertPx(t){if(!t)return t;if("string"!=typeof t)return t;if("0"===t)return 0;if(t.endsWith("px")){return parseInt(t)}return t}static ConvertRect(t){let e=v.SplitString(t," "),s={top:e.length>0?parseInt(e[0]):0,right:e.length>1?parseInt(e[1]):null,bottom:e.length>2?parseInt(e[2]):null,left:e.length>3?parseInt(e[3]):null};return s.right=s.right||0===s.right?s.right:s.top,s.bottom=s.bottom||0===s.bottom?s.bottom:s.top,s.left=s.left||0===s.left?s.left:s.right,s}static ConvertCorner(t){let e=v.SplitString(t," "),s={topLeft:e.length>0?parseInt(e[0]):0,topRight:e.length>1?parseInt(e[1]):null,bottomRight:e.length>2?parseInt(e[2]):null,bottomLeft:e.length>3?parseInt(e[3]):null};return s.topRight=s.topRight||0===s.topRight?s.topRight:s.topLeft,s.bottomRight=s.bottomRight||0===s.bottomRight?s.bottomRight:s.topLeft,s.bottomLeft=s.bottomLeft||0===s.bottomLeft?s.bottomLeft:s.bottomRight,s}static ConvertSize(t){let e=v.SplitString(t," "),s={width:e.length>0?parseInt(e[0]):0,height:e.length>1?parseInt(e[1]):null};return s.height=s.height||0===s.height?s.height:s.width,s}static ConvertAnimation(t){if(null===t||0===t.length)return null;let e=t.indexOf("cubic-bezier"),s=[];if(e>=0){let i=t.indexOf(")"),n=t.substring(e,i+1),r=v.SplitString(t,n);for(let t of r){let e=v.SplitString(t," ");s=s.concat(e)}s.push(n)}else s=v.SplitString(t," ");let i=null,n=0,r=1,o=t.includes("alternate");for(let t=2;t<s.length;t++){if("infinite"===s[t]){r=-1;continue}let e=v.ConvertTimeMs(s[t]);!1===isNaN(e)?n=e:(e=parseFloat(s[t]),!1===isNaN(e)?r=e:i=s[t])}let a=s.length>1?v.ConvertTimeMs(s[1]):0;return{name:s.length>0?s[0]:"",duration:a,timingFunction:v.ConvertEasing(i,a),delay:n,iterationCount:r,direction:o,originStr:t}}static ConvertTransition(t){if(null==t||0==t.length)return null;let e={},s=new Array,i=t.split(",");for(let t=0;t<i.length;t++)if(i[t].indexOf("(")>=0){let e=t;for(;e<i.length&&i[e].indexOf(")")<0;)e++;let n="";for(let s=t;s<=e;s++)s!=t&&(n+=","),n+=i[s];t=e,s=s.concat(n)}else s=s.concat(i[t]);for(let t of s){let s=v.ConvertAnimation(t);if(e[s.name]=s,"all"==s.name){let t=new Array("opacity","left","top","width","height","transform");for(let i of t)e[i]=s}}return e}static ConvertTimeMs(t){t||(t="");let e=NaN;return(t=t.trim()).endsWith("ms")?e=1:t.endsWith("s")&&(e=1e3),e*=parseFloat(t),e}static ConvertEasing(e,s){let i=t.Easing.Circular.InOut;if(!e)return i;if(e.includes("ease"))i=e.includes("-in-out")?t.Easing.Circular.InOut:e.includes("-out")?t.Easing.Circular.Out:e.includes("-in")?t.Easing.Circular.In:t.Easing.Circular.InOut;else if(e.includes("linear"))i=null;else if(e.includes("cubic-bezier")){let n=v.ConvertBezier(e);i=new t.BezierEasing(n.x1,n.y1,n.x2,n.y2,s)}else if(e.includes("steps")){let s=v.ConvertSteps(e);i=new t.StepsEasing(s.steps,s.type)}return i}static ConvertBezier(t){let e=t.indexOf("(");e>=0&&(t=t.substring(e+1));let s=v.SplitString(t,",");return{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}}static ConvertSteps(t){let e=t.indexOf("(");e>=0&&(t=t.substring(e+1));let s=v.SplitString(t,",");return{steps:s.length>0?parseInt(s[0]):1,type:s.length>1?s[1].includes("start")?0:1:0}}static ConvertOverflow(t,e){return t&&!t.includes("visible")?e.HIDDEN:e.VISIBLE}static ConvertObjectFit(t,e){return"symbol"==typeof t?t:(t||(t=""),t.includes("fill")?e.FILL:t.includes("contain")?e.CONTAIN:t.includes("cover")?e.COVER:t.includes("none")?e.NONE:t.includes("scale-down")?e.SCALEDOWN:e.CONTAIN)}static ConvertGradient(t){if(t||(t=""),!(t=t.trim()).startsWith("linear-gradient")&&!t.startsWith("radial-gradient"))return t;let e={rawValue:t},s=t.replace(/.*?\((.*)\)/,"$1"),i=v.SplitStringOutsideParentheses(s,",");if(t.startsWith("linear-gradient")){if(i[0]?.startsWith("to ")||i[0]?.endsWith("deg"))throw i=i.slice(1),new Error("linear-gradient direction or angle is not supported.");i.length<2?console.error("linear-gradient colors is invalid."):(e.type="linear-gradient",e.colors=i)}else if(t.startsWith("radial-gradient"))throw new Error("radial-gradient is not supported.");return e}static SplitString(t,e){t||(t="");let s=t.trim().split(e);if(" "!==e)return s;let i=[];for(let t of s)t&&i.push(t);return i}static SplitStringOutsideParentheses(t,e){let s=[],i=t.split(e);for(let t=0;t<i.length;t++)if(i[t].indexOf("(")>=0){let n=t;for(;n<i.length&&i[n].indexOf(")")<0;)n++;let r="";for(let s=t;s<=n;s++)s!=t&&(r+=e),r+=i[s];t=n,s=s.concat(r.trim())}else s=s.concat(i[t].trim());return s}}class g{constructor(t){if(this.top=null,this.right=null,this.bottom=null,this.left=null,!t||!1===t.startsWith("inset"))return void console.error("Inset.Parse() InvalidArgs: value=",t);let e=t.indexOf("(")+1,s=t.substring(e),i=v.ConvertRect(s);this.top=i.top,this.right=i.right,this.bottom=i.bottom,this.left=i.left}}class p{constructor(t){if(this.source=null,this.slice=null,this.repeat=null,this.outset=null,this.width=null,!t)return void console.error("BorderImage.constructor() InvalidArgs: value=",t);let s=t.indexOf(")")+1,i=t.substring(0,s),n=t.substring(s);this.source=new e(i),this.slice=v.ConvertRect(n)}}class y{constructor(){this.refStyleObject=new Map,this.value=void 0}static AppendRefStyle(t,e,s){let i=y.jsvGetStyleVar(t);i.refStyleObject.has(e)||i.refStyleObject.set(e,[]),i.refStyleObject.get(e).push(s)}static RemoveRefStyle(t){for(const e of y.VariableMap.values())for(const s of e.refStyleObject.keys())s==t&&e.refStyleObject.delete(t)}static UpdateValue(t,e){let s=y.jsvGetStyleVar(t);s.value=e;for(const[t,e]of s.refStyleObject)for(const s of e)t.jsvSetClassProperty(s)}static GetValue(t){return y.jsvGetStyleVar(t).value}static jsvGetStyleVar(t){t.startsWith("--")&&(t=`var(${t})`),y.VariableMap.has(t)||y.VariableMap.set(t,new y);return y.VariableMap.get(t)}}y.VariableMap=new Map;class w{constructor(){this.jsvStore={},this.jsvLazySyncCache=new o("style"),this.jsvLockedProps={},this.jsvNamedClassArray=null,this.jsvCustomStyles={},this.jsvLazyPrevClassNames=null,this.jsvLazyPrevInheritedClassNames=null,this.jsvLazyClassNames=null,this.jsvLazyInheritedClassNames=null,this.jsvLazyClassAttributes=null}setProperty(t,e){"function"==typeof document.jsvCheckStyleFormat&&document.jsvCheckStyleFormat(t,e),this.jsvLockedProps[t]=!0,e=w.JsvConvertPropValue(t,e),this.jsvUpdateProperty(t,e)}getPropertyValue(t){if(void 0!==this.jsvStore[t])return this.jsvStore[t];let e=this.jsvGetClassPropValue(this.jsvLazyClassNames,this.jsvLazyClassAttributes,t);return e?(t==w.PROP.ANIMATION?e=v.ConvertAnimation(e):t==w.PROP.TRANSITION&&(e=v.ConvertTransition(e)),t==w.PROP.BACKGROUNDIMAGE&&(e=v.ConvertGradient(e)),e):(e=this.jsvGetClassPropValue(this.jsvLazyInheritedClassNames,this.jsvLazyClassAttributes,t),e?(t==w.PROP.ANIMATION?e=v.ConvertAnimation(e):t==w.PROP.TRANSITION&&(e=v.ConvertTransition(e)),t==w.PROP.BACKGROUNDIMAGE&&(e=v.ConvertGradient(e)),e):void 0)}jsvDestory(){y.RemoveRefStyle(this)}jsvUpdateProperty(t,e){let s=this.jsvSetPropertySilently(t,e);s&&this.jsvLazySyncCache.setCacheProperty(s,!0)}jsvSetPropertySilently(t,e){if(t.startsWith("--"))return void y.UpdateValue(t,e);if("string"==typeof e&&e.startsWith("var(--"))return void y.AppendRefStyle(e,this,t);if("animation"===t){if(this.jsvStore[t]?.originStr===e?.originStr)return null}else if(this.jsvStore[t]===e)return null;return this.jsvStore[t]=e,w.JsvGetStyleType(t)}jsvApplyClasses(e,s){if(e)if(e.indexOf("JsvStyle_")<0){s?(this.jsvLazyPrevInheritedClassNames=this.jsvLazyInheritedClassNames,this.jsvLazyInheritedClassNames=e.split(" ")):(this.jsvLazyPrevClassNames=this.jsvLazyClassNames,this.jsvLazyClassNames=e.split(" "));const t=w.TYPE.CLASS_NAME;this.jsvLazySyncCache.setCacheProperty(t,!0)}else if(e){let s=e.split(" "),i={};this.jsvNamedClassArray=new Array(s.length);let n=0;for(let e of s){let s=null;if(t.ReactUtils.StyleClassMap.hasOwnProperty(e)){s=t.ReactUtils.StyleClassMap[e];let n=s.getAttach();if(null==n){let t=s.getStyles();n={altStyles:{},hasTextMajorStyle:0,textPackAttr:null};for(let e in t)n.altStyles[e]=w.JsvConvertPropValue(e,t[e]);s.updateAttach(n)}"text"===s.classType()&&(n.hasTextMajorStyle=2,null===n.textPackAttr&&(n.textPackAttr={textLineAlign:s.getLineAlign(),textVerticalAlign:s.getVerticalAlign()}),this.jsvCustomStyles.textLineAlign=n.textPackAttr.textLineAlign,this.jsvCustomStyles.textVerticalAlign=n.textPackAttr.textVerticalAlign),Object.assign(i,n.altStyles)}else console.error("Error: className not found");this.jsvNamedClassArray[n]=s,n++}for(let t in i)this.jsvLockedProps[t]||this.jsvUpdateProperty(t,i[t])}}jsvAppendClassAttribute(t){this.jsvLazyClassAttributes||(this.jsvLazyClassAttributes=new Set),this.jsvLazyClassAttributes.add(t);const e=w.TYPE.CLASS_NAME;this.jsvLazySyncCache.setCacheProperty(e,!0)}jsvSetClassProperty(t){let e=w.JsvGetStyleType(t);e&&this.jsvLazySyncCache.setCacheProperty(e,!0)}jsvGetClassPropValue(t,e,s){if(!t)return;const i=(t,e,s,i)=>{for(let n=e.length-1;n>=0;n--){let r=e[n];if(s&&(r+="["+s+"]"),!t.hasOwnProperty(r))continue;const o=t[r];if(!o.hasOwnProperty(i))continue;let a=o[i];return"string"==typeof a&&a.startsWith("var(--")&&(a=y.GetValue(a)),a}},n=window.JsvCode.Dom.StyleSheets;for(const r of e??[]){const e=i(n,t,r,s);if(e)return e}return i(n,t,null,s)}jsvGetClassDeclarations(t,e){if(!t)return;const s=(t,e,s)=>{let i={};for(let n=0;n<e.length;n++){let r=e[n];if(s&&(r+="["+s+"]"),!t.hasOwnProperty(r))continue;const o=t[r];Object.assign(i,o)}return i},i=window.JsvCode.Dom.StyleSheets;let n=s(i,t,null);for(const r of e??[]){const e=s(i,t,r);Object.assign(n,e)}return n}jsvUpdateChangedClasses(t,e,s){h.D("jsvGetChangedClassTypes() classNames="+t);let i={};if(e){y.RemoveRefStyle(this);const t=this.jsvGetClassDeclarations(e,s);for(const e of Object.keys(t)){i[w.JsvGetStyleType(e)]=!0}e=null}if(t){const e=this.jsvGetClassDeclarations(t,s);for(const[t,s]of Object.entries(e)){i[w.JsvGetStyleType(t)]=!0,"string"==typeof s&&s.startsWith("var(--")&&y.AppendRefStyle(s,this,t)}}return i}jsvSetChangedListener(t){let e=null;t&&(e=e=>{if(e.hasOwnProperty(w.TYPE.CLASS_NAME)){let t=this.jsvUpdateChangedClasses(this.jsvLazyClassNames,this.jsvLazyPrevClassNames,this.jsvLazyClassAttributes);Object.assign(e,t),t=this.jsvUpdateChangedClasses(this.jsvLazyInheritedClassNames,this.jsvLazyPrevInheritedClassNames,this.jsvLazyClassAttributes),Object.assign(e,t),e[w.TYPE.CLASS_NAME]=void 0}t(e)}),this.jsvLazySyncCache.setOnSyncCallback(e)}static JsvContainsTextMajor(t){for(let e of w.TextClassMajorStyles)if(t.hasOwnProperty(e))return!0;return!1}static JsvGetStyleType(t){switch(t){case w.PROP.LEFT:case w.PROP.RIGHT:case w.PROP.TOP:case w.PROP.BOTTOM:case w.PROP.ZINDEX:return w.TYPE.LAYOUT_POS;case w.PROP.TRANSFORM:case w.PROP.TRANSFORMORIGIN:return w.TYPE.TRANSFORM;case w.PROP.WIDTH:case w.PROP.HEIGHT:case w.PROP.VISIBILITY:case w.PROP.DISPLAY:case w.PROP.CLIPPATH:case w.PROP.OVERFLOW:case w.PROP.OBJECTFIT:case w.PROP.PERSPECTIVE:case w.PROP.PERSPECTIVEORIGIN:case w.PROP.BACKFACEVISIBILITY:case w.PROP.TRANSFORMSTYLE:case w.PROP.JSVVIDEOROTATION:return w.TYPE.LAYOUT_SIZE;case w.PROP.BACKGROUNDCOLOR:case w.PROP.BACKGROUNDIMAGE:case w.PROP.BORDERRADIUS:return w.TYPE.BACKGROUND;case w.PROP.COLOR:case w.PROP.LINEHEIGHT:case w.PROP.WHITESPACE:case w.PROP.FONTFAMILY:case w.PROP.FONTSIZE:case w.PROP.FONTSTYLE:case w.PROP.FONTWEIGHT:case w.PROP.TEXTALIGN:case w.PROP.TEXTSHADOW:case w.PROP.TEXTOVERFLOW:case w.PROP.WEBKITTEXTSTROKE:case w.PROP.DIRECTION:return w.TYPE.FOREGROUND;case w.PROP.BORDERIMAGE:case w.PROP.BORDERIMAGEWIDTH:case w.PROP.BORDERIMAGEOUTSET:return w.TYPE.BORDER;case w.PROP.ANIMATION:return w.TYPE.ANIMATION;case w.PROP.TRANSITION:return w.TYPE.TRANSITION;case w.PROP.OPACITY:break;default:return console.warn("Unknown style type for: "+t),null}}static JsvConvertPropValue(t,e){if(void 0===e)return e;if(t.startsWith("--")||e?.startsWith?.("var(--"))return e;switch(t){case w.PROP.TOP:case w.PROP.BOTTOM:case w.PROP.LEFT:case w.PROP.RIGHT:case w.PROP.WIDTH:case w.PROP.HEIGHT:case w.PROP.JSVVIDEOROTATION:return v.ConvertInt(e);case w.PROP.VISIBILITY:case w.PROP.DISPLAY:return e.toUpperCase();case w.PROP.OVERFLOW:return v.ConvertOverflow(e,w.Overflow);case w.PROP.OBJECTFIT:return v.ConvertObjectFit(e,w.ObjectFit);case w.PROP.TRANSFORM:case w.PROP.TRANSFORMORIGIN:return e;case w.PROP.CLIPPATH:return new g(e);case w.PROP.BORDERIMAGE:return new p(e);case w.PROP.BORDERIMAGEWIDTH:case w.PROP.BORDERIMAGEOUTSET:return v.ConvertRect(e);case w.PROP.BORDERRADIUS:return v.ConvertCorner(e);case w.PROP.ANIMATION:return v.ConvertAnimation(e);case w.PROP.TRANSITION:return v.ConvertTransition(e);case w.PROP.OPACITY:return v.ConvertFloat(e);case w.PROP.BACKGROUNDIMAGE:return v.ConvertGradient(e);default:return v.ConvertPx(e)}}}w.Overflow={HIDDEN:Symbol("hidden"),VISIBLE:Symbol("visible")},w.ObjectFit={FILL:Symbol("fill"),CONTAIN:Symbol("contain"),COVER:Symbol("cover"),NONE:Symbol("none"),SCALEDOWN:Symbol("scale-down")},w.TextClassMajorStyles=new Set(["textOverflow","wordWrap","textShadow","color","fontFamily","fontStyle","fontWeight","textAlign","WebkitTextStroke","direction"]),w.TYPE={LAYOUT_POS:"layout-position",LAYOUT_SIZE:"layout-size",FOREGROUND:"foreground",BACKGROUND:"background",BORDER:"border",ANIMATION:"animation",TRANSFORM:"transform",TRANSITION:"transition",CLASS_NAME:"class-name"},w.PROP={TOP:"top",BOTTOM:"bottom",LEFT:"left",RIGHT:"right",WIDTH:"width",HEIGHT:"height",VISIBILITY:"visibility",DISPLAY:"display",BACKFACEVISIBILITY:"backfaceVisibility",CLIPPATH:"clipPath",OVERFLOW:"overflow",OBJECTFIT:"objectFit",TRANSFORM:"transform",TRANSFORMORIGIN:"transformOrigin",PERSPECTIVE:"perspective",PERSPECTIVEORIGIN:"perspectiveOrigin",ZINDEX:"zIndex",TRANSFORMSTYLE:"transformStyle",BACKGROUNDCOLOR:"backgroundColor",BACKGROUNDIMAGE:"backgroundImage",BORDERRADIUS:"borderRadius",COLOR:"color",LINEHEIGHT:"lineHeight",WHITESPACE:"whiteSpace",FONTFAMILY:"fontFamily",FONTSIZE:"fontSize",FONTSTYLE:"fontStyle",FONTWEIGHT:"fontWeight",TEXTALIGN:"textAlign",TEXTSHADOW:"textShadow",TEXTOVERFLOW:"textOverflow",WEBKITTEXTSTROKE:"WebkitTextStroke",DIRECTION:"direction",BORDERIMAGE:"borderImage",BORDERIMAGEWIDTH:"borderImageWidth",BORDERIMAGEOUTSET:"borderImageOutset",ANIMATION:"animation",TRANSITION:"transition",OPACITY:"opacity",JSVVIDEOROTATION:"JsvVideoRotation"};for(let t in w.PROP){let e=w.PROP[t];Object.defineProperty(w.prototype,e,{set:function(t){this.setProperty(e,t)},get:function(){return this.getPropertyValue(e)}})}let f=null;class j{static getHandlers(t){const e=j.reactEventHandlers(t);return e||(t._vei?t._vei:{})}static reactEventHandlers(t){return null==f&&j._getReactToken(t),t["__reactProps$"+f]??t["__reactEventHandlers$"+f]}static _getReactToken(t){for(let e in t)if(e.indexOf("__reactProps")>=0||e.indexOf("__reactEventHandlers")>=0||e.indexOf("__reactInternalInstance")>=0){let t=e.indexOf("$");f=e.substring(t+1);break}}}class m extends u{constructor(e){super(u.ELEMENT_NODE),this.parentElement=null,this.tagName=this.jsvGetTagName(),this.tagName===m.TAG.STYLE?(this.style=null,this.jsvMainView=null,this.jsvMaskView=null):(this.style=new w,this.jsvMainView=new t.LayoutView,this.jsvMaskView=null),this.jsvAnimation=null,this.jsvStore={transition:null,transitionTmp:null,textContent:null,textStylePack:null,clientWidth:NaN,clientHeight:NaN,textureWidth:NaN,textureHeight:NaN,scopedAttributes:[]},this.jsvAttrChangedLazySync=null,this.instantSwapCallback=null,this.eventHandlers=null,this.jsvInheritClassDepth=null,this.jsvHasInheritClassChildren=!1}appendChild(t){null!=t.parentNode?this._moveChildNode(t,null):(super.appendChild(t),this.jsvInsertChild(t,null))}removeChild(t){this.jsvRemoveChild(t),super.removeChild(t)}insertBefore(t,e){null!=t.parentNode?this._moveChildNode(t,e):(super.insertBefore(t,e),this.jsvInsertChild(t,e))}_moveChildNode(t,e){let s=t.parentNode;if(s.moveChild(t,this,e),t.jsvMaskView){(s.jsvMaskView?s.jsvMaskView:s.jsvMainView).MoveChildView(t.jsvMaskView,this.jsvMaskView?this.jsvMaskView:this.jsvMainView,e?e.jsvMaskView:null),console.log("moving child")}else console.log("moving not forge child")}get childElementCount(){return this.childNodes.length}get firstElementChild(){return this.childNodes.length>0?this.childNodes[0]:null}get lastElementChild(){const t=this.childNodes.length;return t>0?this.childNodes[t-1]:null}set className(t){this.setAttribute("class",t)}setAttribute(t,e){t&&("style"!==t?(this[t]=e,t.startsWith("data-v-")?this._jsvAppendScopedAttribute(t,0):"class"===t?this._jsvSetClassNames(e,0):"jsv-inherit-class"===t?this._jsvSetInheritClassDepth(parseInt(e)):t.startsWith(m.ATTRIBUTE.JSVPREFIX)?(t=t.replace(/-/g,"_"),this.jsvSetAttrLazySync(t,m.ATTRTYPE.JSV)):window.JsView||"id"!==t||this.jsvMainView.Element&&(this.jsvMainView.Element.id=e)):console.warn("directly style setting be ignored"))}jsvSetAttrLazySync(t,e){this.jsvAttrChangedLazySync||(this.jsvAttrChangedLazySync=new o("lazy-attr"),this.parentElement&&this._jsvSetAttrLazySyncCallback()),this.jsvAttrChangedLazySync.setCacheProperty(t,e)}removeAttribute(t){this[t]=void 0,t.startsWith(m.ATTRIBUTE.JSVPREFIX)&&this.jsvSetAttrLazySync(t,m.ATTRTYPE.JSV)}getAttribute(t){return this[t]}hasAttribute(t){return console.log("Element.hasAttribute() name="+t),!!this[t]}getBoundingClientRect(){return null!=this.jsvMainView?this.jsvMainView.GetBoundingClientRect():Promise.reject(new Error("getBoundingClientRect while jsvMainView is null."))}get clientWidth(){return isNaN(this.jsvStore.clientWidth)?this.style.width:this.jsvStore.clientWidth}get clientHeight(){return isNaN(this.jsvStore.clientHeight)?this.style.height:this.jsvStore.clientHeight}focus(){console.log("Element.focus()"),document.activeElement&&document.activeElement.onfocus();let t=document.activeElement;if(document.activeElement=this,t){let e=new d(d.Type.BLUR);e.target=t,document.dispatchEvent(e)}let e=new d(d.Type.FOCUS);document.dispatchEvent(e)}jsvInsertChild(t,e){if(t.parentElement=this,t.nodeType===u.ELEMENT_NODE&&t.tagName!==m.TAG.STYLE){if(!1===document.jsvIsReady)return void console.warn("Element.appendChild() Failed to append child to Forge. jsvIsReady="+document.jsvIsReady);t.jsvOnLoadForgeView(),t.style.jsvSetChangedListener(t.jsvOnStyleChanged.bind(t)),e=this.jsvBackwardFindForgeView(e);let s=t.jsvMaskView.GetLayoutParams();this.jsvMainView.InsertView(t.jsvMaskView,e?e.jsvMaskView:null,s),(t.jsvInheritClassDepth>0||t.jsvHasInheritClassChildren)&&(this.jsvHasInheritClassChildren=!0)}else t.nodeType===u.TEXT_NODE&&(this.textContent=t.textContent)}jsvGetProxyView(t){return t?this.jsvMaskView:this.jsvMainView}jsvRemoveChild(t){t.parentElement=null,t.jsvAttrChangedLazySync=null,t.style?.jsvSetChangedListener(null),t.style?.jsvDestory(),t.jsvAnimation?.Cancel(),t.jsvAnimation=null,t instanceof m&&this.jsvMainView.RemoveView(t.jsvMaskView)}jsvOnLoadForgeView(){if(this.style.clipPath||this.style.overflow||this.style.objectFit){if(this.jsvMaskView)throw Error("Jsview: jsvMaskView is conflicting.");this.jsvMaskView=new t.ClipView}else this.jsvMaskView||(this.jsvMaskView=this.jsvMainView);this.jsvMaskView!==this.jsvMainView&&this.jsvMaskView.AddView(this.jsvMainView);let e=this.jsvCallbackOnUnloadForgeView();e&&this.jsvMainView.RegisterDetachCallback(e),this._jsvSetAttrLazySyncCallback()}_jsvSetAttrLazySyncCallback(){if(this.jsvAttrChangedLazySync){let t=this;this.jsvAttrChangedLazySync.setOnSyncCallback((e=>{let s=null,i=null;for(let n in e)if(t.hasOwnProperty(n))switch(e[n]){case m.ATTRTYPE.JSV:null==s&&(s={}),s[n]=t[n];break;case m.ATTRTYPE.CSS:null==i&&(i={}),i[n]=t[n]}s&&(s=t.jsvSetElementPropOnMask(s),t.jsvSetElementProp(s)),i&&t.jsvOnAttrLazySync(i)}))}}jsvOnAttrLazySync(t){}jsvSetElementProp(t){this.jsvMainView&&this.jsvMainView.SetElementProp(t,s.RootActivity)}jsvSetElementPropOnMask(t){if(t.hasOwnProperty("jsv_poster_on_top")){let{jsv_poster_on_top:e,...i}=t;return this.jsvMaskView.SetElementProp({jsv_poster_on_top:e},s.RootActivity),i}return t}jsvCallbackOnUnloadForgeView(){return null}jsvOnStyleChanged(t){let e=!!t[w.TYPE.LAYOUT_SIZE],s=!1;t[w.TYPE.LAYOUT_POS]&&(e||(this.jsvFlushViewLayout(),s=!0)),t[w.TYPE.LAYOUT_SIZE]&&(this.jsvFlushViewLayout(),s=!0),t[w.TYPE.TRANSFORM]&&!s&&(this.jsvMaskView.ResetCssTransform(this.style.transform,this.style.transformOrigin),this.jsvFlushViewTransition(),s=!0),t[w.TYPE.BACKGROUND]&&this.jsvFlushViewBackground(),t[w.TYPE.ANIMATION]&&this.jsvFlushViewAnimation(),t[w.TYPE.TRANSITION]&&!s&&this.jsvFlushViewTransition(),this.jsvFlushEventHandlers()}jsvFlushEventHandlers(){null===this.eventHandlers&&(this.eventHandlers=j.getHandlers(this),this.eventHandlers&&this.eventHandlers.onClick&&this.jsvMainView&&this.jsvMainView.EnableDivTouch(this,null))}jsvApplyObjectFit(t){return null}jsvFlushViewLayout(){if((this.style.clipPath||this.style.overflow||this.style.objectFit)&&!this.jsvMaskView)return void console.error("Element.jsvFlushViewLayout() InvalidOpt: clippath=",this.style.clipPath);const e={x:isNaN(this.style.left)?0:this.style.left,y:isNaN(this.style.top)?0:this.style.top,width:isNaN(this.style.width)?0:this.style.width,height:isNaN(this.style.height)?0:this.style.height};let s=null;if(this.style.objectFit&&(s=this.jsvApplyObjectFit(e),this.style.objectFit===w.ObjectFit.FILL&&(s=null)),this.jsvMaskView.ResetCssTransform(this.style.transform,this.style.transformOrigin),this.style.perspective&&this.style.perspective>0){let t=this.style.perspectiveOrigin?this.style.perspectiveOrigin:null;this.jsvMainView.SetPerspective(this.style.perspective,t)}if(this.style.backfaceVisibility&&this.jsvMainView.SetBackfaceVisibility("visible"==this.style.backfaceVisibility),this.style.transformStyle&&this.jsvMainView.SetTransformStyle(this.style.transformStyle),this.jsvMaskView.ResetLayoutParams({x:e.x,y:e.y,width:this.clientWidth,height:this.clientHeight}),this.jsvMaskView!==this.jsvMainView){const t={x:0,y:0,width:this.jsvMaskView.LayoutParams.Width,height:this.jsvMaskView.LayoutParams.Height};this.jsvMainView.ResetLayoutParams(t)}let i=this.style.visibility;"NONE"==this.style.display&&(i="HIDDEN"),this.jsvMaskView.SetVisibility(i);let n=null;null!==s&&window.JsView?n={x:s.x,y:s.y,width:s.width,height:s.height}:this.style.clipPath?n={x:this.style.clipPath.left,y:this.style.clipPath.top,width:this.jsvMaskView.LayoutParams.Width-this.style.clipPath.left-this.style.clipPath.right,height:this.jsvMaskView.LayoutParams.Height-this.style.clipPath.top-this.style.clipPath.bottom}:this.style.overflow===w.Overflow.HIDDEN&&null===this.jsvStore.textContent&&(n={x:0,y:0,width:this.style.width,height:this.style.height}),n?this.jsvMaskView.SetClipRect(n.x,n.y,n.width,n.height,!0):this.jsvMaskView instanceof t.ClipView&&this.jsvMaskView.SetClipRect(0,0,0,0,!1),void 0!==this.style.zIndex&&null!==this.style.zIndex&&this.jsvMaskView.SetZIndex(this.style.zIndex),this.jsvFlushViewTransition()}jsvFlushViewBackground(){this.style.backgroundImage?(this.jsvStore.textureWidth=NaN,this.jsvStore.textureHeight=NaN,s.SetBackgroundImage(this.jsvMainView,this.style.backgroundImage,this.style.borderRadius)):this.style.backgroundColor?(this.jsvStore.textureWidth=NaN,this.jsvStore.textureHeight=NaN,s.SetBackgroundColor(this.jsvMainView,this.style.backgroundColor,this.style.borderRadius)):this.jsvMainView.ResetTexture(null)}jsvFlushViewAnimation(){if(this.jsvAnimation&&this.jsvAnimation.Cancel(),!this.style.animation)return;let e=document.jsvGetKeyFrames(this.style.animation.name,this.jsvStore.scopedAttributes);this.jsvAnimation=new t.CssKeyframeAnimation(e,this.style.animation.duration,this.style.animation.timingFunction,this.style.width?this.style.width:this.clientWidth,this.style.height),this.jsvAnimation.EnableDelay(this.style.animation.delay).SetRepeat(this.style.animation.iterationCount),"forwards"===this.style.animationFillMode&&this.jsvAnimation.Enable(t.AnimationEnable.KeepTransform);var s=this;let i=new t.AnimationListener;i.OnEnd((e=>{if(s.jsvAnimation=null,e){let e=new c("animationend");e.target=s,s.dispatchEvent(e),null==s.instantSwapCallback&&(s.instantSwapCallback=t.sRenderBridge.InstantPerformSwap.bind(t.sRenderBridge)),Promise.resolve().then(s.instantSwapCallback)}})),this.jsvAnimation.Enable(t.AnimationEnable.ReleaseAfterEndCallback),this.jsvAnimation.SetAnimationListener(i),this.jsvMaskView.StartAnimation(this.jsvAnimation)}jsvFlushViewTransition(){if(this.style.animation)return;if(null!=this.jsvStore.transitionTmp&&this.jsvStore.transitionTmp.syncTimes!=r.cnt&&-1!=this.jsvStore.transitionTmp.syncTimes){let t=this.jsvStore.transition;this.jsvStore.transition=this.jsvStore.transitionTmp,this.jsvStore.transitionTmp=t,null!=this.jsvStore.transitionTmp&&(this.jsvStore.transitionTmp.syncTimes=-1)}if(this.style.transition){if(this.jsvStore.transition){if(!this._JsvBuildTransition())return}}else this.jsvAnimation&&(this.jsvAnimation.Cancel(),this.jsvAnimation=null);let t=this.jsvStore.transitionTmp;t||(t={left:0,top:0,width:0,height:0,opacity:1,transform:null,syncTimes:-1}),t.left=this.style.left,t.top=this.style.top,t.width=this.style.width,t.height=this.style.height,t.opacity=this.style.opacity,t.transform=this.style.transform,t.syncTimes=r.cnt,this.jsvStore.transitionTmp=t}_JsvBuildTransition(){let e=[];for(let t in this.style.transition){let s=this.jsvStore.transition[t],i=this.style[t];if(s===i)continue;let n=this.style.transition[t],r={name:t,dur:Math.round(n.duration),tf:null,dly:Math.round(n.delay),from:s||"",to:i};"transform"===t&&(r.origin=this.style.transformOrigin?this.style.transformOrigin:"center center"),n.timingFunction&&(r.tf=n.timingFunction.Package()),e.push(r)}if(e.length<=0)return!1;var s=this;let i=new t.AnimationListener;return i.OnEnd((e=>{if(s.jsvAnimation=null,e){let e=new c("transitionend");e.target=s,s.dispatchEvent(e),null==s.instantSwapCallback&&(s.instantSwapCallback=t.sRenderBridge.InstantPerformSwap.bind(t.sRenderBridge)),Promise.resolve().then(s.instantSwapCallback)}})),this.jsvAnimation=new t.CssTransitionAnimation(e),this.jsvAnimation.SetAnimationListener(i),this.jsvMaskView.StartAnimation(this.jsvAnimation),!0}jsvBackwardFindForgeView(t){let e=t;for(;e&&!(e instanceof m);)e=e.nextSibling;return e}static applyObjectFitCommon(t,e,s){if(s&&!isNaN(t.jsvStore.textureWidth)&&!isNaN(t.jsvStore.textureHeight)){const i=t.style.objectFit,n=s.ApplyObjectFit(e.width,e.height,t.jsvStore.textureWidth,t.jsvStore.textureHeight,i,w.ObjectFit);return 0!==e.width&&0!==e.height||0===e.width&&0===e.height||(t.jsvStore.clientWidth=Math.max(e.width,n.width),t.jsvStore.clientHeight=Math.max(e.height,n.height)),n}return null}_jsvAppendScopedAttribute(t,e){if(0!=e&&this.jsvInheritClassDepth!=e||(this.jsvStore.scopedAttributes.push(t),this.jsvStore.clientWidth=NaN,this.jsvStore.clientHeight=NaN,this.style.jsvAppendClassAttribute(t)),this.jsvHasInheritClassChildren){e=this.jsvInheritClassDepth==e?1:e+1;for(const s of this.childNodes)s.jsvInheritClassDepth<=0&&0==s.jsvHasInheritClassChildren||s instanceof m&&(s.jsvStore.scopedAttributes.includes(t)||s._jsvAppendScopedAttribute(t,e))}}_jsvSetClassNames(t,e){if(0!=e&&this.jsvInheritClassDepth!=e||this.style.jsvApplyClasses(t,this.jsvInheritClassDepth==e),this.jsvHasInheritClassChildren){e=this.jsvInheritClassDepth==e?1:e+1;for(const s of this.childNodes)s.jsvInheritClassDepth<=0&&0==s.jsvHasInheritClassChildren||s instanceof m&&s._jsvSetClassNames(t,e)}}_jsvSetInheritClassDepth(t){if(t<=0)return;this.jsvInheritClassDepth=t;let e=this;for(let s=0;s<t&&(e=e.parentNode,e);s++);if(e){for(const s of e.jsvStore.scopedAttributes)this._jsvAppendScopedAttribute(s,t);this._jsvSetClassNames(e.class,t)}}}m.TAG={DIV:"DIV",IMAGE:"IMAGE",LINK:"LINK",STYLE:"STYLE",AUDIO:"AUDIO",VIDEO:"VIDEO",ANCHOR:"A",SVG:"SVG",FDIV:"FDIV",AUDIOTRACK:"AUDIOTRACK"},m.ATTRIBUTE={SRC:"src",JSVPREFIX:"jsv"},m.ATTRTYPE={JSV:Symbol("jsv"),CSS:Symbol("css")};class S extends m{constructor(){super(),console.warn("Warnig: <a> is fake in JsView system"),this.href="",this.protocol="",this.host="",this.search="",this.hash="",this.hostname="",this.port="",this.pathname=""}jsvGetTagName(){return m.TAG.ANCHOR}}class C extends m{constructor(t){super(),this.jsvMediaView=null,this.jsvMedia=null,this.onVisibilityChange=this.onVisibilityChange.bind(this),this.stopByOnHide=!1,this.playBackground=!1,t&&(this.srcValue=t)}addEventListener(t,e,s){t=t.replace(/-/g,""),super.addEventListener(t,e,s),this.jsvAddMediaListener(t)}jsvOnLoaded(){}set src(t){if(t&&"about:null"!==t&&"about:blank"!==t){t=new e(t).href}this.jsvMedia||this.jsvInit(),t!==this.jsvMedia.src&&(this.jsvMedia.src=t,this.srcValue=t)}jsvOnLoadForgeView(){console.log("MediaElement jsvOnLoadForgeView"),super.jsvOnLoadForgeView(),this.jsvMedia||this.jsvInit(),this.registerOnVisibilityChange()}jsvInit(){let t=this.jsvEventListener;if(t)for(var e in t.keys)this.jsvAddMediaListener(e);Promise.resolve().then((()=>{this.jsvMedia&&this.jsvMedia.confirmInitSetup?.()}))}jsvCallbackOnUnloadForgeView(){return this.jsvOnUnloadForgeView.bind(this)}jsvOnUnloadForgeView(){console.log("MediaElement jsvOnUnloadForgeView"),this.unregisterOnVisibilityChange(),this.jsvMediaView&&(this.jsvMediaView=null),this.jsvRelease()}jsvRelease(){this.jsvMedia&&(this.jsvMedia.pause(),this.jsvMedia.unload&&this.jsvMedia.unload(),this.jsvMedia.releaseResource&&(this.jsvMedia.releaseResource(),this.jsvMedia.onPlatformDestroy())),this.jsvEventListener=void 0}jsvAddMediaListener(t){}onJsViewHide(){this.jsvMedia&&(this.jsvMedia.paused||(this.stopByOnHide=!0),this.jsvMedia.unload())}onJsViewShow(){this.jsvMedia||this.jsvInit(),this.jsvMedia.src=this.srcValue,this.stopByOnHide&&(this.stopByOnHide=!1,this.jsvMedia.play())}onVisibilityChange(t){this.playBackground||("show"===t.status?this.onJsViewShow():"hide"===t.status&&this.onJsViewHide())}registerOnVisibilityChange(){window.JsView&&window.JsView.onVisibilityChange(this.onVisibilityChange)}unregisterOnVisibilityChange(){window.JsView&&window.JsView.removeEventCallback(this.onVisibilityChange)}setAttribute(t,e){"jsv_play_background"!==t?super.setAttribute(t,e):this.playBackground="true"===e}}C.HOOKS={Audio:Audio,Video:window._ExtVideo,OffscreenVideo:window._ExtOVP},C.PROP={SetOnly:["autoplay","loop","timeupdateless","predownload"],GetOnly:["duration","paused"],SetAndGet:["currentTime","muted","playbackRate","preload","volume"],Function:["load","pause","play","unload","confirmInitSetup"]};for(let t in C.PROP){let e=C.PROP[t];for(let s of e){let e={};"SetOnly"!==t&&"SetAndGet"!==t||(e.set=function(t){this.jsvMedia||this.jsvInit(),this.jsvMedia[s]=t}),"GetOnly"!==t&&"SetAndGet"!==t||(e.get=function(){return this.jsvMedia||this.jsvInit(),this.jsvMedia[s]}),"Function"===t&&(e=function(...t){return this.jsvMedia||this.jsvInit(),this.jsvMedia[s]?this.jsvMedia[s](...t):null}),e instanceof Function?C.prototype[s]=e:Object.defineProperty(C.prototype,s,e)}}class T extends C{constructor(t){super(t),this.jsvOverrideMedia=!1,console.log("AudioElement.constructor()",this)}jsvGetTagName(){return m.TAG.AUDIO}jsvInit(){this.jsvOverrideMedia||(this.jsvMedia=new C.HOOKS.Audio),super.jsvInit(),this.jsvOnLoaded()}jsvOnLoaded(){this.jsvMediaView=new t.LayoutView,this.jsvMainView.AddView(this.jsvMediaView)}jsvAddMediaListener(t){this.jsvMedia||this.jsvInit(),this.jsvMedia.addEventListener(t,(()=>{let e=new i(t);e.target=this,this.dispatchEvent(e)}))}jsvRelease(){super.jsvRelease(),this.jsvMedia=null}setAttribute(t,e){if("data-jsv-audio-predownload"==t)return this.jsvMedia||this.jsvInit(),void(this.jsvMedia.predownload=!0);super.setAttribute(t,e)}}class O{constructor(){this._PersistMap=new Map,this._PersistMax=300,this._PersistIdx=0,this._PersistTrackList=new Array(this._PersistMax),this._TempMap=new Map,this._TempMax=50,this._TempIdx=0,this._TempTrackList=new Array(this._TempMax)}getPersistPack(t){return this._PersistMap.get(t)}putPersistPack(t,e){O._putPack(this._PersistMap,this._PersistTrackList,this._PersistIdx,t,e),this._PersistIdx=(this._PersistIdx+1)%this._PersistMax}getTempPack(t){return this._TempMap.get(t)}putTempPack(t,e){O._putPack(this._TempMap,this._TempTrackList,this._TempIdx,t,e),this._TempIdx=(this._TempIdx+1)%this._TempMax}static _putPack(t,e,s,i,n){let r=e[s];r&&(t.delete(r),e[s]=i),t.set(i,n)}}let E=new O;class R extends m{constructor(){super(),this.jsvContentView=null,this.jsvRefedImgTex=null,this.jsvTextLatexEnable=!1,this.jsvEmoji=!1,this.jsvTextAlignMinWidth=NaN,this.jsvEmptyRect=null}jsvGetTagName(){return m.TAG.DIV}get textContent(){return this.jsvStore.textContent}set textContent(e){(e||this.jsvStore.textContent)&&(this.jsvStore.textContent=e,this.jsvStore.clientWidth=NaN,this.jsvContentView||(this.jsvContentView=new t.LayoutView,this.jsvMainView.AddView(this.jsvContentView)),this.parentElement&&this.jsvFlushViewForeground())}get clientWidth(){const t=this.style.width;if(t||0===t)return t;if(this.jsvStore.textContent){if(!isNaN(this.jsvStore.clientWidth))return this.jsvStore.clientWidth;const t={str:this.jsvStore.textContent,font:this.style.fontFamily,size:this.style.fontSize,italic:this.style.fontStyle,bold:this.style.fontWeight};return this.jsvStore.clientWidth=s.GetTextWidth(t),this.jsvStore.clientWidth}return super.clientWidth}jsvOnLoadForgeView(){this.style.borderImage&&(this.jsvMaskView=new t.NinePatchView),super.jsvOnLoadForgeView()}jsvCallbackOnUnloadForgeView(){return this.jsvOnUnloadForgeView.bind(this)}jsvOnUnloadForgeView(){s.UnrefImgTexSize(this.jsvRefedImgTex),this.jsvRefedImgTex=null}jsvOnStyleChanged(t){super.jsvOnStyleChanged(t),this.jsvStore.textStylePack=null;let e=!!t[w.TYPE.FOREGROUND];t[w.TYPE.LAYOUT_SIZE]&&(e||this.jsvFlushViewForeground()),t[w.TYPE.FOREGROUND]&&this.jsvFlushViewForeground(),t[w.TYPE.BORDER]&&this.jsvFlushViewBorder()}jsvFlushViewForeground(){if(this.jsvContentView&&(this.jsvContentView.ClearViews(),this.jsvStore.textContent)){let t=void 0===this.style.height||0==this.style.height,e=t?(t,e)=>{this.jsvStore.clientHeight=t.height}:null,s=this.jsvBuildTextView(e);t&&s.EnableAutoHeight(),this.jsvContentView.AddView(s)}}jsvBuildTextView(e){let i=this.jsvStore.textStylePack;if(null===i&&(i=this._jsvGetClassNameCache()),null===i){this.style.jsvCustomStyles.textLineAlign||(this.style.jsvCustomStyles.textLineAlign=this.style.lineHeight?"middle":"top"),this.style.jsvCustomStyles.textVerticalAlign||(this.style.jsvCustomStyles.textVerticalAlign="top");let e=R._jsvStyleToPackData(this.style),s=JSON.stringify(e),n=E.getTempPack(s);n||(n=t.sTextStyleCache.StyleToPack(e),E.putTempPack(s,n)),i=n}this.jsvStore.textStylePack=i;let n=this.style.lineHeight?parseInt(this.style.lineHeight):this.style.fontSize?1.3*this.style.fontSize:14,r=this.style.width,o=!1;if(void 0===r&&(r=this.clientWidth,o=!0),this.jsvTextAlignMinWidth&&r<this.jsvTextAlignMinWidth&&(r=this.jsvTextAlignMinWidth),r>3e3){if(!o)return console.error(`text too long. str=${this.jsvStore.textContent}`),null;console.log(`text too long, start to break down. width(${r})`);let a=new t.LayoutView,l=Math.floor(2048/this.style.fontSize),h=this.jsvStore.textContent.length,u=0,d=0,c={str:null,font:this.style.fontFamily,size:this.style.fontSize,italic:this.style.fontStyle,bold:this.style.fontWeight};for(;h>0;){let r=l<h?l:h,o=this.jsvStore.textContent.substr(u,r);u+=r,c.str=o;let v=s.GetTextWidth(c),g=t.sTextUtils.BuildTextView(s.TextureManager,o,i,0===u?e:null,{width:v,height:this.style.height},this.style.fontSize,n,!0,this.jsvTextLatexEnable,this.jsvEmoji,this.jsvEmptyRect);a.AddView(g,{x:d,y:0,width:v,height:this.style.height}),d+=v,h-=r}return a}return t.sTextUtils.BuildTextView(s.TextureManager,this.jsvStore.textContent,i,e,{width:r,height:this.style.height},this.style.fontSize,n,!0,this.jsvTextLatexEnable,this.jsvEmoji,this.jsvEmptyRect)}_jsvGetClassNameCache(){if(null===this.style.jsvNamedClassArray)return null;if(w.JsvContainsTextMajor(this.style.jsvLockedProps))return null;let e="";for(let t of this.style.jsvNamedClassArray){let s=t.getAttach();0===s.hasTextMajorStyle&&(w.JsvContainsTextMajor(t.getStyles())?s.hasTextMajorStyle=2:s.hasTextMajorStyle=1),2===s.hasTextMajorStyle&&(e+=t.getName())}if(e.length>0){let s=E.getPersistPack(e);if(!s){let i=R._jsvStyleToPackData(this.style);s=t.sTextStyleCache.StyleToPack(i),E.putPersistPack(e,s)}return s}return null}static _jsvStyleToPackData(t){let e={textColor:t.color?t.color:"#000000",font:t.fontFamily,italic:"italic"===t.fontStyle,bold:"bold"===t.fontWeight,hAlign:t.textAlign?t.textAlign:"start",vAlign:t.jsvCustomStyles.textLineAlign?t.jsvCustomStyles.textLineAlign:"middle",vAreaAlign:t.jsvCustomStyles.textVerticalAlign?t.jsvCustomStyles.textVerticalAlign:"top",textOverflow:t.textOverflow?t.textOverflow:"clip",wordWrap:"break-word"===t.wordWrap?"break_word":"normal",direction:"rtl"===t.direction?"rtl":"ltr",textInnerDirection:t.jsvCustomStyles.textInnerDirection?t.jsvCustomStyles.textInnerDirection:"unset"};"nowrap"===t.whiteSpace&&(e.wordWrap="none");let s=t.textShadow?t.textShadow.split(" "):void 0;s&&(e.shadow={shadowOffsetX:parseInt(s[0]),shadowOffsetY:parseInt(s[1]),shadowBlur:parseFloat(s[2]),shadowColor:s[3]});let i=t.WebkitTextStroke?t.WebkitTextStroke.split(" "):void 0;return i&&(e.stroke={strokeWidth:parseInt(i[0]),strokeColor:i[1]}),e}jsvFlushViewBorder(){if(this.jsvMaskView)if(this.style.clipPath)console.error("BorderImage is conflicting with ClipPath.");else if(this.style.borderImage){if(!(this.jsvMaskView instanceof t.NinePatchView))return void console.error("Error: style.borderImage NOT support dynamic adding");let e=v.ConvertPx(this.getAttribute("jsv-borderimage-width")),i=v.ConvertPx(this.getAttribute("jsv-borderimage-height"));if(s.UnrefImgTexSize(this.jsvRefedImgTex),!this.jsvRefedImgTex||this.jsvRefedImgTex.Source!==this.style.borderImage.source.href){let n=e&&i?{width:e,height:i}:null;if(!this.style.borderImage.source.href)return void this.jsvMaskView.ResetTexture(null);this.jsvRefedImgTex=s.TextureManager.GetImage2(this.style.borderImage.source.href,!1,n,t.ColorSpace.RGBA_8888)}e&&i&&(console.log("Custom cache image size with: "+e+"/"+i),s.SetImgTexSize(this.jsvRefedImgTex,{width:e,height:i}));const n=new t.ExternalTextureSetting(this.jsvRefedImgTex);this.jsvMaskView.ResetTexture(n),this.jsvMaskView.WaitTextureToResize(!0),s.RefImgTexSize(this.jsvRefedImgTex,function(t){if(!this.jsvMaskView)return void console.log("Found border view gone");let e=this.style.borderImageWidth,s=this.style.borderImage.slice,i=Math.floor(t.width*e.top/s.top),n=Math.floor(t.height*e.left/s.left);this.jsvMaskView.SetImageDspSize(i,n);let r=this.style.borderImageOutset?this.style.borderImageOutset:v.ConvertRect();this.jsvMaskView.SetPadding({start:r.left,width:Math.max(0,i-r.left-r.right)},{start:r.top,width:Math.max(0,n-r.top-r.bottom)}),this.jsvMaskView.SetRepeat([{start:e.left,width:Math.max(0,i-2*e.left)}],[{start:e.top,width:Math.max(0,n-2*e.top)}]),this.jsvMaskView.WaitTextureToResize(!1)}.bind(this))}}setAttribute(t,e){this.jsvTakeTextAttribute(t,e)||super.setAttribute(t,e)}jsvTakeTextAttribute(t,e){return"jsv_text_vertical_align"===t?(this.style.jsvCustomStyles.textVerticalAlign=e,!0):"jsv_text_line_align"===t?(this.style.jsvCustomStyles.textLineAlign=e,!0):"jsv_text_latex_enable"===t?(this.jsvTextLatexEnable="true"===e,!0):"jsv_text_align_minwidth"===t?(this.jsvTextAlignMinWidth=parseInt(e),!0):"jsv_text_emoji"===t?(this.jsvEmoji="true"===e||!0===e,!0):("jsv_text_empty_rect"===t?this.jsvEmptyRect=JSON.parse(e):"jsv_text_inner_direction"===t&&(this.style.jsvCustomStyles.textInnerDirection=e),!1)}}class A{constructor(t,e){this.RouterDelegate={ref:null},t||(this.RouterDelegate.ref=new P(!1,e))}getNodeByName(t){return this.RouterDelegate.ref.getNodeByName(t)}focusByNameBeforeMount(t,e){return t.includes(".")&&(t=t.split(".")),this.RouterDelegate.ref.focusBeforeMount(t,e)}setFocus(t,e){return this.focusByNameBeforeMount(t,e)}printFocusList(){for(let t in this.RouterDelegate.ref._ChildMap)console.log(`branchName[${t}] ${t===this.RouterDelegate.ref._FocusNodeName?"focused":""}`,this.RouterDelegate.ref._ChildMap[t])}printGlobalLastFocus(){console.log("FocusNode:"),console.log(I.sLastFocus)}getCurrentFocusStack(){const t=[];if(this.RouterDelegate.ref){let e=this.RouterDelegate.ref.getCurrentFocusNode();for(;e&&e instanceof I&&e.RouterDelegate.ref===this.RouterDelegate.ref;)t.push({name:e.BranchName}),e=e.GetParentPage()}else console.error("getCurrentFocusStack failed: router delegate is null.");return t}debugPrintNodes(){console.log("***print focus nodes***");for(let t in this.RouterDelegate.ref._ChildMap)t.includes("__DEFAULT_ID_")||console.log(t,this.RouterDelegate.ref._ChildMap[t]);console.log("***********************")}}class P{constructor(t,e){this._IsTemp=!!t,this._ChildMap={},this._FocusNameBeforeMount=null,this._FocusNodeName=null,this.NameSpace=e}getCurrentFocusNode(){return this._ChildMap[this._FocusNodeName]}getNodeByName(t,e){let s=t.split(".");return this._FindRouterSearchBase(s,e)._GetNodeFromPathArray(s,t)}_FindRouterSearchBase(t,e){if(0==t[0].length){let e,s;for(let t in this._ChildMap){e=this._ChildMap[t];break}do{s=e,e=e.GetParentPage()}while(null!=e);return t.splice(0,1),s.RouterDelegate.ref}return e&&e.AsHub&&e.GetParentPage()?e.GetParentPage().RouterDelegate.ref:this}_GetNodeFromPathArray(t,e){let s=0,i=this;for(;s<t.length-1;){let n=!1;for(let e in i._ChildMap){let r=i._ChildMap[e].RouterDelegate.ref;if(r!=i&&r.NameSpace==t[s]){i=r,s++,n=!0;break}}if(!n)return void console.error(`Error: no found subpath fname=${e}`)}let n=t[s];return i._ChildMap.hasOwnProperty(n)?i._ChildMap[n]:void console.error(`Error: no found fname=${e}`)}add(t,e){if(t.indexOf(".")>=0)console.error("ERROR: FDiv name can not contains '.'");else if(this._ChildMap.hasOwnProperty(t)&&this._ChildMap[t]!==e)console.error(`ERROR: FDiv router branch name duplicated:[${t}]`);else if(this._ChildMap[t]=e,this._FocusNameBeforeMount)if("string"==typeof this._FocusNameBeforeMount)this._FocusNameBeforeMount==t&&(this._FocusNameBeforeMount=null,e.Focus());else{this._FocusNameBeforeMount[0]==t&&(e.RouterDelegate.ref.focusBeforeMount(this._FocusNameBeforeMount.slice(1)),this._FocusNameBeforeMount=null)}}remove(t,e){let s=this._ChildMap[t];s&&s==e&&delete this._ChildMap[t]}rename(t,e){if(!this._ChildMap.hasOwnProperty(t))return void console.error(`ERROR: alter name failed ${t}->${e}`);let s=this._ChildMap[t];delete this._ChildMap[t],this.add(e,s),this._FocusNodeName==t&&(this._FocusNodeName=e)}focusBeforeMount(t,e){let s=!1;if(t.indexOf(".")>=0)return console.error("ERROR: not support name with namespace"),!1;if("string"==typeof t){if(!t.includes(".")){s=!0;let i=this._ChildMap[t];return this._FocusNodeName=t,i?(i.Focus(!e),!0):(this._FocusNameBeforeMount=t,!1)}}else if("object"==typeof t&&Array.isArray(t)&&t.length>0){if(s=!0,1==t.length)return this.focusBeforeMount(t[0]);{let e=t[0],s=this._ChildMap[e];return this._FocusNodeName=e,s?s.RouterDelegate.ref.focusBeforeMount(t.slice(1)):(this._FocusNameBeforeMount=t,!1)}}return s||console.error("illegal name param",t),!1}focus(t,e){let s=this.focusBeforeMount(t,e);return s||console.log("No found branch:"+t),s}forEach(t){for(let e in this._ChildMap)t(this._ChildMap[e],e,this._ChildMap)}printNodes(){console.log(this._ChildMap)}}class I extends t.PageBase{constructor(t){super(t),this._OnKeyDown=null,this._OnKeyUp=null,this._OnFocus=null,this._OnBlur=null,this._DispatchKeyDown=null,this._DispatchKeyUp=null,this._OnCustomerEvent=null,this._DKeyDownProxy=void 0,this._DKeyUpProxy=void 0,this._Mounted=!1,this.BranchName=t,this.AsHub=!1,this.InterfaceHub=null,this.RouterDelegate={ref:null},this._TmpRouter=null,this._OriginDispatchKeyDown=this._OriginDispatchKeyDown.bind(this),this._OriginDispatchKeyUp=this._OriginDispatchKeyUp.bind(this),this._AutoShow=!1}updateMountState(){this._Mounted=!0;let t=this.SubPages;for(let e in t)t[e].updateMountState()}getHub(){return this.InterfaceHub||(this.InterfaceHub=new A(!0),this.InterfaceHub.RouterDelegate=this.RouterDelegate),this.InterfaceHub}setHub(t){this.RouterDelegate.ref?console.error("Error: hub is already setted."):(this.RouterDelegate.ref=t.RouterDelegate.ref,this.AsHub=!0)}_UseParentRouter(t){this.RouterDelegate=t,this.InterfaceHub&&(this.InterfaceHub.RouterDelegate=t)}routerAdd(t,e){e.RouterDelegate.ref||e._UseParentRouter(this.RouterDelegate),this.RouterDelegate.ref||(this.RouterDelegate.ref=new P(!0)),this.RouterDelegate.ref.add(t,e)}routerRenameChild(t,e){this.RouterDelegate.ref.rename(t,e)}printFocusList(){this.RouterDelegate.ref?this.RouterDelegate.ref.printFocusList():console.error("Error: no router")}routerUnbind(){let t;this.AsHub?this.GetParentPage()&&(t=this.GetParentPage().RouterDelegate.ref):t=this.RouterDelegate.ref,t&&t.remove(this.BranchName,this)}setBranchName(t){if(t===this.BranchName)return;let e=this.BranchName;this.BranchName=t,this.PageName=t,this._ParentPage&&this._ParentPage.routerRenameChild(e,t)}setOnKeyDown(t){this._OnKeyDown=t}setOnKeyUp(t){this._OnKeyUp=t}setOnFocus(t){this._OnFocus=t}setOnBlur(t){this._OnBlur=t}setDispatchKeyUp(t){this._DispatchKeyUp=t}setDispatchKeyDown(t){this._DispatchKeyDown=t}setOnCustomerEvent(t){this._OnCustomerEvent=t}setDispatchKeyProxy(t,e){this._DKeyDownProxy=t,this._DKeyUpProxy=e}requestFocus(t){let e=this.RouterDelegate.ref;return this.AsHub&&this.GetParentPage()&&(e=this.GetParentPage().RouterDelegate.ref),e?e.focus(this.BranchName,t):(console.error("error: lost router"),!1)}OnKeyDown(t){return!!this._OnKeyDown&&this._OnKeyDown(t)}OnKeyUp(t){return!!this._OnKeyUp&&this._OnKeyUp(t)}OnCustomerEvent(t){return!!this._OnCustomerEvent&&this._OnCustomerEvent(t)}bubbleCustomerEvent(t){this.BubbleCustomerEvent(t)}dispatchKeyDown(t){return this.DispatchKeyDown(t)}DispatchKeyDown(t){return I.sLastFocus=this,this._DKeyDownProxy?this._DKeyDownProxy(t,this._OriginDispatchKeyDown):this._OriginDispatchKeyDown(t)}_OriginDispatchKeyDown(t){let e=!1;return this._DispatchKeyDown&&(e=this._DispatchKeyDown(t)),!!e||super.DispatchKeyDown(t)}dispatchKeyUp(t){return this.DispatchKeyUp(t)}DispatchKeyUp(t){return this.__DKeyUpProxy?this.__DKeyUpProxy(t,this._OriginDispatchKeyUp):this._OriginDispatchKeyUp(t)}_OriginDispatchKeyUp(t){let e=!1;return this._DispatchKeyUp&&(e=this._DispatchKeyUp(t)),!!e||super.DispatchKeyUp(t)}attachToActivity(t,e){this.AttachToActivity(t,e)}AttachToActivity(t,e){super.SetParent(t,e)}setParent(t){this.SetParent(t)}SetParent(t){if(null!=t&&(super.SetParent(t,null),this._ParentPage._Mounted&&(this.updateMountState(),b()),t instanceof I)){if(this.RouterDelegate.ref&&this.RouterDelegate.ref._IsTemp){let e=this.RouterDelegate.ref;this.RouterDelegate.ref=null,e.forEach(((e,s)=>{t.routerAdd(s,e)}))}t.routerAdd(this.BranchName,this)}}focus(t){this.Focus(t)}Focus(t){if(!this._Mounted)return I.sFocusMemos.push({obj:this,bcf:t}),void console.log("page base tree not build, cache focus");super.Focus(t)}OnFocus(){this._OnFocus&&this._OnFocus()}OnBlur(){this._OnBlur&&this._OnBlur()}onUnMount(){let t=this.GetParentPage();t&&t.RemoveSubPage(this),this.ClearSubPages(),this.routerUnbind()}getName(){let t=this,e=[this.RouterDelegate.ref.NameSpace];this.AsHub||e.push(this.BranchName);let s=this.RouterDelegate.ref;do{if(t=t.GetParentPage(),"__AppRoot__"==e[0])break;t&&t.RouterDelegate.ref!=s&&(s=t.RouterDelegate.ref,e.unshift(s.NameSpace))}while(t);return"__AppRoot__"==e[0]?e[0]="":console.error("ERROR: missing app root"),e.join(".")}getNodeByName(t){return this.RouterDelegate.ref.getNodeByName(t,this)}printFocusNodeList(){this.getHub().printFocusList()}printGlobalLastFocus(){this.getHub().printGlobalLastFocus()}}I.sFocusMemos=[],I.sLastFocus=null,I.sRootPageNode=null;let b=()=>{let t=I.sFocusMemos.length;if(t>0){let e=I.sFocusMemos;I.sFocusMemos=[];for(let s=0;s<t;s++)e[s].obj.Focus(e[s].bcf)}},M=1;class N extends m{constructor(){super(),this.FocusNodeRef=new I("__DEFAULT_ID_"+M++),this.HubRef=void 0}jsvGetTagName(){return m.TAG.FDIV}setAttribute(t,e){if(t)if("fname"===t)e&&this.FocusNodeRef.setBranchName(e);else if("new-namespace"===t&&""!==e&&!this.HubRef){let t=new A(!1,e);this.HubRef=t,this.FocusNodeRef.setHub(t),this.FocusNodeRef.setBranchName(e)}}jsvGetHub(){return this.HubRef}}class V extends m{constructor(t){super(t),this.src=null,this.onerror=null,this.onload=null}setAttribute(t,e){console.log("LinkElement.setAttribute() name="+t+", value=",e),this[t]=e}jsvLoadResource(){let t=!1,s=null;if(null!=this.href){var i=new e(this.href);console.log("Ignore to load link from url="+i.href),t=!0}else console.warn("Failed to load link, href is not exists."),s="NoSrc";this.jsvOnLoadResult(t,s)}jsvOnLoadResult(t,e){if(console.log("jsvOnLoadResult isSuccess:"+t+", errCode:"+e),t){if(this.onload){let t=new i("load");this.onload(t)}}else this.onerror&&this.onerror({type:"jsvErr_"+e,target:this})}}class x extends m{constructor(t){super(t),this.src=null,this.onerror=null,this.onload=null,this.charset=null,this.timeout=120}setAttribute(t,e){console.log("ScriptElement.setAttribute() name="+t+", value=",e),this[t]=e}jsvLoadResource(){if(null!=this.src){var t=new e(this.src);console.log("load script with url="+t.href);var s=this;window.JsView.runJsWithUrl(t.href,!1,((t,e)=>{s.jsvOnLoadResult(t,e)}))}}jsvOnLoadResult(t,e){if(console.log("onLoadResult "+t+" "+e),t){if(this.onload){let t=new i("load");this.onload(t)}}else this.onerror&&this.onerror({type:"jsvErr_"+e,target:this})}}class _ extends m{constructor(){super()}appendChild(t){"HTMLScriptElement"==t.constructor.name||"HTMLStyleElement"==t.constructor.name||"HTMLLinkElement"==t.constructor.name?window.originDocument.headAppendChild(t):super.appendChild(t),(t instanceof V||t instanceof x)&&t.jsvLoadResource()}removeChild(t){"HTMLScriptElement"==t.constructor.name||"HTMLStyleElement"==t.constructor.name||"HTMLLinkElement"==t.constructor.name?window.originDocument.headRemoveChild(t):super.removeChild(t)}}class L extends i{constructor(t){super("load")}}class D extends m{constructor(e){super(e),this.jsvImageView=new t.LayoutView(null,"img"),this.jsvMainView.AddView(this.jsvImageView),this._ImageInLoading=!1,this.jsvColorSpace=t.ColorSpace.RGBA_8888,this.jsvScaleDownTex=null,this._HasUserOnLoad=!1,this._OnLoadSeq=1,this._LoadedSrc=null,this.jsvApicAutoPlay=!0}jsvGetTagName(){return m.TAG.IMAGE}setAttribute(t,e){this.jsvTakeTextureAttribute(t,e)||(super.setAttribute(t,e),t===m.ATTRIBUTE.SRC&&this.jsvSetAttrLazySync(t,m.ATTRTYPE.CSS))}jsvSetElementProp(t){this.jsvImageView.SetElementProp(t,s.RootActivity)}jsvCallbackOnUnloadForgeView(){return()=>{if(this._HasUserOnLoad){let t=this.jsvImageView?.TextureSetting?.Texture;t&&t.DisableBackgroundLoad(this)}}}jsvFlushEventHandlers(){if(super.jsvFlushEventHandlers(),this.eventHandlers.onLoad){let t=this.jsvImageView?.TextureSetting?.Texture;t&&(this._HasUserOnLoad=!0,t.EnableBackgroundLoad(this))}else if(this._HasUserOnLoad){let t=this.jsvImageView?.TextureSetting?.Texture;t&&t.DisableBackgroundLoad(this),this._HasUserOnLoad=!1}}jsvTakeTextureAttribute(t,e){return"jsv_img_color_space"==t||"jsvImgColorSpace"==t||"jsv-img-color-space"==t?(this.jsvColorSpace=e,!0):"jsv_img_scaledown_tex"==t||"jsvImgScaledownTex"==t||"jsv-img-scaledown-tex"==t?(""!==e&&void 0!==e||(e="true"),this.jsvScaleDownTex=e,!0):"jsv_disable_apic_autoplay"==t&&(this.jsvApicAutoPlay=!1,!0)}jsvFlushViewLayout(){this._ImageInLoading?(this.jsvImageView.WaitTextureToResize(!0),this.jsvImageView.ResetLayoutParams({x:0,y:0,width:this.style.width,height:this.style.height})):this.jsvImageView.WaitTextureToResize(!1),super.jsvFlushViewLayout()}jsvOnLoaded(t){if(console.log("ImageElement.jsvOnLoaded() imageSize="+JSON.stringify(t)),this._ImageInLoading=!1,this._LoadedSrc=this.src,this.jsvStore.textureWidth=t.width,this.jsvStore.textureHeight=t.height,this.style.jsvLazySyncCache.setCacheProperty(w.TYPE.LAYOUT_SIZE,!0),this._HasUserOnLoad){let t=new L;t.target=this,document.dispatchEvent(t)}}jsvOnAttrLazySync(t){t.hasOwnProperty(m.ATTRIBUTE.SRC)&&this.src!=this._LoadedSrc&&(this._ImageInLoading=!0,this.jsvStore.textureWidth=NaN,this.jsvStore.textureHeight=NaN,this.jsvDrawImage())}jsvOnLoadForgeView(){this.style.objectFit||this.style.jsvSetPropertySilently("objectFit",w.ObjectFit.FILL),super.jsvOnLoadForgeView()}jsvApplyObjectFit(t){return 0!=this.jsvStore.textureWidth&&0!=this.jsvStore.textureHeight||console.warn("warning: size 0 not support object fit, src="+this.src),m.applyObjectFitCommon(this,t,this.jsvImageView)}jsvDrawImage(){if(!this.src)return;let t=null;"true"===this.jsvScaleDownTex&&(this.style&&this.style.width?t={width:this.style.width,height:0}:console.error("set jsvScaleDownTex while style.width is not set. you need to set 'src' prop at the end.")),this._OnLoadSeq++;let e=this._OnLoadSeq;s.SetBackgroundImage(this.jsvImageView,this.src,this.style.borderRadius,(t=>{e===this._OnLoadSeq&&this.jsvOnLoaded(t)}),t,this.jsvColorSpace,this.jsvApicAutoPlay)}}class F extends m{constructor(e){super(),this.jsvMainView=new t.JsvElementView(e)}get textContent(){return this.jsvMainView.textContent}set textContent(t){this.jsvMainView.textContent=t}setAttribute(t,e){super.setAttribute(t,e),this.jsvMainView.setAttribute(t,e)}removeAttribute(t){super.removeAttribute(t),this.jsvMainView.removeAttribute(t)}getAttribute(t){return this.jsvMainView.getAttribute(t)}hasAttribute(t){return this.jsvMainView.hasAttribute(t)}jsvOnStyleChanged(t){super.jsvOnStyleChanged(t)}}class k{constructor(t){let e=t.indexOf(k.KeyFramesFlag)+k.KeyFramesFlag.length,s=t.indexOf("{"),i=t.substring(e,s);this.name=i.trim(),this.cssText=t}}k.KeyFramesFlag="@keyframes";class B{constructor(t){this.jsvCssRules=null,this.jsvTextContent=t}get cssRules(){if(this.jsvCssRules)return this.jsvCssRules;this.jsvCssRules=new Array;if(this.jsvTextContent.indexOf(k.KeyFramesFlag)<0)return this.jsvCssRules;var t=this.jsvTextContent.split(k.KeyFramesFlag);for(let e in t)0!=e&&this.insertRule(k.KeyFramesFlag+t[e]);return this.jsvCssRules}insertRule(t,e){if(void 0===e&&(e=this.jsvCssRules.length),t.indexOf(k.KeyFramesFlag)<0)throw Error("StyleSheet.insertRule() Rule is not supported except keyframes.");let s=new k(t);this.jsvCssRules.splice(e,0,s)}deleteRule(t){this.jsvCssRules.splice(t,1)}}class G extends m{constructor(t){super(t),this.textContent=null}jsvGetTagName(){return m.TAG.STYLE}appendChild(t){super.appendChild(t);let e=new B(t.textContent);document.jsvAppendStyleSheet(e)}removeChild(t){throw super.removeChild(t),Error("Failed to removeChild, unimplement!.")}}class U extends m{}class H extends C{constructor(t){super(t),console.log("VideoElement.constructor()",this),this._EventCache=[],this._UseTexture=!1,this._StartTime=0}jsvGetTagName(){return m.TAG.VIDEO}setAttribute(t,e){("jsv-media-usetexture"!==t||"true"!==e&&!0!==e&&""!==e)&&("jsv_media_usetexture"!==t||"true"!==e)?super.setAttribute(t,e):this._UseTexture=!0}removeAttribute(t){if("jsv-media-usetexture"===t||"jsv_media_usetexture"===t)return this._UseTexture=!1,void console.log("removeAttribute jsv_media_usetexture");super.removeAttribute(t)}jsvFlushViewLayout(){super.jsvFlushViewLayout();let t=this.style.JsvVideoRotation;isNaN(t)&&(t=0),this.style.objectFit&&this.style.objectFit!=w.ObjectFit.CONTAIN&&this.style.objectFit!=w.ObjectFit.FILL&&(console.error("Video rotation is not valid on objectFit=",this.style.objectFit),t=0),this.jsvMedia&&this.jsvMedia.setRotation?.(t,this.style.width,this.style.height,this.style.objectFit==w.ObjectFit.FILL)}jsvAddMediaListener(t){this.jsvMedia?this.jsvMedia.addEventListener(t,(()=>{let e=new i(t);e.target=this,this.dispatchEvent(e)})):this._EventCache.push(t)}jsvFlushVideoView(){this.jsvMediaView&&(this.jsvStore.textureWidth=this.jsvMedia.videoWidth,this.jsvStore.textureHeight=this.jsvMedia.videoHeight,this.style.jsvLazySyncCache.setCacheProperty(w.TYPE.LAYOUT_SIZE,!0))}jsvApplyObjectFit(t){return m.applyObjectFitCommon(this,t,this.jsvMediaView)}jsvInit(){console.log("VideoElement jsvInit"),this._UseTexture?this.jsvMedia=new C.HOOKS.OffscreenVideo:this.jsvMedia=new C.HOOKS.Video,this._EventCache.length>0&&(this._EventCache.map((t=>{this.jsvAddMediaListener(t)})),this._EventCache=[]),this.addEventListener("load",this.jsvOnLoaded.bind(this)),super.jsvInit()}jsvRelease(){super.jsvRelease(),this.jsvMedia=null}jsvOnLoaded(){if(!this.jsvMediaView){let e;if(this._UseTexture){this.jsvMediaView=new t.LayoutView;let i,n=s.TextureManager.GetOffScreenMediaTexture(this.jsvMedia),r=this.style.borderRadius;r&&(i=new t.ViewRoundCornerMask(r.topLeft,r.topRight,r.bottomLeft,r.bottomRight)),e=new t.TextureSetting(n,i)}else{this.jsvMediaView=new t.VideoView(this.jsvMedia);let i=s.TextureManager.GetColorTexture("rgba(0,0,0,0)");e=new t.TextureSetting(i,null,null,!1)}this.jsvMainView.AddView(this.jsvMediaView),this.jsvMediaView.ResetTexture(e)}this.jsvFlushVideoView()}jsvOnLoadForgeView(){this.style.objectFit||this.style.jsvSetPropertySilently("objectFit",w.ObjectFit.CONTAIN),super.jsvOnLoadForgeView()}onJsViewHide(){this._StartTime=this.jsvMedia.currentTime,super.onJsViewHide(),this.jsvMedia.setState("autoPlay",!1,"boolean")}onJsViewShow(){this.jsvMedia||this.jsvInit(),this.jsvMedia.src=this.srcValue,this.jsvMedia.startTime=Math.max(this._StartTime-1,0),this._StartTime=0,this.stopByOnHide&&(this.stopByOnHide=!1,this.jsvMedia.play())}}H.PROP={SetOnly:[],GetOnly:["videoHeight","videoWidth"],SetAndGet:["height","poster","width"]};for(let t in H.PROP){let e=H.PROP[t];for(let s of e){let e={};"SetOnly"!==t&&"SetAndGet"!==t||(e.set=function(t){this.media[s]=t}),"GetOnly"!==t&&"SetAndGet"!==t||(e.get=function(){return this.media[s]}),H.prototype[s]=e}}H.EVENTS=["oncanplay","oncanplaythrough","ondurationchange","onended","onerror","onload","onloadedmetadata","onloadstart","onpause","onplay","onplaying","onprogress","onseeking","onseeked","onstalled","ontimeupdate"];class W extends u{constructor(t){super(u.TEXT_NODE),this.textContent=t}get nodeValue(){return this.textContent}set nodeValue(t){this.textContent=t,this.parentNode&&(this.parentNode.textContent=this.textContent)}}class K extends u{constructor(t){super(u.COMMENT_NODE),this.textContent=t}}let J={};class z{constructor(t,e,s){this._Element=s,J.hasOwnProperty(t)&&console.error(`Warn: FDivRoot duplicate name=${t}`),J[t]=this,this._DoInit(e)}_DoInit(t){let e=this._Element.FocusNodeRef;this._Element.setAttribute("new-namespace","__AppRoot__"),t&&e.setDispatchKeyProxy(t.keyDown,t.keyUp),window.JsView?e.attachToActivity(s.RootActivity,s.RootView):(window.addEventListener("keydown",(t=>{var s=document.activeElement.tagName;s&&"input"===s.toLowerCase()||(e.dispatchKeyDown(t),t.preventDefault&&t.preventDefault())})),window.addEventListener("keyup",(t=>{var s=document.activeElement.tagName;s&&"input"===s.toLowerCase()||(e.dispatchKeyUp(t),t.preventDefault&&t.preventDefault())})))}getElement(){return this._Element}getHub(){return this._Element.jsvGetHub()}onMounted(){this._Element.FocusNodeRef.updateMountState(),b()}}class Y extends T{constructor(t){super(t),console.log("AudioElement.constructor()",this)}jsvGetTagName(){return m.TAG.AUDIOTRACK}jsvInit(){this.jsvMedia=new C.HOOKS.Audio("AudioTrack"),this.jsvOverrideMedia=!0,super.jsvInit()}}class X extends u{constructor(){super(u.DOCUMENT_NODE),this.location=window.location,this.rootElement=new R,this.rootElement.ownerDocument=this,this.rootElement.id="root",this.activeElement=this.rootElement,this.head=new _,this.styleSheets=new Array,window.JsView&&this.styleSheets.push(new B("@keyframes jsv-basic-slot {}")),this.jsvIsReady=!1}createElement(t){switch(t){case X.FDIV_ELEMENT:return new N;case X.DIV_ELEMENT:return new R;case X.IMG_ELEMENT:return new D;case X.STYLE_ELEMENT:return new G;case X.AUDIO_ELEMENT:return new T;case X.VIDEO_ELEMENT:return new H;case X.LINK_ELEMENT:return window.JsView?new V:window.originDocument.createElement(X.LINK_ELEMENT);case X.SCRIPT_ELEMENT:return window.JsView?new x:window.originDocument.createElement(X.SCRIPT_ELEMENT);case X.ANCHOR_ELEMENT:return new S;case X.SVG_ELEMENT:return new SVGElement;default:return t==X.JSV_AUDIOTRACK_ELEMENT?new Y:window.JsView?("template"!=t&&console.warn("Document.createElement() unknown name="+t),new U(t)):new F(t.startsWith("jsv")?t:"jsve-"+t)}}createTextNode(t){return new W(t)}createEvent(t){return new i(t)}createComment(t){return new K(t)}getElementById(t){if("root"===t||"app"===t)return this.rootElement;throw Error("Document.getElementById() id="+t+" is UNIMPLEMENTED.")}getElementsByTagName(t){if("head"===t.toLowerCase())return window.JsView?[this.head]:window.originDocument.getElementsByTagName(t);if("link"===t.toLowerCase()||"script"===t.toLowerCase()||"style"===t.toLowerCase())return[];throw Error("Document.getElementsByTagName() name="+t+" is UNIMPLEMENTED.")}querySelector(t){if("root"===t||"#app"===t)return this.rootElement;if("head"===t)return this.head;if("base"===t)return null;if(t.startsWith("style[")&&t.endsWith("]"))return null;if(t.startsWith("link[")&&t.endsWith("]"))return null;throw Error("Document.querySelector() selectors="+t+" is UNIMPLEMENTED.")}querySelectorAll(t){return[]}jsvAppendStyleSheet(t){document.styleSheets.push(t)}jsvGetKeyFrames(t,e){if(window.JsvCode.Dom.StyleSheets){const s=window.JsvCode.Dom.StyleSheets;for(const i of e){const e=s[`${t}-${i.replace("data-v-","")}`];if(e)return e}const i=s[t];if(i)return i}for(let e of this.styleSheets)for(let s of e.cssRules)if(s.name==t)return s.cssText;let s="@keyframes ",i=s+t;for(let t of this.styleSheets){let e=t.jsvTextContent,n=e.indexOf(i);if(n<0)continue;let r=e.indexOf("-keyframes",n+1),o=e.indexOf(s,n+1);o<0&&(o=e.length),r>0&&r<o&&(o=r);let a=e.substring(n,o);return t.insertRule(a,0),a}return null}jsvUpdateRootElement(t){console.log("Document.jsvUpdateRootElement() this.jsvIsReady = true"),this.rootElement.jsvMainView=t,this.jsvIsReady=!0}jsvInitFDivRoot(t,e,s){if(!s){let t=document.createElement("fdiv");this.rootElement.appendChild(t),this.rootElement=t,s=this.rootElement}return new z(t,e,s)}jsvGetFDivRoot(t){return function(t){return J[t]}(t)}set cookie(t){window.__JsvCookies.setCookie(t)}get cookie(){return window.__JsvCookies.getCookie()}}X.ANCHOR_ELEMENT="a",X.AUDIO_ELEMENT="audio",X.DIV_ELEMENT="div",X.IMG_ELEMENT="img",X.LINK_ELEMENT="link",X.SCRIPT_ELEMENT="script",X.STYLE_ELEMENT="style",X.SVG_ELEMENT="svg",X.VIDEO_ELEMENT="video",X.FDIV_ELEMENT="fdiv",X.JSV_AUDIOTRACK_ELEMENT="jsv-audiotrack";class $ extends m{jsvGetTagName(){return m.TAG.LINK}}if(window.JsvCode={Dom:{StyleSheets:{}}},window.Audio=T,window.Video=H,window.MutationObserver=class{constructor(t){this.callback=t}observe(t,e){if(!(t instanceof u))throw Error("TypeError: Failed to execute 'observe' on 'MutationObserver': parameter 1 is not of type JsView's 'Node'");for(const t of Object.keys(e))"childList"==t||console.warn("JsView: only childList config is supported! ignore "+t);e.childList&&t.jsvObserveChildChanged((()=>{this.callback?.()}))}disconnect(){this.callback=void 0}},window.JsView){console.log("Declare Dom Proxy."),global.SVGElement=$,global.Element=m;let t=new e(window.JsView.getAppUrl(),!0);window.location.applyUrlInfo?window.location.applyUrlInfo(t):window.location=t,window.addEventListener=function(t,e){},window.document=new X,window.history={},window.navigator={userAgent:"jsview-runtime"},window.HTMLIFrameElement=function(){}}h.I("Using JsView Runtime");export{X as Document,s as ForgeExtension,_ as HeadElement,l as JsViewForgeApp,o as JsvLazySyncCache,h as Log,r as gSyncTimesCounter};
@@ -1 +1 @@
1
- /* eslint-disable */ var o={};window.JsView&&(window.JsView.ForgeExtension||(window.JsView.ForgeExtension=o),o=window.JsView.ForgeExtension);var w=o;void 0===window.Forge&&(window.Forge={});var e=window.Forge;export{e as Forge,w as ForgeExtension};
1
+ /* eslint-disable */ void 0===window.Forge&&(window.Forge={});var e=window.Forge;class t{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")){let t=e.indexOf("(")+1,i=e.lastIndexOf(")");if("undefined"===(e=e.substring(t,i).trim())||"null"===e||0===e.length)return}if(!0===e.startsWith("data:"))return void(this.href=e);let i=e.indexOf("://");if(!(i<0||i>10)||e.startsWith("./")||e.startsWith("/")||(e="./"+e),!0===e.startsWith("/"))e=document.location.origin+e;else if((!0===e.startsWith("./")||!0===e.startsWith("../"))&&void 0!==window.JsView&&void 0!==window.JsView.Dom.JsSubPath){if(void 0===window.JsView.Dom.__MainPath||"undefined"===window.JsView.Dom.__MainPathRef||window.JsView.Dom.__MainPathRef!==document.location.href){window.JsView.Dom.JsSubPath.startsWith("/")||(window.JsView.Dom.JsSubPath="/"+window.JsView.Dom.JsSubPath),window.JsView.Dom.JsSubPath.endsWith("/")||(window.JsView.Dom.JsSubPath=window.JsView.Dom.JsSubPath+"/"),window.JsView.Dom.__MainPathRef=document.location.href;let e=document.location.pathname.lastIndexOf(window.JsView.Dom.JsSubPath);window.JsView.Dom.__MainPath=document.location.origin+document.location.pathname.substring(0,e)+"/"}let t=window.JsView.Dom.__MainPath;e=e.startsWith("./")?t+e.substring(2):t+e}if(this.href=e,!t)return;let r=this.href,n=r.indexOf("#");n>0&&(this.hash=r.substring(n),r=r.substring(0,n));let s=r.indexOf("?");s>1&&(this.search=r.substring(s),r=r.substring(0,s));let o=r,a=o.indexOf("://");this.protocol=a>0?o.substring(0,a+1):"";let u=a>1?o.substring(a+3):"";if(a=u.indexOf("/"),this.host=a>0?u.substring(0,a):"",this.pathname=a>1?u.substring(a):"",this.origin=a>0?this.protocol+"//"+this.host:"",this.host.startsWith("[")){let e=this.host.indexOf("]");this.hostname=this.host.substring(0,e+1),e=this.host.substring(e+1).indexOf(":"),this.port=e>1?this.host.substring(e+1):""}else{let e=this.host.indexOf(":");this.hostname=e>0?this.host.substring(0,e):this.host,this.port=e>1?this.host.substring(e+1):""}}replace(e){this.href=e}}window.JsView&&window.JsView.registerUriConverter?.((e=>new t(e,!1).href));class i{static SetBackgroundColor(t,r,n){const s=i.TextureManager.GetColorTextureCached(r);let o;n&&(o=new e.ViewRoundCornerMask(n.topLeft,n.topRight,n.bottomLeft,n.bottomRight));const a=new e.ExternalTextureSetting(s,o);t.ResetTexture(a)}static SetBackgroundImage(r,n,s,o,a,u,h){let l,d={};if("string"==typeof n){const e=new t(n);if(e instanceof t==!1)throw Error("Bad Argument.",e);d.url=e.href}else"linear-gradient"==n?.type&&(d.gradient=n);if(d.gradient)if(d.gradient.colors?.length>2){const e=d.gradient.colors,t=[e[0],e[e.length-1]],r=e.slice(1,e.length-1);l=i.TextureManager.CreateLinearGradientTexture(t,r)}else 2==d.gradient.colors?.length?l=i.TextureManager.CreateMiniGradientTexture(!0,d.gradient.colors[0],d.gradient.colors[1],d.gradient.rawValue):console.warn("Failed to create backgroundImage gradient, bad colors.",d.gradient.colors);else d.url&&(l=d.url.includes(".gif")||d.url.includes(".webp")?i.TextureManager.GetGifImage(d.url,!1,null,h):i.TextureManager.GetImage2(d.url,!1,a,u||e.ColorSpace.RGBA_8888));if(l){let t;s&&(t=new e.ViewRoundCornerMask(s.topLeft,s.topRight,s.bottomLeft,s.bottomRight));const i=new e.ExternalTextureSetting(l,t);if(r.ResetTexture(i),o){let e=l.RegisterLoadImageCallback(null,(function(){o({width:l.Width,height:l.Height})}));r.RegisterDetachCallback((()=>{l.UnregisterLoadImageCallback(e)}))}}}static SetMaskedBackgroundImage(r,n,s,o){if("string"==typeof n&&(n=new t(n)),n instanceof t==!1)throw Error("Bad Argument.",n);if("string"==typeof s&&(s=new t(s)),s instanceof t==!1)throw Error("Bad Argument(MaskURL).",s);const a=i.TextureManager.GetImage2(n.href,!1,null,o||e.ColorSpace.RGBA_8888);if(a){const t=i.TextureManager.GetImage2(s.href,!1,null,e.ColorSpace.RGBA_8888),n=new e.ExternalTextureSetting(a,new e.ViewTextureMask(t));r.ResetTexture(n)}}static SetVideoTexture(t,r,n){const s=i.TextureManager.GetColorTexture(r);let o;n&&(o=new e.ViewRoundCornerMask(n.topLeft,n.topRight,n.bottomLeft,n.bottomRight));const a=new e.TextureSetting(s,o);t.ResetTexture(a)}static GetTextWidth(t){return t.str||(t.str=""),t.font||(t.font=e.TextUtils._sDefaultFont),t.size||(t.size=e.TextUtils._sDefaultFontSize),"italic"!==t.italic&&(t.italic=""),"bold"!==t.bold&&(t.bold=""),window.PlatformUtils.GetTextWidth(t)}static RequestSwap(){e.sRenderBridge.RequestSwap()}static SetImgTexSize(e,t){let r={size:t,refNum:0};i.TextureInfo.Cache[e.Source]=r}static RefImgTexSize(e,t){let r=i.TextureInfo.Cache[e.Source];r?(r.refNum>0?r.refNum++:r.refNum=1,t(r.size)):e.RegisterLoadImageCallback(null,(function(){const r={width:e.Width,height:e.Height};t(r);let n=i.TextureInfo.Cache[e.Source];if(n)n.refNum>0?n.refNum++:n.refNum=1;else{let t={size:r,refNum:1};i.TextureInfo.Cache[e.Source]=t}}))}static UnrefImgTexSize(e){if(!e)return;let t=i.TextureInfo.Cache[e.Source];t&&(t.refNum--,t.refNum<=0&&i.TextureInfo.Unused.add(e.Source))}static ClearUnusedTexSize(){for(let e of i.TextureInfo.Unused){let t=i.TextureInfo.Cache[e];t.refNum<-2?(delete i.TextureInfo.Cache[e],i.TextureInfo.Unused.delete(e)):t.refNum<=0?t.refNum--:i.TextureInfo.Unused.delete(e)}}}i.TextureInfo={Cache:{},Unused:new Set},i.TextureManager=null,i.RootView=null,i.RootActivity=null,i.HaltKeyEvent=!1,window.ForgeExtension=i;export{e as Forge,i as ForgeExtension};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shijiu/jsview",
3
- "version": "1.9.872",
3
+ "version": "1.9.874",
4
4
  "bin": {
5
5
  "jsview-post-build": "./tools/jsview-post-build.js",
6
6
  "jsview-post-install": "./tools/jsview-post-install.js"
@@ -146,9 +146,10 @@ async function printRevision(options)
146
146
  for(const fileName of pluginFileNames) {
147
147
  var pathname = path.resolve(pluginDirPath, fileName);
148
148
  if (fs.statSync(pathname).isDirectory()) {
149
- let versionFilePath = path.resolve(pathname, 'version.js');
149
+ let versionFilePath = path.resolve(pathname, 'version.mjs');
150
150
  if (fs.existsSync(versionFilePath)) {
151
- const targetVersion = require(versionFilePath);
151
+ const versionFileURL = url.pathToFileURL(versionFilePath);
152
+ const { default: targetVersion } = await import(versionFileURL);
152
153
  console.log(`* [${path.basename
153
154
  (pathname)}] : ${targetVersion.packageName
154
155
  } : ${targetVersion.version}`);