@shijiu/jsview 1.9.912 → 1.9.914
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 */ class e{static CreateAudioPlayer(){return new window.Audio}static CreateVideoPlayer(){const t=window.originDocument.createElement("video");return t.jsvOnCssStyleChanged=e.OnCssStyleChanged.bind(t),t.jsvFinalize=e.JsvFinalize.bind(t),t}static OnCssStyleChanged(e,t){const s=this;s.parentNode,s.style.position="fixed",s.style.left=(t.left?t.left:0)+"px",s.style.top=(t.top?t.top:0)+"px",s.style.width=(t.width?t.width:0)+"px",s.style.height=(t.height?t.height:0)+"px",s.style.objectFit=t.objectFit,s.style.visibility=t.visibility}static JsvFinalize(){console.log("BrowserPlatformMediaBridge.JsvFinalize()");this.pause()}}window.JsvCode.BrowserPlatformMediaBridge||(window.JsvCode.BrowserPlatformMediaBridge=e);class t{constructor(e,t){this.target=t,this.timeStamp=Date.now(),this.type=e}}class s extends t{constructor(e){super(e)}}class i extends t{constructor(e){super(e)}}void 0===window.Forge?(window.Forge={},console.log("Define forge browser")):console.log("Define using JsView forge engine-js");var r=window.Forge;class o{constructor(e,t){if(!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("./")&&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)}e=window.JsView.Dom.MainPath+e.substring(1)}if(this.href=e,!t)return;let i=this.href,r=i.indexOf("#");r>0&&(this.hash=i.substring(r),i=i.substring(0,r));let o=i.indexOf("?");o>1&&(this.search=i.substring(o),i=i.substring(0,o));let n=i,a=n.indexOf("://");this.protocol=a>0?n.substring(0,a+1):"";let l=a>1?n.substring(a+3):"";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:"",a=this.host.indexOf(":"),this.hostname=a>0?this.host.substring(0,a):this.host,this.port=a>1?this.host.substring(a+1):""}replace(e){this.href=e}href="";origin="";protocol="";host="";hostname="";port="";pathname="";search="";hash=""}class n{static SetBackgroundColor(e,t,s){const i=n.TextureManager.GetColorTextureCached(t);let o;s&&(o=new r.ViewRoundCornerMask(s.topLeft,s.topRight,s.bottomLeft,s.bottomRight));const a=new r.ExternalTextureSetting(i,o);e.ResetTexture(a)}static SetBackgroundImage(e,t,s,i,a,l,c){let d,h={};if("string"==typeof t){const e=new o(t);if(e instanceof o==!1)throw Error("Bad Argument.",e);h.url=e.href}else"linear-gradient"==t?.type&&(h.gradient=t);if(h.gradient)if(h.gradient.colors?.length>2){const e=h.gradient.colors,t=[e[0],e[e.length-1]],s=e.slice(1,e.length-1);d=n.TextureManager.CreateLinearGradientTexture(t,s)}else 2==h.gradient.colors?.length?d=n.TextureManager.CreateMiniGradientTexture(!0,h.gradient.colors[0],h.gradient.colors[1],h.gradient.rawValue):console.warn("Failed to create backgroundImage gradient, bad colors.",h.gradient.colors);else h.url&&(d=h.url.includes(".gif")||h.url.includes(".webp")?n.TextureManager.GetGifImage(h.url,!1,null,c):n.TextureManager.GetImage2(h.url,!1,a,l||r.ColorSpace.RGBA_8888));if(d){let t;s&&(t=new r.ViewRoundCornerMask(s.topLeft,s.topRight,s.bottomLeft,s.bottomRight));const o=new r.ExternalTextureSetting(d,t);if(e.ResetTexture(o),i){let t=d.RegisterLoadImageCallback(null,(function(){i({width:d.Width,height:d.Height})}));e.RegisterDetachCallback((()=>{d.UnregisterLoadImageCallback(t)}))}}}static SetMaskedBackgroundImage(e,t,s,i){if("string"==typeof t&&(t=new o(t)),t instanceof o==!1)throw Error("Bad Argument.",t);if("string"==typeof s&&(s=new o(s)),s instanceof o==!1)throw Error("Bad Argument(MaskURL).",s);const a=n.TextureManager.GetImage2(t.href,!1,null,i||r.ColorSpace.RGBA_8888);if(a){const t=n.TextureManager.GetImage2(s.href,!1,null,r.ColorSpace.RGBA_8888),i=new r.ExternalTextureSetting(a,new r.ViewTextureMask(t));e.ResetTexture(i)}}static SetVideoTexture(e,t,s){const i=n.TextureManager.GetColorTexture(t);let o;s&&(o=new r.ViewRoundCornerMask(s.topLeft,s.topRight,s.bottomLeft,s.bottomRight));const a=new r.TextureSetting(i,o);e.ResetTexture(a)}static GetTextWidth(e){return e.str||(e.str=""),e.font||(e.font=r.TextUtils._sDefaultFont),e.size||(e.size=r.TextUtils._sDefaultFontSize),"italic"!==e.italic&&(e.italic=""),"bold"!==e.bold&&(e.bold=""),window.PlatformUtils.GetTextWidth(e)}static RequestSwap(){r.sRenderBridge.RequestSwap()}static SetImgTexSize(e,t){let s={size:t,refNum:0};n.TextureInfo.Cache[e.Source]=s}static RefImgTexSize(e,t){let s=n.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 i=n.TextureInfo.Cache[e.Source];if(i)i.refNum>0?i.refNum++:i.refNum=1;else{let t={size:s,refNum:1};n.TextureInfo.Cache[e.Source]=t}}))}static UnrefImgTexSize(e){if(!e)return;let t=n.TextureInfo.Cache[e.Source];t&&(t.refNum--,t.refNum<=0&&n.TextureInfo.Unused.add(e.Source))}static ClearUnusedTexSize(){for(let e of n.TextureInfo.Unused){let t=n.TextureInfo.Cache[e];t.refNum<-2?(delete n.TextureInfo.Cache[e],n.TextureInfo.Unused.delete(e)):t.refNum<=0?t.refNum--:n.TextureInfo.Unused.delete(e)}}}n.TextureInfo={Cache:{},Unused:new Set},n.TextureManager=null,n.RootView=null,n.RootActivity=null,n.HaltKeyEvent=!1,window.JsvCode.ForgeExtension||(window.JsvCode.ForgeExtension=n);var a=n=window.JsvCode.ForgeExtension;class l{static EnableEventListener(e){const t=window.JsvCode.Dom.PlatformBridge.JsViewId;window.JsvCode.Dom.PlatformBridge.SetOnEventListener(t,e)}static CreateElement(e,t){l.#e(l.#t.CreateElement,e,t)}static BindElementToRootView(e){l.#e(l.#t.BindElementToRootView,e)}static InsertElementChild(e,t,s){l.#e(l.#t.InsertElementChild,e,t,s)}static RemoveElementChild(e,t){l.#e(l.#t.RemoveElementChild,e,t)}static MoveElementChild(e,t,s,i){l.#e(l.#t.MoveElementChild,e,t,s,i)}static AddElementEventListener(e,t){l.#e(l.#t.AddElementEventListener,e,t)}static RemoveElementEventListener(e,t){l.#e(l.#t.RemoveElementEventListener,e,t)}static SetElementText(e,t){l.#e(l.#t.SetElementText,e,t)}static SetElementAttribute(e,t,s){l.#e(l.#t.SetElementAttribute,e,t,s),l.#s.has(e)&&l.#i.add(e)}static GetElementBoundingClientStyles(e,t){return l.#r(l.#t.GetElementBoundingClientStyles,e,t)}static SetForgeViewInnerProps(e,t,s){let i=0;(t=t.substr(12)).startsWith("mask-")&&(i=1,t=t.substr(5)),l.#e(l.#t.SetForgeViewInnerProps,e,t,i,""+s)}static DeclareStyleSheets(e){l.#e(l.#t.DeclareStyleSheets,-1,e)}static SetStyleProperty(e,t,s){l.#e(l.#t.SetStyleProperty,e,t,s),l.#s.has(e)&&l.#i.add(e)}static GetStyleProperties(e,t){return l.#r(l.#t.GetStyleProperties,e,t)}static AppendLazyTaskSyncedListener(e,t){l.#s.set(e,t)}static RemoveLazyTaskSyncedListener(e){l.#s.delete(e)}static RequestSwapAllCachedTasks(){if(0==l.#o.length)return;const e=JSON.stringify(l.#o);l.#o=[];const t=window.JsvCode.Dom.PlatformBridge.JsViewId;window.JsvCode.Dom.PlatformBridge.RunLazyTaskList(t,e);for(const e of l.#i){l.#s.get(e)?.()}l.#i.clear()}static GetElementAttribute(e,t){return l.#r(l.#t.GetElementAttribute,e,t)}static InsertKeyFrame(e,t){l.#e(l.#t.InsertKeyFrameDefine,-1,e,t)}static RemoveKeyFrame(e){l.#e(l.#t.RemoveKeyFrameDefine,-1,e)}static GetRelativePosition(e,t){const s=l.#r(l.#t.GetRelativePosition,e,t);return JSON.parse(s)}static#r(e,t,...s){l.RequestSwapAllCachedTasks();const i=window.JsvCode.Dom.PlatformBridge.JsViewId;return window.JsvCode.Dom.PlatformBridge.RunSyncTask(i,e,t,...s)}static#e(e,t,...s){l.#o.push([e,t,...s]),r.sRenderBridge.RequestSwap()}static#o=[];static#i=new Set;static#s=new Map;static#t={CreateElement:10,BindElementToRootView:11,InsertElementChild:12,RemoveElementChild:13,AddElementEventListener:14,RemoveElementEventListener:15,SetElementText:16,SetElementAttribute:17,GetElementBoundingClientStyles:18,GetElementAttribute:19,MoveElementChild:20,GetRelativePosition:21,DeclareStyleSheets:30,SetStyleProperty:31,GetStyleProperties:32,SetForgeViewInnerProps:40,InsertKeyFrameDefine:41,RemoveKeyFrameDefine:42}}class c{static CreateAudioPlayer(){return window.JsvCode.Media.PlatformBridge.CreateAudioPlayer()}static CreateVideoPlayer(){return window.JsvCode.Media.PlatformBridge.CreateVideoPlayer()}}class d{static Dom=l;static Media=c}class h{constructor(e){this.ownerDocument=window.document,this.nodeType=e,this.parentNode=void 0,this.childNodes=[]}jsvFinalize(){}appendChild(e){this.childNodes.push(e),e.parentNode=this,this.#n?.()}removeChild(e){let t=this.childNodes.indexOf(e);if(t<0)throw new DOMError("Failed to remove node, child node is not found. node=",e);this.childNodes.splice(t,1),e.parentNode=void 0,this.#n?.()}insertBefore(e,t){this.#a(e,t)}get previousSibling(){const e=this.parentNode.childNodes;let t=e.indexOf(this);if(t<0)throw new DOMError("Failed to call Node.previousSibling(), this node not found. this=",this);return e[t-1]}get nextSibling(){const e=this.parentNode.childNodes;let t=e.indexOf(this);if(t<0)throw new DOMError("Failed to call Node.nextSibling(), this node not found. this=",this);return e[t+1]}addEventListener(e,t,s){this.#l||(this.#l={});let i=this.#l[e];i||(i=new Set,this.#l[e]=i),i.add(t)}removeEventListener(e,t,s){if(!this.#l)return;let i=this.#l[e];i&&(i.delete(t),i.size<=0&&this.#l.hasOwnProperty(e)&&delete this.#l[e],0===Object.values(this.#l).length&&(this.#l=void 0))}dispatchEvent(e){if(!this.#l)return void console.warn("Node.dispatchEvent() Ignore to dispatch event: "+e.type+". No event added.");let t=this.#l[e.type];if(t){e.target||(e.target=document.activeElement);for(let s of t)s(e)}else console.warn("Node.dispatchEvent() Ignore to dispatch event: "+e.type+". No listener added.")}jsvObserveChildChanged(e){this.#n=e}jsvMoveChildToNewParent(e,t,s){let i=this.childNodes.indexOf(e);i<0&&Log.Throw("Failed to call Node.removeChild(), node not found. node=",e),this.childNodes.splice(i,1),e.parentNode=void 0,this.jsvChildChangedCallback?.(),t.#a(e,s)}#a(e,t){let s=this.childNodes.length;if(void 0===t)throw new DOMError("TypeError: Failed to execute 'insertBefore' on 'Node': 2 arguments required, but only 1 present.");if(null!==t&&(s=this.childNodes.indexOf(t)),s<0)throw new DOMError("Failed to call insert node, before node not found. beforeNode=",t);this.childNodes.splice(s,0,e),e.parentNode=this,this.#n?.()}#l=void 0;#n=void 0;static ELEMENT_NODE=1;static TEXT_NODE=3;static COMMENT_NODE=8;static DOCUMENT_NODE=9;static NOLAYOUT_NODE=10}class u{static Layout=class{static Height="height";static Left="left";static Top="top";static Width="width";constructor(){throw new Error("new StyleName.Layout() is forbidden.")}};static Background=class{static BackgroundColor="backgroundColor";static BackgroundImage="backgroundImage";static BorderRadius="borderRadius";constructor(){throw new Error("new StyleName.Background() is forbidden.")}};static Effect=class{static BackfaceVisibility="backfaceVisibility";static BorderImage="borderImage";static BorderImageWidth="borderImageWidth";static BorderImageOutset="borderImageOutset";static Display="display";static ObjectFit="objectFit";static Opacity="opacity";static Overflow="overflow";static Perspective="perspective";static PerspectiveOrigin="perspectiveOrigin";static Transform="transform";static TransformOrigin="transformOrigin";static TransformStyle="transformStyle";static Visibility="visibility";static ZIndex="zIndex";constructor(){throw new Error("new StyleName.Effect() is forbidden.")}};static Text=class{static Color="color";static FontFamily="fontFamily";static FontSize="fontSize";static FontStyle="fontStyle";static FontWeight="fontWeight";static LineHeight="lineHeight";static TextAlign="textAlign";static TextOverflow="textOverflow";static TextShadow="textShadow";static WebkitTextStroke="WebkitTextStroke";static WhiteSpace="whiteSpace";static WordWrap="wordWrap";static Direction="direction";static JsvTextEmoji="JsvTextEmoji";static JsvTextLatex="JsvTextLatex";static JsvTextAlignMinWidth="JsvTextAlignMinWidth";static JsvTextVerticalAlign="JsvTextVerticalAlign";static JsvTextLineAlign="JsvTextLineAlign";static JsvTextInnerDirection="JsvTextInnerDirection";constructor(){throw new Error("new StyleName.Text() is forbidden.")}};static Motion=class{static Animation="animation";static Transition="transition";constructor(){throw new Error("new StyleName.Motion() is forbidden.")}};static HasGetterMethod(e){switch(e){case u.Layout.Height:case u.Layout.Left:case u.Layout.Top:case u.Layout.Width:case u.Effect.ObjectFit:return!0;default:return!1}}static ToConst(e){return e==u.Layout.Height?u.Layout.Height:e==u.Layout.Left?u.Layout.Left:e==u.Layout.Top?u.Layout.Top:e==u.Layout.Width?u.Layout.Width:e==u.Background.BackgroundColor?u.Background.BackgroundColor:e==u.Background.BackgroundImage?u.Background.BackgroundImage:e==u.Background.BorderRadius?u.Background.BorderRadius:e==u.Effect.BackfaceVisibility?u.Effect.BackfaceVisibility:e==u.Effect.BorderImage?u.Effect.BorderImage:e==u.Effect.BorderImageWidth?u.Effect.BorderImageWidth:e==u.Effect.BorderImageOutset?u.Effect.BorderImageOutset:e==u.Effect.Display?u.Effect.Display:e==u.Effect.ObjectFit?u.Effect.ObjectFit:e==u.Effect.Opacity?u.Effect.Opacity:e==u.Effect.Overflow?u.Effect.Overflow:e==u.Effect.Perspective?u.Effect.Perspective:e==u.Effect.PerspectiveOrigin?u.Effect.PerspectiveOrigin:e==u.Effect.Transform?u.Effect.Transform:e==u.Effect.TransformOrigin?u.Effect.TransformOrigin:e==u.Effect.TransformStyle?u.Effect.TransformStyle:e==u.Effect.Visibility?u.Effect.Visibility:e==u.Effect.ZIndex?u.Effect.ZIndex:e==u.Text.Color?u.Text.Color:e==u.Text.FontFamily?u.Text.FontFamily:e==u.Text.FontSize?u.Text.FontSize:e==u.Text.FontStyle?u.Text.FontStyle:e==u.Text.FontWeight?u.Text.FontWeight:e==u.Text.LineHeight?u.Text.LineHeight:e==u.Text.TextAlign?u.Text.TextAlign:e==u.Text.TextOverflow?u.Text.TextOverflow:e==u.Text.TextShadow?u.Text.TextShadow:e==u.Text.WebkitTextStroke?u.Text.WebkitTextStroke:e==u.Text.WhiteSpace?u.Text.WhiteSpace:e==u.Text.WordWrap?u.Text.WordWrap:e==u.Text.Direction?u.Text.Direction:e==u.Text.JsvTextEmoji?u.Text.JsvTextEmoji:e==u.Text.JsvTextLatex?u.Text.JsvTextLatex:e==u.Text.JsvTextAlignMinWidth?u.Text.JsvTextAlignMinWidth:e==u.Text.JsvTextVerticalAlign?u.Text.JsvTextVerticalAlign:e==u.Text.JsvTextLineAlign?u.Text.JsvTextLineAlign:e==u.Text.JsvTextInnerDirection?u.Text.JsvTextInnerDirection:e==u.Motion.Animation?u.Motion.Animation:e==u.Motion.Transition?u.Motion.Transition:null}constructor(){throw new Error("new StyleName() is forbidden.")}}class v{static Base=class{constructor(e){this.rawValue=e}rawValue};static AnimationImpl=class extends v.Base{constructor(e){super(e)}name="";duration=0;timingFunction=null;delay=0;iterationCount=0;direction=!1};static CornerImpl=class extends v.Base{constructor(e){super(e)}topLeft=0;topRight=0;bottomRight=0;bottomLeft=0};static RectImpl=class extends v.Base{constructor(e){super(e)}top=0;right=0;left=0;bottom=0};static TextShadowImpl=class extends v.Base{constructor(e){super(e)}hShadow=0;vShadow=0;blur=0;color=void 0};static WebkitTextStrokeImpl=class extends v.Base{constructor(e){super(e)}length=0;color=void 0};static TransitionImpl=class extends v.Base{constructor(e){super(e)}animationMap=new Map};static BorderImageImpl=class extends v.Base{constructor(e){super(e)}source="";slice=null};static DataType=class{static Null=0;static Int32=1;static Float=2;static String=3;static Animation=4;static Corner=5;static Rect=6;static TextShadow=7;static WebkitTextStroke=8;static Transition=9;static BorderImage=10};static InvalidInt32=Number.MIN_VALUE;static InvalidFloat=Number.NaN;static InvalidPointer=null;constructor(e){let t=-1,s=null;null==e?t=v.DataType.Null:Number(e)===e&&e%1==0?t=v.DataType.Int32:Number(e)===e&&e%1!=0?t=v.DataType.Float:"string"==typeof e||e instanceof String?t=v.DataType.String:e instanceof v.AnimationImpl?t=v.DataType.Animation:e instanceof v.CornerImpl?t=v.DataType.Corner:e instanceof v.RectImpl?t=v.DataType.Rect:e instanceof v.TextShadowImpl?t=v.DataType.TextShadow:e instanceof v.WebkitTextStrokeImpl?t=v.DataType.WebkitTextStroke:e instanceof v.TransitionImpl?t=v.DataType.Transition:e instanceof v.BorderImageImpl&&(t=v.DataType.BorderImage),e!=v.InvalidInt32&&e!=v.InvalidFloat&&e!=v.InvalidPointer?s=e:(t=v.DataType.Null,s=null),this.data=new v.DataInfo,this.data.index=t,this.data.value=s}is(e){return this.data.index==e}get(){return this.data.value}reset(e){this.data.value=e.data.value,this.data.index=e.data.index}equals(e){return this.data.value===e.data.value&&this.data.index===e.data.index}static DataInfo=class{value=null;index=-1};data}class m{static JsvDeclarePrototype(){for(let e in u){let t=u[e];for(let e in t){let s=t[e];if("string"!=typeof s)continue;const i={set:function(e){this.setProperty(s,e)},get:function(){return this.getPropertyValue(s)}};Object.defineProperty(m.prototype,s,i)}}}constructor(e){this.#c=e}setProperty(e,t){if(document.jsvCheckStyleFormat?.(e,t),e==u.Background.BackgroundImage&&t){t=new o(t).href}else e==u.Effect.Display&&(this.#d[e]=t);if(e==u.Effect.BorderImage&&t){const e=t.split(" ");e.length>0&&(e[0]=new o(e[0]).href),t=e.join(" ")}d.Dom.SetStyleProperty(this.#c,e,t)}getPropertyValue(e){if(e==u.Effect.Display)return this.#d[e];throw console.error("StyleDeclaration.getPropertyValue() propName="+e),new Error("Get style value is unimplemented because it's low performance.")}jsvGetProperties(...e){const t=JSON.stringify(e),s=d.Dom.GetStyleProperties(this.#c,t);return JSON.parse(s)}#c;#d={}}class p extends t{constructor(e){super(e)}}class f extends h{static JsvTagName={Anchor:"A",Audio:"AUDIO",Div:"DIV",Head:"HEAD",Img:"IMG",IFrame:"IFRAME",Link:"LINK",Script:"SCRIPT",Style:"STYLE",Svg:"SVG",Video:"VIDEO",JsvAudioTrack:"JSV-AUDIOTRACK",JsvFDiv:"FDIV"};static JsvEnableEventListener(){d.Dom.EnableEventListener((function(e,t,s){const i=f.#h[e]?.[t];i?.(t,s)}))}constructor(e){super(h.ELEMENT_NODE),this.tagName=e,this.tagName!=f.JsvTagName.Link&&this.tagName!=f.JsvTagName.Script&&this.tagName!=f.JsvTagName.Style&&(this.jsvNativeId=++f.#u,this.style=new m(this.jsvNativeId),d.Dom.CreateElement(this.jsvNativeId,e)),this.jsvAttrStore={}}appendChild(e){e.parentNode?this.#v(e,null):(super.appendChild(e),this.#m(e,null))}removeChild(e){super.removeChild(e),this.#p(e),e.jsvNativeId&&d.Dom.RemoveElementChild(this.jsvNativeId,e.jsvNativeId)}insertBefore(e,t){e.parentNode?this.#v(e,t):(super.insertBefore(e,t),this.#m(e,t))}addEventListener(e,t,s){super.addEventListener(e,t,s),this.jsvNativeId&&(this.#f(this.jsvNativeId,e),d.Dom.AddElementEventListener(this.jsvNativeId,e))}removeEventListener(e,t,s){this.jsvNativeId&&(this.#g(this.jsvNativeId,e),d.Dom.RemoveElementEventListener(this.jsvNativeId,e)),super.removeEventListener(e,t,s)}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)}get clientWidth(){return this.jsvAttrStore.clientWidth||(this.jsvAttrStore.clientWidth=d.Dom.GetElementAttribute(this.jsvNativeId,"clientWidth")),this.jsvAttrStore.clientWidth}get clientHeight(){return this.jsvAttrStore.clientHeight||(this.jsvAttrStore.clientHeight=d.Dom.GetElementAttribute(this.jsvNativeId,"clientHeight")),this.jsvAttrStore.clientHeight}setAttribute(e,t){e&&(this.jsvAttrStore[e]=t,this.jsvNativeId&&(e.startsWith("data-jsv-vw-")?d.Dom.SetForgeViewInnerProps(this.jsvNativeId,e,t):("class"===e||e.startsWith("data-v-")||e.startsWith("data-jsv")||e.startsWith("dataJsv"))&&d.Dom.SetElementAttribute(this.jsvNativeId,e,t)))}removeAttribute(e){delete this.jsvAttrStore[e],("class"==e||e.startsWith("data-v-")||"src"==e)&&this.jsvNativeId&&d.Dom.SetElementAttribute(this.jsvNativeId,e,null)}getAttribute(e){return this.jsvAttrStore[e]}hasAttribute(e){return!!this.jsvAttrStore[e]}focus(){document.activeElement&&document.activeElement.onfocus();let e=document.activeElement;if(document.activeElement=this,e){let t=new i(i.JsvType.Blur);t.target=e,document.dispatchEvent(t)}let t=new i(i.JsvType.Focus);document.dispatchEvent(t)}getBoundingClientRect(){return new Promise(((e,t)=>{const s=this.jsvGetProxyView();s.RegisterOnProxyReady((()=>{s.GetBoundingClientRect().then((t=>{e(t)}),(e=>{t(e)}))}))}))}jsvSetOnLazyTaskSyncedListener(e){d.Dom.AppendLazyTaskSyncedListener(this.jsvNativeId,e)}jsvOnEvent(e,...t){let i;e.startsWith("animation")?(i=new s(e),i.target=this,i.animationName=t[0]):e.startsWith("transition")&&(i=new p(e),i.target=this,i.propertyName=t[0]),i&&this.dispatchEvent(i)}jsvGetProxyView(e){return e?(this._MaskViewProxy||(this._MaskViewProxy=r.NewDomProxyView(this.jsvNativeId,!0)),this._MaskViewProxy):(this._MainViewProxy||(this._MainViewProxy=r.NewDomProxyView(this.jsvNativeId,!1)),this._MainViewProxy)}jsvGetProxyTexture(e){return this._MainViewTextureProxy||(this._MainViewTextureProxy=e.GetDomProxyTexture(this.jsvNativeId)),this._MainViewTextureProxy}jsvGetRelativePosition(e){return d.Dom.GetRelativePosition(this.jsvNativeId,e.jsvNativeId)}#f(e,t){let s=f.#h[e];s||(s=new Set,f.#h[e]=s),s[t]=this.jsvOnEvent.bind(this)}#g(e,t){let s=f.#h[e];s&&delete s[t]}#v(e,t){let s=e.parentNode;s.jsvMoveChildToNewParent(e,this,t),this.#y(s,e,t)}#y(e,t,s){t.jsvNativeId&&(s=f.#w(s),d.Dom.MoveElementChild(this.jsvNativeId,e.jsvNativeId,t.jsvNativeId,s?.jsvNativeId))}#m(e,t){e.parentNode=this,e.nodeType===h.TEXT_NODE?this.textContent=e.nodeValue:e.jsvNativeId&&(t=f.#w(t),d.Dom.InsertElementChild(this.jsvNativeId,e.jsvNativeId,t?.jsvNativeId))}#p(e){for(const t of e.childNodes)e.#p(t);e.jsvFinalize(),d.Dom.RemoveLazyTaskSyncedListener(e.jsvNativeId),delete f.#h[e.jsvNativeId]}static#w(e){let t=e;for(;t&&!(t instanceof f);)t=t.nextSibling;return t}parentNode;tagName;style;jsvNativeId;jsvAttrStore;static#h={};static#u=0}class g extends f{static JsvDeclareProperties(){for(const[e,t]of Object.entries(g.#T)){let s={};t.set&&(s.set=function(t){if("src"===e){t=new o(t).href}this.jsvOnSetter(e,t)}),t.get&&(s.get=function(){return this.jsvOnGetter(e)}),Object.defineProperty(g.prototype,e,s)}for(const e of g.#C){let t={set:function(t){t?this.addEventListener(e,t):this.removeEventListener(e,this.jsvEventMap[e]),this.jsvEventMap[e]=t},get:function(){this.jsvEventMap[e]}};Object.defineProperty(g.prototype,"on"+e,t)}for(const e of g.#k){const t=function(...t){this.jsvMediaPlayer[e](t)};g.prototype[e]=t}}constructor(e){super(e),Promise.resolve().then((()=>{this.jsvMediaPlayer&&this.jsvMediaPlayer.confirmInitSetup?.()}))}jsvFinalize(){this.jsvMediaPlayer.pause(),this.jsvMediaPlayer.unload(),this.jsvMediaPlayer.releaseResource?.(),this.jsvMediaPlayer.onPlatformDestroy?.(),this.jsvMediaPlayer=null}addEventListener(e,t,s){super.addEventListener(e,t,s),this.jsvNativeId&&g.#C.includes(e)&&this.jsvMediaPlayer.addEventListener(e,(()=>{this.onMediaPlayerEvent(e)}))}removeEventListener(e,t,s){this.jsvNativeId&&g.#C.includes(e)&&this.jsvMediaPlayer.removeEventListener(e,t),super.removeEventListener(e,t,s)}jsvOnSetter(e,t){if(e in g.#T==0)throw new DomError("Failed to set "+e);this.jsvMediaPlayer[e]=t}jsvOnGetter(e){if(e in g.#T==0)throw new DomError("Failed to get "+e);return this.jsvMediaPlayer[e]}onMediaPlayerEvent(e){let s=new t(e);s.target=this,s&&this.dispatchEvent(s)}static#T={autoplay:{set:!0,get:!0},currentTime:{set:!0,get:!0},muted:{set:!0,get:!0},playbackRate:{set:!0,get:!0},volume:{set:!0,get:!0},timeupdateless:{set:!0,get:!0},predownload:{set:!0,get:!0},preload:{set:!0,get:!0},duration:{set:!1,get:!0},error:{set:!1,get:!0},paused:{set:!1,get:!0},loop:{set:!0,get:!1},src:{set:!0,get:!1}};static#C=["abort","canplay","canplaythrough","durationchange","ended","error","load","loadedmetadata","loadstart","pause","play","playing","seeking","seeked","stalled","timeupdate"];static#k=["load","pause","play","unload","confirmInitSetup"];jsvMediaPlayer=null;jsvEventMap={}}class y extends g{constructor(){super(Element.JsvTagName.Audio),this.jsvMediaPlayer=d.Media.CreateAudioPlayer()}}class w extends h{constructor(e){super(h.COMMENT_NODE),this.textContent=e}}class T extends f{constructor(){super(f.JsvTagName.Div)}get textContent(){return this.#b}set textContent(e){this.#b=e,d.Dom.SetElementText(this.jsvNativeId,e)}#b}class C{constructor(e,t){this.RouterDelegate={ref:null},e||(this.RouterDelegate.ref=new k(!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(b.sLastFocus)}getCurrentFocusStack(){const e=[];if(this.RouterDelegate.ref){let t=this.RouterDelegate.ref.getCurrentFocusNode();for(;t&&t instanceof b&&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 k{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 r=!1;for(let t in i._ChildMap){let o=i._ChildMap[t].RouterDelegate.ref;if(o!=i&&o.NameSpace==e[s]){i=o,s++,r=!0;break}}if(!r)return void console.error(`Error: no found subpath fname=${t}`)}let r=e[s];return i._ChildMap.hasOwnProperty(r)?i._ChildMap[r]: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 b extends r.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 C(!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 k(!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 b.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 b)){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 b.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()}}b.sFocusMemos=[],b.sLastFocus=null,b.sRootPageNode=null;let x=()=>{let e=b.sFocusMemos.length;if(e>0){let t=b.sFocusMemos;b.sFocusMemos=[];for(let s=0;s<e;s++)t[s].obj.Focus(t[s].bcf)}},E={};class N{constructor(e,t,s){this._Element=s,E.hasOwnProperty(e)&&console.error(`Warn: FDivRoot duplicate name=${e}`),E[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(a.RootActivity,a.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 D extends f{constructor(){super(f.JsvTagName.Img)}setAttribute(e,t){if("src"===e){t=new o(t).href}super.setAttribute(e,t),this.jsvNativeId&&"src"===e&&d.Dom.SetElementAttribute(this.jsvNativeId,e,t)}jsvOnEvent(e,...s){let i;super.jsvOnEvent(e,...s),"load"==e&&(i=new t(e),i.target=this),i&&this.dispatchEvent(i)}}class S extends f{constructor(){super(f.JsvTagName.Link),this.src=null,this.onerror=null,this.onload=null}setAttribute(e,t){this[e]=t}jsvLoadResource(){let e=!1,t=null;if(null!=this.href){var s=new o(this.href);console.log("Ignore to load link from url="+s.href),e=!0}else console.warn("Failed to load link, href is not exists."),t="NoSrc";this.jsvOnLoadResult(e,t)}jsvOnLoadResult(e,s){if(console.log("Load link result: isSuccess:"+e+", errCode:"+s),e){if(this.onload){let e=new t("load");this.onload(e)}}else this.onerror&&this.onerror({type:"jsvErr_"+s,target:this})}}class I extends f{constructor(){super(f.JsvTagName.Script)}setAttribute(e,t){this[e]=t}jsvLoadResource(){if(null!=this.src){var e=new o(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,s){if(console.log("Load script result: isSuccess:"+e+", errCode:"+s),e){if(this.onload){let e=new t("load");this.onload(e)}}else this.onerror&&this.onerror({type:"jsvErr_"+s,target:this})}src=null;onerror=null;onload=null;charset=null;timeout=120}class L extends f{constructor(){super(f.JsvTagName.Style),this.jsvAttrStore={left:0,top:0,width:0,height:0}}}class O extends f{constructor(){super(f.JsvTagName.Svg)}}class j extends h{constructor(e){super(h.TEXT_NODE),this.textContent=e}get nodeValue(){return this.textContent}set nodeValue(e){this.textContent=e,this.parentNode&&(this.parentNode.textContent=this.textContent)}}class P extends g{constructor(){super(Element.JsvTagName.Video),super.jsvMediaPlayer=d.Media.CreateVideoPlayer(),this.#x={left:0,top:0,width:0,height:0,objectFit:null},this.jsvSetOnLazyTaskSyncedListener(this.jsvOnLazyTaskSynced.bind(this))}jsvFinalize(){this.jsvMediaPlayer.jsvFinalize()}jsvGetBoundingClientStyles(...e){const t=JSON.stringify(e),s=d.Dom.GetElementBoundingClientStyles(this.jsvNativeId,t);return JSON.parse(s)}jsvOnLazyTaskSynced(){const e=this.jsvGetBoundingClientStyles(u.Layout.Left,u.Layout.Top,u.Layout.Width,u.Layout.Height,u.Effect.ObjectFit,u.Effect.Visibility);let t=!1;this.#x.left!=e.left&&(this.#x.left=e.left,t=!0),this.#x.top!=e.top&&(this.#x.top=e.top,t=!0),this.#x.width!=e.width&&(this.#x.width=e.width,t=!0),this.#x.height!=e.height&&(this.#x.height=e.height,t=!0),this.#x.objectFit!=e.objectFit&&(this.#x.objectFit=e.objectFit,t=!0),this.#x.visibility!=e.visibility&&(this.#x.visibility=e.visibility,t=!0),t?this.jsvMediaPlayer.jsvOnCssStyleChanged(this.jsvNativeId,this.#x):console.log("VideoElement.jsvOnLazyTaskSynced() style is not changed.")}#x}class J extends g{constructor(){super(Element.JsvTagName.JsvAudioTrack),this.jsvMediaPlayer=d.Media.CreateAudioPlayer("AudioTrack")}}let M=1;class B extends f{constructor(){super(f.JsvTagName.JsvFDiv),this.FocusNodeRef=new b(""+M++),this.HubRef=void 0}setAttribute(e,t){if(e)if("fname"===e)t&&this.FocusNodeRef.setBranchName(t);else if("new-namespace"===e&&""!==t&&!this.HubRef){let e=new C(!1,t);this.HubRef=e,this.FocusNodeRef.setHub(e),this.FocusNodeRef.setBranchName(t)}}removeAttribute(e){}jsvGetHub(){return this.HubRef}}class R extends h{constructor(){super(h.DOCUMENT_NODE),this.location=window.location,this.rootElement=new T,this.rootElement.ownerDocument=this,this.rootElement.id="root",d.Dom.BindElementToRootView(this.rootElement.jsvNativeId),this.activeElement=this.rootElement,this.head=null}createComment(e){return new w(e)}createElement(e){switch(e=e.toUpperCase()){case f.JsvTagName.Audio:return new y;case f.JsvTagName.AudioTrack:return new AudioTrackElement;case f.JsvTagName.Div:return new T;case f.JsvTagName.Img:return new D;case f.JsvTagName.Link:return new S;case f.JsvTagName.Script:return new I;case f.JsvTagName.Style:return new L;case f.JsvTagName.Svg:return new O;case f.JsvTagName.Video:return new P;case f.JsvTagName.JsvAudioTrack:return new J;case f.JsvTagName.JsvFDiv:return new B;case f.JsvTagName.IFrame:console.error("Unsupported element: "+e+". Your vue compilation may may have failed, please check it first.")}if("TEMPLATE"==e)return{};throw new TypeError("Unimplemented element: "+e)}createEvent(e){return new t(e)}createTextNode(e){return new j(e)}getElementById(e){if("root"===e||"app"===e)return this.rootElement;throw new DOMError("Failed to get element by id, id="+e+" is UNIMPLEMENTED.")}getElementsByTagName(e){if((e=e.toUpperCase())===f.JsvTagName.Head)return[this.head];if(e===f.JsvTagName.Link||e===f.JsvTagName.Script||e===f.JsvTagName.Style)return[];throw new DOMError("Failed to get element by name, 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;throw new DOMError("Failed to query selector, selectors="+e+" is UNIMPLEMENTED.")}querySelectorAll(e){return[]}jsvInitFDivRoot(e,t,s){if(!s){let e=document.createElement("fdiv");this.rootElement.appendChild(e),this.rootElement=e,s=this.rootElement}return new N(e,t,s)}}class F extends f{constructor(){super(f.JsvTagName.Head)}appendChild(e){super.appendChild(e),(e instanceof S||e instanceof I)&&e.jsvLoadResource()}removeChild(e){super.removeChild(e)}}let _="@keyframes",A=_.length;class V{constructor(e){this._AnchorTag=e,this._NamesCache=new Set}insertRule(e){let t=this.#E(e);this._NamesCache.has(t)&&console.warn(`Warn: keyframe replace of name ${t}`),this._NamesCache.add(t),d.Dom.InsertKeyFrame(t,e)}hasRule(e){return this._NamesCache.has(e)}removeRule(e){this._NamesCache.has(e)?(this._NamesCache.delete(e),d.Dom.RemoveKeyFrame(e)):console.error(`Error: keyFrame(${e}) is not exist.`)}removeMultiRules(e){for(let t of e)this.removeRule(t)}#E(e){let t=e.indexOf(_)+A,s=e.indexOf("{");return e.substring(t,s).trim()}}let U=null;function W(e){return U||(U={global:new V("global")}),U.global}class z{static EnsureGlobalEnv(e,t){const s=window.navigator?.userAgent?.toLowerCase();window.jsvInAndroidWebView=s?.indexOf("android")>=0,z.#N(e,t),f.JsvEnableEventListener(),g.JsvDeclareProperties(),m.JsvDeclarePrototype()}static#N(e,t){window.JsvCode||(window.JsvCode={}),window.JsvCode.Dom||(window.JsvCode.Dom={}),window.JsvCode.Media||(window.JsvCode.Media={}),window.JsvCode.Dom.PlatformBridge||(window.JsvCode.Dom.PlatformBridge=e),window.JsvCode.Media.PlatformBridge||(window.JsvCode.Media.PlatformBridge=t),window.JsvCode.Dom.DeclareStyleSheets||(window.JsvCode.Dom.DeclareStyleSheets=d.Dom.DeclareStyleSheets),window.JsvCode.Dom.getKeyFrameGroup||(window.JsvCode.Dom.getKeyFrameGroup=W)}}class G{static SetLevel(e){switch(G.E=G.W=G.I=G.D=function(){},e){case G.Level.Verbose:G.V=console.debug.bind(console);case G.Level.Debug:G.D=console.debug.bind(console);case G.Level.Info:G.I=console.info.bind(console)}}static E=console.error.bind(console);static W=console.warn.bind(console);static I=console.info.bind(console);static D=function(){};static V=function(){};static Level={Error:0,Warning:1,Info:2,Debug:3,Verbose:4}}class K{constructor(e){this.callback=e}observe(e,t){if(!(e instanceof h))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}}class H{constructor(){this.#D(),H.#S()}#D(){r.sRenderBridge.AddWillSwapListener("forgeSwap",(()=>{d.Dom.RequestSwapAllCachedTasks()})),a.TextureManager=new r.TextureManager,r.DomElementGetter=e=>{let t=window.JsvCode.Dom.PlatformBridge.JsViewId;return window.JsvCode.Dom.PlatformBridge.GetInstance(t).getElementById(e)}}static SetRender(e){H.#S=e,window.Forge.RunApp(this)}static#S=null}class q extends L{constructor(){super(),this.jsvBrowserElement=window.JsvCode.Dom.BrowserDocument.createElement(Element.JsvTagName.Style)}jsvBrowserElement}class $ extends F{constructor(){super()}appendChild(e){"HTMLLinkElement"==e.constructor.name||"HTMLScriptElement"==e.constructor.name?window.JsvCode.Dom.BrowserDocument.head.appendChild(e):e instanceof q?window.JsvCode.Dom.BrowserDocument.head.appendChild(e.jsvBrowserElement):super.appendChild(e)}removeChild(e){"HTMLLinkElement"==e.constructor.name||"HTMLScriptElement"==e.constructor.name?window.JsvCode.Dom.BrowserDocument.head.removeChild(e):e instanceof q?window.JsvCode.Dom.BrowserDocument.head.removeChild(e.jsvBrowserElement):super.removeChild(e)}}class X extends R{constructor(){super(),this.head=new $}createElement(e){switch(e=e.toUpperCase()){case f.JsvTagName.IFrame:case f.JsvTagName.Link:case f.JsvTagName.Script:return window.JsvCode.Dom.BrowserDocument.createElement(e);case f.JsvTagName.Style:return new q;default:return super.createElement(e)}}getElementsByTagName(e){return e.toUpperCase()===f.JsvTagName.Head?window.JsvCode.Dom.BrowserDocument.getElementsByTagName(e):super.getElementsByTagName(e)}}class Z{static Get(e){return Z.#I[e]}static#L(e,t){let s=void 0===t;return s&&console.error(e+" property is undefined!"),s}static#O(e,t){return!!Z.#L(e,t)||(""===t||"number"==typeof t)}static#j(e,t){Z.#L(e,t)||t.indexOf("transform")<0&&t.indexOf("opacity")<0&&console.error("keyframes property is only support transform and opacity, value:",t)}static#P(e,t){if(Z.#L(e,t))return;const s="fill contain cover none scale-down";s.indexOf(t)<0&&console.error(" objectFit is only support one of string["+s+"]")}static#J(e,t){Z.#L(e,t)||console.error(e+" property is not support, you can use transition property, e.g. transition='width 2s'")}static#M(e,t){Z.#L(e,t)}static#B(e,t){Z.#L(e,t)||t.length>0&&t.indexOf("translate3d")<0&&t.indexOf("scale3d")<0&&t.indexOf("rotate3d")<0&&t.indexOf("skew")<0&&console.error("transform property's value only support translate3d、scale3d、rotate3d、skew, value:",t)}static#R(e,t){Z.#L(e,t)||t.length>0&&t.indexOf("%")<0&&t.indexOf("left")<0&&t.indexOf("center")<0&&t.indexOf("top")<0&&t.indexOf("right")<0&&t.indexOf("bottom")<0&&console.error("transformOrigin property's value only support XX%、left、top、right, bottom:",t)}static#F(e,t){if(!Z.#L(e,t))switch(t){case"clip":case"ellipsis":break;default:console.error("textOverflow property's value is not support, value:",t)}}static#_(e,t){if(!Z.#L(e,t))switch(t){case"normal":case"nowrap":case"pre-wrap":break;default:console.error("whiteSpace property's value is not support, value:",t)}}static#A(e,t){if(!Z.#L(e,t))switch(t){case"left":case"right":case"center":case"start":case"end":break;default:console.error("textAlign property's value is not support, value:",t)}}static#V(e,t){if(!Z.#O(e,t))switch(t){case"normal":case"inherit":console.error("lineHeight property's value is support number only, value:",t);break;default:t.indexOf("%")>=0&&console.error("lineHeight property's value is support number only, value:",t)}}static#U(e,t){Z.#L(e,t)||Z.#W("Color()",t)}static#z(e,t){Z.#L(e,t)||"visible"!==t&&"hidden"!==t&&"inherit"!==t&&console.error("visibility property's value is not support, value:",t)}static#G(e,t){Z.#L(e,t)||"block"!==t&&"inline"!==t&&"none"!==t&&"inline-block"!==t&&"inherit"!==t&&""!==t&&console.error("display property's value is not support, value:",t)}static#K(e,t){Z.#L(e,t)||"visible"!==t&&"hidden"!==t&&console.error("overflow property's value is support visible or hidden only, value:",t)}static#H(e,t){if(!Z.#O(e,t))switch(t){case"auto":case"inherit":console.error("top property's value is support number only, value:",t);break;default:t.indexOf("%")>=0&&console.error("top property's value is support number only, value:",t)}}static#q(e,t){if(!Z.#O(e,t))switch(t){case"auto":case"inherit":console.error("left property's value is support number only, value:",t);break;default:t.indexOf("%")>=0&&console.error("left property's value is support number only, value:",t)}}static#$(e,t){if(!Z.#O(e,t))switch(t){case"auto":case"inherit":console.error("height property's value is support number only, value:",t);break;default:t.indexOf("%")>=0&&console.error("height property's value is support number only, value:",t)}}static#X(e,t){if(!Z.#O(e,t))switch(t){case"auto":case"inherit":console.error("width property's value is support number only, value:",t);break;default:t.indexOf("%")>=0&&console.error("width property's value is support number only, value:",t)}}static#Z(e,t){if(!Z.#L(e,t))switch(t){case"visible":case"hidden":break;default:console.error("backfaceVisibility property's value is support visible/hidden only, value: ",t)}}static#Y(e,t){Z.#L(e,t)}static#Q(e,t){if(Z.#L(e,t))return;t.split(" ").length<2&&console.error("Error: WebkitTextStroke should format of(width color) such as: '1px rgba(255,255,255,1.0)'")}static#ee(e,t){Z.#L(e,t)||isNaN(t)&&console.error("zIndex property's value is support number only, value: ",t)}static#te(e,t){if(!Z.#O(e,t))switch(t){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:",t);break;default:t.indexOf("%")>=0&&console.error("fontSize property's value is support number only, value:",t)}}static#se(e,t){Z.#L(e,t)||"bold"!==t&&console.error("fontWeight property's value is support bold only, value:",t)}static#ie(e,t){Z.#L(e,t)||"italic"!==t&&console.error("fontWeight property's value is support italic only, value:",t)}static#re(e,t){if(Z.#L(e,t))return;let s=[t];"string"==typeof t&&(s=t.split(" ")),s.length>4&&console.error("borderRadius property's value is not support, value:",t)}static#oe(e,t){Z.#O(e,t)}static#ne(e,t){if(Z.#L(e,t))return;t.split(" ").length>4&&console.error("borderImageOutsetCheck property's value is not support, value:",t)}static#ae(e,t){Z.#L(e,t)||t.indexOf("fill")<0&&console.error("borderImage property's value is not contain fill, e.g. source slice, but value:",t)}static#le(e,t){console.error(e+" property not support, you can use backgroundImage property, e.g. backgroundImage=`url(${iconImgPath})`")}static#ce(e,t){Z.#L(e,t)||"inherit"==t&&console.error("backgroundImage property's value is not support, value:",t)}static#de(e,t){if(!Z.#L(e,t))return Z.#W("backgroundColor",t)}static#he(e,t){}static#ue(e,t){console.error(e+" property is not support, you can use animation property, e.g. animation='mymove 5s infinite'")}static#ve(e,t){if(!Z.#L(e,t))switch(t){case"flat":case"preserve-3d":break;default:console.error("transformStyle property value is not valid",t)}}static#me(e,t){Z.#L(e,t)||t.length>0&&t.indexOf("%")<0&&t.indexOf("left")<0&&t.indexOf("center")<0&&t.indexOf("top")<0&&t.indexOf("right")<0&&t.indexOf("bottom")<0&&console.error("perspectiveOrigin property's value only support XX%、left、top、right, bottom:",t)}static#pe(e,t){if(!Z.#L(e,t)&&t.length>0){if(t.replace(/\(.*\)/g,"").split(",").length>1)return void console.error("textShadow: NOT support more than one part settings");const e=t.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=${t})`);if(!Z.#W("textShadow",e[3]))return}}}static#W(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#fe(e,t){Z.#L(e,t)||"number"!=typeof t&&console.error("JsvTextLatex property's value is support number only, value: ",t)}static#ge(e,t){Z.#L(e,t)||"number"!=typeof t&&console.error("JsvTextEmoji property's value is support number only, value: ",t)}static#ye(e,t){if(!Z.#L(e,t))switch(t){case"ltr":case"rtl":break;default:console.error("direction property's value is not support, value:",t)}}static#we(e,t){Z.#L(e,t)||"number"!=typeof t&&console.error("JsvTextAlignMinWidth property's value is support number only, value: ",t)}static#Te(e,t){if(!Z.#L(e,t))switch(t){case"top":case"middle":case"bottom":break;default:console.error("JsvTextVerticalAlign property's value is not support, value: ",t)}}static#Ce(e,t){if(!Z.#L(e,t))switch(t){case"top":case"middle":case"bottom":break;default:console.error("JsvTextLineAlign property's value is not support, value: ",t)}}static#ke(e,t){if(!Z.#L(e,t))switch(t){case"unset":case"ltr":case"rtl":break;default:console.error("JsvTextInnerDirection property's value is not support, value: ",t)}}static#I={animation:{check:Z.#he},animationName:{check:Z.#ue},animationDuration:{check:Z.#ue},animationTimingFunction:{check:Z.#ue},animationDelay:{check:Z.#ue},animationIterationCount:{check:Z.#ue},animationDirection:{check:Z.#ue},animationPlayState:{check:Z.#ue},animationFillMode:{check:Z.#ue},background:{check:Z.#le},backgroundColor:{check:Z.#de},backgroundImage:{check:Z.#ce},borderImage:{check:Z.#ae},borderImageOutset:{check:Z.#ne},borderImageWidth:{check:Z.#oe},borderRadius:{check:Z.#re},height:{check:Z.#$},width:{check:Z.#X},zIndex:{check:Z.#ee},fontFamily:{check:null},fontSize:{check:Z.#te},fontStyle:{check:Z.#ie},fontWeight:{check:Z.#se},left:{check:Z.#q},overflow:{check:Z.#K},top:{check:Z.#H},visibility:{check:Z.#z},display:{check:Z.#G},color:{check:Z.#U},lineHeight:{check:Z.#V},textAlign:{check:Z.#A},direction:{check:Z.#ye},whiteSpace:{check:Z.#_},textOverflow:{check:Z.#F},transform:{check:Z.#B},transformOrigin:{check:Z.#R},transition:{check:Z.#M},transitionProperty:{check:Z.#J},transitionDuration:{check:Z.#J},transitionTimingFunction:{check:Z.#J},transitionDelay:{check:Z.#J},keyframes:{check:Z.#j},objectFit:{check:Z.#P},perspective:{check:Z.#Y},backfaceVisibility:{check:Z.#Z},transformStyle:{check:Z.#ve},perspectiveOrigin:{check:Z.#Y},WebkitTextStroke:{check:Z.#Q},textShadow:{check:Z.#pe},JsvTextLatex:{check:Z.#fe},JsvTextEmoji:{check:Z.#ge},JsvTextAlignMinWidth:{check:Z.#we},JsvTextVerticalAlign:{check:Z.#Te},JsvTextLineAlign:{check:Z.#Ce},JsvTextInnerDirection:{check:Z.#ke}}}class Y{static BackupBrowser(){return{createComment:window.document.createComment.bind(window.document),createElement:window.document.createElement.bind(window.document),createElementNS:window.document.createElementNS.bind(window.document),createTextNode:window.document.createTextNode.bind(window.document),dispatchEvent:window.document.dispatchEvent.bind(window.document),getElementById:window.document.getElementById.bind(window.document),getElementsByTagName:window.document.getElementsByTagName.bind(window.document),querySelector:window.document.querySelector.bind(window.document),head:{appendChild:window.document.head.appendChild.bind(window.document.head),removeChild:window.document.head.removeChild.bind(window.document.head)}}}static HookBrowser(e){Y.#be(e),Y.#xe(),Y.#Ee()}static#be(e){window.JsvCode.Dom.BrowserDocument=e;const t=new X;window.document.createComment=t.createComment.bind(t),window.document.createElement=t.createElement.bind(t),window.document.createTextNode=t.createTextNode.bind(t),window.document.dispatchEvent=t.dispatchEvent.bind(t),window.document.getElementById=t.getElementById.bind(t),window.document.getElementsByTagName=t.getElementsByTagName.bind(t),window.document.querySelector=t.querySelector.bind(t),window.document.head.appendChild=t.head.appendChild.bind(t.head),window.document.head.removeChild=t.head.removeChild.bind(t.head),window.JsvCode.Dom.JsViewDocument=t}static#xe(){window.MutationObserver=K,window.Element=f,window.SVGElement=O}static#Ee(){const e=window.JsvCode.Dom.JsViewDocument;window.document.jsvInitFDivRoot=e.jsvInitFDivRoot.bind(e),window.document.jsvCheckStyleFormat=window.jsvInAndroidWebView?null:Y.#Ne}static#Ne(e,t){if(e.startsWith("--"))return;let s=Z.Get(e);s?s.check&&t&&s.check(e,t):console.error(e+" property is not support.")}}window.jsvIsBrowserDebug=!0;const Q=window.JsvCode.BrowserPlatformDomBridge,ee=window.JsvCode.BrowserPlatformMediaBridge;function te(){const e=Y.BackupBrowser();Q.RegisterOriginDocument(e),z.EnsureGlobalEnv(Q,ee),Y.HookBrowser(e),G.I("Using JsView HTML Environment.")}export{H as BrowserForgeApp,te as InitEnv};
|
|
1
|
+
/* eslint-disable */ class e{static CreateAudioPlayer(){return new window.Audio}static CreateVideoPlayer(){const t=window.originDocument.createElement("video");return t.jsvOnCssStyleChanged=e.OnCssStyleChanged.bind(t),t.jsvFinalize=e.JsvFinalize.bind(t),t}static OnCssStyleChanged(e,t){const s=this;s.parentNode,s.style.position="fixed",s.style.left=(t.left?t.left:0)+"px",s.style.top=(t.top?t.top:0)+"px",s.style.width=(t.width?t.width:0)+"px",s.style.height=(t.height?t.height:0)+"px",s.style.objectFit=t.objectFit,s.style.visibility=t.visibility}static JsvFinalize(){console.log("BrowserPlatformMediaBridge.JsvFinalize()");this.pause()}}window.JsvCode.BrowserPlatformMediaBridge||(window.JsvCode.BrowserPlatformMediaBridge=e);class t{constructor(e,t){this.target=t,this.timeStamp=Date.now(),this.type=e}}class s extends t{constructor(e){super(e)}}class i extends t{constructor(e){super(e)}}void 0===window.Forge?(window.Forge={},console.log("Define forge browser")):console.log("Define using JsView forge engine-js");var r=window.Forge;class o{constructor(e,t){if(!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("./")&&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)}e=window.JsView.Dom.MainPath+e.substring(1)}if(this.href=e,!t)return;let i=this.href,r=i.indexOf("#");r>0&&(this.hash=i.substring(r),i=i.substring(0,r));let o=i.indexOf("?");o>1&&(this.search=i.substring(o),i=i.substring(0,o));let n=i,a=n.indexOf("://");this.protocol=a>0?n.substring(0,a+1):"";let l=a>1?n.substring(a+3):"";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:"",a=this.host.indexOf(":"),this.hostname=a>0?this.host.substring(0,a):this.host,this.port=a>1?this.host.substring(a+1):""}replace(e){this.href=e}href="";origin="";protocol="";host="";hostname="";port="";pathname="";search="";hash=""}class n{static SetBackgroundColor(e,t,s){const i=n.TextureManager.GetColorTextureCached(t);let o;s&&(o=new r.ViewRoundCornerMask(s.topLeft,s.topRight,s.bottomLeft,s.bottomRight));const a=new r.ExternalTextureSetting(i,o);e.ResetTexture(a)}static SetBackgroundImage(e,t,s,i,a,l,c){let d,h={};if("string"==typeof t){const e=new o(t);if(e instanceof o==!1)throw Error("Bad Argument.",e);h.url=e.href}else"linear-gradient"==t?.type&&(h.gradient=t);if(h.gradient)if(h.gradient.colors?.length>2){const e=h.gradient.colors,t=[e[0],e[e.length-1]],s=e.slice(1,e.length-1);d=n.TextureManager.CreateLinearGradientTexture(t,s)}else 2==h.gradient.colors?.length?d=n.TextureManager.CreateMiniGradientTexture(!0,h.gradient.colors[0],h.gradient.colors[1],h.gradient.rawValue):console.warn("Failed to create backgroundImage gradient, bad colors.",h.gradient.colors);else h.url&&(d=h.url.includes(".gif")||h.url.includes(".webp")?n.TextureManager.GetGifImage(h.url,!1,null,c):n.TextureManager.GetImage2(h.url,!1,a,l||r.ColorSpace.RGBA_8888));if(d){let t;s&&(t=new r.ViewRoundCornerMask(s.topLeft,s.topRight,s.bottomLeft,s.bottomRight));const o=new r.ExternalTextureSetting(d,t);if(e.ResetTexture(o),i){let t=d.RegisterLoadImageCallback(null,(function(){i({width:d.Width,height:d.Height})}));e.RegisterDetachCallback((()=>{d.UnregisterLoadImageCallback(t)}))}}}static SetMaskedBackgroundImage(e,t,s,i){if("string"==typeof t&&(t=new o(t)),t instanceof o==!1)throw Error("Bad Argument.",t);if("string"==typeof s&&(s=new o(s)),s instanceof o==!1)throw Error("Bad Argument(MaskURL).",s);const a=n.TextureManager.GetImage2(t.href,!1,null,i||r.ColorSpace.RGBA_8888);if(a){const t=n.TextureManager.GetImage2(s.href,!1,null,r.ColorSpace.RGBA_8888),i=new r.ExternalTextureSetting(a,new r.ViewTextureMask(t));e.ResetTexture(i)}}static SetVideoTexture(e,t,s){const i=n.TextureManager.GetColorTexture(t);let o;s&&(o=new r.ViewRoundCornerMask(s.topLeft,s.topRight,s.bottomLeft,s.bottomRight));const a=new r.TextureSetting(i,o);e.ResetTexture(a)}static GetTextWidth(e){return e.str||(e.str=""),e.font||(e.font=r.TextUtils._sDefaultFont),e.size||(e.size=r.TextUtils._sDefaultFontSize),"italic"!==e.italic&&(e.italic=""),"bold"!==e.bold&&(e.bold=""),window.PlatformUtils.GetTextWidth(e)}static RequestSwap(){r.sRenderBridge.RequestSwap()}static SetImgTexSize(e,t){let s={size:t,refNum:0};n.TextureInfo.Cache[e.Source]=s}static RefImgTexSize(e,t){let s=n.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 i=n.TextureInfo.Cache[e.Source];if(i)i.refNum>0?i.refNum++:i.refNum=1;else{let t={size:s,refNum:1};n.TextureInfo.Cache[e.Source]=t}}))}static UnrefImgTexSize(e){if(!e)return;let t=n.TextureInfo.Cache[e.Source];t&&(t.refNum--,t.refNum<=0&&n.TextureInfo.Unused.add(e.Source))}static ClearUnusedTexSize(){for(let e of n.TextureInfo.Unused){let t=n.TextureInfo.Cache[e];t.refNum<-2?(delete n.TextureInfo.Cache[e],n.TextureInfo.Unused.delete(e)):t.refNum<=0?t.refNum--:n.TextureInfo.Unused.delete(e)}}}n.TextureInfo={Cache:{},Unused:new Set},n.TextureManager=null,n.RootView=null,n.RootActivity=null,n.HaltKeyEvent=!1,window.JsvCode.ForgeExtension||(window.JsvCode.ForgeExtension=n);var a=n=window.JsvCode.ForgeExtension;class l{static EnableEventListener(e){const t=window.JsvCode.Dom.PlatformBridge.JsViewId;window.JsvCode.Dom.PlatformBridge.SetOnEventListener(t,e)}static CreateElement(e,t){l.#e(l.#t.CreateElement,e,t)}static BindElementToRootView(e){l.#e(l.#t.BindElementToRootView,e)}static InsertElementChild(e,t,s){l.#e(l.#t.InsertElementChild,e,t,s)}static RemoveElementChild(e,t){l.#e(l.#t.RemoveElementChild,e,t)}static MoveElementChild(e,t,s,i){l.#e(l.#t.MoveElementChild,e,t,s,i)}static AddElementEventListener(e,t){l.#e(l.#t.AddElementEventListener,e,t)}static RemoveElementEventListener(e,t){l.#e(l.#t.RemoveElementEventListener,e,t)}static SetElementText(e,t){l.#e(l.#t.SetElementText,e,t)}static SetElementAttribute(e,t,s){l.#e(l.#t.SetElementAttribute,e,t,s),l.#s.has(e)&&l.#i.add(e)}static GetElementBoundingClientStyles(e,t){return l.#r(l.#t.GetElementBoundingClientStyles,e,t)}static SetForgeViewInnerProps(e,t,s){let i=0;(t=t.substr(12)).startsWith("mask-")&&(i=1,t=t.substr(5)),l.#e(l.#t.SetForgeViewInnerProps,e,t,i,""+s)}static DeclareStyleSheets(e){l.#e(l.#t.DeclareStyleSheets,-1,e)}static SetStyleProperty(e,t,s){l.#e(l.#t.SetStyleProperty,e,t,s),l.#s.has(e)&&l.#i.add(e)}static GetStyleProperties(e,t){return l.#r(l.#t.GetStyleProperties,e,t)}static AppendLazyTaskSyncedListener(e,t){l.#s.set(e,t)}static RemoveLazyTaskSyncedListener(e){l.#s.delete(e)}static RequestSwapAllCachedTasks(){if(0==l.#o.length)return;const e=JSON.stringify(l.#o);l.#o=[];const t=window.JsvCode.Dom.PlatformBridge.JsViewId;window.JsvCode.Dom.PlatformBridge.RunLazyTaskList(t,e);for(const e of l.#i){l.#s.get(e)?.()}l.#i.clear()}static GetElementAttribute(e,t){return l.#r(l.#t.GetElementAttribute,e,t)}static InsertKeyFrame(e,t){l.#e(l.#t.InsertKeyFrameDefine,-1,e,t)}static RemoveKeyFrame(e){l.#e(l.#t.RemoveKeyFrameDefine,-1,e)}static GetRelativePosition(e,t){const s=l.#r(l.#t.GetRelativePosition,e,t);return JSON.parse(s)}static#r(e,t,...s){l.RequestSwapAllCachedTasks();const i=window.JsvCode.Dom.PlatformBridge.JsViewId;return window.JsvCode.Dom.PlatformBridge.RunSyncTask(i,e,t,...s)}static#e(e,t,...s){l.#o.push([e,t,...s]),r.sRenderBridge.RequestSwap()}static#o=[];static#i=new Set;static#s=new Map;static#t={CreateElement:10,BindElementToRootView:11,InsertElementChild:12,RemoveElementChild:13,AddElementEventListener:14,RemoveElementEventListener:15,SetElementText:16,SetElementAttribute:17,GetElementBoundingClientStyles:18,GetElementAttribute:19,MoveElementChild:20,GetRelativePosition:21,DeclareStyleSheets:30,SetStyleProperty:31,GetStyleProperties:32,SetForgeViewInnerProps:40,InsertKeyFrameDefine:41,RemoveKeyFrameDefine:42}}class c{static CreateAudioPlayer(){return window.JsvCode.Media.PlatformBridge.CreateAudioPlayer()}static CreateVideoPlayer(){return window.JsvCode.Media.PlatformBridge.CreateVideoPlayer()}}class d{static Dom=l;static Media=c}class h{constructor(e){this.ownerDocument=window.document,this.nodeType=e,this.parentNode=void 0,this.childNodes=[]}jsvFinalize(){}appendChild(e){this.childNodes.push(e),e.parentNode=this,this.#n?.()}removeChild(e){let t=this.childNodes.indexOf(e);if(t<0)throw new DOMError("Failed to remove node, child node is not found. node=",e);this.childNodes.splice(t,1),e.parentNode=void 0,this.#n?.()}insertBefore(e,t){this.#a(e,t)}get previousSibling(){const e=this.parentNode.childNodes;let t=e.indexOf(this);if(t<0)throw new DOMError("Failed to call Node.previousSibling(), this node not found. this=",this);return e[t-1]}get nextSibling(){const e=this.parentNode.childNodes;let t=e.indexOf(this);if(t<0)throw new DOMError("Failed to call Node.nextSibling(), this node not found. this=",this);return e[t+1]}addEventListener(e,t,s){this.#l||(this.#l={});let i=this.#l[e];i||(i=new Set,this.#l[e]=i),i.add(t)}removeEventListener(e,t,s){if(!this.#l)return;let i=this.#l[e];i&&(i.delete(t),i.size<=0&&this.#l.hasOwnProperty(e)&&delete this.#l[e],0===Object.values(this.#l).length&&(this.#l=void 0))}dispatchEvent(e){if(!this.#l)return void console.warn("Node.dispatchEvent() Ignore to dispatch event: "+e.type+". No event added.");let t=this.#l[e.type];if(t){e.target||(e.target=document.activeElement);for(let s of t)s(e)}else console.warn("Node.dispatchEvent() Ignore to dispatch event: "+e.type+". No listener added.")}jsvObserveChildChanged(e){this.#n=e}jsvMoveChildToNewParent(e,t,s){let i=this.childNodes.indexOf(e);i<0&&Log.Throw("Failed to call Node.removeChild(), node not found. node=",e),this.childNodes.splice(i,1),e.parentNode=void 0,this.jsvChildChangedCallback?.(),t.#a(e,s)}#a(e,t){let s=this.childNodes.length;if(void 0===t)throw new DOMError("TypeError: Failed to execute 'insertBefore' on 'Node': 2 arguments required, but only 1 present.");if(null!==t&&(s=this.childNodes.indexOf(t)),s<0)throw new DOMError("Failed to call insert node, before node not found. beforeNode=",t);this.childNodes.splice(s,0,e),e.parentNode=this,this.#n?.()}#l=void 0;#n=void 0;static ELEMENT_NODE=1;static TEXT_NODE=3;static COMMENT_NODE=8;static DOCUMENT_NODE=9;static NOLAYOUT_NODE=10}class u{static Layout=class{static Height="height";static Left="left";static Top="top";static Width="width";constructor(){throw new Error("new StyleName.Layout() is forbidden.")}};static Background=class{static BackgroundColor="backgroundColor";static BackgroundImage="backgroundImage";static BorderRadius="borderRadius";constructor(){throw new Error("new StyleName.Background() is forbidden.")}};static Effect=class{static BackfaceVisibility="backfaceVisibility";static BorderImage="borderImage";static BorderImageWidth="borderImageWidth";static BorderImageOutset="borderImageOutset";static Display="display";static ObjectFit="objectFit";static Opacity="opacity";static Overflow="overflow";static Perspective="perspective";static PerspectiveOrigin="perspectiveOrigin";static Transform="transform";static TransformOrigin="transformOrigin";static TransformStyle="transformStyle";static Visibility="visibility";static ZIndex="zIndex";constructor(){throw new Error("new StyleName.Effect() is forbidden.")}};static Text=class{static Color="color";static FontFamily="fontFamily";static FontSize="fontSize";static FontStyle="fontStyle";static FontWeight="fontWeight";static LineHeight="lineHeight";static TextAlign="textAlign";static TextOverflow="textOverflow";static TextShadow="textShadow";static WebkitTextStroke="WebkitTextStroke";static WhiteSpace="whiteSpace";static WordWrap="wordWrap";static Direction="direction";static JsvTextEmoji="JsvTextEmoji";static JsvTextLatex="JsvTextLatex";static JsvTextAlignMinWidth="JsvTextAlignMinWidth";static JsvTextVerticalAlign="JsvTextVerticalAlign";static JsvTextLineAlign="JsvTextLineAlign";static JsvTextInnerDirection="JsvTextInnerDirection";constructor(){throw new Error("new StyleName.Text() is forbidden.")}};static Motion=class{static Animation="animation";static Transition="transition";constructor(){throw new Error("new StyleName.Motion() is forbidden.")}};static HasGetterMethod(e){switch(e){case u.Layout.Height:case u.Layout.Left:case u.Layout.Top:case u.Layout.Width:case u.Effect.ObjectFit:return!0;default:return!1}}static ToConst(e){return e==u.Layout.Height?u.Layout.Height:e==u.Layout.Left?u.Layout.Left:e==u.Layout.Top?u.Layout.Top:e==u.Layout.Width?u.Layout.Width:e==u.Background.BackgroundColor?u.Background.BackgroundColor:e==u.Background.BackgroundImage?u.Background.BackgroundImage:e==u.Background.BorderRadius?u.Background.BorderRadius:e==u.Effect.BackfaceVisibility?u.Effect.BackfaceVisibility:e==u.Effect.BorderImage?u.Effect.BorderImage:e==u.Effect.BorderImageWidth?u.Effect.BorderImageWidth:e==u.Effect.BorderImageOutset?u.Effect.BorderImageOutset:e==u.Effect.Display?u.Effect.Display:e==u.Effect.ObjectFit?u.Effect.ObjectFit:e==u.Effect.Opacity?u.Effect.Opacity:e==u.Effect.Overflow?u.Effect.Overflow:e==u.Effect.Perspective?u.Effect.Perspective:e==u.Effect.PerspectiveOrigin?u.Effect.PerspectiveOrigin:e==u.Effect.Transform?u.Effect.Transform:e==u.Effect.TransformOrigin?u.Effect.TransformOrigin:e==u.Effect.TransformStyle?u.Effect.TransformStyle:e==u.Effect.Visibility?u.Effect.Visibility:e==u.Effect.ZIndex?u.Effect.ZIndex:e==u.Text.Color?u.Text.Color:e==u.Text.FontFamily?u.Text.FontFamily:e==u.Text.FontSize?u.Text.FontSize:e==u.Text.FontStyle?u.Text.FontStyle:e==u.Text.FontWeight?u.Text.FontWeight:e==u.Text.LineHeight?u.Text.LineHeight:e==u.Text.TextAlign?u.Text.TextAlign:e==u.Text.TextOverflow?u.Text.TextOverflow:e==u.Text.TextShadow?u.Text.TextShadow:e==u.Text.WebkitTextStroke?u.Text.WebkitTextStroke:e==u.Text.WhiteSpace?u.Text.WhiteSpace:e==u.Text.WordWrap?u.Text.WordWrap:e==u.Text.Direction?u.Text.Direction:e==u.Text.JsvTextEmoji?u.Text.JsvTextEmoji:e==u.Text.JsvTextLatex?u.Text.JsvTextLatex:e==u.Text.JsvTextAlignMinWidth?u.Text.JsvTextAlignMinWidth:e==u.Text.JsvTextVerticalAlign?u.Text.JsvTextVerticalAlign:e==u.Text.JsvTextLineAlign?u.Text.JsvTextLineAlign:e==u.Text.JsvTextInnerDirection?u.Text.JsvTextInnerDirection:e==u.Motion.Animation?u.Motion.Animation:e==u.Motion.Transition?u.Motion.Transition:null}constructor(){throw new Error("new StyleName() is forbidden.")}}class v{static Base=class{constructor(e){this.rawValue=e}rawValue};static AnimationImpl=class extends v.Base{constructor(e){super(e)}name="";duration=0;timingFunction=null;delay=0;iterationCount=0;direction=!1};static CornerImpl=class extends v.Base{constructor(e){super(e)}topLeft=0;topRight=0;bottomRight=0;bottomLeft=0};static RectImpl=class extends v.Base{constructor(e){super(e)}top=0;right=0;left=0;bottom=0};static TextShadowImpl=class extends v.Base{constructor(e){super(e)}hShadow=0;vShadow=0;blur=0;color=void 0};static WebkitTextStrokeImpl=class extends v.Base{constructor(e){super(e)}length=0;color=void 0};static TransitionImpl=class extends v.Base{constructor(e){super(e)}animationMap=new Map};static BorderImageImpl=class extends v.Base{constructor(e){super(e)}source="";slice=null};static DataType=class{static Null=0;static Int32=1;static Float=2;static String=3;static Animation=4;static Corner=5;static Rect=6;static TextShadow=7;static WebkitTextStroke=8;static Transition=9;static BorderImage=10};static InvalidInt32=Number.MIN_VALUE;static InvalidFloat=Number.NaN;static InvalidPointer=null;constructor(e){let t=-1,s=null;null==e?t=v.DataType.Null:Number(e)===e&&e%1==0?t=v.DataType.Int32:Number(e)===e&&e%1!=0?t=v.DataType.Float:"string"==typeof e||e instanceof String?t=v.DataType.String:e instanceof v.AnimationImpl?t=v.DataType.Animation:e instanceof v.CornerImpl?t=v.DataType.Corner:e instanceof v.RectImpl?t=v.DataType.Rect:e instanceof v.TextShadowImpl?t=v.DataType.TextShadow:e instanceof v.WebkitTextStrokeImpl?t=v.DataType.WebkitTextStroke:e instanceof v.TransitionImpl?t=v.DataType.Transition:e instanceof v.BorderImageImpl&&(t=v.DataType.BorderImage),e!=v.InvalidInt32&&e!=v.InvalidFloat&&e!=v.InvalidPointer?s=e:(t=v.DataType.Null,s=null),this.data=new v.DataInfo,this.data.index=t,this.data.value=s}is(e){return this.data.index==e}get(){return this.data.value}reset(e){this.data.value=e.data.value,this.data.index=e.data.index}equals(e){return this.data.value===e.data.value&&this.data.index===e.data.index}static DataInfo=class{value=null;index=-1};data}class m{static JsvDeclarePrototype(){for(let e in u){let t=u[e];for(let e in t){let s=t[e];if("string"!=typeof s)continue;const i={set:function(e){this.setProperty(s,e)},get:function(){return this.getPropertyValue(s)}};Object.defineProperty(m.prototype,s,i)}}}constructor(e){this.#c=e}setProperty(e,t){if(document.jsvCheckStyleFormat?.(e,t),e==u.Background.BackgroundImage&&t){t=new o(t).href}else e==u.Effect.Display&&(this.#d[e]=t);if(e==u.Effect.BorderImage&&t){const e=t.split(" ");e.length>0&&(e[0]=new o(e[0]).href),t=e.join(" ")}d.Dom.SetStyleProperty(this.#c,e,t)}getPropertyValue(e){if(e==u.Effect.Display)return this.#d[e];throw console.error("StyleDeclaration.getPropertyValue() propName="+e),new Error("Get style value is unimplemented because it's low performance.")}jsvGetProperties(...e){const t=JSON.stringify(e),s=d.Dom.GetStyleProperties(this.#c,t);return JSON.parse(s)}#c;#d={}}class p extends t{constructor(e){super(e)}}class f extends h{static JsvTagName={Anchor:"A",Audio:"AUDIO",Div:"DIV",Head:"HEAD",Img:"IMG",IFrame:"IFRAME",Link:"LINK",Script:"SCRIPT",Style:"STYLE",Svg:"SVG",Video:"VIDEO",JsvAudioTrack:"JSV-AUDIOTRACK",JsvFDiv:"FDIV"};static JsvEnableEventListener(){d.Dom.EnableEventListener((function(e,t,s){const i=f.#h[e]?.[t];i?.(t,s)}))}constructor(e){super(h.ELEMENT_NODE),this.tagName=e,this.tagName!=f.JsvTagName.Link&&this.tagName!=f.JsvTagName.Script&&this.tagName!=f.JsvTagName.Style&&(this.jsvNativeId=++f.#u,this.style=new m(this.jsvNativeId),d.Dom.CreateElement(this.jsvNativeId,e)),this.jsvAttrStore={}}appendChild(e){e.parentNode?this.#v(e,null):(super.appendChild(e),this.#m(e,null))}removeChild(e){super.removeChild(e),this.#p(e),e.jsvNativeId&&d.Dom.RemoveElementChild(this.jsvNativeId,e.jsvNativeId)}insertBefore(e,t){e.parentNode?this.#v(e,t):(super.insertBefore(e,t),this.#m(e,t))}addEventListener(e,t,s){super.addEventListener(e,t,s),this.jsvNativeId&&(this.#f(this.jsvNativeId,e),d.Dom.AddElementEventListener(this.jsvNativeId,e))}removeEventListener(e,t,s){this.jsvNativeId&&(this.#g(this.jsvNativeId,e),d.Dom.RemoveElementEventListener(this.jsvNativeId,e)),super.removeEventListener(e,t,s)}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)}get clientWidth(){return this.jsvAttrStore.clientWidth||(this.jsvAttrStore.clientWidth=d.Dom.GetElementAttribute(this.jsvNativeId,"clientWidth")),this.jsvAttrStore.clientWidth}get clientHeight(){return this.jsvAttrStore.clientHeight||(this.jsvAttrStore.clientHeight=d.Dom.GetElementAttribute(this.jsvNativeId,"clientHeight")),this.jsvAttrStore.clientHeight}setAttribute(e,t){e&&(this.jsvAttrStore[e]=t,this.jsvNativeId&&(e.startsWith("data-jsv-vw-")?d.Dom.SetForgeViewInnerProps(this.jsvNativeId,e,t):("class"===e||e.startsWith("data-v-")||e.startsWith("data-jsv")||e.startsWith("dataJsv"))&&d.Dom.SetElementAttribute(this.jsvNativeId,e,t)))}removeAttribute(e){delete this.jsvAttrStore[e],("class"==e||e.startsWith("data-v-")||"src"==e)&&this.jsvNativeId&&d.Dom.SetElementAttribute(this.jsvNativeId,e,null)}getAttribute(e){return this.jsvAttrStore[e]}hasAttribute(e){return!!this.jsvAttrStore[e]}focus(){document.activeElement&&document.activeElement.onfocus();let e=document.activeElement;if(document.activeElement=this,e){let t=new i(i.JsvType.Blur);t.target=e,document.dispatchEvent(t)}let t=new i(i.JsvType.Focus);document.dispatchEvent(t)}getBoundingClientRect(){return new Promise(((e,t)=>{const s=this.jsvGetProxyView();s.RegisterOnProxyReady((()=>{s.GetBoundingClientRect().then((t=>{e(t)}),(e=>{t(e)}))}))}))}jsvSetOnLazyTaskSyncedListener(e){d.Dom.AppendLazyTaskSyncedListener(this.jsvNativeId,e)}jsvOnEvent(e,...t){let i;e.startsWith("animation")?(i=new s(e),i.target=this,i.animationName=t[0]):e.startsWith("transition")&&(i=new p(e),i.target=this,i.propertyName=t[0]),i&&this.dispatchEvent(i)}jsvGetProxyView(e){return e?(this._MaskViewProxy||(this._MaskViewProxy=r.NewDomProxyView(this.jsvNativeId,!0)),this._MaskViewProxy):(this._MainViewProxy||(this._MainViewProxy=r.NewDomProxyView(this.jsvNativeId,!1)),this._MainViewProxy)}jsvGetProxyTexture(e){return this._MainViewTextureProxy||(this._MainViewTextureProxy=e.GetDomProxyTexture(this.jsvNativeId)),this._MainViewTextureProxy}jsvGetRelativePosition(e){return d.Dom.GetRelativePosition(this.jsvNativeId,e.jsvNativeId)}#f(e,t){let s=f.#h[e];s||(s=new Set,f.#h[e]=s),s[t]=this.jsvOnEvent.bind(this)}#g(e,t){let s=f.#h[e];s&&delete s[t]}#v(e,t){let s=e.parentNode;s.jsvMoveChildToNewParent(e,this,t),this.#y(s,e,t)}#y(e,t,s){t.jsvNativeId&&(s=f.#w(s),d.Dom.MoveElementChild(this.jsvNativeId,e.jsvNativeId,t.jsvNativeId,s?.jsvNativeId))}#m(e,t){e.parentNode=this,e.nodeType===h.TEXT_NODE?this.textContent=e.nodeValue:e.jsvNativeId&&(t=f.#w(t),d.Dom.InsertElementChild(this.jsvNativeId,e.jsvNativeId,t?.jsvNativeId))}#p(e){for(const t of e.childNodes)e.#p(t);e.jsvFinalize(),d.Dom.RemoveLazyTaskSyncedListener(e.jsvNativeId),delete f.#h[e.jsvNativeId]}static#w(e){let t=e;for(;t&&!(t instanceof f);)t=t.nextSibling;return t}parentNode;tagName;style;jsvNativeId;jsvAttrStore;static#h={};static#u=0}class g extends f{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 f.TAG.ANCHOR}}class y extends f{static JsvDeclareProperties(){for(const[e,t]of Object.entries(y.#T)){let s={};t.set&&(s.set=function(t){if("src"===e){t=new o(t).href}this.jsvOnSetter(e,t)}),t.get&&(s.get=function(){return this.jsvOnGetter(e)}),Object.defineProperty(y.prototype,e,s)}for(const e of y.#C){let t={set:function(t){t?this.addEventListener(e,t):this.removeEventListener(e,this.jsvEventMap[e]),this.jsvEventMap[e]=t},get:function(){this.jsvEventMap[e]}};Object.defineProperty(y.prototype,"on"+e,t)}for(const e of y.#k){const t=function(...t){this.jsvMediaPlayer[e](t)};y.prototype[e]=t}}constructor(e){super(e),Promise.resolve().then((()=>{this.jsvMediaPlayer&&this.jsvMediaPlayer.confirmInitSetup?.()}))}jsvFinalize(){this.jsvMediaPlayer.pause(),this.jsvMediaPlayer.unload(),this.jsvMediaPlayer.releaseResource?.(),this.jsvMediaPlayer.onPlatformDestroy?.(),this.jsvMediaPlayer=null}addEventListener(e,t,s){super.addEventListener(e,t,s),this.jsvNativeId&&y.#C.includes(e)&&this.jsvMediaPlayer.addEventListener(e,(()=>{this.onMediaPlayerEvent(e)}))}removeEventListener(e,t,s){this.jsvNativeId&&y.#C.includes(e)&&this.jsvMediaPlayer.removeEventListener(e,t),super.removeEventListener(e,t,s)}jsvOnSetter(e,t){if(e in y.#T==0)throw new DomError("Failed to set "+e);this.jsvMediaPlayer[e]=t}jsvOnGetter(e){if(e in y.#T==0)throw new DomError("Failed to get "+e);return this.jsvMediaPlayer[e]}onMediaPlayerEvent(e){let s=new t(e);s.target=this,s&&this.dispatchEvent(s)}static#T={autoplay:{set:!0,get:!0},currentTime:{set:!0,get:!0},muted:{set:!0,get:!0},playbackRate:{set:!0,get:!0},volume:{set:!0,get:!0},timeupdateless:{set:!0,get:!0},predownload:{set:!0,get:!0},preload:{set:!0,get:!0},duration:{set:!1,get:!0},error:{set:!1,get:!0},paused:{set:!1,get:!0},loop:{set:!0,get:!1},src:{set:!0,get:!1}};static#C=["abort","canplay","canplaythrough","durationchange","ended","error","load","loadedmetadata","loadstart","pause","play","playing","seeking","seeked","stalled","timeupdate"];static#k=["load","pause","play","unload","confirmInitSetup"];jsvMediaPlayer=null;jsvEventMap={}}class w extends y{constructor(){super(Element.JsvTagName.Audio),this.jsvMediaPlayer=d.Media.CreateAudioPlayer()}}class T extends h{constructor(e){super(h.COMMENT_NODE),this.textContent=e}}class C extends f{constructor(){super(f.JsvTagName.Div)}get textContent(){return this.#b}set textContent(e){this.#b=e,d.Dom.SetElementText(this.jsvNativeId,e)}#b}class k{constructor(e,t){this.RouterDelegate={ref:null},e||(this.RouterDelegate.ref=new b(!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(x.sLastFocus)}getCurrentFocusStack(){const e=[];if(this.RouterDelegate.ref){let t=this.RouterDelegate.ref.getCurrentFocusNode();for(;t&&t instanceof x&&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 b{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 r=!1;for(let t in i._ChildMap){let o=i._ChildMap[t].RouterDelegate.ref;if(o!=i&&o.NameSpace==e[s]){i=o,s++,r=!0;break}}if(!r)return void console.error(`Error: no found subpath fname=${t}`)}let r=e[s];return i._ChildMap.hasOwnProperty(r)?i._ChildMap[r]: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 x extends r.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 k(!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 b(!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 x.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(),E()),e instanceof x)){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 x.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()}}x.sFocusMemos=[],x.sLastFocus=null,x.sRootPageNode=null;let E=()=>{let e=x.sFocusMemos.length;if(e>0){let t=x.sFocusMemos;x.sFocusMemos=[];for(let s=0;s<e;s++)t[s].obj.Focus(t[s].bcf)}},N={};class D{constructor(e,t,s){this._Element=s,N.hasOwnProperty(e)&&console.error(`Warn: FDivRoot duplicate name=${e}`),N[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(a.RootActivity,a.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(),E()}}class S extends f{constructor(){super(f.JsvTagName.Img)}setAttribute(e,t){if("src"===e){t=new o(t).href}super.setAttribute(e,t),this.jsvNativeId&&"src"===e&&d.Dom.SetElementAttribute(this.jsvNativeId,e,t)}jsvOnEvent(e,...s){let i;super.jsvOnEvent(e,...s),"load"==e&&(i=new t(e),i.target=this),i&&this.dispatchEvent(i)}}class I extends f{constructor(){super(f.JsvTagName.Link),this.src=null,this.onerror=null,this.onload=null}setAttribute(e,t){this[e]=t}jsvLoadResource(){let e=!1,t=null;if(null!=this.href){var s=new o(this.href);console.log("Ignore to load link from url="+s.href),e=!0}else console.warn("Failed to load link, href is not exists."),t="NoSrc";this.jsvOnLoadResult(e,t)}jsvOnLoadResult(e,s){if(console.log("Load link result: isSuccess:"+e+", errCode:"+s),e){if(this.onload){let e=new t("load");this.onload(e)}}else this.onerror&&this.onerror({type:"jsvErr_"+s,target:this})}}class L extends f{constructor(){super(f.JsvTagName.Script)}setAttribute(e,t){this[e]=t}jsvLoadResource(){if(null!=this.src){var e=new o(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,s){if(console.log("Load script result: isSuccess:"+e+", errCode:"+s),e){if(this.onload){let e=new t("load");this.onload(e)}}else this.onerror&&this.onerror({type:"jsvErr_"+s,target:this})}src=null;onerror=null;onload=null;charset=null;timeout=120}class O extends f{constructor(){super(f.JsvTagName.Style),this.jsvAttrStore={left:0,top:0,width:0,height:0}}}class j extends f{constructor(){super(f.JsvTagName.Svg)}}class P extends h{constructor(e){super(h.TEXT_NODE),this.textContent=e}get nodeValue(){return this.textContent}set nodeValue(e){this.textContent=e,this.parentNode&&(this.parentNode.textContent=this.textContent)}}class J extends y{constructor(){super(Element.JsvTagName.Video),super.jsvMediaPlayer=d.Media.CreateVideoPlayer(),this.#x={left:0,top:0,width:0,height:0,objectFit:null},this.jsvSetOnLazyTaskSyncedListener(this.jsvOnLazyTaskSynced.bind(this))}jsvFinalize(){this.jsvMediaPlayer.jsvFinalize()}jsvGetBoundingClientStyles(...e){const t=JSON.stringify(e),s=d.Dom.GetElementBoundingClientStyles(this.jsvNativeId,t);return JSON.parse(s)}jsvOnLazyTaskSynced(){const e=this.jsvGetBoundingClientStyles(u.Layout.Left,u.Layout.Top,u.Layout.Width,u.Layout.Height,u.Effect.ObjectFit,u.Effect.Visibility);let t=!1;this.#x.left!=e.left&&(this.#x.left=e.left,t=!0),this.#x.top!=e.top&&(this.#x.top=e.top,t=!0),this.#x.width!=e.width&&(this.#x.width=e.width,t=!0),this.#x.height!=e.height&&(this.#x.height=e.height,t=!0),this.#x.objectFit!=e.objectFit&&(this.#x.objectFit=e.objectFit,t=!0),this.#x.visibility!=e.visibility&&(this.#x.visibility=e.visibility,t=!0),t?this.jsvMediaPlayer.jsvOnCssStyleChanged(this.jsvNativeId,this.#x):console.log("VideoElement.jsvOnLazyTaskSynced() style is not changed.")}#x}class M extends y{constructor(){super(Element.JsvTagName.JsvAudioTrack),this.jsvMediaPlayer=d.Media.CreateAudioPlayer("AudioTrack")}}let B=1;class R extends f{constructor(){super(f.JsvTagName.JsvFDiv),this.FocusNodeRef=new x(""+B++),this.HubRef=void 0}setAttribute(e,t){if(e)if("fname"===e)t&&this.FocusNodeRef.setBranchName(t);else if("new-namespace"===e&&""!==t&&!this.HubRef){let e=new k(!1,t);this.HubRef=e,this.FocusNodeRef.setHub(e),this.FocusNodeRef.setBranchName(t)}}removeAttribute(e){}jsvGetHub(){return this.HubRef}}class F extends h{constructor(){super(h.DOCUMENT_NODE),this.location=window.location,this.rootElement=new C,this.rootElement.ownerDocument=this,this.rootElement.id="root",d.Dom.BindElementToRootView(this.rootElement.jsvNativeId),this.activeElement=this.rootElement,this.head=null}createComment(e){return new T(e)}createElement(e){switch(e=e.toUpperCase()){case f.JsvTagName.Anchor:return new g;case f.JsvTagName.Audio:return new w;case f.JsvTagName.Div:return new C;case f.JsvTagName.Img:return new S;case f.JsvTagName.Link:return new I;case f.JsvTagName.Script:return new L;case f.JsvTagName.Style:return new O;case f.JsvTagName.Svg:return new j;case f.JsvTagName.Video:return new J;case f.JsvTagName.JsvAudioTrack:return new M;case f.JsvTagName.JsvFDiv:return new R;case f.JsvTagName.IFrame:console.error("Unsupported element: "+e+". Your vue compilation may may have failed, please check it first.")}if("TEMPLATE"==e)return{};throw new TypeError("Unimplemented element: "+e)}createEvent(e){return new t(e)}createTextNode(e){return new P(e)}getElementById(e){if("root"===e||"app"===e)return this.rootElement;throw new DOMError("Failed to get element by id, id="+e+" is UNIMPLEMENTED.")}getElementsByTagName(e){if((e=e.toUpperCase())===f.JsvTagName.Head)return[this.head];if(e===f.JsvTagName.Link||e===f.JsvTagName.Script||e===f.JsvTagName.Style)return[];throw new DOMError("Failed to get element by name, 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;throw new DOMError("Failed to query selector, selectors="+e+" is UNIMPLEMENTED.")}querySelectorAll(e){return[]}jsvInitFDivRoot(e,t,s){if(!s){let e=document.createElement("fdiv");this.rootElement.appendChild(e),this.rootElement=e,s=this.rootElement}return new D(e,t,s)}}class _ extends f{constructor(){super(f.JsvTagName.Head)}appendChild(e){super.appendChild(e),(e instanceof I||e instanceof L)&&e.jsvLoadResource()}removeChild(e){super.removeChild(e)}}let A="@keyframes",V=A.length;class U{constructor(e){this._AnchorTag=e,this._NamesCache=new Set}insertRule(e){let t=this.#E(e);this._NamesCache.has(t)&&console.warn(`Warn: keyframe replace of name ${t}`),this._NamesCache.add(t),d.Dom.InsertKeyFrame(t,e)}hasRule(e){return this._NamesCache.has(e)}removeRule(e){this._NamesCache.has(e)?(this._NamesCache.delete(e),d.Dom.RemoveKeyFrame(e)):console.error(`Error: keyFrame(${e}) is not exist.`)}removeMultiRules(e){for(let t of e)this.removeRule(t)}#E(e){let t=e.indexOf(A)+V,s=e.indexOf("{");return e.substring(t,s).trim()}}let W=null;function z(e){return W||(W={global:new U("global")}),W.global}class G{static EnsureGlobalEnv(e,t){const s=window.navigator?.userAgent?.toLowerCase();window.jsvInAndroidWebView=s?.indexOf("android")>=0,G.#N(e,t),f.JsvEnableEventListener(),y.JsvDeclareProperties(),m.JsvDeclarePrototype()}static#N(e,t){window.JsvCode||(window.JsvCode={}),window.JsvCode.Dom||(window.JsvCode.Dom={}),window.JsvCode.Media||(window.JsvCode.Media={}),window.JsvCode.Dom.PlatformBridge||(window.JsvCode.Dom.PlatformBridge=e),window.JsvCode.Media.PlatformBridge||(window.JsvCode.Media.PlatformBridge=t),window.JsvCode.Dom.DeclareStyleSheets||(window.JsvCode.Dom.DeclareStyleSheets=d.Dom.DeclareStyleSheets),window.JsvCode.Dom.getKeyFrameGroup||(window.JsvCode.Dom.getKeyFrameGroup=z)}}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 E=console.error.bind(console);static W=console.warn.bind(console);static I=console.info.bind(console);static D=function(){};static V=function(){};static Level={Error:0,Warning:1,Info:2,Debug:3,Verbose:4}}class K{constructor(e){this.callback=e}observe(e,t){if(!(e instanceof h))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}}class q{constructor(){this.#D(),q.#S()}#D(){r.sRenderBridge.AddWillSwapListener("forgeSwap",(()=>{d.Dom.RequestSwapAllCachedTasks()})),a.TextureManager=new r.TextureManager,r.DomElementGetter=e=>{let t=window.JsvCode.Dom.PlatformBridge.JsViewId;return window.JsvCode.Dom.PlatformBridge.GetInstance(t).getElementById(e)}}static SetRender(e){q.#S=e,window.Forge.RunApp(this)}static#S=null}class $ extends O{constructor(){super(),this.jsvBrowserElement=window.JsvCode.Dom.BrowserDocument.createElement(Element.JsvTagName.Style)}jsvBrowserElement}class X extends _{constructor(){super()}appendChild(e){"HTMLLinkElement"==e.constructor.name||"HTMLScriptElement"==e.constructor.name?window.JsvCode.Dom.BrowserDocument.head.appendChild(e):e instanceof $?window.JsvCode.Dom.BrowserDocument.head.appendChild(e.jsvBrowserElement):super.appendChild(e)}removeChild(e){"HTMLLinkElement"==e.constructor.name||"HTMLScriptElement"==e.constructor.name?window.JsvCode.Dom.BrowserDocument.head.removeChild(e):e instanceof $?window.JsvCode.Dom.BrowserDocument.head.removeChild(e.jsvBrowserElement):super.removeChild(e)}}class Z extends F{constructor(){super(),this.head=new X}createElement(e){switch(e=e.toUpperCase()){case f.JsvTagName.IFrame:case f.JsvTagName.Link:case f.JsvTagName.Script:return window.JsvCode.Dom.BrowserDocument.createElement(e);case f.JsvTagName.Style:return new $;default:return super.createElement(e)}}getElementsByTagName(e){return e.toUpperCase()===f.JsvTagName.Head?window.JsvCode.Dom.BrowserDocument.getElementsByTagName(e):super.getElementsByTagName(e)}}class Y{static Get(e){return Y.#I[e]}static#L(e,t){let s=void 0===t;return s&&console.error(e+" property is undefined!"),s}static#O(e,t){return!!Y.#L(e,t)||(""===t||"number"==typeof t)}static#j(e,t){Y.#L(e,t)||t.indexOf("transform")<0&&t.indexOf("opacity")<0&&console.error("keyframes property is only support transform and opacity, value:",t)}static#P(e,t){if(Y.#L(e,t))return;const s="fill contain cover none scale-down";s.indexOf(t)<0&&console.error(" objectFit is only support one of string["+s+"]")}static#J(e,t){Y.#L(e,t)||console.error(e+" property is not support, you can use transition property, e.g. transition='width 2s'")}static#M(e,t){Y.#L(e,t)}static#B(e,t){Y.#L(e,t)||t.length>0&&t.indexOf("translate3d")<0&&t.indexOf("scale3d")<0&&t.indexOf("rotate3d")<0&&t.indexOf("skew")<0&&console.error("transform property's value only support translate3d、scale3d、rotate3d、skew, value:",t)}static#R(e,t){Y.#L(e,t)||t.length>0&&t.indexOf("%")<0&&t.indexOf("left")<0&&t.indexOf("center")<0&&t.indexOf("top")<0&&t.indexOf("right")<0&&t.indexOf("bottom")<0&&console.error("transformOrigin property's value only support XX%、left、top、right, bottom:",t)}static#F(e,t){if(!Y.#L(e,t))switch(t){case"clip":case"ellipsis":break;default:console.error("textOverflow property's value is not support, value:",t)}}static#_(e,t){if(!Y.#L(e,t))switch(t){case"normal":case"nowrap":case"pre-wrap":break;default:console.error("whiteSpace property's value is not support, value:",t)}}static#A(e,t){if(!Y.#L(e,t))switch(t){case"left":case"right":case"center":case"start":case"end":break;default:console.error("textAlign property's value is not support, value:",t)}}static#V(e,t){if(!Y.#O(e,t))switch(t){case"normal":case"inherit":console.error("lineHeight property's value is support number only, value:",t);break;default:t.indexOf("%")>=0&&console.error("lineHeight property's value is support number only, value:",t)}}static#U(e,t){Y.#L(e,t)||Y.#W("Color()",t)}static#z(e,t){Y.#L(e,t)||"visible"!==t&&"hidden"!==t&&"inherit"!==t&&console.error("visibility property's value is not support, value:",t)}static#G(e,t){Y.#L(e,t)||"block"!==t&&"inline"!==t&&"none"!==t&&"inline-block"!==t&&"inherit"!==t&&""!==t&&console.error("display property's value is not support, value:",t)}static#H(e,t){Y.#L(e,t)||"visible"!==t&&"hidden"!==t&&console.error("overflow property's value is support visible or hidden only, value:",t)}static#K(e,t){if(!Y.#O(e,t))switch(t){case"auto":case"inherit":console.error("top property's value is support number only, value:",t);break;default:t.indexOf("%")>=0&&console.error("top property's value is support number only, value:",t)}}static#q(e,t){if(!Y.#O(e,t))switch(t){case"auto":case"inherit":console.error("left property's value is support number only, value:",t);break;default:t.indexOf("%")>=0&&console.error("left property's value is support number only, value:",t)}}static#$(e,t){if(!Y.#O(e,t))switch(t){case"auto":case"inherit":console.error("height property's value is support number only, value:",t);break;default:t.indexOf("%")>=0&&console.error("height property's value is support number only, value:",t)}}static#X(e,t){if(!Y.#O(e,t))switch(t){case"auto":case"inherit":console.error("width property's value is support number only, value:",t);break;default:t.indexOf("%")>=0&&console.error("width property's value is support number only, value:",t)}}static#Z(e,t){if(!Y.#L(e,t))switch(t){case"visible":case"hidden":break;default:console.error("backfaceVisibility property's value is support visible/hidden only, value: ",t)}}static#Y(e,t){Y.#L(e,t)}static#Q(e,t){if(Y.#L(e,t))return;t.split(" ").length<2&&console.error("Error: WebkitTextStroke should format of(width color) such as: '1px rgba(255,255,255,1.0)'")}static#ee(e,t){Y.#L(e,t)||isNaN(t)&&console.error("zIndex property's value is support number only, value: ",t)}static#te(e,t){if(!Y.#O(e,t))switch(t){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:",t);break;default:t.indexOf("%")>=0&&console.error("fontSize property's value is support number only, value:",t)}}static#se(e,t){Y.#L(e,t)||"bold"!==t&&console.error("fontWeight property's value is support bold only, value:",t)}static#ie(e,t){Y.#L(e,t)||"italic"!==t&&console.error("fontWeight property's value is support italic only, value:",t)}static#re(e,t){if(Y.#L(e,t))return;let s=[t];"string"==typeof t&&(s=t.split(" ")),s.length>4&&console.error("borderRadius property's value is not support, value:",t)}static#oe(e,t){Y.#O(e,t)}static#ne(e,t){if(Y.#L(e,t))return;t.split(" ").length>4&&console.error("borderImageOutsetCheck property's value is not support, value:",t)}static#ae(e,t){Y.#L(e,t)||t.indexOf("fill")<0&&console.error("borderImage property's value is not contain fill, e.g. source slice, but value:",t)}static#le(e,t){console.error(e+" property not support, you can use backgroundImage property, e.g. backgroundImage=`url(${iconImgPath})`")}static#ce(e,t){Y.#L(e,t)||"inherit"==t&&console.error("backgroundImage property's value is not support, value:",t)}static#de(e,t){if(!Y.#L(e,t))return Y.#W("backgroundColor",t)}static#he(e,t){}static#ue(e,t){console.error(e+" property is not support, you can use animation property, e.g. animation='mymove 5s infinite'")}static#ve(e,t){if(!Y.#L(e,t))switch(t){case"flat":case"preserve-3d":break;default:console.error("transformStyle property value is not valid",t)}}static#me(e,t){Y.#L(e,t)||t.length>0&&t.indexOf("%")<0&&t.indexOf("left")<0&&t.indexOf("center")<0&&t.indexOf("top")<0&&t.indexOf("right")<0&&t.indexOf("bottom")<0&&console.error("perspectiveOrigin property's value only support XX%、left、top、right, bottom:",t)}static#pe(e,t){if(!Y.#L(e,t)&&t.length>0){if(t.replace(/\(.*\)/g,"").split(",").length>1)return void console.error("textShadow: NOT support more than one part settings");const e=t.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=${t})`);if(!Y.#W("textShadow",e[3]))return}}}static#W(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#fe(e,t){Y.#L(e,t)||"number"!=typeof t&&console.error("JsvTextLatex property's value is support number only, value: ",t)}static#ge(e,t){Y.#L(e,t)||"number"!=typeof t&&console.error("JsvTextEmoji property's value is support number only, value: ",t)}static#ye(e,t){if(!Y.#L(e,t))switch(t){case"ltr":case"rtl":break;default:console.error("direction property's value is not support, value:",t)}}static#we(e,t){Y.#L(e,t)||"number"!=typeof t&&console.error("JsvTextAlignMinWidth property's value is support number only, value: ",t)}static#Te(e,t){if(!Y.#L(e,t))switch(t){case"top":case"middle":case"bottom":break;default:console.error("JsvTextVerticalAlign property's value is not support, value: ",t)}}static#Ce(e,t){if(!Y.#L(e,t))switch(t){case"top":case"middle":case"bottom":break;default:console.error("JsvTextLineAlign property's value is not support, value: ",t)}}static#ke(e,t){if(!Y.#L(e,t))switch(t){case"unset":case"ltr":case"rtl":break;default:console.error("JsvTextInnerDirection property's value is not support, value: ",t)}}static#I={animation:{check:Y.#he},animationName:{check:Y.#ue},animationDuration:{check:Y.#ue},animationTimingFunction:{check:Y.#ue},animationDelay:{check:Y.#ue},animationIterationCount:{check:Y.#ue},animationDirection:{check:Y.#ue},animationPlayState:{check:Y.#ue},animationFillMode:{check:Y.#ue},background:{check:Y.#le},backgroundColor:{check:Y.#de},backgroundImage:{check:Y.#ce},borderImage:{check:Y.#ae},borderImageOutset:{check:Y.#ne},borderImageWidth:{check:Y.#oe},borderRadius:{check:Y.#re},height:{check:Y.#$},width:{check:Y.#X},zIndex:{check:Y.#ee},fontFamily:{check:null},fontSize:{check:Y.#te},fontStyle:{check:Y.#ie},fontWeight:{check:Y.#se},left:{check:Y.#q},overflow:{check:Y.#H},top:{check:Y.#K},visibility:{check:Y.#z},display:{check:Y.#G},color:{check:Y.#U},lineHeight:{check:Y.#V},textAlign:{check:Y.#A},direction:{check:Y.#ye},whiteSpace:{check:Y.#_},textOverflow:{check:Y.#F},transform:{check:Y.#B},transformOrigin:{check:Y.#R},transition:{check:Y.#M},transitionProperty:{check:Y.#J},transitionDuration:{check:Y.#J},transitionTimingFunction:{check:Y.#J},transitionDelay:{check:Y.#J},keyframes:{check:Y.#j},objectFit:{check:Y.#P},perspective:{check:Y.#Y},backfaceVisibility:{check:Y.#Z},transformStyle:{check:Y.#ve},perspectiveOrigin:{check:Y.#Y},WebkitTextStroke:{check:Y.#Q},textShadow:{check:Y.#pe},JsvTextLatex:{check:Y.#fe},JsvTextEmoji:{check:Y.#ge},JsvTextAlignMinWidth:{check:Y.#we},JsvTextVerticalAlign:{check:Y.#Te},JsvTextLineAlign:{check:Y.#Ce},JsvTextInnerDirection:{check:Y.#ke}}}class Q{static BackupBrowser(){return{createComment:window.document.createComment.bind(window.document),createElement:window.document.createElement.bind(window.document),createElementNS:window.document.createElementNS.bind(window.document),createTextNode:window.document.createTextNode.bind(window.document),dispatchEvent:window.document.dispatchEvent.bind(window.document),getElementById:window.document.getElementById.bind(window.document),getElementsByTagName:window.document.getElementsByTagName.bind(window.document),querySelector:window.document.querySelector.bind(window.document),head:{appendChild:window.document.head.appendChild.bind(window.document.head),removeChild:window.document.head.removeChild.bind(window.document.head)}}}static HookBrowser(e){Q.#be(e),Q.#xe(),Q.#Ee()}static#be(e){window.JsvCode.Dom.BrowserDocument=e;const t=new Z;window.document.createComment=t.createComment.bind(t),window.document.createElement=t.createElement.bind(t),window.document.createTextNode=t.createTextNode.bind(t),window.document.dispatchEvent=t.dispatchEvent.bind(t),window.document.getElementById=t.getElementById.bind(t),window.document.getElementsByTagName=t.getElementsByTagName.bind(t),window.document.querySelector=t.querySelector.bind(t),window.document.head.appendChild=t.head.appendChild.bind(t.head),window.document.head.removeChild=t.head.removeChild.bind(t.head),window.JsvCode.Dom.JsViewDocument=t}static#xe(){window.MutationObserver=K,window.Element=f,window.SVGElement=j}static#Ee(){const e=window.JsvCode.Dom.JsViewDocument;window.document.jsvInitFDivRoot=e.jsvInitFDivRoot.bind(e),window.document.jsvCheckStyleFormat=window.jsvInAndroidWebView?null:Q.#Ne}static#Ne(e,t){if(e.startsWith("--"))return;let s=Y.Get(e);s?s.check&&t&&s.check(e,t):console.error(e+" property is not support.")}}window.jsvIsBrowserDebug=!0;const ee=window.JsvCode.BrowserPlatformDomBridge,te=window.JsvCode.BrowserPlatformMediaBridge;function se(){const e=Q.BackupBrowser();ee.RegisterOriginDocument(e),G.EnsureGlobalEnv(ee,te),Q.HookBrowser(e),H.I("Using JsView HTML Environment.")}export{q as BrowserForgeApp,se as InitEnv};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
/* eslint-disable */ class e{static CreateAudioPlayer(e){return new Audio(e)}static CreateVideoPlayer(){const t=new Video;return t.jsvOnCssStyleChanged=e.OnCssStyleChanged.bind(t),t.jsvFinalize=e.JsvFinalize.bind(t),t}static OnCssStyleChanged(e,t){this.jsvSetStyles(t.left,t.top,t.width,t.height,t.objectFit,t.visibility)}static JsvFinalize(){console.log("NativePlatformMediaBridge.JsvFinalize()");const e=this;e.pause(),e.unload?.(),e.releaseResource&&(e.releaseResource(),e.onPlatformDestroy())}}window.JsvCode.NativePlatformMediaBridge||(window.JsvCode.NativePlatformMediaBridge=e);class t{constructor(e,t){this.target=t,this.timeStamp=Date.now(),this.type=e}}class s extends t{constructor(e){super(e)}}class i extends t{constructor(e){super(e)}}void 0===window.Forge?(window.Forge={},console.log("Define forge browser")):console.log("Define using JsView forge engine-js");var r=window.Forge;class o{constructor(e,t){if(!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("./")&&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)}e=window.JsView.Dom.MainPath+e.substring(1)}if(this.href=e,!t)return;let i=this.href,r=i.indexOf("#");r>0&&(this.hash=i.substring(r),i=i.substring(0,r));let o=i.indexOf("?");o>1&&(this.search=i.substring(o),i=i.substring(0,o));let n=i,a=n.indexOf("://");this.protocol=a>0?n.substring(0,a+1):"";let l=a>1?n.substring(a+3):"";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:"",a=this.host.indexOf(":"),this.hostname=a>0?this.host.substring(0,a):this.host,this.port=a>1?this.host.substring(a+1):""}replace(e){this.href=e}href="";origin="";protocol="";host="";hostname="";port="";pathname="";search="";hash=""}class n{static SetBackgroundColor(e,t,s){const i=n.TextureManager.GetColorTextureCached(t);let o;s&&(o=new r.ViewRoundCornerMask(s.topLeft,s.topRight,s.bottomLeft,s.bottomRight));const a=new r.ExternalTextureSetting(i,o);e.ResetTexture(a)}static SetBackgroundImage(e,t,s,i,a,l,c){let d,h={};if("string"==typeof t){const e=new o(t);if(e instanceof o==!1)throw Error("Bad Argument.",e);h.url=e.href}else"linear-gradient"==t?.type&&(h.gradient=t);if(h.gradient)if(h.gradient.colors?.length>2){const e=h.gradient.colors,t=[e[0],e[e.length-1]],s=e.slice(1,e.length-1);d=n.TextureManager.CreateLinearGradientTexture(t,s)}else 2==h.gradient.colors?.length?d=n.TextureManager.CreateMiniGradientTexture(!0,h.gradient.colors[0],h.gradient.colors[1],h.gradient.rawValue):console.warn("Failed to create backgroundImage gradient, bad colors.",h.gradient.colors);else h.url&&(d=h.url.includes(".gif")||h.url.includes(".webp")?n.TextureManager.GetGifImage(h.url,!1,null,c):n.TextureManager.GetImage2(h.url,!1,a,l||r.ColorSpace.RGBA_8888));if(d){let t;s&&(t=new r.ViewRoundCornerMask(s.topLeft,s.topRight,s.bottomLeft,s.bottomRight));const o=new r.ExternalTextureSetting(d,t);if(e.ResetTexture(o),i){let t=d.RegisterLoadImageCallback(null,(function(){i({width:d.Width,height:d.Height})}));e.RegisterDetachCallback((()=>{d.UnregisterLoadImageCallback(t)}))}}}static SetMaskedBackgroundImage(e,t,s,i){if("string"==typeof t&&(t=new o(t)),t instanceof o==!1)throw Error("Bad Argument.",t);if("string"==typeof s&&(s=new o(s)),s instanceof o==!1)throw Error("Bad Argument(MaskURL).",s);const a=n.TextureManager.GetImage2(t.href,!1,null,i||r.ColorSpace.RGBA_8888);if(a){const t=n.TextureManager.GetImage2(s.href,!1,null,r.ColorSpace.RGBA_8888),i=new r.ExternalTextureSetting(a,new r.ViewTextureMask(t));e.ResetTexture(i)}}static SetVideoTexture(e,t,s){const i=n.TextureManager.GetColorTexture(t);let o;s&&(o=new r.ViewRoundCornerMask(s.topLeft,s.topRight,s.bottomLeft,s.bottomRight));const a=new r.TextureSetting(i,o);e.ResetTexture(a)}static GetTextWidth(e){return e.str||(e.str=""),e.font||(e.font=r.TextUtils._sDefaultFont),e.size||(e.size=r.TextUtils._sDefaultFontSize),"italic"!==e.italic&&(e.italic=""),"bold"!==e.bold&&(e.bold=""),window.PlatformUtils.GetTextWidth(e)}static RequestSwap(){r.sRenderBridge.RequestSwap()}static SetImgTexSize(e,t){let s={size:t,refNum:0};n.TextureInfo.Cache[e.Source]=s}static RefImgTexSize(e,t){let s=n.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 i=n.TextureInfo.Cache[e.Source];if(i)i.refNum>0?i.refNum++:i.refNum=1;else{let t={size:s,refNum:1};n.TextureInfo.Cache[e.Source]=t}}))}static UnrefImgTexSize(e){if(!e)return;let t=n.TextureInfo.Cache[e.Source];t&&(t.refNum--,t.refNum<=0&&n.TextureInfo.Unused.add(e.Source))}static ClearUnusedTexSize(){for(let e of n.TextureInfo.Unused){let t=n.TextureInfo.Cache[e];t.refNum<-2?(delete n.TextureInfo.Cache[e],n.TextureInfo.Unused.delete(e)):t.refNum<=0?t.refNum--:n.TextureInfo.Unused.delete(e)}}}n.TextureInfo={Cache:{},Unused:new Set},n.TextureManager=null,n.RootView=null,n.RootActivity=null,n.HaltKeyEvent=!1,window.JsvCode.ForgeExtension||(window.JsvCode.ForgeExtension=n);var a=n=window.JsvCode.ForgeExtension;class l{static EnableEventListener(e){const t=window.JsvCode.Dom.PlatformBridge.JsViewId;window.JsvCode.Dom.PlatformBridge.SetOnEventListener(t,e)}static CreateElement(e,t){l.#e(l.#t.CreateElement,e,t)}static BindElementToRootView(e){l.#e(l.#t.BindElementToRootView,e)}static InsertElementChild(e,t,s){l.#e(l.#t.InsertElementChild,e,t,s)}static RemoveElementChild(e,t){l.#e(l.#t.RemoveElementChild,e,t)}static MoveElementChild(e,t,s,i){l.#e(l.#t.MoveElementChild,e,t,s,i)}static AddElementEventListener(e,t){l.#e(l.#t.AddElementEventListener,e,t)}static RemoveElementEventListener(e,t){l.#e(l.#t.RemoveElementEventListener,e,t)}static SetElementText(e,t){l.#e(l.#t.SetElementText,e,t)}static SetElementAttribute(e,t,s){l.#e(l.#t.SetElementAttribute,e,t,s),l.#s.has(e)&&l.#i.add(e)}static GetElementBoundingClientStyles(e,t){return l.#r(l.#t.GetElementBoundingClientStyles,e,t)}static SetForgeViewInnerProps(e,t,s){let i=0;(t=t.substr(12)).startsWith("mask-")&&(i=1,t=t.substr(5)),l.#e(l.#t.SetForgeViewInnerProps,e,t,i,""+s)}static DeclareStyleSheets(e){l.#e(l.#t.DeclareStyleSheets,-1,e)}static SetStyleProperty(e,t,s){l.#e(l.#t.SetStyleProperty,e,t,s),l.#s.has(e)&&l.#i.add(e)}static GetStyleProperties(e,t){return l.#r(l.#t.GetStyleProperties,e,t)}static AppendLazyTaskSyncedListener(e,t){l.#s.set(e,t)}static RemoveLazyTaskSyncedListener(e){l.#s.delete(e)}static RequestSwapAllCachedTasks(){if(0==l.#o.length)return;const e=JSON.stringify(l.#o);l.#o=[];const t=window.JsvCode.Dom.PlatformBridge.JsViewId;window.JsvCode.Dom.PlatformBridge.RunLazyTaskList(t,e);for(const e of l.#i){l.#s.get(e)?.()}l.#i.clear()}static GetElementAttribute(e,t){return l.#r(l.#t.GetElementAttribute,e,t)}static InsertKeyFrame(e,t){l.#e(l.#t.InsertKeyFrameDefine,-1,e,t)}static RemoveKeyFrame(e){l.#e(l.#t.RemoveKeyFrameDefine,-1,e)}static GetRelativePosition(e,t){const s=l.#r(l.#t.GetRelativePosition,e,t);return JSON.parse(s)}static#r(e,t,...s){l.RequestSwapAllCachedTasks();const i=window.JsvCode.Dom.PlatformBridge.JsViewId;return window.JsvCode.Dom.PlatformBridge.RunSyncTask(i,e,t,...s)}static#e(e,t,...s){l.#o.push([e,t,...s]),r.sRenderBridge.RequestSwap()}static#o=[];static#i=new Set;static#s=new Map;static#t={CreateElement:10,BindElementToRootView:11,InsertElementChild:12,RemoveElementChild:13,AddElementEventListener:14,RemoveElementEventListener:15,SetElementText:16,SetElementAttribute:17,GetElementBoundingClientStyles:18,GetElementAttribute:19,MoveElementChild:20,GetRelativePosition:21,DeclareStyleSheets:30,SetStyleProperty:31,GetStyleProperties:32,SetForgeViewInnerProps:40,InsertKeyFrameDefine:41,RemoveKeyFrameDefine:42}}class c{static CreateAudioPlayer(){return window.JsvCode.Media.PlatformBridge.CreateAudioPlayer()}static CreateVideoPlayer(){return window.JsvCode.Media.PlatformBridge.CreateVideoPlayer()}}class d{static Dom=l;static Media=c}class h{constructor(e){this.ownerDocument=window.document,this.nodeType=e,this.parentNode=void 0,this.childNodes=[]}jsvFinalize(){}appendChild(e){this.childNodes.push(e),e.parentNode=this,this.#n?.()}removeChild(e){let t=this.childNodes.indexOf(e);if(t<0)throw new DOMError("Failed to remove node, child node is not found. node=",e);this.childNodes.splice(t,1),e.parentNode=void 0,this.#n?.()}insertBefore(e,t){this.#a(e,t)}get previousSibling(){const e=this.parentNode.childNodes;let t=e.indexOf(this);if(t<0)throw new DOMError("Failed to call Node.previousSibling(), this node not found. this=",this);return e[t-1]}get nextSibling(){const e=this.parentNode.childNodes;let t=e.indexOf(this);if(t<0)throw new DOMError("Failed to call Node.nextSibling(), this node not found. this=",this);return e[t+1]}addEventListener(e,t,s){this.#l||(this.#l={});let i=this.#l[e];i||(i=new Set,this.#l[e]=i),i.add(t)}removeEventListener(e,t,s){if(!this.#l)return;let i=this.#l[e];i&&(i.delete(t),i.size<=0&&this.#l.hasOwnProperty(e)&&delete this.#l[e],0===Object.values(this.#l).length&&(this.#l=void 0))}dispatchEvent(e){if(!this.#l)return void console.warn("Node.dispatchEvent() Ignore to dispatch event: "+e.type+". No event added.");let t=this.#l[e.type];if(t){e.target||(e.target=document.activeElement);for(let s of t)s(e)}else console.warn("Node.dispatchEvent() Ignore to dispatch event: "+e.type+". No listener added.")}jsvObserveChildChanged(e){this.#n=e}jsvMoveChildToNewParent(e,t,s){let i=this.childNodes.indexOf(e);i<0&&Log.Throw("Failed to call Node.removeChild(), node not found. node=",e),this.childNodes.splice(i,1),e.parentNode=void 0,this.jsvChildChangedCallback?.(),t.#a(e,s)}#a(e,t){let s=this.childNodes.length;if(void 0===t)throw new DOMError("TypeError: Failed to execute 'insertBefore' on 'Node': 2 arguments required, but only 1 present.");if(null!==t&&(s=this.childNodes.indexOf(t)),s<0)throw new DOMError("Failed to call insert node, before node not found. beforeNode=",t);this.childNodes.splice(s,0,e),e.parentNode=this,this.#n?.()}#l=void 0;#n=void 0;static ELEMENT_NODE=1;static TEXT_NODE=3;static COMMENT_NODE=8;static DOCUMENT_NODE=9;static NOLAYOUT_NODE=10}class u{static Layout=class{static Height="height";static Left="left";static Top="top";static Width="width";constructor(){throw new Error("new StyleName.Layout() is forbidden.")}};static Background=class{static BackgroundColor="backgroundColor";static BackgroundImage="backgroundImage";static BorderRadius="borderRadius";constructor(){throw new Error("new StyleName.Background() is forbidden.")}};static Effect=class{static BackfaceVisibility="backfaceVisibility";static BorderImage="borderImage";static BorderImageWidth="borderImageWidth";static BorderImageOutset="borderImageOutset";static Display="display";static ObjectFit="objectFit";static Opacity="opacity";static Overflow="overflow";static Perspective="perspective";static PerspectiveOrigin="perspectiveOrigin";static Transform="transform";static TransformOrigin="transformOrigin";static TransformStyle="transformStyle";static Visibility="visibility";static ZIndex="zIndex";constructor(){throw new Error("new StyleName.Effect() is forbidden.")}};static Text=class{static Color="color";static FontFamily="fontFamily";static FontSize="fontSize";static FontStyle="fontStyle";static FontWeight="fontWeight";static LineHeight="lineHeight";static TextAlign="textAlign";static TextOverflow="textOverflow";static TextShadow="textShadow";static WebkitTextStroke="WebkitTextStroke";static WhiteSpace="whiteSpace";static WordWrap="wordWrap";static Direction="direction";static JsvTextEmoji="JsvTextEmoji";static JsvTextLatex="JsvTextLatex";static JsvTextAlignMinWidth="JsvTextAlignMinWidth";static JsvTextVerticalAlign="JsvTextVerticalAlign";static JsvTextLineAlign="JsvTextLineAlign";static JsvTextInnerDirection="JsvTextInnerDirection";constructor(){throw new Error("new StyleName.Text() is forbidden.")}};static Motion=class{static Animation="animation";static Transition="transition";constructor(){throw new Error("new StyleName.Motion() is forbidden.")}};static HasGetterMethod(e){switch(e){case u.Layout.Height:case u.Layout.Left:case u.Layout.Top:case u.Layout.Width:case u.Effect.ObjectFit:return!0;default:return!1}}static ToConst(e){return e==u.Layout.Height?u.Layout.Height:e==u.Layout.Left?u.Layout.Left:e==u.Layout.Top?u.Layout.Top:e==u.Layout.Width?u.Layout.Width:e==u.Background.BackgroundColor?u.Background.BackgroundColor:e==u.Background.BackgroundImage?u.Background.BackgroundImage:e==u.Background.BorderRadius?u.Background.BorderRadius:e==u.Effect.BackfaceVisibility?u.Effect.BackfaceVisibility:e==u.Effect.BorderImage?u.Effect.BorderImage:e==u.Effect.BorderImageWidth?u.Effect.BorderImageWidth:e==u.Effect.BorderImageOutset?u.Effect.BorderImageOutset:e==u.Effect.Display?u.Effect.Display:e==u.Effect.ObjectFit?u.Effect.ObjectFit:e==u.Effect.Opacity?u.Effect.Opacity:e==u.Effect.Overflow?u.Effect.Overflow:e==u.Effect.Perspective?u.Effect.Perspective:e==u.Effect.PerspectiveOrigin?u.Effect.PerspectiveOrigin:e==u.Effect.Transform?u.Effect.Transform:e==u.Effect.TransformOrigin?u.Effect.TransformOrigin:e==u.Effect.TransformStyle?u.Effect.TransformStyle:e==u.Effect.Visibility?u.Effect.Visibility:e==u.Effect.ZIndex?u.Effect.ZIndex:e==u.Text.Color?u.Text.Color:e==u.Text.FontFamily?u.Text.FontFamily:e==u.Text.FontSize?u.Text.FontSize:e==u.Text.FontStyle?u.Text.FontStyle:e==u.Text.FontWeight?u.Text.FontWeight:e==u.Text.LineHeight?u.Text.LineHeight:e==u.Text.TextAlign?u.Text.TextAlign:e==u.Text.TextOverflow?u.Text.TextOverflow:e==u.Text.TextShadow?u.Text.TextShadow:e==u.Text.WebkitTextStroke?u.Text.WebkitTextStroke:e==u.Text.WhiteSpace?u.Text.WhiteSpace:e==u.Text.WordWrap?u.Text.WordWrap:e==u.Text.Direction?u.Text.Direction:e==u.Text.JsvTextEmoji?u.Text.JsvTextEmoji:e==u.Text.JsvTextLatex?u.Text.JsvTextLatex:e==u.Text.JsvTextAlignMinWidth?u.Text.JsvTextAlignMinWidth:e==u.Text.JsvTextVerticalAlign?u.Text.JsvTextVerticalAlign:e==u.Text.JsvTextLineAlign?u.Text.JsvTextLineAlign:e==u.Text.JsvTextInnerDirection?u.Text.JsvTextInnerDirection:e==u.Motion.Animation?u.Motion.Animation:e==u.Motion.Transition?u.Motion.Transition:null}constructor(){throw new Error("new StyleName() is forbidden.")}}class v{static Base=class{constructor(e){this.rawValue=e}rawValue};static AnimationImpl=class extends v.Base{constructor(e){super(e)}name="";duration=0;timingFunction=null;delay=0;iterationCount=0;direction=!1};static CornerImpl=class extends v.Base{constructor(e){super(e)}topLeft=0;topRight=0;bottomRight=0;bottomLeft=0};static RectImpl=class extends v.Base{constructor(e){super(e)}top=0;right=0;left=0;bottom=0};static TextShadowImpl=class extends v.Base{constructor(e){super(e)}hShadow=0;vShadow=0;blur=0;color=void 0};static WebkitTextStrokeImpl=class extends v.Base{constructor(e){super(e)}length=0;color=void 0};static TransitionImpl=class extends v.Base{constructor(e){super(e)}animationMap=new Map};static BorderImageImpl=class extends v.Base{constructor(e){super(e)}source="";slice=null};static DataType=class{static Null=0;static Int32=1;static Float=2;static String=3;static Animation=4;static Corner=5;static Rect=6;static TextShadow=7;static WebkitTextStroke=8;static Transition=9;static BorderImage=10};static InvalidInt32=Number.MIN_VALUE;static InvalidFloat=Number.NaN;static InvalidPointer=null;constructor(e){let t=-1,s=null;null==e?t=v.DataType.Null:Number(e)===e&&e%1==0?t=v.DataType.Int32:Number(e)===e&&e%1!=0?t=v.DataType.Float:"string"==typeof e||e instanceof String?t=v.DataType.String:e instanceof v.AnimationImpl?t=v.DataType.Animation:e instanceof v.CornerImpl?t=v.DataType.Corner:e instanceof v.RectImpl?t=v.DataType.Rect:e instanceof v.TextShadowImpl?t=v.DataType.TextShadow:e instanceof v.WebkitTextStrokeImpl?t=v.DataType.WebkitTextStroke:e instanceof v.TransitionImpl?t=v.DataType.Transition:e instanceof v.BorderImageImpl&&(t=v.DataType.BorderImage),e!=v.InvalidInt32&&e!=v.InvalidFloat&&e!=v.InvalidPointer?s=e:(t=v.DataType.Null,s=null),this.data=new v.DataInfo,this.data.index=t,this.data.value=s}is(e){return this.data.index==e}get(){return this.data.value}reset(e){this.data.value=e.data.value,this.data.index=e.data.index}equals(e){return this.data.value===e.data.value&&this.data.index===e.data.index}static DataInfo=class{value=null;index=-1};data}class m{static JsvDeclarePrototype(){for(let e in u){let t=u[e];for(let e in t){let s=t[e];if("string"!=typeof s)continue;const i={set:function(e){this.setProperty(s,e)},get:function(){return this.getPropertyValue(s)}};Object.defineProperty(m.prototype,s,i)}}}constructor(e){this.#c=e}setProperty(e,t){if(document.jsvCheckStyleFormat?.(e,t),e==u.Background.BackgroundImage&&t){t=new o(t).href}else e==u.Effect.Display&&(this.#d[e]=t);if(e==u.Effect.BorderImage&&t){const e=t.split(" ");e.length>0&&(e[0]=new o(e[0]).href),t=e.join(" ")}d.Dom.SetStyleProperty(this.#c,e,t)}getPropertyValue(e){if(e==u.Effect.Display)return this.#d[e];throw console.error("StyleDeclaration.getPropertyValue() propName="+e),new Error("Get style value is unimplemented because it's low performance.")}jsvGetProperties(...e){const t=JSON.stringify(e),s=d.Dom.GetStyleProperties(this.#c,t);return JSON.parse(s)}#c;#d={}}class f extends t{constructor(e){super(e)}}class g extends h{static JsvTagName={Anchor:"A",Audio:"AUDIO",Div:"DIV",Head:"HEAD",Img:"IMG",IFrame:"IFRAME",Link:"LINK",Script:"SCRIPT",Style:"STYLE",Svg:"SVG",Video:"VIDEO",JsvAudioTrack:"JSV-AUDIOTRACK",JsvFDiv:"FDIV"};static JsvEnableEventListener(){d.Dom.EnableEventListener((function(e,t,s){const i=g.#h[e]?.[t];i?.(t,s)}))}constructor(e){super(h.ELEMENT_NODE),this.tagName=e,this.tagName!=g.JsvTagName.Link&&this.tagName!=g.JsvTagName.Script&&this.tagName!=g.JsvTagName.Style&&(this.jsvNativeId=++g.#u,this.style=new m(this.jsvNativeId),d.Dom.CreateElement(this.jsvNativeId,e)),this.jsvAttrStore={}}appendChild(e){e.parentNode?this.#v(e,null):(super.appendChild(e),this.#m(e,null))}removeChild(e){super.removeChild(e),this.#f(e),e.jsvNativeId&&d.Dom.RemoveElementChild(this.jsvNativeId,e.jsvNativeId)}insertBefore(e,t){e.parentNode?this.#v(e,t):(super.insertBefore(e,t),this.#m(e,t))}addEventListener(e,t,s){super.addEventListener(e,t,s),this.jsvNativeId&&(this.#g(this.jsvNativeId,e),d.Dom.AddElementEventListener(this.jsvNativeId,e))}removeEventListener(e,t,s){this.jsvNativeId&&(this.#p(this.jsvNativeId,e),d.Dom.RemoveElementEventListener(this.jsvNativeId,e)),super.removeEventListener(e,t,s)}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)}get clientWidth(){return this.jsvAttrStore.clientWidth||(this.jsvAttrStore.clientWidth=d.Dom.GetElementAttribute(this.jsvNativeId,"clientWidth")),this.jsvAttrStore.clientWidth}get clientHeight(){return this.jsvAttrStore.clientHeight||(this.jsvAttrStore.clientHeight=d.Dom.GetElementAttribute(this.jsvNativeId,"clientHeight")),this.jsvAttrStore.clientHeight}setAttribute(e,t){e&&(this.jsvAttrStore[e]=t,this.jsvNativeId&&(e.startsWith("data-jsv-vw-")?d.Dom.SetForgeViewInnerProps(this.jsvNativeId,e,t):("class"===e||e.startsWith("data-v-")||e.startsWith("data-jsv")||e.startsWith("dataJsv"))&&d.Dom.SetElementAttribute(this.jsvNativeId,e,t)))}removeAttribute(e){delete this.jsvAttrStore[e],("class"==e||e.startsWith("data-v-")||"src"==e)&&this.jsvNativeId&&d.Dom.SetElementAttribute(this.jsvNativeId,e,null)}getAttribute(e){return this.jsvAttrStore[e]}hasAttribute(e){return!!this.jsvAttrStore[e]}focus(){document.activeElement&&document.activeElement.onfocus();let e=document.activeElement;if(document.activeElement=this,e){let t=new i(i.JsvType.Blur);t.target=e,document.dispatchEvent(t)}let t=new i(i.JsvType.Focus);document.dispatchEvent(t)}getBoundingClientRect(){return new Promise(((e,t)=>{const s=this.jsvGetProxyView();s.RegisterOnProxyReady((()=>{s.GetBoundingClientRect().then((t=>{e(t)}),(e=>{t(e)}))}))}))}jsvSetOnLazyTaskSyncedListener(e){d.Dom.AppendLazyTaskSyncedListener(this.jsvNativeId,e)}jsvOnEvent(e,...t){let i;e.startsWith("animation")?(i=new s(e),i.target=this,i.animationName=t[0]):e.startsWith("transition")&&(i=new f(e),i.target=this,i.propertyName=t[0]),i&&this.dispatchEvent(i)}jsvGetProxyView(e){return e?(this._MaskViewProxy||(this._MaskViewProxy=r.NewDomProxyView(this.jsvNativeId,!0)),this._MaskViewProxy):(this._MainViewProxy||(this._MainViewProxy=r.NewDomProxyView(this.jsvNativeId,!1)),this._MainViewProxy)}jsvGetProxyTexture(e){return this._MainViewTextureProxy||(this._MainViewTextureProxy=e.GetDomProxyTexture(this.jsvNativeId)),this._MainViewTextureProxy}jsvGetRelativePosition(e){return d.Dom.GetRelativePosition(this.jsvNativeId,e.jsvNativeId)}#g(e,t){let s=g.#h[e];s||(s=new Set,g.#h[e]=s),s[t]=this.jsvOnEvent.bind(this)}#p(e,t){let s=g.#h[e];s&&delete s[t]}#v(e,t){let s=e.parentNode;s.jsvMoveChildToNewParent(e,this,t),this.#y(s,e,t)}#y(e,t,s){t.jsvNativeId&&(s=g.#w(s),d.Dom.MoveElementChild(this.jsvNativeId,e.jsvNativeId,t.jsvNativeId,s?.jsvNativeId))}#m(e,t){e.parentNode=this,e.nodeType===h.TEXT_NODE?this.textContent=e.nodeValue:e.jsvNativeId&&(t=g.#w(t),d.Dom.InsertElementChild(this.jsvNativeId,e.jsvNativeId,t?.jsvNativeId))}#f(e){for(const t of e.childNodes)e.#f(t);e.jsvFinalize(),d.Dom.RemoveLazyTaskSyncedListener(e.jsvNativeId),delete g.#h[e.jsvNativeId]}static#w(e){let t=e;for(;t&&!(t instanceof g);)t=t.nextSibling;return t}parentNode;tagName;style;jsvNativeId;jsvAttrStore;static#h={};static#u=0}class p extends g{static JsvDeclareProperties(){for(const[e,t]of Object.entries(p.#T)){let s={};t.set&&(s.set=function(t){if("src"===e){t=new o(t).href}this.jsvOnSetter(e,t)}),t.get&&(s.get=function(){return this.jsvOnGetter(e)}),Object.defineProperty(p.prototype,e,s)}for(const e of p.#E){let t={set:function(t){t?this.addEventListener(e,t):this.removeEventListener(e,this.jsvEventMap[e]),this.jsvEventMap[e]=t},get:function(){this.jsvEventMap[e]}};Object.defineProperty(p.prototype,"on"+e,t)}for(const e of p.#D){const t=function(...t){this.jsvMediaPlayer[e](t)};p.prototype[e]=t}}constructor(e){super(e),Promise.resolve().then((()=>{this.jsvMediaPlayer&&this.jsvMediaPlayer.confirmInitSetup?.()}))}jsvFinalize(){this.jsvMediaPlayer.pause(),this.jsvMediaPlayer.unload(),this.jsvMediaPlayer.releaseResource?.(),this.jsvMediaPlayer.onPlatformDestroy?.(),this.jsvMediaPlayer=null}addEventListener(e,t,s){super.addEventListener(e,t,s),this.jsvNativeId&&p.#E.includes(e)&&this.jsvMediaPlayer.addEventListener(e,(()=>{this.onMediaPlayerEvent(e)}))}removeEventListener(e,t,s){this.jsvNativeId&&p.#E.includes(e)&&this.jsvMediaPlayer.removeEventListener(e,t),super.removeEventListener(e,t,s)}jsvOnSetter(e,t){if(e in p.#T==0)throw new DomError("Failed to set "+e);this.jsvMediaPlayer[e]=t}jsvOnGetter(e){if(e in p.#T==0)throw new DomError("Failed to get "+e);return this.jsvMediaPlayer[e]}onMediaPlayerEvent(e){let s=new t(e);s.target=this,s&&this.dispatchEvent(s)}static#T={autoplay:{set:!0,get:!0},currentTime:{set:!0,get:!0},muted:{set:!0,get:!0},playbackRate:{set:!0,get:!0},volume:{set:!0,get:!0},timeupdateless:{set:!0,get:!0},predownload:{set:!0,get:!0},preload:{set:!0,get:!0},duration:{set:!1,get:!0},error:{set:!1,get:!0},paused:{set:!1,get:!0},loop:{set:!0,get:!1},src:{set:!0,get:!1}};static#E=["abort","canplay","canplaythrough","durationchange","ended","error","load","loadedmetadata","loadstart","pause","play","playing","seeking","seeked","stalled","timeupdate"];static#D=["load","pause","play","unload","confirmInitSetup"];jsvMediaPlayer=null;jsvEventMap={}}class y extends p{constructor(){super(Element.JsvTagName.Audio),this.jsvMediaPlayer=d.Media.CreateAudioPlayer()}}class w extends h{constructor(e){super(h.COMMENT_NODE),this.textContent=e}}class T extends g{constructor(){super(g.JsvTagName.Div)}get textContent(){return this.#N}set textContent(e){this.#N=e,d.Dom.SetElementText(this.jsvNativeId,e)}#N}class E{constructor(e,t){this.RouterDelegate={ref:null},e||(this.RouterDelegate.ref=new D(!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(N.sLastFocus)}getCurrentFocusStack(){const e=[];if(this.RouterDelegate.ref){let t=this.RouterDelegate.ref.getCurrentFocusNode();for(;t&&t instanceof N&&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 D{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 r=!1;for(let t in i._ChildMap){let o=i._ChildMap[t].RouterDelegate.ref;if(o!=i&&o.NameSpace==e[s]){i=o,s++,r=!0;break}}if(!r)return void console.error(`Error: no found subpath fname=${t}`)}let r=e[s];return i._ChildMap.hasOwnProperty(r)?i._ChildMap[r]: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 N extends r.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 E(!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 D(!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 N.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 N)){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 N.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()}}N.sFocusMemos=[],N.sLastFocus=null,N.sRootPageNode=null;let x=()=>{let e=N.sFocusMemos.length;if(e>0){let t=N.sFocusMemos;N.sFocusMemos=[];for(let s=0;s<e;s++)t[s].obj.Focus(t[s].bcf)}},S={};class C{constructor(e,t,s){this._Element=s,S.hasOwnProperty(e)&&console.error(`Warn: FDivRoot duplicate name=${e}`),S[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(a.RootActivity,a.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 b extends g{constructor(){super(g.JsvTagName.Img)}setAttribute(e,t){if("src"===e){t=new o(t).href}super.setAttribute(e,t),this.jsvNativeId&&"src"===e&&d.Dom.SetElementAttribute(this.jsvNativeId,e,t)}jsvOnEvent(e,...s){let i;super.jsvOnEvent(e,...s),"load"==e&&(i=new t(e),i.target=this),i&&this.dispatchEvent(i)}}class L extends g{constructor(){super(g.JsvTagName.Link),this.src=null,this.onerror=null,this.onload=null}setAttribute(e,t){this[e]=t}jsvLoadResource(){let e=!1,t=null;if(null!=this.href){var s=new o(this.href);console.log("Ignore to load link from url="+s.href),e=!0}else console.warn("Failed to load link, href is not exists."),t="NoSrc";this.jsvOnLoadResult(e,t)}jsvOnLoadResult(e,s){if(console.log("Load link result: isSuccess:"+e+", errCode:"+s),e){if(this.onload){let e=new t("load");this.onload(e)}}else this.onerror&&this.onerror({type:"jsvErr_"+s,target:this})}}class P extends g{constructor(){super(g.JsvTagName.Script)}setAttribute(e,t){this[e]=t}jsvLoadResource(){if(null!=this.src){var e=new o(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,s){if(console.log("Load script result: isSuccess:"+e+", errCode:"+s),e){if(this.onload){let e=new t("load");this.onload(e)}}else this.onerror&&this.onerror({type:"jsvErr_"+s,target:this})}src=null;onerror=null;onload=null;charset=null;timeout=120}class I extends g{constructor(){super(g.JsvTagName.Style),this.jsvAttrStore={left:0,top:0,width:0,height:0}}}class j extends g{constructor(){super(g.JsvTagName.Svg)}}class R extends h{constructor(e){super(h.TEXT_NODE),this.textContent=e}get nodeValue(){return this.textContent}set nodeValue(e){this.textContent=e,this.parentNode&&(this.parentNode.textContent=this.textContent)}}class M extends p{constructor(){super(Element.JsvTagName.Video),super.jsvMediaPlayer=d.Media.CreateVideoPlayer(),this.#x={left:0,top:0,width:0,height:0,objectFit:null},this.jsvSetOnLazyTaskSyncedListener(this.jsvOnLazyTaskSynced.bind(this))}jsvFinalize(){this.jsvMediaPlayer.jsvFinalize()}jsvGetBoundingClientStyles(...e){const t=JSON.stringify(e),s=d.Dom.GetElementBoundingClientStyles(this.jsvNativeId,t);return JSON.parse(s)}jsvOnLazyTaskSynced(){const e=this.jsvGetBoundingClientStyles(u.Layout.Left,u.Layout.Top,u.Layout.Width,u.Layout.Height,u.Effect.ObjectFit,u.Effect.Visibility);let t=!1;this.#x.left!=e.left&&(this.#x.left=e.left,t=!0),this.#x.top!=e.top&&(this.#x.top=e.top,t=!0),this.#x.width!=e.width&&(this.#x.width=e.width,t=!0),this.#x.height!=e.height&&(this.#x.height=e.height,t=!0),this.#x.objectFit!=e.objectFit&&(this.#x.objectFit=e.objectFit,t=!0),this.#x.visibility!=e.visibility&&(this.#x.visibility=e.visibility,t=!0),t?this.jsvMediaPlayer.jsvOnCssStyleChanged(this.jsvNativeId,this.#x):console.log("VideoElement.jsvOnLazyTaskSynced() style is not changed.")}#x}class k extends p{constructor(){super(Element.JsvTagName.JsvAudioTrack),this.jsvMediaPlayer=d.Media.CreateAudioPlayer("AudioTrack")}}let O=1;class F extends g{constructor(){super(g.JsvTagName.JsvFDiv),this.FocusNodeRef=new N(""+O++),this.HubRef=void 0}setAttribute(e,t){if(e)if("fname"===e)t&&this.FocusNodeRef.setBranchName(t);else if("new-namespace"===e&&""!==t&&!this.HubRef){let e=new E(!1,t);this.HubRef=e,this.FocusNodeRef.setHub(e),this.FocusNodeRef.setBranchName(t)}}removeAttribute(e){}jsvGetHub(){return this.HubRef}}class J extends h{constructor(){super(h.DOCUMENT_NODE),this.location=window.location,this.rootElement=new T,this.rootElement.ownerDocument=this,this.rootElement.id="root",d.Dom.BindElementToRootView(this.rootElement.jsvNativeId),this.activeElement=this.rootElement,this.head=null}createComment(e){return new w(e)}createElement(e){switch(e=e.toUpperCase()){case g.JsvTagName.Audio:return new y;case g.JsvTagName.AudioTrack:return new AudioTrackElement;case g.JsvTagName.Div:return new T;case g.JsvTagName.Img:return new b;case g.JsvTagName.Link:return new L;case g.JsvTagName.Script:return new P;case g.JsvTagName.Style:return new I;case g.JsvTagName.Svg:return new j;case g.JsvTagName.Video:return new M;case g.JsvTagName.JsvAudioTrack:return new k;case g.JsvTagName.JsvFDiv:return new F;case g.JsvTagName.IFrame:console.error("Unsupported element: "+e+". Your vue compilation may may have failed, please check it first.")}if("TEMPLATE"==e)return{};throw new TypeError("Unimplemented element: "+e)}createEvent(e){return new t(e)}createTextNode(e){return new R(e)}getElementById(e){if("root"===e||"app"===e)return this.rootElement;throw new DOMError("Failed to get element by id, id="+e+" is UNIMPLEMENTED.")}getElementsByTagName(e){if((e=e.toUpperCase())===g.JsvTagName.Head)return[this.head];if(e===g.JsvTagName.Link||e===g.JsvTagName.Script||e===g.JsvTagName.Style)return[];throw new DOMError("Failed to get element by name, 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;throw new DOMError("Failed to query selector, selectors="+e+" is UNIMPLEMENTED.")}querySelectorAll(e){return[]}jsvInitFDivRoot(e,t,s){if(!s){let e=document.createElement("fdiv");this.rootElement.appendChild(e),this.rootElement=e,s=this.rootElement}return new C(e,t,s)}}class _ extends g{constructor(){super(g.JsvTagName.Head)}appendChild(e){super.appendChild(e),(e instanceof L||e instanceof P)&&e.jsvLoadResource()}removeChild(e){super.removeChild(e)}}let B="@keyframes",A=B.length;class V{constructor(e){this._AnchorTag=e,this._NamesCache=new Set}insertRule(e){let t=this.#S(e);this._NamesCache.has(t)&&console.warn(`Warn: keyframe replace of name ${t}`),this._NamesCache.add(t),d.Dom.InsertKeyFrame(t,e)}hasRule(e){return this._NamesCache.has(e)}removeRule(e){this._NamesCache.has(e)?(this._NamesCache.delete(e),d.Dom.RemoveKeyFrame(e)):console.error(`Error: keyFrame(${e}) is not exist.`)}removeMultiRules(e){for(let t of e)this.removeRule(t)}#S(e){let t=e.indexOf(B)+A,s=e.indexOf("{");return e.substring(t,s).trim()}}let z=null;function G(e){return z||(z={global:new V("global")}),z.global}class K{static EnsureGlobalEnv(e,t){const s=window.navigator?.userAgent?.toLowerCase();window.jsvInAndroidWebView=s?.indexOf("android")>=0,K.#C(e,t),g.JsvEnableEventListener(),p.JsvDeclareProperties(),m.JsvDeclarePrototype()}static#C(e,t){window.JsvCode||(window.JsvCode={}),window.JsvCode.Dom||(window.JsvCode.Dom={}),window.JsvCode.Media||(window.JsvCode.Media={}),window.JsvCode.Dom.PlatformBridge||(window.JsvCode.Dom.PlatformBridge=e),window.JsvCode.Media.PlatformBridge||(window.JsvCode.Media.PlatformBridge=t),window.JsvCode.Dom.DeclareStyleSheets||(window.JsvCode.Dom.DeclareStyleSheets=d.Dom.DeclareStyleSheets),window.JsvCode.Dom.getKeyFrameGroup||(window.JsvCode.Dom.getKeyFrameGroup=G)}}class W{static SetLevel(e){switch(W.E=W.W=W.I=W.D=function(){},e){case W.Level.Verbose:W.V=console.debug.bind(console);case W.Level.Debug:W.D=console.debug.bind(console);case W.Level.Info:W.I=console.info.bind(console)}}static E=console.error.bind(console);static W=console.warn.bind(console);static I=console.info.bind(console);static D=function(){};static V=function(){};static Level={Error:0,Warning:1,Info:2,Debug:3,Verbose:4}}class U extends t{constructor(e){super(e),this.keyCode=-1,this.key=-1,this.repeat=0}}class H{constructor(e){this.callback=e}observe(e,t){if(!(e instanceof h))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}}class q extends J{constructor(){super(),this.head=new _}}class ${static DeclareGlobal(){$.#b(),$.#L(),$.#P()}static#b(){window.document=new q}static#L(){window.MutationObserver=H,window.Element=g,window.SVGElement=j;let e=new o(window.JsView.getAppUrl(),!0);window.location.applyUrlInfo?window.location.applyUrlInfo(e):window.location=e,window.history={},window.navigator={userAgent:"jsview-runtime"}}static#P(){window.JsView.Dom={Render:null,Extension:null,UrlRef:o}}}class Y{constructor(e){this.activity=new r.ReactActivity("NativeForgeActivity",e,this.OnKeyDown.bind(this),this.OnKeyUp.bind(this)),this.#I()}OnKeyDown(e){if(a.HaltKeyEvent){let t=new U(U.Type.KEYDOWN);return t.keyCode=e.keyCode,t.repeat=e.repeat,document.dispatchEvent(t),!0}return!1}OnKeyUp(e){if(a.HaltKeyEvent){let t=new U(U.Type.KEYUP);return t.keyCode=e.keyCode,t.key=U.JsvGetKeyFromCode(t.keyCode),t.repeat=e.repeat,document.dispatchEvent(t),!0}return!1}#I(){console.log("create NativeForgeActivity."),a.TextureManager=this.activity.GetTextureManager(),a.RootView=new r.LayoutView,a.RootActivity=this.activity;let e=null;r.DesignMap&&(e=r.DesignMap());let t=e?e.width:1280,s=Math.floor(9*t/16);this.activity.SetContentView(a.RootView,{x:0,y:0,width:t,height:s}),r.sRenderBridge.AddWillSwapListener("forgeSwap",(()=>{d.Dom.RequestSwapAllCachedTasks()})),window.JsView.Dom.Render()}}class X{constructor(e){this.activityManager=e;let t=new Y(e);e.RegisterActivity(t.activity),e.StartActivity(new r.Intent("NativeForgeActivity"))}}window.jsvIsBrowserDebug=!1;const Z=window.JsvCode.NativePlatformDomBridge,Q=window.JsvCode.NativePlatformMediaBridge;function ee(){K.EnsureGlobalEnv(Z,Q),$.DeclareGlobal(),W.I("Using JsView Native Environment.")}export{a as ForgeExtension,ee as InitEnv,X as NativeForgeApp};
|
|
1
|
+
/* eslint-disable */ class e{static CreateAudioPlayer(e){return new Audio(e)}static CreateVideoPlayer(){const t=new Video;return t.jsvOnCssStyleChanged=e.OnCssStyleChanged.bind(t),t.jsvFinalize=e.JsvFinalize.bind(t),t}static OnCssStyleChanged(e,t){this.jsvSetStyles(t.left,t.top,t.width,t.height,t.objectFit,t.visibility)}static JsvFinalize(){console.log("NativePlatformMediaBridge.JsvFinalize()");const e=this;e.pause(),e.unload?.(),e.releaseResource&&(e.releaseResource(),e.onPlatformDestroy())}}window.JsvCode.NativePlatformMediaBridge||(window.JsvCode.NativePlatformMediaBridge=e);class t{constructor(e,t){this.target=t,this.timeStamp=Date.now(),this.type=e}}class s extends t{constructor(e){super(e)}}class i extends t{constructor(e){super(e)}}void 0===window.Forge?(window.Forge={},console.log("Define forge browser")):console.log("Define using JsView forge engine-js");var r=window.Forge;class o{constructor(e,t){if(!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("./")&&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)}e=window.JsView.Dom.MainPath+e.substring(1)}if(this.href=e,!t)return;let i=this.href,r=i.indexOf("#");r>0&&(this.hash=i.substring(r),i=i.substring(0,r));let o=i.indexOf("?");o>1&&(this.search=i.substring(o),i=i.substring(0,o));let n=i,a=n.indexOf("://");this.protocol=a>0?n.substring(0,a+1):"";let l=a>1?n.substring(a+3):"";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:"",a=this.host.indexOf(":"),this.hostname=a>0?this.host.substring(0,a):this.host,this.port=a>1?this.host.substring(a+1):""}replace(e){this.href=e}href="";origin="";protocol="";host="";hostname="";port="";pathname="";search="";hash=""}class n{static SetBackgroundColor(e,t,s){const i=n.TextureManager.GetColorTextureCached(t);let o;s&&(o=new r.ViewRoundCornerMask(s.topLeft,s.topRight,s.bottomLeft,s.bottomRight));const a=new r.ExternalTextureSetting(i,o);e.ResetTexture(a)}static SetBackgroundImage(e,t,s,i,a,l,c){let d,h={};if("string"==typeof t){const e=new o(t);if(e instanceof o==!1)throw Error("Bad Argument.",e);h.url=e.href}else"linear-gradient"==t?.type&&(h.gradient=t);if(h.gradient)if(h.gradient.colors?.length>2){const e=h.gradient.colors,t=[e[0],e[e.length-1]],s=e.slice(1,e.length-1);d=n.TextureManager.CreateLinearGradientTexture(t,s)}else 2==h.gradient.colors?.length?d=n.TextureManager.CreateMiniGradientTexture(!0,h.gradient.colors[0],h.gradient.colors[1],h.gradient.rawValue):console.warn("Failed to create backgroundImage gradient, bad colors.",h.gradient.colors);else h.url&&(d=h.url.includes(".gif")||h.url.includes(".webp")?n.TextureManager.GetGifImage(h.url,!1,null,c):n.TextureManager.GetImage2(h.url,!1,a,l||r.ColorSpace.RGBA_8888));if(d){let t;s&&(t=new r.ViewRoundCornerMask(s.topLeft,s.topRight,s.bottomLeft,s.bottomRight));const o=new r.ExternalTextureSetting(d,t);if(e.ResetTexture(o),i){let t=d.RegisterLoadImageCallback(null,(function(){i({width:d.Width,height:d.Height})}));e.RegisterDetachCallback((()=>{d.UnregisterLoadImageCallback(t)}))}}}static SetMaskedBackgroundImage(e,t,s,i){if("string"==typeof t&&(t=new o(t)),t instanceof o==!1)throw Error("Bad Argument.",t);if("string"==typeof s&&(s=new o(s)),s instanceof o==!1)throw Error("Bad Argument(MaskURL).",s);const a=n.TextureManager.GetImage2(t.href,!1,null,i||r.ColorSpace.RGBA_8888);if(a){const t=n.TextureManager.GetImage2(s.href,!1,null,r.ColorSpace.RGBA_8888),i=new r.ExternalTextureSetting(a,new r.ViewTextureMask(t));e.ResetTexture(i)}}static SetVideoTexture(e,t,s){const i=n.TextureManager.GetColorTexture(t);let o;s&&(o=new r.ViewRoundCornerMask(s.topLeft,s.topRight,s.bottomLeft,s.bottomRight));const a=new r.TextureSetting(i,o);e.ResetTexture(a)}static GetTextWidth(e){return e.str||(e.str=""),e.font||(e.font=r.TextUtils._sDefaultFont),e.size||(e.size=r.TextUtils._sDefaultFontSize),"italic"!==e.italic&&(e.italic=""),"bold"!==e.bold&&(e.bold=""),window.PlatformUtils.GetTextWidth(e)}static RequestSwap(){r.sRenderBridge.RequestSwap()}static SetImgTexSize(e,t){let s={size:t,refNum:0};n.TextureInfo.Cache[e.Source]=s}static RefImgTexSize(e,t){let s=n.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 i=n.TextureInfo.Cache[e.Source];if(i)i.refNum>0?i.refNum++:i.refNum=1;else{let t={size:s,refNum:1};n.TextureInfo.Cache[e.Source]=t}}))}static UnrefImgTexSize(e){if(!e)return;let t=n.TextureInfo.Cache[e.Source];t&&(t.refNum--,t.refNum<=0&&n.TextureInfo.Unused.add(e.Source))}static ClearUnusedTexSize(){for(let e of n.TextureInfo.Unused){let t=n.TextureInfo.Cache[e];t.refNum<-2?(delete n.TextureInfo.Cache[e],n.TextureInfo.Unused.delete(e)):t.refNum<=0?t.refNum--:n.TextureInfo.Unused.delete(e)}}}n.TextureInfo={Cache:{},Unused:new Set},n.TextureManager=null,n.RootView=null,n.RootActivity=null,n.HaltKeyEvent=!1,window.JsvCode.ForgeExtension||(window.JsvCode.ForgeExtension=n);var a=n=window.JsvCode.ForgeExtension;class l{static EnableEventListener(e){const t=window.JsvCode.Dom.PlatformBridge.JsViewId;window.JsvCode.Dom.PlatformBridge.SetOnEventListener(t,e)}static CreateElement(e,t){l.#e(l.#t.CreateElement,e,t)}static BindElementToRootView(e){l.#e(l.#t.BindElementToRootView,e)}static InsertElementChild(e,t,s){l.#e(l.#t.InsertElementChild,e,t,s)}static RemoveElementChild(e,t){l.#e(l.#t.RemoveElementChild,e,t)}static MoveElementChild(e,t,s,i){l.#e(l.#t.MoveElementChild,e,t,s,i)}static AddElementEventListener(e,t){l.#e(l.#t.AddElementEventListener,e,t)}static RemoveElementEventListener(e,t){l.#e(l.#t.RemoveElementEventListener,e,t)}static SetElementText(e,t){l.#e(l.#t.SetElementText,e,t)}static SetElementAttribute(e,t,s){l.#e(l.#t.SetElementAttribute,e,t,s),l.#s.has(e)&&l.#i.add(e)}static GetElementBoundingClientStyles(e,t){return l.#r(l.#t.GetElementBoundingClientStyles,e,t)}static SetForgeViewInnerProps(e,t,s){let i=0;(t=t.substr(12)).startsWith("mask-")&&(i=1,t=t.substr(5)),l.#e(l.#t.SetForgeViewInnerProps,e,t,i,""+s)}static DeclareStyleSheets(e){l.#e(l.#t.DeclareStyleSheets,-1,e)}static SetStyleProperty(e,t,s){l.#e(l.#t.SetStyleProperty,e,t,s),l.#s.has(e)&&l.#i.add(e)}static GetStyleProperties(e,t){return l.#r(l.#t.GetStyleProperties,e,t)}static AppendLazyTaskSyncedListener(e,t){l.#s.set(e,t)}static RemoveLazyTaskSyncedListener(e){l.#s.delete(e)}static RequestSwapAllCachedTasks(){if(0==l.#o.length)return;const e=JSON.stringify(l.#o);l.#o=[];const t=window.JsvCode.Dom.PlatformBridge.JsViewId;window.JsvCode.Dom.PlatformBridge.RunLazyTaskList(t,e);for(const e of l.#i){l.#s.get(e)?.()}l.#i.clear()}static GetElementAttribute(e,t){return l.#r(l.#t.GetElementAttribute,e,t)}static InsertKeyFrame(e,t){l.#e(l.#t.InsertKeyFrameDefine,-1,e,t)}static RemoveKeyFrame(e){l.#e(l.#t.RemoveKeyFrameDefine,-1,e)}static GetRelativePosition(e,t){const s=l.#r(l.#t.GetRelativePosition,e,t);return JSON.parse(s)}static#r(e,t,...s){l.RequestSwapAllCachedTasks();const i=window.JsvCode.Dom.PlatformBridge.JsViewId;return window.JsvCode.Dom.PlatformBridge.RunSyncTask(i,e,t,...s)}static#e(e,t,...s){l.#o.push([e,t,...s]),r.sRenderBridge.RequestSwap()}static#o=[];static#i=new Set;static#s=new Map;static#t={CreateElement:10,BindElementToRootView:11,InsertElementChild:12,RemoveElementChild:13,AddElementEventListener:14,RemoveElementEventListener:15,SetElementText:16,SetElementAttribute:17,GetElementBoundingClientStyles:18,GetElementAttribute:19,MoveElementChild:20,GetRelativePosition:21,DeclareStyleSheets:30,SetStyleProperty:31,GetStyleProperties:32,SetForgeViewInnerProps:40,InsertKeyFrameDefine:41,RemoveKeyFrameDefine:42}}class c{static CreateAudioPlayer(){return window.JsvCode.Media.PlatformBridge.CreateAudioPlayer()}static CreateVideoPlayer(){return window.JsvCode.Media.PlatformBridge.CreateVideoPlayer()}}class d{static Dom=l;static Media=c}class h{constructor(e){this.ownerDocument=window.document,this.nodeType=e,this.parentNode=void 0,this.childNodes=[]}jsvFinalize(){}appendChild(e){this.childNodes.push(e),e.parentNode=this,this.#n?.()}removeChild(e){let t=this.childNodes.indexOf(e);if(t<0)throw new DOMError("Failed to remove node, child node is not found. node=",e);this.childNodes.splice(t,1),e.parentNode=void 0,this.#n?.()}insertBefore(e,t){this.#a(e,t)}get previousSibling(){const e=this.parentNode.childNodes;let t=e.indexOf(this);if(t<0)throw new DOMError("Failed to call Node.previousSibling(), this node not found. this=",this);return e[t-1]}get nextSibling(){const e=this.parentNode.childNodes;let t=e.indexOf(this);if(t<0)throw new DOMError("Failed to call Node.nextSibling(), this node not found. this=",this);return e[t+1]}addEventListener(e,t,s){this.#l||(this.#l={});let i=this.#l[e];i||(i=new Set,this.#l[e]=i),i.add(t)}removeEventListener(e,t,s){if(!this.#l)return;let i=this.#l[e];i&&(i.delete(t),i.size<=0&&this.#l.hasOwnProperty(e)&&delete this.#l[e],0===Object.values(this.#l).length&&(this.#l=void 0))}dispatchEvent(e){if(!this.#l)return void console.warn("Node.dispatchEvent() Ignore to dispatch event: "+e.type+". No event added.");let t=this.#l[e.type];if(t){e.target||(e.target=document.activeElement);for(let s of t)s(e)}else console.warn("Node.dispatchEvent() Ignore to dispatch event: "+e.type+". No listener added.")}jsvObserveChildChanged(e){this.#n=e}jsvMoveChildToNewParent(e,t,s){let i=this.childNodes.indexOf(e);i<0&&Log.Throw("Failed to call Node.removeChild(), node not found. node=",e),this.childNodes.splice(i,1),e.parentNode=void 0,this.jsvChildChangedCallback?.(),t.#a(e,s)}#a(e,t){let s=this.childNodes.length;if(void 0===t)throw new DOMError("TypeError: Failed to execute 'insertBefore' on 'Node': 2 arguments required, but only 1 present.");if(null!==t&&(s=this.childNodes.indexOf(t)),s<0)throw new DOMError("Failed to call insert node, before node not found. beforeNode=",t);this.childNodes.splice(s,0,e),e.parentNode=this,this.#n?.()}#l=void 0;#n=void 0;static ELEMENT_NODE=1;static TEXT_NODE=3;static COMMENT_NODE=8;static DOCUMENT_NODE=9;static NOLAYOUT_NODE=10}class u{static Layout=class{static Height="height";static Left="left";static Top="top";static Width="width";constructor(){throw new Error("new StyleName.Layout() is forbidden.")}};static Background=class{static BackgroundColor="backgroundColor";static BackgroundImage="backgroundImage";static BorderRadius="borderRadius";constructor(){throw new Error("new StyleName.Background() is forbidden.")}};static Effect=class{static BackfaceVisibility="backfaceVisibility";static BorderImage="borderImage";static BorderImageWidth="borderImageWidth";static BorderImageOutset="borderImageOutset";static Display="display";static ObjectFit="objectFit";static Opacity="opacity";static Overflow="overflow";static Perspective="perspective";static PerspectiveOrigin="perspectiveOrigin";static Transform="transform";static TransformOrigin="transformOrigin";static TransformStyle="transformStyle";static Visibility="visibility";static ZIndex="zIndex";constructor(){throw new Error("new StyleName.Effect() is forbidden.")}};static Text=class{static Color="color";static FontFamily="fontFamily";static FontSize="fontSize";static FontStyle="fontStyle";static FontWeight="fontWeight";static LineHeight="lineHeight";static TextAlign="textAlign";static TextOverflow="textOverflow";static TextShadow="textShadow";static WebkitTextStroke="WebkitTextStroke";static WhiteSpace="whiteSpace";static WordWrap="wordWrap";static Direction="direction";static JsvTextEmoji="JsvTextEmoji";static JsvTextLatex="JsvTextLatex";static JsvTextAlignMinWidth="JsvTextAlignMinWidth";static JsvTextVerticalAlign="JsvTextVerticalAlign";static JsvTextLineAlign="JsvTextLineAlign";static JsvTextInnerDirection="JsvTextInnerDirection";constructor(){throw new Error("new StyleName.Text() is forbidden.")}};static Motion=class{static Animation="animation";static Transition="transition";constructor(){throw new Error("new StyleName.Motion() is forbidden.")}};static HasGetterMethod(e){switch(e){case u.Layout.Height:case u.Layout.Left:case u.Layout.Top:case u.Layout.Width:case u.Effect.ObjectFit:return!0;default:return!1}}static ToConst(e){return e==u.Layout.Height?u.Layout.Height:e==u.Layout.Left?u.Layout.Left:e==u.Layout.Top?u.Layout.Top:e==u.Layout.Width?u.Layout.Width:e==u.Background.BackgroundColor?u.Background.BackgroundColor:e==u.Background.BackgroundImage?u.Background.BackgroundImage:e==u.Background.BorderRadius?u.Background.BorderRadius:e==u.Effect.BackfaceVisibility?u.Effect.BackfaceVisibility:e==u.Effect.BorderImage?u.Effect.BorderImage:e==u.Effect.BorderImageWidth?u.Effect.BorderImageWidth:e==u.Effect.BorderImageOutset?u.Effect.BorderImageOutset:e==u.Effect.Display?u.Effect.Display:e==u.Effect.ObjectFit?u.Effect.ObjectFit:e==u.Effect.Opacity?u.Effect.Opacity:e==u.Effect.Overflow?u.Effect.Overflow:e==u.Effect.Perspective?u.Effect.Perspective:e==u.Effect.PerspectiveOrigin?u.Effect.PerspectiveOrigin:e==u.Effect.Transform?u.Effect.Transform:e==u.Effect.TransformOrigin?u.Effect.TransformOrigin:e==u.Effect.TransformStyle?u.Effect.TransformStyle:e==u.Effect.Visibility?u.Effect.Visibility:e==u.Effect.ZIndex?u.Effect.ZIndex:e==u.Text.Color?u.Text.Color:e==u.Text.FontFamily?u.Text.FontFamily:e==u.Text.FontSize?u.Text.FontSize:e==u.Text.FontStyle?u.Text.FontStyle:e==u.Text.FontWeight?u.Text.FontWeight:e==u.Text.LineHeight?u.Text.LineHeight:e==u.Text.TextAlign?u.Text.TextAlign:e==u.Text.TextOverflow?u.Text.TextOverflow:e==u.Text.TextShadow?u.Text.TextShadow:e==u.Text.WebkitTextStroke?u.Text.WebkitTextStroke:e==u.Text.WhiteSpace?u.Text.WhiteSpace:e==u.Text.WordWrap?u.Text.WordWrap:e==u.Text.Direction?u.Text.Direction:e==u.Text.JsvTextEmoji?u.Text.JsvTextEmoji:e==u.Text.JsvTextLatex?u.Text.JsvTextLatex:e==u.Text.JsvTextAlignMinWidth?u.Text.JsvTextAlignMinWidth:e==u.Text.JsvTextVerticalAlign?u.Text.JsvTextVerticalAlign:e==u.Text.JsvTextLineAlign?u.Text.JsvTextLineAlign:e==u.Text.JsvTextInnerDirection?u.Text.JsvTextInnerDirection:e==u.Motion.Animation?u.Motion.Animation:e==u.Motion.Transition?u.Motion.Transition:null}constructor(){throw new Error("new StyleName() is forbidden.")}}class v{static Base=class{constructor(e){this.rawValue=e}rawValue};static AnimationImpl=class extends v.Base{constructor(e){super(e)}name="";duration=0;timingFunction=null;delay=0;iterationCount=0;direction=!1};static CornerImpl=class extends v.Base{constructor(e){super(e)}topLeft=0;topRight=0;bottomRight=0;bottomLeft=0};static RectImpl=class extends v.Base{constructor(e){super(e)}top=0;right=0;left=0;bottom=0};static TextShadowImpl=class extends v.Base{constructor(e){super(e)}hShadow=0;vShadow=0;blur=0;color=void 0};static WebkitTextStrokeImpl=class extends v.Base{constructor(e){super(e)}length=0;color=void 0};static TransitionImpl=class extends v.Base{constructor(e){super(e)}animationMap=new Map};static BorderImageImpl=class extends v.Base{constructor(e){super(e)}source="";slice=null};static DataType=class{static Null=0;static Int32=1;static Float=2;static String=3;static Animation=4;static Corner=5;static Rect=6;static TextShadow=7;static WebkitTextStroke=8;static Transition=9;static BorderImage=10};static InvalidInt32=Number.MIN_VALUE;static InvalidFloat=Number.NaN;static InvalidPointer=null;constructor(e){let t=-1,s=null;null==e?t=v.DataType.Null:Number(e)===e&&e%1==0?t=v.DataType.Int32:Number(e)===e&&e%1!=0?t=v.DataType.Float:"string"==typeof e||e instanceof String?t=v.DataType.String:e instanceof v.AnimationImpl?t=v.DataType.Animation:e instanceof v.CornerImpl?t=v.DataType.Corner:e instanceof v.RectImpl?t=v.DataType.Rect:e instanceof v.TextShadowImpl?t=v.DataType.TextShadow:e instanceof v.WebkitTextStrokeImpl?t=v.DataType.WebkitTextStroke:e instanceof v.TransitionImpl?t=v.DataType.Transition:e instanceof v.BorderImageImpl&&(t=v.DataType.BorderImage),e!=v.InvalidInt32&&e!=v.InvalidFloat&&e!=v.InvalidPointer?s=e:(t=v.DataType.Null,s=null),this.data=new v.DataInfo,this.data.index=t,this.data.value=s}is(e){return this.data.index==e}get(){return this.data.value}reset(e){this.data.value=e.data.value,this.data.index=e.data.index}equals(e){return this.data.value===e.data.value&&this.data.index===e.data.index}static DataInfo=class{value=null;index=-1};data}class m{static JsvDeclarePrototype(){for(let e in u){let t=u[e];for(let e in t){let s=t[e];if("string"!=typeof s)continue;const i={set:function(e){this.setProperty(s,e)},get:function(){return this.getPropertyValue(s)}};Object.defineProperty(m.prototype,s,i)}}}constructor(e){this.#c=e}setProperty(e,t){if(document.jsvCheckStyleFormat?.(e,t),e==u.Background.BackgroundImage&&t){t=new o(t).href}else e==u.Effect.Display&&(this.#d[e]=t);if(e==u.Effect.BorderImage&&t){const e=t.split(" ");e.length>0&&(e[0]=new o(e[0]).href),t=e.join(" ")}d.Dom.SetStyleProperty(this.#c,e,t)}getPropertyValue(e){if(e==u.Effect.Display)return this.#d[e];throw console.error("StyleDeclaration.getPropertyValue() propName="+e),new Error("Get style value is unimplemented because it's low performance.")}jsvGetProperties(...e){const t=JSON.stringify(e),s=d.Dom.GetStyleProperties(this.#c,t);return JSON.parse(s)}#c;#d={}}class f extends t{constructor(e){super(e)}}class g extends h{static JsvTagName={Anchor:"A",Audio:"AUDIO",Div:"DIV",Head:"HEAD",Img:"IMG",IFrame:"IFRAME",Link:"LINK",Script:"SCRIPT",Style:"STYLE",Svg:"SVG",Video:"VIDEO",JsvAudioTrack:"JSV-AUDIOTRACK",JsvFDiv:"FDIV"};static JsvEnableEventListener(){d.Dom.EnableEventListener((function(e,t,s){const i=g.#h[e]?.[t];i?.(t,s)}))}constructor(e){super(h.ELEMENT_NODE),this.tagName=e,this.tagName!=g.JsvTagName.Link&&this.tagName!=g.JsvTagName.Script&&this.tagName!=g.JsvTagName.Style&&(this.jsvNativeId=++g.#u,this.style=new m(this.jsvNativeId),d.Dom.CreateElement(this.jsvNativeId,e)),this.jsvAttrStore={}}appendChild(e){e.parentNode?this.#v(e,null):(super.appendChild(e),this.#m(e,null))}removeChild(e){super.removeChild(e),this.#f(e),e.jsvNativeId&&d.Dom.RemoveElementChild(this.jsvNativeId,e.jsvNativeId)}insertBefore(e,t){e.parentNode?this.#v(e,t):(super.insertBefore(e,t),this.#m(e,t))}addEventListener(e,t,s){super.addEventListener(e,t,s),this.jsvNativeId&&(this.#g(this.jsvNativeId,e),d.Dom.AddElementEventListener(this.jsvNativeId,e))}removeEventListener(e,t,s){this.jsvNativeId&&(this.#p(this.jsvNativeId,e),d.Dom.RemoveElementEventListener(this.jsvNativeId,e)),super.removeEventListener(e,t,s)}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)}get clientWidth(){return this.jsvAttrStore.clientWidth||(this.jsvAttrStore.clientWidth=d.Dom.GetElementAttribute(this.jsvNativeId,"clientWidth")),this.jsvAttrStore.clientWidth}get clientHeight(){return this.jsvAttrStore.clientHeight||(this.jsvAttrStore.clientHeight=d.Dom.GetElementAttribute(this.jsvNativeId,"clientHeight")),this.jsvAttrStore.clientHeight}setAttribute(e,t){e&&(this.jsvAttrStore[e]=t,this.jsvNativeId&&(e.startsWith("data-jsv-vw-")?d.Dom.SetForgeViewInnerProps(this.jsvNativeId,e,t):("class"===e||e.startsWith("data-v-")||e.startsWith("data-jsv")||e.startsWith("dataJsv"))&&d.Dom.SetElementAttribute(this.jsvNativeId,e,t)))}removeAttribute(e){delete this.jsvAttrStore[e],("class"==e||e.startsWith("data-v-")||"src"==e)&&this.jsvNativeId&&d.Dom.SetElementAttribute(this.jsvNativeId,e,null)}getAttribute(e){return this.jsvAttrStore[e]}hasAttribute(e){return!!this.jsvAttrStore[e]}focus(){document.activeElement&&document.activeElement.onfocus();let e=document.activeElement;if(document.activeElement=this,e){let t=new i(i.JsvType.Blur);t.target=e,document.dispatchEvent(t)}let t=new i(i.JsvType.Focus);document.dispatchEvent(t)}getBoundingClientRect(){return new Promise(((e,t)=>{const s=this.jsvGetProxyView();s.RegisterOnProxyReady((()=>{s.GetBoundingClientRect().then((t=>{e(t)}),(e=>{t(e)}))}))}))}jsvSetOnLazyTaskSyncedListener(e){d.Dom.AppendLazyTaskSyncedListener(this.jsvNativeId,e)}jsvOnEvent(e,...t){let i;e.startsWith("animation")?(i=new s(e),i.target=this,i.animationName=t[0]):e.startsWith("transition")&&(i=new f(e),i.target=this,i.propertyName=t[0]),i&&this.dispatchEvent(i)}jsvGetProxyView(e){return e?(this._MaskViewProxy||(this._MaskViewProxy=r.NewDomProxyView(this.jsvNativeId,!0)),this._MaskViewProxy):(this._MainViewProxy||(this._MainViewProxy=r.NewDomProxyView(this.jsvNativeId,!1)),this._MainViewProxy)}jsvGetProxyTexture(e){return this._MainViewTextureProxy||(this._MainViewTextureProxy=e.GetDomProxyTexture(this.jsvNativeId)),this._MainViewTextureProxy}jsvGetRelativePosition(e){return d.Dom.GetRelativePosition(this.jsvNativeId,e.jsvNativeId)}#g(e,t){let s=g.#h[e];s||(s=new Set,g.#h[e]=s),s[t]=this.jsvOnEvent.bind(this)}#p(e,t){let s=g.#h[e];s&&delete s[t]}#v(e,t){let s=e.parentNode;s.jsvMoveChildToNewParent(e,this,t),this.#y(s,e,t)}#y(e,t,s){t.jsvNativeId&&(s=g.#w(s),d.Dom.MoveElementChild(this.jsvNativeId,e.jsvNativeId,t.jsvNativeId,s?.jsvNativeId))}#m(e,t){e.parentNode=this,e.nodeType===h.TEXT_NODE?this.textContent=e.nodeValue:e.jsvNativeId&&(t=g.#w(t),d.Dom.InsertElementChild(this.jsvNativeId,e.jsvNativeId,t?.jsvNativeId))}#f(e){for(const t of e.childNodes)e.#f(t);e.jsvFinalize(),d.Dom.RemoveLazyTaskSyncedListener(e.jsvNativeId),delete g.#h[e.jsvNativeId]}static#w(e){let t=e;for(;t&&!(t instanceof g);)t=t.nextSibling;return t}parentNode;tagName;style;jsvNativeId;jsvAttrStore;static#h={};static#u=0}class p extends g{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 g.TAG.ANCHOR}}class y extends g{static JsvDeclareProperties(){for(const[e,t]of Object.entries(y.#T)){let s={};t.set&&(s.set=function(t){if("src"===e){t=new o(t).href}this.jsvOnSetter(e,t)}),t.get&&(s.get=function(){return this.jsvOnGetter(e)}),Object.defineProperty(y.prototype,e,s)}for(const e of y.#E){let t={set:function(t){t?this.addEventListener(e,t):this.removeEventListener(e,this.jsvEventMap[e]),this.jsvEventMap[e]=t},get:function(){this.jsvEventMap[e]}};Object.defineProperty(y.prototype,"on"+e,t)}for(const e of y.#N){const t=function(...t){this.jsvMediaPlayer[e](t)};y.prototype[e]=t}}constructor(e){super(e),Promise.resolve().then((()=>{this.jsvMediaPlayer&&this.jsvMediaPlayer.confirmInitSetup?.()}))}jsvFinalize(){this.jsvMediaPlayer.pause(),this.jsvMediaPlayer.unload(),this.jsvMediaPlayer.releaseResource?.(),this.jsvMediaPlayer.onPlatformDestroy?.(),this.jsvMediaPlayer=null}addEventListener(e,t,s){super.addEventListener(e,t,s),this.jsvNativeId&&y.#E.includes(e)&&this.jsvMediaPlayer.addEventListener(e,(()=>{this.onMediaPlayerEvent(e)}))}removeEventListener(e,t,s){this.jsvNativeId&&y.#E.includes(e)&&this.jsvMediaPlayer.removeEventListener(e,t),super.removeEventListener(e,t,s)}jsvOnSetter(e,t){if(e in y.#T==0)throw new DomError("Failed to set "+e);this.jsvMediaPlayer[e]=t}jsvOnGetter(e){if(e in y.#T==0)throw new DomError("Failed to get "+e);return this.jsvMediaPlayer[e]}onMediaPlayerEvent(e){let s=new t(e);s.target=this,s&&this.dispatchEvent(s)}static#T={autoplay:{set:!0,get:!0},currentTime:{set:!0,get:!0},muted:{set:!0,get:!0},playbackRate:{set:!0,get:!0},volume:{set:!0,get:!0},timeupdateless:{set:!0,get:!0},predownload:{set:!0,get:!0},preload:{set:!0,get:!0},duration:{set:!1,get:!0},error:{set:!1,get:!0},paused:{set:!1,get:!0},loop:{set:!0,get:!1},src:{set:!0,get:!1}};static#E=["abort","canplay","canplaythrough","durationchange","ended","error","load","loadedmetadata","loadstart","pause","play","playing","seeking","seeked","stalled","timeupdate"];static#N=["load","pause","play","unload","confirmInitSetup"];jsvMediaPlayer=null;jsvEventMap={}}class w extends y{constructor(){super(Element.JsvTagName.Audio),this.jsvMediaPlayer=d.Media.CreateAudioPlayer()}}class T extends h{constructor(e){super(h.COMMENT_NODE),this.textContent=e}}class E extends g{constructor(){super(g.JsvTagName.Div)}get textContent(){return this.#D}set textContent(e){this.#D=e,d.Dom.SetElementText(this.jsvNativeId,e)}#D}class N{constructor(e,t){this.RouterDelegate={ref:null},e||(this.RouterDelegate.ref=new D(!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(x.sLastFocus)}getCurrentFocusStack(){const e=[];if(this.RouterDelegate.ref){let t=this.RouterDelegate.ref.getCurrentFocusNode();for(;t&&t instanceof x&&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 D{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 r=!1;for(let t in i._ChildMap){let o=i._ChildMap[t].RouterDelegate.ref;if(o!=i&&o.NameSpace==e[s]){i=o,s++,r=!0;break}}if(!r)return void console.error(`Error: no found subpath fname=${t}`)}let r=e[s];return i._ChildMap.hasOwnProperty(r)?i._ChildMap[r]: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 x extends r.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 N(!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 D(!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 x.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(),S()),e instanceof x)){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 x.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()}}x.sFocusMemos=[],x.sLastFocus=null,x.sRootPageNode=null;let S=()=>{let e=x.sFocusMemos.length;if(e>0){let t=x.sFocusMemos;x.sFocusMemos=[];for(let s=0;s<e;s++)t[s].obj.Focus(t[s].bcf)}},C={};class b{constructor(e,t,s){this._Element=s,C.hasOwnProperty(e)&&console.error(`Warn: FDivRoot duplicate name=${e}`),C[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(a.RootActivity,a.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(),S()}}class L extends g{constructor(){super(g.JsvTagName.Img)}setAttribute(e,t){if("src"===e){t=new o(t).href}super.setAttribute(e,t),this.jsvNativeId&&"src"===e&&d.Dom.SetElementAttribute(this.jsvNativeId,e,t)}jsvOnEvent(e,...s){let i;super.jsvOnEvent(e,...s),"load"==e&&(i=new t(e),i.target=this),i&&this.dispatchEvent(i)}}class P extends g{constructor(){super(g.JsvTagName.Link),this.src=null,this.onerror=null,this.onload=null}setAttribute(e,t){this[e]=t}jsvLoadResource(){let e=!1,t=null;if(null!=this.href){var s=new o(this.href);console.log("Ignore to load link from url="+s.href),e=!0}else console.warn("Failed to load link, href is not exists."),t="NoSrc";this.jsvOnLoadResult(e,t)}jsvOnLoadResult(e,s){if(console.log("Load link result: isSuccess:"+e+", errCode:"+s),e){if(this.onload){let e=new t("load");this.onload(e)}}else this.onerror&&this.onerror({type:"jsvErr_"+s,target:this})}}class I extends g{constructor(){super(g.JsvTagName.Script)}setAttribute(e,t){this[e]=t}jsvLoadResource(){if(null!=this.src){var e=new o(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,s){if(console.log("Load script result: isSuccess:"+e+", errCode:"+s),e){if(this.onload){let e=new t("load");this.onload(e)}}else this.onerror&&this.onerror({type:"jsvErr_"+s,target:this})}src=null;onerror=null;onload=null;charset=null;timeout=120}class j extends g{constructor(){super(g.JsvTagName.Style),this.jsvAttrStore={left:0,top:0,width:0,height:0}}}class R extends g{constructor(){super(g.JsvTagName.Svg)}}class M extends h{constructor(e){super(h.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 y{constructor(){super(Element.JsvTagName.Video),super.jsvMediaPlayer=d.Media.CreateVideoPlayer(),this.#x={left:0,top:0,width:0,height:0,objectFit:null},this.jsvSetOnLazyTaskSyncedListener(this.jsvOnLazyTaskSynced.bind(this))}jsvFinalize(){this.jsvMediaPlayer.jsvFinalize()}jsvGetBoundingClientStyles(...e){const t=JSON.stringify(e),s=d.Dom.GetElementBoundingClientStyles(this.jsvNativeId,t);return JSON.parse(s)}jsvOnLazyTaskSynced(){const e=this.jsvGetBoundingClientStyles(u.Layout.Left,u.Layout.Top,u.Layout.Width,u.Layout.Height,u.Effect.ObjectFit,u.Effect.Visibility);let t=!1;this.#x.left!=e.left&&(this.#x.left=e.left,t=!0),this.#x.top!=e.top&&(this.#x.top=e.top,t=!0),this.#x.width!=e.width&&(this.#x.width=e.width,t=!0),this.#x.height!=e.height&&(this.#x.height=e.height,t=!0),this.#x.objectFit!=e.objectFit&&(this.#x.objectFit=e.objectFit,t=!0),this.#x.visibility!=e.visibility&&(this.#x.visibility=e.visibility,t=!0),t?this.jsvMediaPlayer.jsvOnCssStyleChanged(this.jsvNativeId,this.#x):console.log("VideoElement.jsvOnLazyTaskSynced() style is not changed.")}#x}class O extends y{constructor(){super(Element.JsvTagName.JsvAudioTrack),this.jsvMediaPlayer=d.Media.CreateAudioPlayer("AudioTrack")}}let F=1;class J extends g{constructor(){super(g.JsvTagName.JsvFDiv),this.FocusNodeRef=new x(""+F++),this.HubRef=void 0}setAttribute(e,t){if(e)if("fname"===e)t&&this.FocusNodeRef.setBranchName(t);else if("new-namespace"===e&&""!==t&&!this.HubRef){let e=new N(!1,t);this.HubRef=e,this.FocusNodeRef.setHub(e),this.FocusNodeRef.setBranchName(t)}}removeAttribute(e){}jsvGetHub(){return this.HubRef}}class _ extends h{constructor(){super(h.DOCUMENT_NODE),this.location=window.location,this.rootElement=new E,this.rootElement.ownerDocument=this,this.rootElement.id="root",d.Dom.BindElementToRootView(this.rootElement.jsvNativeId),this.activeElement=this.rootElement,this.head=null}createComment(e){return new T(e)}createElement(e){switch(e=e.toUpperCase()){case g.JsvTagName.Anchor:return new p;case g.JsvTagName.Audio:return new w;case g.JsvTagName.Div:return new E;case g.JsvTagName.Img:return new L;case g.JsvTagName.Link:return new P;case g.JsvTagName.Script:return new I;case g.JsvTagName.Style:return new j;case g.JsvTagName.Svg:return new R;case g.JsvTagName.Video:return new k;case g.JsvTagName.JsvAudioTrack:return new O;case g.JsvTagName.JsvFDiv:return new J;case g.JsvTagName.IFrame:console.error("Unsupported element: "+e+". Your vue compilation may may have failed, please check it first.")}if("TEMPLATE"==e)return{};throw new TypeError("Unimplemented element: "+e)}createEvent(e){return new t(e)}createTextNode(e){return new M(e)}getElementById(e){if("root"===e||"app"===e)return this.rootElement;throw new DOMError("Failed to get element by id, id="+e+" is UNIMPLEMENTED.")}getElementsByTagName(e){if((e=e.toUpperCase())===g.JsvTagName.Head)return[this.head];if(e===g.JsvTagName.Link||e===g.JsvTagName.Script||e===g.JsvTagName.Style)return[];throw new DOMError("Failed to get element by name, 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;throw new DOMError("Failed to query selector, selectors="+e+" is UNIMPLEMENTED.")}querySelectorAll(e){return[]}jsvInitFDivRoot(e,t,s){if(!s){let e=document.createElement("fdiv");this.rootElement.appendChild(e),this.rootElement=e,s=this.rootElement}return new b(e,t,s)}}class B extends g{constructor(){super(g.JsvTagName.Head)}appendChild(e){super.appendChild(e),(e instanceof P||e instanceof I)&&e.jsvLoadResource()}removeChild(e){super.removeChild(e)}}let A="@keyframes",V=A.length;class z{constructor(e){this._AnchorTag=e,this._NamesCache=new Set}insertRule(e){let t=this.#S(e);this._NamesCache.has(t)&&console.warn(`Warn: keyframe replace of name ${t}`),this._NamesCache.add(t),d.Dom.InsertKeyFrame(t,e)}hasRule(e){return this._NamesCache.has(e)}removeRule(e){this._NamesCache.has(e)?(this._NamesCache.delete(e),d.Dom.RemoveKeyFrame(e)):console.error(`Error: keyFrame(${e}) is not exist.`)}removeMultiRules(e){for(let t of e)this.removeRule(t)}#S(e){let t=e.indexOf(A)+V,s=e.indexOf("{");return e.substring(t,s).trim()}}let G=null;function K(e){return G||(G={global:new z("global")}),G.global}class W{static EnsureGlobalEnv(e,t){const s=window.navigator?.userAgent?.toLowerCase();window.jsvInAndroidWebView=s?.indexOf("android")>=0,W.#C(e,t),g.JsvEnableEventListener(),y.JsvDeclareProperties(),m.JsvDeclarePrototype()}static#C(e,t){window.JsvCode||(window.JsvCode={}),window.JsvCode.Dom||(window.JsvCode.Dom={}),window.JsvCode.Media||(window.JsvCode.Media={}),window.JsvCode.Dom.PlatformBridge||(window.JsvCode.Dom.PlatformBridge=e),window.JsvCode.Media.PlatformBridge||(window.JsvCode.Media.PlatformBridge=t),window.JsvCode.Dom.DeclareStyleSheets||(window.JsvCode.Dom.DeclareStyleSheets=d.Dom.DeclareStyleSheets),window.JsvCode.Dom.getKeyFrameGroup||(window.JsvCode.Dom.getKeyFrameGroup=K)}}class U{static SetLevel(e){switch(U.E=U.W=U.I=U.D=function(){},e){case U.Level.Verbose:U.V=console.debug.bind(console);case U.Level.Debug:U.D=console.debug.bind(console);case U.Level.Info:U.I=console.info.bind(console)}}static E=console.error.bind(console);static W=console.warn.bind(console);static I=console.info.bind(console);static D=function(){};static V=function(){};static Level={Error:0,Warning:1,Info:2,Debug:3,Verbose:4}}class H extends t{constructor(e){super(e),this.keyCode=-1,this.key=-1,this.repeat=0}}class q{constructor(e){this.callback=e}observe(e,t){if(!(e instanceof h))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}}class $ extends _{constructor(){super(),this.head=new B}}class Y{static DeclareGlobal(){Y.#b(),Y.#L(),Y.#P()}static#b(){window.document=new $}static#L(){window.MutationObserver=q,window.Element=g,window.SVGElement=R;let e=new o(window.JsView.getAppUrl(),!0);window.location.applyUrlInfo?window.location.applyUrlInfo(e):window.location=e,window.history={},window.navigator={userAgent:"jsview-runtime"}}static#P(){window.JsView.Dom={Render:null,Extension:null,UrlRef:o}}}class X{constructor(e){this.activity=new r.ReactActivity("NativeForgeActivity",e,this.OnKeyDown.bind(this),this.OnKeyUp.bind(this)),this.#I()}OnKeyDown(e){if(a.HaltKeyEvent){let t=new H(H.Type.KEYDOWN);return t.keyCode=e.keyCode,t.repeat=e.repeat,document.dispatchEvent(t),!0}return!1}OnKeyUp(e){if(a.HaltKeyEvent){let t=new H(H.Type.KEYUP);return t.keyCode=e.keyCode,t.key=H.JsvGetKeyFromCode(t.keyCode),t.repeat=e.repeat,document.dispatchEvent(t),!0}return!1}#I(){console.log("create NativeForgeActivity."),a.TextureManager=this.activity.GetTextureManager(),a.RootView=new r.LayoutView,a.RootActivity=this.activity;let e=null;r.DesignMap&&(e=r.DesignMap());let t=e?e.width:1280,s=Math.floor(9*t/16);this.activity.SetContentView(a.RootView,{x:0,y:0,width:t,height:s}),r.sRenderBridge.AddWillSwapListener("forgeSwap",(()=>{d.Dom.RequestSwapAllCachedTasks()})),window.JsView.Dom.Render()}}class Z{constructor(e){this.activityManager=e;let t=new X(e);e.RegisterActivity(t.activity),e.StartActivity(new r.Intent("NativeForgeActivity"))}}window.jsvIsBrowserDebug=!1;const Q=window.JsvCode.NativePlatformDomBridge,ee=window.JsvCode.NativePlatformMediaBridge;function te(){W.EnsureGlobalEnv(Q,ee),Y.DeclareGlobal(),U.I("Using JsView Native Environment.")}export{a as ForgeExtension,te as InitEnv,Z as NativeForgeApp};
|
package/package.json
CHANGED
|
@@ -16,10 +16,11 @@ function getOptions(argv)
|
|
|
16
16
|
const options = {
|
|
17
17
|
stagePixels: '1',
|
|
18
18
|
stageAnimation: '2',
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
19
|
+
stageHashHistory: '3',
|
|
20
|
+
stageAudiotrack: '4',
|
|
21
|
+
stageImportPostfix: '5',
|
|
22
|
+
stageAppConfig: '6',
|
|
23
|
+
stageMainEntry: '7',
|
|
23
24
|
};
|
|
24
25
|
|
|
25
26
|
const scriptPath = path.resolve(process.cwd(), process.argv[1]);
|
|
@@ -130,23 +131,38 @@ function replaceStageContent(options, sourcePathList, msgPrefix,
|
|
|
130
131
|
}
|
|
131
132
|
|
|
132
133
|
fs.writeFileSync(filePath, fixedContent, 'utf8');
|
|
133
|
-
console.info(msgPrefix + ': Upgraded ' + path.relative(options.rootDir, filePath)
|
|
134
|
+
console.info(msgPrefix + ': Upgraded ' + path.relative(options.rootDir, filePath));
|
|
134
135
|
}
|
|
135
136
|
|
|
136
137
|
return 0;
|
|
137
138
|
}
|
|
138
139
|
|
|
139
140
|
function removeStageFile(options, sourcePathList, msgPrefix,
|
|
140
|
-
|
|
141
|
+
fromExtNameList, toExtName)
|
|
141
142
|
{
|
|
142
143
|
for (const filePath of sourcePathList) {
|
|
143
|
-
|
|
144
|
+
let fromExtName = null;
|
|
145
|
+
for (const extName of fromExtNameList) {
|
|
146
|
+
if (filePath.endsWith(extName)) {
|
|
147
|
+
fromExtName = extName;
|
|
148
|
+
break;
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
if (fromExtName == null) {
|
|
144
152
|
continue;
|
|
145
153
|
}
|
|
146
154
|
|
|
147
155
|
const toFilePath = filePath.replace(new RegExp(fromExtName + '$'), toExtName);
|
|
148
156
|
fs.renameSync(filePath, toFilePath)
|
|
149
|
-
|
|
157
|
+
|
|
158
|
+
// json => mjs
|
|
159
|
+
if (fromExtName == '.json') {
|
|
160
|
+
const content = fs.readFileSync(toFilePath, 'utf8');
|
|
161
|
+
const fixedContent = 'export default ' + content;
|
|
162
|
+
fs.writeFileSync(toFilePath, fixedContent, 'utf8');
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
console.info(msgPrefix + ': Upgraded ' + path.relative(options.rootDir, filePath));
|
|
150
166
|
}
|
|
151
167
|
|
|
152
168
|
return 0;
|
|
@@ -157,7 +173,7 @@ function upgradeStagePixel(options) {
|
|
|
157
173
|
console.info(msgPrefix + ': Upgrading pixels...');
|
|
158
174
|
|
|
159
175
|
const ret = replaceStageContent(options, options.sourcePathList, msgPrefix,
|
|
160
|
-
/([0-9])px/g, '$1');
|
|
176
|
+
/([0-9}])px/g, '$1');
|
|
161
177
|
return ret;
|
|
162
178
|
}
|
|
163
179
|
|
|
@@ -172,6 +188,17 @@ function upgradeStageAnimation(options)
|
|
|
172
188
|
return ret;
|
|
173
189
|
}
|
|
174
190
|
|
|
191
|
+
function upgradeStageHashHistory(options)
|
|
192
|
+
{
|
|
193
|
+
const msgPrefix = 'Stage ' + options.stageHashHistory;
|
|
194
|
+
console.info(msgPrefix + ': Upgrading hash history...');
|
|
195
|
+
|
|
196
|
+
const ret = replaceStageContent(options, options.sourcePathList, msgPrefix,
|
|
197
|
+
'createJsvHashHistory', 'jsvCreateHashHistory');
|
|
198
|
+
|
|
199
|
+
return ret;
|
|
200
|
+
}
|
|
201
|
+
|
|
175
202
|
function upgradeStageAudiotrack(options)
|
|
176
203
|
{
|
|
177
204
|
const msgPrefix = 'Stage ' + options.stageAudiotrack;
|
|
@@ -200,14 +227,17 @@ function upgradeStageImportPostfix(options)
|
|
|
200
227
|
if (importFromFile === content) {
|
|
201
228
|
return content;
|
|
202
229
|
}
|
|
203
|
-
let importFilePath = path.resolve(currentDir, importFromFile);
|
|
204
|
-
importFilePath += '.vue';
|
|
205
|
-
if (fs.existsSync(importFilePath) == false) {
|
|
206
|
-
return content;
|
|
207
|
-
}
|
|
208
230
|
|
|
209
|
-
|
|
210
|
-
|
|
231
|
+
let fixedContent = content;
|
|
232
|
+
|
|
233
|
+
const importFilePath = path.resolve(currentDir, importFromFile);
|
|
234
|
+
if (fs.existsSync(importFilePath + '.js')) {
|
|
235
|
+
// 执行到此处,则需要给给import的文件加上js尾缀。当同时存在.js和.vue时,.js优先。
|
|
236
|
+
fixedContent = content.replace(importFromFile, importFromFile + '.js');
|
|
237
|
+
} else if (fs.existsSync(importFilePath + '.vue')) {
|
|
238
|
+
// 执行到此处,则需要给给import的文件加上vue尾缀。
|
|
239
|
+
fixedContent = content.replace(importFromFile, importFromFile + '.vue');
|
|
240
|
+
}
|
|
211
241
|
|
|
212
242
|
return fixedContent;
|
|
213
243
|
}
|
|
@@ -229,7 +259,7 @@ function upgradeStageImportPostfix(options)
|
|
|
229
259
|
}
|
|
230
260
|
|
|
231
261
|
fs.writeFileSync(filePath, fixedContent, 'utf8');
|
|
232
|
-
console.info(msgPrefix + ': Upgraded ' + path.relative(options.rootDir, filePath)
|
|
262
|
+
console.info(msgPrefix + ': Upgraded ' + path.relative(options.rootDir, filePath));
|
|
233
263
|
}
|
|
234
264
|
|
|
235
265
|
return 0;
|
|
@@ -247,10 +277,19 @@ function upgradeStageAppConfig(options)
|
|
|
247
277
|
process.exit(1);
|
|
248
278
|
}
|
|
249
279
|
|
|
280
|
+
const appConfigFilePath = path.resolve(appConfigDir, 'app_config.json');
|
|
281
|
+
|
|
282
|
+
let ret = removeStageFile(options, [ appConfigFilePath ], msgPrefix,
|
|
283
|
+
[ 'app_config.json' ], 'app.config.json');
|
|
284
|
+
if (ret < 0) {
|
|
285
|
+
console.error(msgPrefix + ': Failed to upgrading app config file, is not found.');
|
|
286
|
+
process.exit(1);
|
|
287
|
+
}
|
|
288
|
+
|
|
250
289
|
const sourcePathList = getFilesRecursive(appConfigDir);
|
|
251
290
|
|
|
252
|
-
|
|
253
|
-
'.js', '.mjs');
|
|
291
|
+
ret = removeStageFile(options, sourcePathList, msgPrefix,
|
|
292
|
+
[ '.js', '.json' ], '.mjs');
|
|
254
293
|
|
|
255
294
|
return ret;
|
|
256
295
|
}
|
|
@@ -262,14 +301,16 @@ function upgradeStageMainEntry(options)
|
|
|
262
301
|
|
|
263
302
|
const mainEntryFilePath = path.resolve(options.upgradeDir, 'main.ts');
|
|
264
303
|
const fixedMainEntryFilePath = path.resolve(options.upgradeDir, 'main.tsx');
|
|
265
|
-
if (fs.existsSync(mainEntryFilePath) == false
|
|
266
|
-
|
|
304
|
+
if (fs.existsSync(mainEntryFilePath) == false) {
|
|
305
|
+
if (fs.existsSync(fixedMainEntryFilePath)) {
|
|
306
|
+
return 0;
|
|
307
|
+
}
|
|
267
308
|
console.error(msgPrefix + ': Failed to upgrading main entry, main.ts is not found.');
|
|
268
309
|
process.exit(1);
|
|
269
310
|
}
|
|
270
311
|
|
|
271
312
|
const ret = removeStageFile(options, [ mainEntryFilePath ], msgPrefix,
|
|
272
|
-
'main.ts', 'main.tsx');
|
|
313
|
+
[ 'main.ts' ], 'main.tsx');
|
|
273
314
|
|
|
274
315
|
return ret;
|
|
275
316
|
}
|
|
@@ -292,21 +333,26 @@ function main(argv)
|
|
|
292
333
|
}
|
|
293
334
|
|
|
294
335
|
// Stage 3
|
|
336
|
+
if (options.stages.includes(options.stageHashHistory)) {
|
|
337
|
+
upgradeStageHashHistory(options);
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
// Stage 4
|
|
295
341
|
if (options.stages.includes(options.stageAudiotrack)) {
|
|
296
342
|
upgradeStageAudiotrack(options);
|
|
297
343
|
}
|
|
298
344
|
|
|
299
|
-
// Stage
|
|
345
|
+
// Stage 5
|
|
300
346
|
if (options.stages.includes(options.stageImportPostfix)) {
|
|
301
347
|
upgradeStageImportPostfix(options);
|
|
302
348
|
}
|
|
303
349
|
|
|
304
|
-
// Stage
|
|
350
|
+
// Stage 6
|
|
305
351
|
if (options.stages.includes(options.stageAppConfig)) {
|
|
306
352
|
upgradeStageAppConfig(options);
|
|
307
353
|
}
|
|
308
354
|
|
|
309
|
-
// Stage
|
|
355
|
+
// Stage 7
|
|
310
356
|
if (options.stages.includes(options.stageMainEntry)) {
|
|
311
357
|
upgradeStageMainEntry(options);
|
|
312
358
|
}
|
|
@@ -321,12 +367,13 @@ function main(argv)
|
|
|
321
367
|
|
|
322
368
|
const requiredUsages = {
|
|
323
369
|
'--stages': `Upgrade stages, separate by comma(,). The value means the following:
|
|
324
|
-
1. Fix pixels.
|
|
325
|
-
2. Fix animation.
|
|
326
|
-
3. Fix
|
|
327
|
-
4. Fix
|
|
328
|
-
5. Fix
|
|
329
|
-
6.
|
|
370
|
+
1. Fix pixels. "[0-9}]px => [0-9}]"
|
|
371
|
+
2. Fix animation. ":onAnimationEnd => @animationend"
|
|
372
|
+
3. Fix hash history. "createJsvHashHistory => jsvCreateHashHistory"
|
|
373
|
+
4. Fix audiotrack. "<audiotrack => <jsv-audiotrack"
|
|
374
|
+
5. Fix import postfix. "import xxx from 'xxx' => import xxx from 'xxx.vue'"
|
|
375
|
+
6. Fix appConfig. "xxx.config.js => xxx.config.mjs"
|
|
376
|
+
7. Fix main.ts. "main.ts => main.tsx"`,
|
|
330
377
|
};
|
|
331
378
|
const optionalUsages = {
|
|
332
379
|
'--dir': 'Upgrade directory, default is [src].',
|