@shijiu/jsview 2.1.367-test.0 → 2.1.428

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,2 +1,2 @@
1
- /* eslint-disable */ class e{static CreateAudioPlayer(){return console.warn("BrowserPlatformMediaBridge.CreateAudioPlayer() is not supported"),{}}static CreateVideoPlayer(){return console.warn("BrowserPlatformMediaBridge.CreateVideoPlayer() is not supported"),{}}static OnCssStyleChanged(e,t){const i=this;i.parentNode,i.style.position="fixed",i.style.left=(t.left?t.left:0)+"px",i.style.top=(t.top?t.top:0)+"px",i.style.width=(t.width?t.width:0)+"px",i.style.height=(t.height?t.height:0)+"px",i.style.objectFit=t.objectFit,i.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.prevented=!1,this.target=t,this.timeStamp=Date.now(),this.type=e}preventDefault(){this.prevented=!0}jsvIsPrevented(){return this.prevented}}class i extends t{constructor(e){super(e)}}class s extends t{constructor(e,t){super(e),this.options=t}initCustomEvent(e,t,i,s){this.type=e}get detail(){return this.options?.detail}}class n extends t{constructor(e){super(e)}}n.JsvType={Focus:"focus",Blur:"blur"},void 0===window.Forge?(window.Forge={},console.log("Define forge browser")):console.log("Define using JsView forge engine-js");var o,r,a,l,c,d,h,u,m,p,v,f,g,w=window.Forge;class y{constructor(e,t){if(this.href="",this.origin="",this.protocol="",this.host="",this.hostname="",this.port="",this.pathname="",this.search="",this.hash="",!e)return;if(!0===e.startsWith("url")){let t=e.indexOf("(")+1,i=e.lastIndexOf(")");if("undefined"===(e=e.substring(t,i).trim())||"null"===e||0===e.length)return}if(!0===e.startsWith("data:")||!0===e.startsWith("jsvtexturestore:"))return void(this.href=e);let i=e.indexOf("://");if(!(i<0||i>10)||e.startsWith("./")||e.startsWith("/")||(e="./"+e),!0===e.startsWith("/"))e=document.location.origin+e;else if(!0===e.startsWith("./")&&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 s=this.href,n=s.indexOf("#");n>0&&(this.hash=s.substring(n),s=s.substring(0,n));let o=s.indexOf("?");o>1&&(this.search=s.substring(o),s=s.substring(0,o));let r=s,a=r.indexOf("://");this.protocol=a>0?r.substring(0,a+1):"";let l=a>1?r.substring(a+3):"";a=l.indexOf("/"),this.host=a>0?l.substring(0,a):"",this.pathname=a>=1?l.substring(a):"","file:"==this.protocol&&(this.host="",this.pathname=l),this.origin=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}}class k{static EnableEventListener(e){const t=window.JsvCode.Dom.PlatformBridge.JsViewId;window.JsvCode.Dom.PlatformBridge.SetOnEventListener(t,e)}static CreateElement(e,t){k.PushLazyTask(k.LazyTaskType.CreateElement,e,t)}static BindElementToRootView(e){k.PushLazyTask(k.LazyTaskType.BindElementToRootView,e)}static InsertElementChild(e,t,i){k.PushLazyTask(k.LazyTaskType.InsertElementChild,e,t,i)}static RemoveElementChild(e,t){k.PushLazyTask(k.LazyTaskType.RemoveElementChild,e,t)}static MoveElementChild(e,t,i,s){k.PushLazyTask(k.LazyTaskType.MoveElementChild,e,t,i,s)}static ReOrderElementChild(e,t,i){k.PushLazyTask(k.LazyTaskType.ReOrderElementChild,e,t,i)}static AddElementEventListener(e,t,i){k.PushLazyTask(k.LazyTaskType.AddElementEventListener,e,t,i)}static RemoveElementEventListener(e,t,i){k.PushLazyTask(k.LazyTaskType.RemoveElementEventListener,e,t,i)}static SetElementText(e,t){k.PushLazyTask(k.LazyTaskType.SetElementText,e,t)}static SetElementAttribute(e,t,i){k.PushLazyTask(k.LazyTaskType.SetElementAttribute,e,t,i),k.LazyTaskSyncedListenerMap.has(e)&&k.CachedSyncListenIdSet.add(e)}static GetElementBoundingClientStyles(e,t){return k.RunSyncTask(k.LazyTaskType.GetElementBoundingClientStyles,e,t)}static SetForgeViewInnerProps(e,t,i){let s=0;(t=t.substr(12)).startsWith("mask-")&&(s=1,t=t.substr(5)),k.PushLazyTask(k.LazyTaskType.SetForgeViewInnerProps,e,t,s,""+i)}static DeclareStyleSheets(e){k.PushLazyTask(k.LazyTaskType.DeclareStyleSheets,-1,e)}static UndeclareStyleSheets(e){k.PushLazyTask(k.LazyTaskType.UndeclareStyleSheets,-1,e)}static SetStyleProperty(e,t,i){k.PushLazyTask(k.LazyTaskType.SetStyleProperty,e,t,i),k.LazyTaskSyncedListenerMap.has(e)&&k.CachedSyncListenIdSet.add(e)}static GetStyleProperties(e,t){return k.RunSyncTask(k.LazyTaskType.GetStyleProperties,e,t)}static AppendLazyTaskSyncedListener(e,t){k.LazyTaskSyncedListenerMap.set(e,t)}static RemoveLazyTaskSyncedListener(e){k.LazyTaskSyncedListenerMap.delete(e)}static RequestSwapAllCachedTasks(){if(0==k.CachedLazyTaskList.length)return;const e=JSON.stringify(k.CachedLazyTaskList);k.CachedLazyTaskList=[];const t=window.JsvCode.Dom.PlatformBridge.JsViewId;window.JsvCode.Dom.PlatformBridge.RunLazyTaskList(t,e);for(const e of k.CachedSyncListenIdSet){const t=k.LazyTaskSyncedListenerMap.get(e);t?.()}k.CachedSyncListenIdSet.clear()}static GetElementAttribute(e,t){return k.RunSyncTask(k.LazyTaskType.GetElementAttribute,e,t)}static InsertKeyFrame(e,t){k.PushLazyTask(k.LazyTaskType.InsertKeyFrameDefine,-1,e,t)}static RemoveKeyFrame(e){k.PushLazyTask(k.LazyTaskType.RemoveKeyFrameDefine,-1,e)}static GetRelativePosition(e,t){const i=k.RunSyncTask(k.LazyTaskType.GetRelativePosition,e,t);return JSON.parse(i)}static RunSyncTask(e,t,...i){k.RequestSwapAllCachedTasks();const s=window.JsvCode.Dom.PlatformBridge.JsViewId;return window.JsvCode.Dom.PlatformBridge.RunSyncTask(s,e,t,...i)}static PushLazyTask(e,t,...i){k.CachedLazyTaskList.push([e,t,...i]),w.sRenderBridge?.RequestSwap()}}k.CachedLazyTaskList=new Array,k.CachedSyncListenIdSet=new Set,k.LazyTaskSyncedListenerMap=new Map,k.LazyTaskType={CreateElement:10,BindElementToRootView:11,InsertElementChild:12,RemoveElementChild:13,AddElementEventListener:14,RemoveElementEventListener:15,SetElementText:16,SetElementAttribute:17,GetElementBoundingClientStyles:18,GetElementAttribute:19,MoveElementChild:20,GetRelativePosition:21,ReOrderElementChild:22,DeclareStyleSheets:30,SetStyleProperty:31,GetStyleProperties:32,UndeclareStyleSheets:39,SetForgeViewInnerProps:40,InsertKeyFrameDefine:41,RemoveKeyFrameDefine:42};class T{}T.Dom=k,T.Media=class{static CreateAudioPlayer(){return window.JsvCode.Media.PlatformBridge.CreateAudioPlayer()}static CreateVideoPlayer(){return window.JsvCode.Media.PlatformBridge.CreateVideoPlayer()}};class C{static GenerateId(){const e=this.UniqueId++;if(e>=this.MaxUniqueId)throw new Error("JsvUniqueId.GenerateId() Failed to create unique id. id is overflow.");return e}}C.UniqueId=0,C.MaxUniqueId=Math.pow(2,31)-1;class N{constructor(e){this.childNodes=[],this.nodeType=e,this.ownerDocument=window.document,this.parentNode=null,this.jsvEventListenerMap=null,this.jsvChildChangedCallback=null}jsvFinalize(){}appendChild(e){this.childNodes.push(e),e.parentNode=this,this.jsvChildChangedCallback?.()}removeChild(e){let t=this.childNodes.indexOf(e);if(t<0)throw new DOMException("Failed to remove node, child node is not found. node=",e);this.childNodes.splice(t,1),e.parentNode=null,this.jsvChildChangedCallback?.()}insertBefore(e,t){this.insertBeforeInner(e,t)}get previousSibling(){const e=this.parentNode?.childNodes;let t=e?.indexOf(this);if(void 0===t||t<0)throw new DOMException("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(void 0===t||t<0)throw new DOMException("Failed to call Node.nextSibling(), this node not found. this=",this);return e[t+1]}addEventListener(e,t,i){this.jsvEventListenerMap||(this.jsvEventListenerMap=new Map);let s=this.jsvEventListenerMap?.get(e);s||(s=new Set,this.jsvEventListenerMap?.set(e,s)),s.add(t)}removeEventListener(e,t,i){let s=this.jsvEventListenerMap?.get(e);s&&(s.delete(t),s.size<=0&&this.jsvEventListenerMap?.delete(e),0==this.jsvEventListenerMap?.size&&(this.jsvEventListenerMap=null))}dispatchEvent(e){if(!this.jsvEventListenerMap)return void console.warn("Node.dispatchEvent() Ignore to dispatch event: "+e.type+". No event added.");let t=this.jsvEventListenerMap?.get(e.type);if(t){e.target||(e.target=document.activeElement);for(let i of t)if(i?.(e),e.jsvIsPrevented())break}else console.warn("Node.dispatchEvent() Ignore to dispatch event: "+e.type+". No listener added.")}jsvObserveChildChanged(e){this.jsvChildChangedCallback=e}jsvMoveChildReOrder(e,t){{let t=this.childNodes.indexOf(e);if(t<0)throw new DOMException("Failed to call jsvMoveChildReOrder, node not found. node=",e);this.childNodes.splice(t,1)}{let i=this.childNodes.length;if(t&&(i=this.childNodes.indexOf(t),i<0))throw new DOMException("Failed to call move node, before node not found. beforeNode=",t);this.childNodes.splice(i,0,e)}this.jsvChildChangedCallback?.()}jsvMoveChildToNewParent(e,t,i){let s=this.childNodes.indexOf(e);if(s<0)throw new DOMException("Failed to call jsvMoveChildToNewParent, node not found. node=",e);this.childNodes.splice(s,1),e.parentNode=null,this.jsvChildChangedCallback?.(),t.insertBeforeInner(e,i)}jsvGetEventListenerSet(e){const t=this.jsvEventListenerMap?.get(e);return t}insertBeforeInner(e,t){let i=this.childNodes.length;if(void 0===t)throw new DOMException("TypeError: Failed to execute 'insertBefore' on 'Node': 2 arguments required, but only 1 present.");if(null!==t&&(i=this.childNodes.indexOf(t)),i<0)throw new DOMException("Failed to call insert node, before node not found. beforeNode=",t);this.childNodes.splice(i,0,e),e.parentNode=this,this.jsvChildChangedCallback?.()}}function b(e,t,i){return"symbol"==typeof t&&(t=t.description?"[".concat(t.description,"]"):""),Object.defineProperty(e,"name",{configurable:!0,value:i?"".concat(i," ",t):t})}N.ELEMENT_NODE=1,N.TEXT_NODE=3,N.COMMENT_NODE=8,N.DOCUMENT_NODE=9,N.NOLAYOUT_NODE=10;class D{static HasGetterMethod(e){switch(e){case D.Layout.Height:case D.Layout.Left:case D.Layout.Top:case D.Layout.Width:case D.Effect.ObjectFit:return!0;default:return!1}}static ToConst(e){return e==D.Layout.Height?D.Layout.Height:e==D.Layout.Left?D.Layout.Left:e==D.Layout.Top?D.Layout.Top:e==D.Layout.Width?D.Layout.Width:e==D.Background.BackgroundColor?D.Background.BackgroundColor:e==D.Background.BackgroundImage?D.Background.BackgroundImage:e==D.Background.BorderRadius?D.Background.BorderRadius:e==D.Effect.BackfaceVisibility?D.Effect.BackfaceVisibility:e==D.Effect.BorderImage?D.Effect.BorderImage:e==D.Effect.BorderImageWidth?D.Effect.BorderImageWidth:e==D.Effect.BorderImageOutset?D.Effect.BorderImageOutset:e==D.Effect.Display?D.Effect.Display:e==D.Effect.ObjectFit?D.Effect.ObjectFit:e==D.Effect.Opacity?D.Effect.Opacity:e==D.Effect.Overflow?D.Effect.Overflow:e==D.Effect.Perspective?D.Effect.Perspective:e==D.Effect.PerspectiveOrigin?D.Effect.PerspectiveOrigin:e==D.Effect.Transform?D.Effect.Transform:e==D.Effect.TransformOrigin?D.Effect.TransformOrigin:e==D.Effect.TransformStyle?D.Effect.TransformStyle:e==D.Effect.Visibility?D.Effect.Visibility:e==D.Effect.ZIndex?D.Effect.ZIndex:e==D.Text.Color?D.Text.Color:e==D.Text.FontFamily?D.Text.FontFamily:e==D.Text.FontSize?D.Text.FontSize:e==D.Text.FontStyle?D.Text.FontStyle:e==D.Text.FontWeight?D.Text.FontWeight:e==D.Text.LineHeight?D.Text.LineHeight:e==D.Text.TextAlign?D.Text.TextAlign:e==D.Text.TextOverflow?D.Text.TextOverflow:e==D.Text.TextShadow?D.Text.TextShadow:e==D.Text.WebkitTextStroke?D.Text.WebkitTextStroke:e==D.Text.WhiteSpace?D.Text.WhiteSpace:e==D.Text.WordWrap?D.Text.WordWrap:e==D.Text.Direction?D.Text.Direction:e==D.Text.JsvTextEmoji?D.Text.JsvTextEmoji:e==D.Text.JsvTextLatex?D.Text.JsvTextLatex:e==D.Text.JsvTextAlignMinWidth?D.Text.JsvTextAlignMinWidth:e==D.Text.JsvTextVerticalAlign?D.Text.JsvTextVerticalAlign:e==D.Text.JsvTextLineAlign?D.Text.JsvTextLineAlign:e==D.Text.JsvTextInnerDirection?D.Text.JsvTextInnerDirection:e==D.Motion.Animation?D.Motion.Animation:e==D.Motion.Transition?D.Motion.Transition:e==D.Motion.AnimationFillMode?D.Motion.AnimationFillMode:null}constructor(){throw new Error("new StyleName() is forbidden.")}}D.Layout=(b(o=class{constructor(){throw new Error("new StyleName.Layout() is forbidden.")}},"Layout"),o.Height="height",o.Left="left",o.Top="top",o.Width="width",o),D.Background=(b(r=class{constructor(){throw new Error("new StyleName.Background() is forbidden.")}},"Background"),r.BackgroundColor="backgroundColor",r.BackgroundImage="backgroundImage",r.BorderRadius="borderRadius",r),D.Effect=(b(a=class{constructor(){throw new Error("new StyleName.Effect() is forbidden.")}},"Effect"),a.BackfaceVisibility="backfaceVisibility",a.BorderImage="borderImage",a.BorderImageWidth="borderImageWidth",a.BorderImageOutset="borderImageOutset",a.Display="display",a.ObjectFit="objectFit",a.Opacity="opacity",a.Overflow="overflow",a.Perspective="perspective",a.PerspectiveOrigin="perspectiveOrigin",a.Transform="transform",a.TransformOrigin="transformOrigin",a.TransformStyle="transformStyle",a.Visibility="visibility",a.ZIndex="zIndex",a),D.Text=(b(l=class{constructor(){throw new Error("new StyleName.Text() is forbidden.")}},"Text"),l.Color="color",l.FontFamily="fontFamily",l.FontSize="fontSize",l.FontStyle="fontStyle",l.FontWeight="fontWeight",l.LineHeight="lineHeight",l.TextAlign="textAlign",l.TextOverflow="textOverflow",l.TextShadow="textShadow",l.WebkitTextStroke="WebkitTextStroke",l.WhiteSpace="whiteSpace",l.WordWrap="wordWrap",l.Direction="direction",l.JsvTextEmoji="JsvTextEmoji",l.JsvTextLatex="JsvTextLatex",l.JsvTextAlignMinWidth="JsvTextAlignMinWidth",l.JsvTextVerticalAlign="JsvTextVerticalAlign",l.JsvTextLineAlign="JsvTextLineAlign",l.JsvTextInnerDirection="JsvTextInnerDirection",l),D.Motion=(b(c=class{constructor(){throw new Error("new StyleName.Motion() is forbidden.")}},"Motion"),c.Animation="animation",c.Transition="transition",c.AnimationFillMode="animationFillMode",c);class x{constructor(e){let t=-1,i=null;null==e?t=x.DataType.Null:Number(e)===e&&e%1==0?t=x.DataType.Int32:Number(e)===e&&e%1!=0?t=x.DataType.Float:"string"==typeof e||e instanceof String?t=x.DataType.String:e instanceof x.AnimationImpl?t=x.DataType.Animation:e instanceof x.CornerImpl?t=x.DataType.Corner:e instanceof x.RectImpl?t=x.DataType.Rect:e instanceof x.TextShadowImpl?t=x.DataType.TextShadow:e instanceof x.WebkitTextStrokeImpl?t=x.DataType.WebkitTextStroke:e instanceof x.TransitionImpl?t=x.DataType.Transition:e instanceof x.BorderImageImpl&&(t=x.DataType.BorderImage),e!=x.InvalidInt32&&e!=x.InvalidFloat&&e!=x.InvalidPointer?i=e:(t=x.DataType.Null,i=null),this.data=new x.DataInfo,this.data.index=t,this.data.value=i}toString(){let e=null;switch(this.data.index){case x.DataType.Null:return"";case x.DataType.Int32:case x.DataType.Float:return String(this.get());case x.DataType.String:e=this.get();break;case x.DataType.Animation:case x.DataType.Corner:case x.DataType.Rect:case x.DataType.TextShadow:case x.DataType.WebkitTextStroke:case x.DataType.Transition:case x.DataType.BorderImage:case x.DataType.BackgroundImage:e=this.get().rawValue;break;default:console.error("Failed to do StyleValue.toString()")}return e??""}is(e){return this.data.index==e}get(){return this.data.value}reset(e){this.data.value=e.data.value,this.data.index=e.data.index}equals(e){return this.data.value===e.data.value&&this.data.index===e.data.index}}x.Base=class{constructor(e){this.rawValue=e}},x.AnimationImpl=class extends x.Base{constructor(e){super(e),this.name="",this.duration=0,this.timingFunction=null,this.delay=0,this.iterationCount=0,this.direction=!1}},x.CornerImpl=class extends x.Base{constructor(e){super(e),this.topLeft=0,this.topRight=0,this.bottomRight=0,this.bottomLeft=0}},x.RectImpl=class extends x.Base{constructor(e){super(e),this.top=0,this.right=0,this.left=0,this.bottom=0}},x.TextShadowImpl=class extends x.Base{constructor(e){super(e),this.hShadow=0,this.vShadow=0,this.blur=0,this.color=void 0}},x.WebkitTextStrokeImpl=class extends x.Base{constructor(e){super(e),this.length=0,this.color=void 0}},x.TransitionImpl=class extends x.Base{constructor(e){super(e),this.animationMap=new Map}},x.BorderImageImpl=class extends x.Base{constructor(e){super(e),this.source="",this.slice=null}},x.BackgroundImageImpl=(b(d=class extends x.Base{constructor(e){super(e),this.type=0,this.urlPath=""}},"BackgroundImageImpl"),d.eType={UNKNOWN:0,LINEAR_GRADIENT:1,URL_PATH:2},d.LinearGradient=class{constructor(){this.fromX=0,this.fromY=0,this.toX=0,this.toY=0,this.stops=[]}},d),x.DataType=(b(h=class{},"DataType"),h.Null=0,h.Int32=1,h.Float=2,h.String=3,h.Animation=4,h.Corner=5,h.Rect=6,h.TextShadow=7,h.WebkitTextStroke=8,h.Transition=9,h.BorderImage=10,h.BackgroundImage=11,h),x.InvalidInt32=Number.MIN_VALUE,x.InvalidFloat=Number.NaN,x.InvalidPointer=null,x.DataInfo=class{constructor(){this.value=null,this.index=-1}},b(u=class{},"Text"),u.Color="#000000",u.FontFamily="黑体",u.FontSize=10,u.FontStyle="normal",u.FontWeight="normal",u.LineHeight=0,u.TextAlign="start",u.TextOverflow="clip",u.TextShadow=null,u.WebkitTextStroke=null,u.WhiteSpace="normal",u.WordWrap="normal",u.Direction="ltr",u.JsvTextEmoji=0,u.JsvTextLatex=0,u.JsvTextAlignMinWidth=0,u.JsvTextVerticalAlign="top",u.JsvTextLineAlign="middle",u.JsvTextInnerDirection="unset",b(m=class{constructor(){this.height=x.InvalidInt32,this.left=x.InvalidInt32,this.top=x.InvalidInt32,this.width=x.InvalidInt32}},"Layout"),m.Name="layout",b(p=class{constructor(){this.backgroundColor=x.InvalidPointer,this.backgroundImage=x.InvalidPointer,this.borderRadius=x.InvalidPointer}},"Background"),p.Name="background",b(v=class{constructor(){this.backfaceVisibility=x.InvalidPointer,this.borderImage=x.InvalidPointer,this.borderImageWidth=x.InvalidPointer,this.borderImageOutset=x.InvalidPointer,this.display=x.InvalidPointer,this.objectFit=x.InvalidPointer,this.opacity=x.InvalidFloat,this.overflow=x.InvalidPointer,this.perspective=x.InvalidInt32,this.perspectiveOrigin=x.InvalidPointer,this.transform=x.InvalidPointer,this.transformOrigin=x.InvalidPointer,this.transformStyle=x.InvalidPointer,this.visibility=x.InvalidPointer,this.zIndex=x.InvalidInt32}},"Effect"),v.Name="effect",b(f=class{constructor(){this.color=x.InvalidPointer,this.fontFamily=x.InvalidPointer,this.fontSize=x.InvalidInt32,this.fontStyle=x.InvalidPointer,this.fontWeight=x.InvalidPointer,this.lineHeight=x.InvalidInt32,this.textAlign=x.InvalidPointer,this.textOverflow=x.InvalidPointer,this.textShadow=x.InvalidPointer,this.webkitTextStroke=x.InvalidPointer,this.whiteSpace=x.InvalidPointer,this.wordWrap=x.InvalidPointer,this.direction=x.InvalidPointer,this.jsvTextEmoji=x.InvalidInt32,this.jsvTextLatex=x.InvalidInt32,this.jsvTextAlignMinWidth=x.InvalidInt32,this.jsvTextVerticalAlign=x.InvalidPointer,this.jsvTextLineAlign=x.InvalidPointer,this.jsvTextInnerDirection=x.InvalidPointer}},"Text"),f.Name="text",b(g=class{constructor(){this.animation=x.InvalidPointer,this.transition=x.InvalidPointer,this.animationFillMode="none"}},"Motion"),g.Name="motion";class I{static JsvDeclarePrototype(){for(let e in D){let t=D[e];for(let e in t){let i=t[e];if("string"!=typeof i)continue;const s={set:function(e){this.setProperty(i,e)},get:function(){return this.getPropertyValue(i)}};Object.defineProperty(I.prototype,i,s)}}}constructor(e){this.cachedProps={},this.nativeId=e}setProperty(e,t){if(window.JsvCode.Dom.CheckStyleFormat?.(e,t),e==D.Background.BackgroundImage&&"string"==typeof t)if(0==t.indexOf("linear-gradient")){const e=t.match(/\(/g)?.length,i=t.match(/\)/g)?.length;e!=i&&(console.error(`StyleError: illegal linear-gradient value '${t}'`),t="")}else{t=new y(t).href}else if(e==D.Effect.BorderImage&&"string"==typeof t){const e=t.split(" ");e.length>0&&(e[0]=new y(e[0]).href),t=e.join(" ")}else e==D.Effect.Display&&(this.cachedProps[e]=t);T.Dom.SetStyleProperty(this.nativeId,e,t)}getPropertyValue(e){if(e==D.Effect.Display)return this.cachedProps[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),i=T.Dom.GetStyleProperties(this.nativeId,t);return JSON.parse(i)}}class E extends t{constructor(e){super(e)}}class S extends N{static JsvEnableEventListener(){T.Dom.EnableEventListener((function(e,t,...i){let s=S.JsvEventListenerMap.get(e);const n=s?.get(t);n?.(t,...i)}))}constructor(e){super(N.ELEMENT_NODE),this.jsvNativeId=-1,this.jsvAttrStore={},this.jsvClientSizeStore={},this.tagName=e,this.tagName!=S.JsvTagName.Audio&&this.tagName!=S.JsvTagName.Div&&this.tagName!=S.JsvTagName.Image&&this.tagName!=S.JsvTagName.Video&&this.tagName!=S.JsvTagName.JsvFDiv||(this.jsvNativeId=C.GenerateId(),this.style=new I(this.jsvNativeId),T.Dom.CreateElement(this.jsvNativeId,e))}appendChild(e){e.parentNode?this.moveChildNode(e,null):(super.appendChild(e),this.jsvInsertChild(e,null))}removeChild(e){super.removeChild(e),this.jsvRemoveChild(e),e instanceof S&&e.jsvNativeId>0&&T.Dom.RemoveElementChild(this.jsvNativeId,e.jsvNativeId)}insertBefore(e,t){e.parentNode?e.parentNode==this?(this.jsvMoveChildReOrder(e,t),this.jsvReOrderChildNode(e,t)):this.moveChildNode(e,t):(super.insertBefore(e,t),this.jsvInsertChild(e,t))}addEventListener(e,t,i){const s=this.jsvGetEventListenerSet(e);s?.has(t)?console.warn("Element.addEventListener() Faild to add listener, func is exists"):(i=this.jsvCheckEventOptions(i),this.jsvNativeId&&(this.jsvAddListener(this.jsvNativeId,e),T.Dom.AddElementEventListener(this.jsvNativeId,e,i)),super.addEventListener(e,t,i))}removeEventListener(e,t,i){const s=this.jsvGetEventListenerSet(e);0!=!!s?.has(t)&&(i=this.jsvCheckEventOptions(i),super.removeEventListener(e,t,i),this.jsvNativeId&&(this.jsvRemoveListener(this.jsvNativeId,e),T.Dom.RemoveElementEventListener(this.jsvNativeId,e,i)))}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.jsvClientSizeStore.clientWidth||(this.jsvClientSizeStore.clientWidth=T.Dom.GetElementAttribute(this.jsvNativeId,"clientWidth")),this.jsvClientSizeStore.clientWidth}get clientHeight(){return this.jsvClientSizeStore.clientHeight||(this.jsvClientSizeStore.clientHeight=T.Dom.GetElementAttribute(this.jsvNativeId,"clientHeight")),this.jsvClientSizeStore.clientHeight}setAttribute(e,t){e&&(this.jsvAttrStore[e]=t,this.jsvNativeId&&(e.startsWith("data-jsv-vw-")?T.Dom.SetForgeViewInnerProps(this.jsvNativeId,e,t):"class"===e||e.startsWith("data-v-")||e.startsWith("data-jsv")||e.startsWith("dataJsv")?T.Dom.SetElementAttribute(this.jsvNativeId,e,t):"id"===e&&T.Dom.SetForgeViewInnerProps(this.jsvNativeId,"data-jsv-vw-id",t)))}removeAttribute(e){delete this.jsvAttrStore[e],("class"==e||e.startsWith("data-v-")||"src"==e)&&this.jsvNativeId&&T.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 n(n.JsvType.Blur);t.target=e,document.dispatchEvent(t)}let t=new n(n.JsvType.Focus);document.dispatchEvent(t)}jsvGetBoundingClientRect(){const e="jsv-getbound",t=C.GenerateId();return new Promise(((i,s)=>{const n=o=>{const r=o.jsvParams?.[1];if(r!=t)return;o.preventDefault(),this.removeEventListener(e,n);const a=JSON.parse(o.jsvParams?.[0]??"{}");0===a.status?i(a.data):s(a.error)};this.addEventListener(e,n,{jsvtoken:t})}))}jsvSetOnLazyTaskSyncedListener(e){T.Dom.AppendLazyTaskSyncedListener(this.jsvNativeId,e)}jsvOnEvent(e,...n){let o;e.startsWith("animation")?(o=new i(e),o.animationName=n[0]):e.startsWith("transition")?(o=new E(e),o.propertyName=n[0]):e.startsWith("jsv")?(o=new s(e),o.options={detail:n[0]},o.jsvParams=n):"click"==e&&(o=new t(e),o.target=this),o&&(o.target=this,this.dispatchEvent(o))}jsvGetProxyView(e){return e?(this.maskViewProxy||(this.maskViewProxy=w.NewDomProxyView(this.jsvNativeId,!0)),this.maskViewProxy):(this.mainViewProxy||(this.mainViewProxy=w.NewDomProxyView(this.jsvNativeId,!1)),this.mainViewProxy)}jsvGetProxyTexture(e){return this.mainViewTextureProxy||(this.mainViewTextureProxy=e.GetDomProxyTexture(this.jsvNativeId)),this.mainViewTextureProxy}jsvGetRelativePosition(e){return T.Dom.GetRelativePosition(this.jsvNativeId,e.jsvNativeId)}jsvAddListener(e,t){let i=S.JsvEventListenerMap.get(e);i||(i=new Map,S.JsvEventListenerMap.set(e,i));this.jsvGetEventListenerSet(t)||i.set(t,this.jsvOnEvent.bind(this))}jsvRemoveListener(e,t){let i=S.JsvEventListenerMap.get(e);if(!i)return;this.jsvGetEventListenerSet(t)||i.delete(t)}moveChildNode(e,t){console.log("Do move child node");let i=e.parentNode;i.jsvMoveChildToNewParent(e,this,t),this.jsvMoveChildNode(i,e,t)}jsvMoveChildNode(e,t,i){t.jsvNativeId&&(i=S.JsvFindBackwardForgeView(i),T.Dom.MoveElementChild(this.jsvNativeId,e.jsvNativeId,t.jsvNativeId,i?.jsvNativeId))}jsvReOrderChildNode(e,t){e.jsvNativeId&&(t=S.JsvFindBackwardForgeView(t),T.Dom.ReOrderElementChild(this.jsvNativeId,e.jsvNativeId,t?.jsvNativeId))}jsvInsertChild(e,t){e.parentNode=this,e.nodeType===N.TEXT_NODE?this.textContent=e.nodeValue:e instanceof S&&e.jsvNativeId>0&&(t=S.JsvFindBackwardForgeView(t),T.Dom.InsertElementChild(this.jsvNativeId,e.jsvNativeId,t?.jsvNativeId))}jsvRemoveChild(e){if(e instanceof S!=0){for(const t of e.childNodes)e.jsvRemoveChild(t);e.jsvFinalize(),T.Dom.RemoveLazyTaskSyncedListener(e.jsvNativeId),S.JsvEventListenerMap.delete(e.jsvNativeId)}}jsvCheckEventOptions(e){if(null==e)return null;if("object"!=typeof e||e instanceof Array)return console.warn("Event options is invalid for ",e),null;const t=["capture","once","passive","signal"];for(const[i,s]of Object.entries(e))0==t.includes(i)&&0==i.startsWith("jsv")&&(console.warn("Event options name is invalid: ",i),delete e[i]),"boolean"==typeof s?e[i]=+e[i]:"number"!=typeof s&&(console.warn("Event options value is invalid: ",s),delete e[i]);return e}static JsvFindBackwardForgeView(e){let t=e;for(;t&&!(t instanceof S);)t=t.nextSibling;return t}}S.JsvTagName={Anchor:"A",Audio:"AUDIO",Div:"DIV",Head:"HEAD",Image:"IMG",IFrame:"IFRAME",Link:"LINK",Script:"SCRIPT",Style:"STYLE",Svg:"SVG",Video:"VIDEO",JsvAudioTrack:"JSV-AUDIOTRACK",JsvFDiv:"FDIV"},S.JsvEventListenerMap=new Map;class O extends S{constructor(){super(S.JsvTagName.Anchor),this.href="",this.protocol="",this.host="",this.search="",this.hash="",this.hostname="",this.port="",this.pathname="",console.warn("Warnig: <a> is fake in JsView system")}jsvGetTagName(){return S.JsvTagName.Anchor}}class F extends N{constructor(e){super(N.COMMENT_NODE),this.textContent=e}}class L extends S{constructor(){super(S.JsvTagName.Div),this.textContentStore=null}get textContent(){return this.textContentStore}set textContent(e){this.textContentStore=e,this.jsvClientSizeStore={},T.Dom.SetElementText(this.jsvNativeId,e)}}const P="FocusDebug",B="__AppRoot__";let M=!1,R=!1;function J(e,t){let i=function(e){let t="";if(e){let i=e,s=i.RouterDelegate?.ref?.NameSpace;for(s=s==B?"":s,t=`[${s?s+", ":""}${i.BranchName}]`,i=i.GetParentPage();i;)s=i.RouterDelegate?.ref?.NameSpace,s=s==B?"":s,t=`[${s?s+", ":""}${i.BranchName}]->`+t,i=i.GetParentPage()}return t}(e);if(t.stack){let e=t.stack.split("\n");e.length>=3&&(t.stack=e.slice(2,6))}let s="";for(let e of t.stack)s+=e+"\n";delete t.stack,console.log(P,`focusChange(${t?.from}):${t?.askName}\n:focusStack:${i}\n:trace:${s}:`,t)}class j{constructor(e,t){this._DefaultFocusNameSpace=null,this._DefaultFocusNameSpace=null,this.RouterDelegate={ref:null},e||(this.RouterDelegate.ref=new _(!1,t))}enableFocusTrace(e){M=!0,R=e}getNameSpace(){let e=this.RouterDelegate.ref.NameSpace;return e==B?"":e}wrapWithNameSpace(e){let t=new j(!0);return t._DefaultFocusNameSpace=e,t.RouterDelegate=this.RouterDelegate,t}getNodeByName(e){return this.RouterDelegate.ref.getNodeByName(e)}focusByNameBeforeMount(e,t,i){if("string"==typeof e)return e.includes(".")&&(e=e.split(".")),this.RouterDelegate.ref.focusBeforeMount(e,t,i);console.error(`setFocus name=${e} is invalid`)}setFocus(e,t){this._DefaultFocusNameSpace&&this._DefaultFocusNameSpace.length>0&&(e=`${this._DefaultFocusNameSpace}.${e}`);let i=null;M&&(i={askName:e,deepToChild:t,from:"setFocus",stack:R?new Error("simulate-stack").stack:null});return this.focusByNameBeforeMount(e,t,i)}printAllFocusable(){this.RouterDelegate.ref.printAllFocusRecursive(this._DefaultFocusNameSpace,"")}getCurrentFocusStack(){const e=[];if(this.RouterDelegate.ref){let t=this.RouterDelegate.ref.getCurrentFocusNode();for(;t&&t instanceof A;){let i=t.RouterDelegate?.ref?.NameSpace;e.push({nameSpace:i==B||i==t.BranchName?"":i,name:t.BranchName}),t=t.GetParentPage()}}else console.error("getCurrentFocusStack failed: router delegate is null.");return e}getLastFocus(){if(A.sLastFocus){let e=A.sLastFocus;for(;e._LatestFocusChild;)e=e._LatestFocusChild;return e.BranchName}return null}getCurrentFocus(){if(this.RouterDelegate.ref){const e=this.RouterDelegate.ref.getCurrentFocusNode();if(e)return e.BranchName}return null}getDeactivedPageFocus(){return this.RouterDelegate.ref?this.RouterDelegate.ref.getDeactivePageFocusName():null}returnFocusToParent(){const e=this.RouterDelegate.ref.getCurrentFocusNode();e?e.ReturnFocusToParent():console.warn("returnFocusToParent: current focus node is null.")}}class _{constructor(e,t){this._ChildMap={},this._FocusNameBeforeMount=null,this._BeforeMountStack=null,this._FocusNodeName=null,this._IsTemp=!!e,this.NameSpace=t}getDeactivePageFocusName(){return this._FocusNodeName}getCurrentFocusNode(){if(null==this._FocusNodeName)return null;let e=this._ChildMap[this._FocusNodeName];if(!e)return console.error("Erorr: node not mounted name="+this._FocusNodeName),null;if(e.RouterDelegate.ref!=this){let t=e.RouterDelegate.ref.getCurrentFocusNode();return null==t?e:t}return e}getNodeByName(e,t){let i=e.split(".");return this._FindRouterSearchBase(i,t)._GetNodeFromPathArray(i,e)}printAllFocusRecursive(e,t){let i=this.NameSpace==B?"":this.NameSpace,s=t+(t&&t.length>0?".":"")+i;for(let t in this._ChildMap){let i=this._ChildMap[t];if(!e||0==e.length||s.indexOf(e)>=0){let e=s===B?t:s+"."+t;console.log(e,i)}i.RouterDelegate.ref!=this&&i.RouterDelegate.ref.printAllFocusRecursive(e,s)}}_FindRouterSearchBase(e,t){if(0==e[0].length){let t,i;for(let e in this._ChildMap){t=this._ChildMap[e];break}do{i=t,t=t.GetParentPage()}while(null!=t);return e.splice(0,1),i.RouterDelegate.ref}return t&&t.AsHub&&t.GetParentPage()?t.GetParentPage().RouterDelegate.ref:this}_GetNodeFromPathArray(e,t){let i=0,s=this;for(;i<e.length-1;){let n=!1;for(let t in s._ChildMap){let o=s._ChildMap[t].RouterDelegate.ref;if(o!=s&&o.NameSpace==e[i]){s=o,i++,n=!0;break}}if(!n)return void console.error(`Error: no found subpath fname=${t}`)}let n=e[i];return s._ChildMap.hasOwnProperty(n)?s._ChildMap[n]:void console.error(`Error: no found fname=${t}`)}add(e,t){if(e.indexOf(".")>=0)console.error("ERROR: FDiv name can not contains '.'");else if(this._ChildMap.hasOwnProperty(e)&&this._ChildMap[e]!==t)console.error(`ERROR: FDiv router branch name duplicated:[${e}]`);else if(this._ChildMap[e]=t,this._FocusNameBeforeMount)if("string"==typeof this._FocusNameBeforeMount)this._FocusNameBeforeMount==e&&t.RouterDelegate.ref.focusBeforeMount(this._FocusNameBeforeMount,!1,this._BeforeMountStack);else{this._FocusNameBeforeMount[0]==e&&t.RouterDelegate.ref.focusBeforeMount(this._FocusNameBeforeMount.slice(1),!1,this._BeforeMountStack)}}remove(e,t,i,s){let n=this._ChildMap[e];n&&n==t&&(delete this._ChildMap[e],n.OnRemoveFromTree()),this._FocusNodeName==e&&i&&(s||(this._FocusNodeName=i))}rename(e,t){if(!this._ChildMap.hasOwnProperty(e))return void console.error(`ERROR: alter name failed ${e}->${t}`);let i=this._ChildMap[e];delete this._ChildMap[e],this.add(t,i),this._FocusNodeName==e&&(this._FocusNodeName=t)}clearChildFocus(){this._FocusNodeName=null,this._FocusNameBeforeMount=null}hasPendingFocusRequest(){return!this._FocusNameBeforeMount}focusBeforeMount(e,t,i){M&&!i&&console.error(P,`Error: found debug info missing from ${new Error("simulate-stack").stack}`);let s=!1;if("string"==typeof e){if(!e.includes(".")){s=!0;let n=this._ChildMap[e];if(this._FocusNodeName=e,n){this._FocusNameBeforeMount=null,this._BeforeMountStack=i,n.Focus(!t);let e=n.GetFocusChild();for(;e;){let t=e.GetFocusChild();if(!t){this._FocusNodeName=e.BranchName;break}e=t}return M&&J(e??n,i),n.RouterDelegate.ref!=this&&n.RouterDelegate.ref.clearChildFocus(),!0}return this._FocusNameBeforeMount=e,this._BeforeMountStack=i,!1}console.error("error: name contain .")}else if("object"==typeof e&&Array.isArray(e)&&e.length>0){if(s=!0,1==e.length)return this.focusBeforeMount(e[0],t,i);{let s=e[0],n=this._ChildMap[s];return this._FocusNodeName=s,n?n.RouterDelegate.ref.focusBeforeMount(e.slice(1),t,i):(this._FocusNameBeforeMount=e,this._BeforeMountStack=i,!1)}}return s||console.error("illegal name param",e),!1}focus(e,t,i){let s=this.focusBeforeMount(e,t,i);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 A extends w.PageBase{constructor(e){super(e),this._OnKeyDown=null,this._OnKeyUp=null,this._OnFocus=null,this._OnBlur=null,this._DispatchKeyDown=null,this._DispatchKeyUp=null,this._OnCustomEvent=null,this._DKeyDownProxy=void 0,this._DKeyUpProxy=void 0,this._Mounted=!1,this._MountWaitingList=null,this.AsHub=!1,this.InterfaceHub=null,this._TmpRouter=null,this._AutoShow=null,this.BranchName=e,this.RouterDelegate={ref:null},this._TmpRouter=null,this._OriginDispatchKeyDown=this._OriginDispatchKeyDown.bind(this),this._OriginDispatchKeyUp=this._OriginDispatchKeyUp.bind(this),this._AutoShow=!1}async waitMounted(){if(this._Mounted)return;let e=this;return new Promise(((t,i)=>{e._MountWaitingList||(e._MountWaitingList=[]),e._MountWaitingList.push(t)}))}updateMountState(){this._Mounted=!0;let e=this.SubPages;for(let t in e)e[t].updateMountState();if(this._MountWaitingList&&this._MountWaitingList.length>0){for(const e of this._MountWaitingList)e();this._MountWaitingList=null}}getHub(){return this.InterfaceHub||(this.InterfaceHub=new j(!0),this.InterfaceHub.RouterDelegate=this.RouterDelegate),this.InterfaceHub}setHub(e){this.RouterDelegate.ref?console.error("Error: hub is already setted."):(this.RouterDelegate.ref=e.RouterDelegate.ref,this.AsHub=!0)}_UseParentRouter(e){this.RouterDelegate=e,this.InterfaceHub&&(this.InterfaceHub.RouterDelegate=e)}routerAdd(e,t){t.RouterDelegate.ref||t._UseParentRouter(this.RouterDelegate),this.RouterDelegate.ref||(this.RouterDelegate.ref=new _(!0)),this.RouterDelegate.ref.add(e,t)}routerRenameChild(e,t){this.RouterDelegate.ref.rename(e,t)}routerUnbind(e,t){let i;this.AsHub?this.GetParentPage()&&(i=this.GetParentPage().RouterDelegate.ref):i=this.RouterDelegate.ref,i&&i.remove(this.BranchName,this,e,t),this.RouterDelegate={ref:null}}setBranchName(e){if(e===this.BranchName)return;let t=this.BranchName;this.BranchName=e,this.PageName=e,this._ParentPage&&this._ParentPage.routerRenameChild(t,e)}static safeCallback(e){return e&&e instanceof Function?function(...t){try{return e(...t)}catch(t){console.error("FocusNode: callback error",e.name,t)}}:null}setOnKeyDown(e){this._OnKeyDown=A.safeCallback(e)}setOnKeyUp(e){this._OnKeyUp=A.safeCallback(e)}setOnFocus(e){this._OnFocus=A.safeCallback(e)}setOnBlur(e){this._OnBlur=A.safeCallback(e)}setDispatchKeyUp(e){this._DispatchKeyUp=A.safeCallback(e)}setDispatchKeyDown(e){this._DispatchKeyDown=A.safeCallback(e)}setOnCustomEvent(e){this._OnCustomEvent=A.safeCallback(e)}setDispatchKeyProxy(e,t){this._DKeyDownProxy=A.safeCallback(e),this._DKeyUpProxy=A.safeCallback(t)}requestFocus(e){let t=null;M&&(t={askName:this.BranchName,deepToChild:e,from:"requestFocus",stack:R?new Error("simulate-stack").stack:null}),this.requestFocusInner(e,t)}ReturnFocusToParent(){if(this.IsFocus()){let e=this.GetParentPage();if(e){const t=e.BranchName;let i=null;M&&(i={askName:t,deepToChild:!1,from:"returnFocusToParent",stack:R?new Error("simulate-stack").stack:null}),e.RouterDelegate.ref.focus(t,!1,i)}}else super.ReturnFocusToParent()}requestFocusInner(e,t){let i=this.RouterDelegate.ref;return this.AsHub&&this.GetParentPage()&&(i=this.GetParentPage().RouterDelegate.ref),i?i.focus(this.BranchName,e,t):(console.error("error: lost router"),!1)}OnKeyDown(e){return!!this._OnKeyDown&&this._OnKeyDown(e)}OnKeyUp(e){return!!this._OnKeyUp&&this._OnKeyUp(e)}OnCustomEvent(e){return!!this._OnCustomEvent&&this._OnCustomEvent(e)}bubbleCustomEvent(e){this.BubbleCustomEvent(e)}dispatchKeyDown(e){return this.DispatchKeyDown(e)}DispatchKeyDown(e){return 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(),W()),e instanceof A)){if(this.RouterDelegate.ref&&this.RouterDelegate.ref._IsTemp){let t=this.RouterDelegate.ref;this.RouterDelegate.ref=null,t.forEach(((t,i)=>{e.routerAdd(i,t)}))}e.routerAdd(this.BranchName,this)}}focus(e){this.Focus(e)}Focus(e){if(!this._Mounted)return A.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(){A.sLastFocus=this,this._OnBlur&&this._OnBlur()}onUnMount(e){A.sLastFocus==this&&(A.sLastFocus=null);let t=this.IsFocus();if(M&&t){let t=this.GetParentPage();if(t){let i=null;i={askName:t.BranchName,deepToChild:!1,from:e?"deactive":"unmount",stack:R?new Error("simulate-stack").stack:null},J(t,i)}}let i=this.GetParentPage();i&&i.RemoveSubPage(this),this.ClearSubPages(),this.routerUnbind(i?.BranchName,e),this._Mounted=!1}getFullName(){let e=this,t=[this.RouterDelegate.ref.NameSpace];this.AsHub||t.push(this.BranchName);let i=this.RouterDelegate.ref;do{if(e=e.GetParentPage(),t[0]==B)break;e&&e.RouterDelegate.ref!=i&&(i=e.RouterDelegate.ref,t.unshift(i.NameSpace))}while(e);return t[0]==B?t.shift():console.error("ERROR: missing app root"),t.join(".")}getNodeByName(e){return this.RouterDelegate.ref.getNodeByName(e,this)}}A.sFocusMemos=[],A.sLastFocus=null,A.sRootPageNode=null;let W=()=>{let e=A.sFocusMemos.length;if(e>0){let t=A.sFocusMemos;A.sFocusMemos=[];for(let i=0;i<e;i++)t[i].obj.Focus(t[i].bcf)}},V={};class U{constructor(e,t,i){this._Element=i,V.hasOwnProperty(e)&&console.error(`Warn: FDivRoot duplicate name=${e}`),V[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(window.JsvCode.ForgeHandles.RootActivity,window.JsvCode.ForgeHandles.RootView):(window.addEventListener("keydown",(e=>{var i=document.activeElement?.tagName;i&&"input"===i.toLowerCase()||(t.dispatchKeyDown(e),e.preventDefault&&e.preventDefault())})),window.addEventListener("keyup",(e=>{var i=document.activeElement?.tagName;i&&"input"===i.toLowerCase()||(t.dispatchKeyUp(e),e.preventDefault&&e.preventDefault())})))}getElement(){return this._Element}getHub(){return this._Element.jsvGetHub()}onMounted(){this._Element.FocusNodeRef.updateMountState(),W()}}class z extends S{constructor(){super(S.JsvTagName.Image)}setAttribute(e,t){if("src"===e){t=new y(t).href,this.jsvClientSizeStore={}}super.setAttribute(e,t),this.jsvNativeId&&"src"===e&&T.Dom.SetElementAttribute(this.jsvNativeId,e,t)}jsvOnEvent(e,...i){let s;super.jsvOnEvent(e,...i),"load"==e&&(s=new t(e),s.target=this),s&&this.dispatchEvent(s)}}class G extends S{constructor(){super(S.JsvTagName.Link)}setAttribute(e,t){this[e]=t}jsvLoadResource(){let e=!1,t=null;if(null!=this.href){var i=new y(this.href);console.log("Ignore to load link from url="+i.href),e=!0}else console.warn("Failed to load link, href is not exists."),t="NoSrc";this.jsvOnLoadResult(e,t)}jsvOnLoadResult(e,i){if(console.log("Load link result: isSuccess:"+e+", errCode:"+i),e){if(this.onload){let e=new t("load");this.onload(e)}}else this.onerror&&this.onerror({type:"jsvErr_"+i,target:this})}}class K extends S{constructor(){super(S.JsvTagName.Script)}setAttribute(e,t){this[e]=t}jsvLoadResource(){if(null!=this.src){var e=new y(this.src);console.log("Load script with url="+e.href);var t=this;window.JsView.runJsWithUrl(e.href,!1,((e,i)=>{t.jsvOnLoadResult(e,i)}))}}jsvOnLoadResult(e,i){if(console.log("Load script result: isSuccess:"+e+", errCode:"+i),e){if(this.onload){let e=new t("load");this.onload(e)}}else this.onerror&&this.onerror({type:"jsvErr_"+i,target:this})}}class H extends S{constructor(){super(S.JsvTagName.Style),this.jsvAttrStore={left:0,top:0,width:0,height:0}}}class $ extends S{constructor(){super(S.JsvTagName.Svg)}}class q extends N{constructor(e){super(N.TEXT_NODE),this.textContent=e}get nodeValue(){return this.textContent}set nodeValue(e){this.textContent=e,this.parentNode&&(this.parentNode.textContent=this.textContent)}}let X=1;class Y extends S{constructor(){super(S.JsvTagName.JsvFDiv),this.FocusNodeRef=new A("unnamed-"+X++),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 j(!1,t);this.hubRef=e,this.FocusNodeRef.setHub(e),this.FocusNodeRef.setBranchName(t)}}removeAttribute(e){}jsvGetHub(){return this.hubRef}}class Z extends N{constructor(){super(N.DOCUMENT_NODE),this.location=window.location,this.rootElement=new L,this.rootElement.ownerDocument=this,this.rootElement.id="root",T.Dom.BindElementToRootView(this.rootElement.jsvNativeId),this.activeElement=this.rootElement,this.head=null}createComment(e){return new F(e)}createElement(e){switch(e=e.toUpperCase()){case S.JsvTagName.Anchor:return new O;case S.JsvTagName.Div:return new L;case S.JsvTagName.Image:return new z;case S.JsvTagName.Link:return new G;case S.JsvTagName.Script:return new K;case S.JsvTagName.Style:return new H;case S.JsvTagName.Svg:return new $;case S.JsvTagName.JsvFDiv:return new Y;case S.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"CUSTOMEVENT"===(e=e.toUpperCase())?new s(e):new t(e)}createTextNode(e){return new q(e)}getElementById(e){if("root"===e||"app"===e)return this.rootElement;throw new DOMException("Failed to get element by id, id="+e+" is UNIMPLEMENTED.")}getElementsByTagName(e){if((e=e.toUpperCase())===S.JsvTagName.Head)return[this.head];if(e===S.JsvTagName.Link||e===S.JsvTagName.Script||e===S.JsvTagName.Style)return[];throw new DOMException("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("title"===e)return null;if(e.startsWith("style[")&&e.endsWith("]"))return null;throw new DOMException("Failed to query selector, selectors="+e+" is UNIMPLEMENTED.")}querySelectorAll(e){return[]}jsvInitFDivRoot(e,t,i){if(!i){let e=document.createElement("fdiv");this.rootElement.appendChild(e),this.rootElement=e,i=this.rootElement}return new U(e,t,i)}}class Q extends S{constructor(){super(S.JsvTagName.Head)}appendChild(e){super.appendChild(e),(e instanceof G||e instanceof K)&&e.jsvLoadResource()}removeChild(e){super.removeChild(e)}}class ee{constructor(){this.ready=!1,this.callbacks=[]}listenToReady(e){this.ready?e?.():this.callbacks.push(e)}dataReady(){this.ready=!0;for(let e of this.callbacks)e?.()}}class te extends ee{constructor(){super(),this.TextureManager=null,this.RootActivity=null,this.RootView=null}setHandles(e,t,i){this.TextureManager=e,this.RootActivity=i,this.RootView=t,this.dataReady()}}let ie="@keyframes";class se{constructor(e){this._AnchorTag=e,this._NamesCache=new Set}insertRule(e){let t=this.getName(e);this._NamesCache.has(t)&&console.warn(`Warn: keyframe replace of name ${t}`),this._NamesCache.add(t),T.Dom.InsertKeyFrame(t,e)}hasRule(e){return this._NamesCache.has(e)}removeRule(e){this._NamesCache.has(e)?(this._NamesCache.delete(e),T.Dom.RemoveKeyFrame(e)):console.error(`Error: keyFrame(${e}) is not exist.`)}removeMultiRules(e){for(let t of e)this.removeRule(t)}getName(e){let t=e.indexOf(ie)+10,i=e.indexOf("{");return e.substring(t,i).trim()}}let ne=null;function oe(e){return ne||(ne={global:new se("global")}),ne.global}class re{static EnsureGlobalEnv(e,t){const i=window.navigator?.userAgent?.toLowerCase();window.jsvInAndroidWebView=i?.indexOf("android")>=0,re.EnsureGlobalJsvCode(e,t),S.JsvEnableEventListener(),I.JsvDeclarePrototype()}static EnsureGlobalJsvCode(e,t){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=T.Dom.DeclareStyleSheets),window.JsvCode.Dom.UndeclareStyleSheets||(window.JsvCode.Dom.UndeclareStyleSheets=T.Dom.UndeclareStyleSheets),window.JsvCode.Dom.getKeyFrameGroup||(window.JsvCode.Dom.getKeyFrameGroup=oe),window.JsvCode.ForgeHandles||(window.JsvCode.ForgeHandles=new te)}}class ae{static SetLevel(e){switch(ae.E=ae.W=ae.I=ae.D=function(){},e){case ae.Level.Verbose:ae.V=console.debug.bind(console);case ae.Level.Debug:ae.D=console.debug.bind(console);case ae.Level.Info:ae.I=console.info.bind(console)}}}ae.E=console.error.bind(console),ae.W=console.warn.bind(console),ae.I=console.info.bind(console),ae.D=function(){},ae.V=function(){},ae.Level={Error:0,Warning:1,Info:2,Debug:3,Verbose:4};class le{constructor(e){this.callback=e}observe(e,t){if(!(e instanceof N))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 ce{constructor(){this.init(),ce.Render?.()}init(){w.sRenderBridge.AddWillSwapListener("forgeSwap",(()=>{T.Dom.RequestSwapAllCachedTasks()})),window.JsvCode.ForgeHandles.setHandles(new w.TextureManager,null,null);let e=null;w.DesignMap&&(e=w.DesignMap(),w.sRenderBridge.InitScreenBuffer(e.displayScale,e.width)),w.DomElementGetter=e=>{let t=window.JsvCode.Dom.PlatformBridge.JsViewId;return window.JsvCode.Dom.PlatformBridge.GetInstance(t).forgeElementGetter(e)}}static SetRender(e){ce.Render=e,w.RunApp({})}}ce.Render=void 0;class de extends H{constructor(){super(),this.jsvBrowserElement=window.JsvCode.Dom.BrowserDocument.createElement(H.JsvTagName.Style)}}class he extends Q{constructor(){super()}appendChild(e){"HTMLLinkElement"==e.constructor.name||"HTMLScriptElement"==e.constructor.name?window.JsvCode.Dom.BrowserDocument.head.appendChild(e):e instanceof de?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 de?window.JsvCode.Dom.BrowserDocument.head.removeChild(e.jsvBrowserElement):super.removeChild(e)}}class ue extends Z{constructor(){super(),this.head=new he}createElement(e){switch(e=e.toUpperCase()){case S.JsvTagName.IFrame:case S.JsvTagName.Link:case S.JsvTagName.Script:return window.JsvCode.Dom.BrowserDocument.createElement(e);case S.JsvTagName.Style:return new de;default:return super.createElement(e)}}getElementsByTagName(e){return e.toUpperCase()===S.JsvTagName.Head?window.JsvCode.Dom.BrowserDocument.getElementsByTagName(e):super.getElementsByTagName(e)}}class me{static Get(e){return me.ValidStyleMap[e]}static IsUndefinedOrNumber(e,t){return!!me.IsUndefined(e,t)||(""===t||"number"==typeof t)}static IsUndefined(e,t){let i=void 0===t;return i&&console.error(e+" property is undefined!"),i}static KeyframesCheck(e,t){me.IsUndefined(e,t)||t.indexOf("transform")<0&&t.indexOf("opacity")<0&&console.error("keyframes property is only support transform and opacity, value:",t)}static ObjectFit(e,t){if(me.IsUndefined(e,t))return;const i="fill contain cover none scale-down";i.indexOf(t)<0&&console.error(" objectFit is only support one of string["+i+"]")}static TransitionOtherCheck(e,t){me.IsUndefined(e,t)||console.error(e+" property is not support, you can use transition property, e.g. transition='width 2s'")}static TransitionCheck(e,t){me.IsUndefined(e,t)||t.length>0&&(t.indexOf("left")<0&&t.indexOf("top")<0&&t.indexOf("width")<0&&t.indexOf("height")<0&&t.indexOf("transform")<0||t.indexOf("all")>=0)&&console.error("transition property's value only support [top, left, width, height, transform] value:",t)}static TransformCheck(e,t){me.IsUndefined(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 TransformOriginCheck(e,t){me.IsUndefined(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 TextOverflowCheck(e,t){if(!me.IsUndefined(e,t))switch(t){case"clip":case"ellipsis":break;default:console.error("textOverflow property's value is not support, value:",t)}}static WhiteSpaceCheck(e,t){if(!me.IsUndefined(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 TextAlignCheck(e,t){if(!me.IsUndefined(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 LineHeightCheck(e,t){if(!me.IsUndefinedOrNumber(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 ColorCheck(e,t){me.IsUndefined(e,t)||me.CheckColorFormat("Color()",t)}static VisibilityCheck(e,t){me.IsUndefined(e,t)||"visible"!==t&&"hidden"!==t&&"inherit"!==t&&console.error("visibility property's value is not support, value:",t)}static DisplayCheck(e,t){me.IsUndefined(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 OverflowCheck(e,t){me.IsUndefined(e,t)||"visible"!==t&&"hidden"!==t&&console.error("overflow property's value is support visible or hidden only, value:",t)}static TopCheck(e,t){if(!me.IsUndefinedOrNumber(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 LeftCheck(e,t){if(!me.IsUndefinedOrNumber(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 HeightCheck(e,t){if(!me.IsUndefinedOrNumber(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 WidthCheck(e,t){if(!me.IsUndefinedOrNumber(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 BackfaceVisibility(e,t){if(!me.IsUndefined(e,t))switch(t){case"visible":case"hidden":break;default:console.error("backfaceVisibility property's value is support visible/hidden only, value: ",t)}}static PerspectiveCheck(e,t){me.IsUndefined(e,t)}static WebkitTextStroke(e,t){if(me.IsUndefined(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 ZIndexCheck(e,t){me.IsUndefined(e,t)||isNaN(t)&&console.error("zIndex property's value is support number only, value: ",t)}static OpacityCheck(e,t){me.IsUndefined(e,t)||(isNaN(t)||t>1)&&console.error("opacity property's value is support number only(0.0 ~ 1.0), value: ",t)}static FontSizeCheck(e,t){if(!me.IsUndefinedOrNumber(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 FontWeightCheck(e,t){me.IsUndefined(e,t)||"bold"!==t&&console.error("fontWeight property's value is support bold only, value:",t)}static FontStyleCheck(e,t){me.IsUndefined(e,t)||"italic"!==t&&console.error("fontWeight property's value is support italic only, value:",t)}static BorderRadiusCheck(e,t){if(me.IsUndefined(e,t))return;let i=[t];"string"==typeof t&&(i=t.split(" ")),i.length>4&&console.error("borderRadius property's value is not support, value:",t)}static BorderImageWidthCheck(e,t){me.IsUndefinedOrNumber(e,t)}static BorderImageOutsetCheck(e,t){if(me.IsUndefined(e,t))return;t.split(" ").length>4&&console.error("borderImageOutsetCheck property's value is not support, value:",t)}static BorderImageCheck(e,t){me.IsUndefined(e,t)||t.indexOf("fill")<0&&console.error("borderImage property's value is not contain fill, e.g. source slice, but value:",t)}static BackgroundOtherCheck(e,t){console.error(e+" property not support, you can use backgroundImage property, e.g. backgroundImage=`url(${iconImgPath})`")}static BackgroundImageCheck(e,t){me.IsUndefined(e,t)||"inherit"==t&&console.error("backgroundImage property's value is not support, value:",t)}static BackgroundColorCheck(e,t){if(!me.IsUndefined(e,t))return me.CheckColorFormat("backgroundColor",t)}static AnimationCheck(e,t){}static AnimationFillModeCheck(e,t){if(!me.IsUndefined(e,t))switch(t){case"none":case"forwards":break;case"backwards":console.error("animationFillMode 'backwards' is not supported yet.");break;case"both":console.error("animationFillMode 'both' is not supported yet.");break;default:console.error("animationFillMode property value is not valid",t)}}static AnimationOtherNotSupport(e,t){console.error(e+" property is not support, you can use animation property, e.g. animation='mymove 5s infinite'")}static TransformStyleCheck(e,t){if(!me.IsUndefined(e,t))switch(t){case"flat":case"preserve-3d":break;default:console.error("transformStyle property value is not valid",t)}}static PerspectiveOriginCheck(e,t){me.IsUndefined(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 TextShadowCheck(e,t){if(!me.IsUndefined(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(!me.CheckColorFormat("textShadow",e[3]))return}}}static CheckColorFormat(e,t){if(0===t.indexOf("rgba(")||0===t.indexOf("rgb("));else{if(0!==t.indexOf("#"))return console.error(`${e} color value is not valid, need startwith rgba or #, value:[${t}]`),!1;if(4!==t.length&&7!==t.length&&9!==t.length)return console.error(`${e} color value's length is not valid, value:${t}`),!1}return!0}static JsvTextLatexCheck(e,t){me.IsUndefined(e,t)||"number"!=typeof t&&console.error("JsvTextLatex property's value is support number only, value: ",t)}static JsvTextEmojiCheck(e,t){me.IsUndefined(e,t)||"number"!=typeof t&&console.error("JsvTextEmoji property's value is support number only, value: ",t)}static DirectionCheck(e,t){if(!me.IsUndefined(e,t))switch(t){case"ltr":case"rtl":break;default:console.error("direction property's value is not support, value:",t)}}static JsvTextAlignMinWidthCheck(e,t){me.IsUndefined(e,t)||"number"!=typeof t&&console.error("JsvTextAlignMinWidth property's value is support number only, value: ",t)}static JsvTextVerticalAlignCheck(e,t){if(!me.IsUndefined(e,t))switch(t){case"top":case"middle":case"bottom":break;default:console.error("JsvTextVerticalAlign property's value is not support, value: ",t)}}static JsvTextLineAlignCheck(e,t){if(!me.IsUndefined(e,t))switch(t){case"top":case"middle":case"bottom":break;default:console.error("JsvTextLineAlign property's value is not support, value: ",t)}}static JsvTextInnerDirectionCheck(e,t){if(!me.IsUndefined(e,t))switch(t){case"unset":case"ltr":case"rtl":break;default:console.error("JsvTextInnerDirection property's value is not support, value: ",t)}}}me.ValidStyleMap={animation:{check:me.AnimationCheck},animationName:{check:me.AnimationOtherNotSupport},animationDuration:{check:me.AnimationOtherNotSupport},animationTimingFunction:{check:me.AnimationOtherNotSupport},animationDelay:{check:me.AnimationOtherNotSupport},animationIterationCount:{check:me.AnimationOtherNotSupport},animationDirection:{check:me.AnimationOtherNotSupport},animationPlayState:{check:me.AnimationOtherNotSupport},animationFillMode:{check:me.AnimationFillModeCheck},background:{check:me.BackgroundOtherCheck},backgroundColor:{check:me.BackgroundColorCheck},backgroundImage:{check:me.BackgroundImageCheck},borderImage:{check:me.BorderImageCheck},borderImageOutset:{check:me.BorderImageOutsetCheck},borderImageWidth:{check:me.BorderImageWidthCheck},borderRadius:{check:me.BorderRadiusCheck},height:{check:me.HeightCheck},width:{check:me.WidthCheck},zIndex:{check:me.ZIndexCheck},opacity:{check:me.OpacityCheck},fontFamily:{check:null},fontSize:{check:me.FontSizeCheck},fontStyle:{check:me.FontStyleCheck},fontWeight:{check:me.FontWeightCheck},left:{check:me.LeftCheck},overflow:{check:me.OverflowCheck},top:{check:me.TopCheck},visibility:{check:me.VisibilityCheck},display:{check:me.DisplayCheck},color:{check:me.ColorCheck},lineHeight:{check:me.LineHeightCheck},textAlign:{check:me.TextAlignCheck},direction:{check:me.DirectionCheck},whiteSpace:{check:me.WhiteSpaceCheck},textOverflow:{check:me.TextOverflowCheck},transform:{check:me.TransformCheck},transformOrigin:{check:me.TransformOriginCheck},transition:{check:me.TransitionCheck},transitionProperty:{check:me.TransitionOtherCheck},transitionDuration:{check:me.TransitionOtherCheck},transitionTimingFunction:{check:me.TransitionOtherCheck},transitionDelay:{check:me.TransitionOtherCheck},keyframes:{check:me.KeyframesCheck},objectFit:{check:me.ObjectFit},perspective:{check:me.PerspectiveCheck},backfaceVisibility:{check:me.BackfaceVisibility},transformStyle:{check:me.TransformStyleCheck},perspectiveOrigin:{check:me.PerspectiveCheck},WebkitTextStroke:{check:me.WebkitTextStroke},textShadow:{check:me.TextShadowCheck},JsvTextLatex:{check:me.JsvTextLatexCheck},JsvTextEmoji:{check:me.JsvTextEmojiCheck},JsvTextAlignMinWidth:{check:me.JsvTextAlignMinWidthCheck},JsvTextVerticalAlign:{check:me.JsvTextVerticalAlignCheck},JsvTextLineAlign:{check:me.JsvTextLineAlignCheck},JsvTextInnerDirection:{check:me.JsvTextInnerDirectionCheck}};class pe{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){pe.HookDocument(e),pe.HookOthers(),pe.DeclareAddition()}static HookDocument(e){window.JsvCode.Dom.BrowserDocument=e;const t=new ue;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 HookOthers(){window.MutationObserver=le,window.Element=S,window.SVGElement=$}static DeclareAddition(){const e=window.JsvCode.Dom.JsViewDocument;window.document.jsvInitFDivRoot=e.jsvInitFDivRoot.bind(e),window.JsvCode.Dom.CheckStyleFormat=window.jsvInAndroidWebView?null:pe.CheckStyleFormat}static CheckStyleFormat(e,t){if(e.startsWith("--"))return;let i=me.Get(e);i?i.check&&t&&i.check(e,t):console.error(e+" property is not support.")}}window.jsvIsBrowserDebug=!0;const ve=window.JsvCode.BrowserPlatformDomBridge,fe=window.JsvCode.BrowserPlatformMediaBridge;function ge(){const e=pe.BackupBrowser();ve.RegisterOriginDocument(e),re.EnsureGlobalEnv(ve,fe),pe.HookBrowser(e),ae.I("Using JsView HTML Environment.")}export{ce as BrowserForgeApp,ge as InitEnv};
1
+ /* eslint-disable */ class e{static CreateAudioPlayer(){return console.warn("BrowserPlatformMediaBridge.CreateAudioPlayer() is not supported"),{}}static CreateVideoPlayer(){return console.warn("BrowserPlatformMediaBridge.CreateVideoPlayer() is not supported"),{}}static OnCssStyleChanged(e,t){const i=this;i.parentNode,i.style.position="fixed",i.style.left=(t.left?t.left:0)+"px",i.style.top=(t.top?t.top:0)+"px",i.style.width=(t.width?t.width:0)+"px",i.style.height=(t.height?t.height:0)+"px",i.style.objectFit=t.objectFit,i.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.prevented=!1,this.target=t,this.timeStamp=Date.now(),this.type=e}preventDefault(){this.prevented=!0}jsvIsPrevented(){return this.prevented}}class i extends t{constructor(e){super(e)}}class s extends t{constructor(e,t){super(e),this.options=t}initCustomEvent(e,t,i,s){this.type=e}get detail(){return this.options?.detail}}class n extends t{constructor(e){super(e)}}n.JsvType={Focus:"focus",Blur:"blur"},void 0===window.Forge?(window.Forge={},console.log("Define forge browser")):console.log("Define using JsView forge engine-js");var o,r,a,l,c,d,h,u,m,p,f,v,g,w,y,k=window.Forge;class C{constructor(e,t){if(this.href="",this.origin="",this.protocol="",this.host="",this.hostname="",this.port="",this.pathname="",this.search="",this.hash="",!e)return;if(!0===e.startsWith("url")){let t=e.indexOf("(")+1,i=e.lastIndexOf(")");if("undefined"===(e=e.substring(t,i).trim())||"null"===e||0===e.length)return}if(!0===e.startsWith("data:")||!0===e.startsWith("jsvtexturestore:"))return void(this.href=e);let i=e.indexOf("://");if(!(i<0||i>10)||e.startsWith("./")||e.startsWith("/")||(e="./"+e),!0===e.startsWith("/"))e=document.location.origin+e;else if(!0===e.startsWith("./")&&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 s=this.href,n=s.indexOf("#");n>0&&(this.hash=s.substring(n),s=s.substring(0,n));let o=s.indexOf("?");o>1&&(this.search=s.substring(o),s=s.substring(0,o));let r=s,a=r.indexOf("://");this.protocol=a>0?r.substring(0,a+1):"";let l=a>1?r.substring(a+3):"";a=l.indexOf("/"),this.host=a>0?l.substring(0,a):"",this.pathname=a>=1?l.substring(a):"","file:"==this.protocol&&(this.host="",this.pathname=l),this.origin=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}}class T{static EnableEventListener(e){const t=window.JsvCode.Dom.PlatformBridge.JsViewId;window.JsvCode.Dom.PlatformBridge.SetOnEventListener(t,e)}static CreateElement(e,t){T.PushLazyTask(T.LazyTaskType.CreateElement,e,t)}static BindElementToRootView(e){T.PushLazyTask(T.LazyTaskType.BindElementToRootView,e)}static InsertElementChild(e,t,i){T.PushLazyTask(T.LazyTaskType.InsertElementChild,e,t,i)}static RemoveElementChild(e,t){T.PushLazyTask(T.LazyTaskType.RemoveElementChild,e,t)}static MoveElementChild(e,t,i,s){T.PushLazyTask(T.LazyTaskType.MoveElementChild,e,t,i,s)}static ReOrderElementChild(e,t,i){T.PushLazyTask(T.LazyTaskType.ReOrderElementChild,e,t,i)}static AddElementEventListener(e,t,i){T.PushLazyTask(T.LazyTaskType.AddElementEventListener,e,t,i)}static RemoveElementEventListener(e,t,i){T.PushLazyTask(T.LazyTaskType.RemoveElementEventListener,e,t,i)}static SetElementText(e,t){T.PushLazyTask(T.LazyTaskType.SetElementText,e,t)}static SetElementAttribute(e,t,i){T.PushLazyTask(T.LazyTaskType.SetElementAttribute,e,t,i),T.LazyTaskSyncedListenerMap.has(e)&&T.CachedSyncListenIdSet.add(e)}static GetElementBoundingClientStyles(e,t){return T.RunSyncTask(T.LazyTaskType.GetElementBoundingClientStyles,e,t)}static SetForgeViewInnerProps(e,t,i){let s=0;(t=t.substr(12)).startsWith("mask-")&&(s=1,t=t.substr(5)),T.PushLazyTask(T.LazyTaskType.SetForgeViewInnerProps,e,t,s,""+i)}static DeclareStyleSheets(e){T.PushLazyTask(T.LazyTaskType.DeclareStyleSheets,-1,e)}static UndeclareStyleSheets(e){T.PushLazyTask(T.LazyTaskType.UndeclareStyleSheets,-1,e)}static SetStyleProperty(e,t,i){T.PushLazyTask(T.LazyTaskType.SetStyleProperty,e,t,i),T.LazyTaskSyncedListenerMap.has(e)&&T.CachedSyncListenIdSet.add(e)}static GetStyleProperties(e,t){return T.RunSyncTask(T.LazyTaskType.GetStyleProperties,e,t)}static AppendLazyTaskSyncedListener(e,t){T.LazyTaskSyncedListenerMap.set(e,t)}static RemoveLazyTaskSyncedListener(e){T.LazyTaskSyncedListenerMap.delete(e)}static RequestSwapAllCachedTasks(){if(0==T.CachedLazyTaskList.length)return;const e=JSON.stringify(T.CachedLazyTaskList);T.CachedLazyTaskList=[];const t=window.JsvCode.Dom.PlatformBridge.JsViewId;window.JsvCode.Dom.PlatformBridge.RunLazyTaskList(t,e);for(const e of T.CachedSyncListenIdSet){const t=T.LazyTaskSyncedListenerMap.get(e);t?.()}T.CachedSyncListenIdSet.clear()}static GetElementAttribute(e,t){return T.RunSyncTask(T.LazyTaskType.GetElementAttribute,e,t)}static InsertKeyFrame(e,t){T.PushLazyTask(T.LazyTaskType.InsertKeyFrameDefine,-1,e,t)}static RemoveKeyFrame(e){T.PushLazyTask(T.LazyTaskType.RemoveKeyFrameDefine,-1,e)}static GetRelativePosition(e,t){const i=T.RunSyncTask(T.LazyTaskType.GetRelativePosition,e,t);return JSON.parse(i)}static RunSyncTask(e,t,...i){T.RequestSwapAllCachedTasks();const s=window.JsvCode.Dom.PlatformBridge.JsViewId;return window.JsvCode.Dom.PlatformBridge.RunSyncTask(s,e,t,...i)}static PushLazyTask(e,t,...i){T.CachedLazyTaskList.push([e,t,...i]),k.sRenderBridge?.RequestSwap()}}T.CachedLazyTaskList=new Array,T.CachedSyncListenIdSet=new Set,T.LazyTaskSyncedListenerMap=new Map,T.LazyTaskType={CreateElement:10,BindElementToRootView:11,InsertElementChild:12,RemoveElementChild:13,AddElementEventListener:14,RemoveElementEventListener:15,SetElementText:16,SetElementAttribute:17,GetElementBoundingClientStyles:18,GetElementAttribute:19,MoveElementChild:20,GetRelativePosition:21,ReOrderElementChild:22,DeclareStyleSheets:30,SetStyleProperty:31,GetStyleProperties:32,UndeclareStyleSheets:39,SetForgeViewInnerProps:40,InsertKeyFrameDefine:41,RemoveKeyFrameDefine:42};class x{}x.Dom=T,x.Media=class{static CreateAudioPlayer(){return window.JsvCode.Media.PlatformBridge.CreateAudioPlayer()}static CreateVideoPlayer(){return window.JsvCode.Media.PlatformBridge.CreateVideoPlayer()}};class b{static GenerateId(){const e=this.UniqueId++;if(e>=this.MaxUniqueId)throw new Error("JsvUniqueId.GenerateId() Failed to create unique id. id is overflow.");return e}}b.UniqueId=0,b.MaxUniqueId=Math.pow(2,31)-1;class N{constructor(e){this.childNodes=[],this.nodeType=e,this.ownerDocument=window.document,this.parentNode=null,this.jsvEventListenerMap=null,this.jsvChildChangedCallback=null}jsvFinalize(){}appendChild(e){this.childNodes.push(e),e.parentNode=this,this.jsvChildChangedCallback?.()}removeChild(e){let t=this.childNodes.indexOf(e);if(t<0)throw new DOMException("Failed to remove node, child node is not found. node=",e);this.childNodes.splice(t,1),e.parentNode=null,this.jsvChildChangedCallback?.()}insertBefore(e,t){this.insertBeforeInner(e,t)}get previousSibling(){const e=this.parentNode?.childNodes;let t=e?.indexOf(this);if(void 0===t||t<0)throw new DOMException("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(void 0===t||t<0)throw new DOMException("Failed to call Node.nextSibling(), this node not found. this=",this);return e[t+1]}addEventListener(e,t,i){this.jsvEventListenerMap||(this.jsvEventListenerMap=new Map);let s=this.jsvEventListenerMap?.get(e);s||(s=new Set,this.jsvEventListenerMap?.set(e,s)),s.add(t)}removeEventListener(e,t,i){let s=this.jsvEventListenerMap?.get(e);s&&(s.delete(t),s.size<=0&&this.jsvEventListenerMap?.delete(e),0==this.jsvEventListenerMap?.size&&(this.jsvEventListenerMap=null))}dispatchEvent(e){if(!this.jsvEventListenerMap)return void console.warn("Node.dispatchEvent() Ignore to dispatch event: "+e.type+". No event added.");let t=this.jsvEventListenerMap?.get(e.type);if(t){e.target||(e.target=document.activeElement);for(let i of t)if(i?.(e),e.jsvIsPrevented())break}else console.warn("Node.dispatchEvent() Ignore to dispatch event: "+e.type+". No listener added.")}jsvObserveChildChanged(e){this.jsvChildChangedCallback=e}jsvMoveChildReOrder(e,t){{let t=this.childNodes.indexOf(e);if(t<0)throw new DOMException("Failed to call jsvMoveChildReOrder, node not found. node=",e);this.childNodes.splice(t,1)}{let i=this.childNodes.length;if(t&&(i=this.childNodes.indexOf(t),i<0))throw new DOMException("Failed to call move node, before node not found. beforeNode=",t);this.childNodes.splice(i,0,e)}this.jsvChildChangedCallback?.()}jsvMoveChildToNewParent(e,t,i){let s=this.childNodes.indexOf(e);if(s<0)throw new DOMException("Failed to call jsvMoveChildToNewParent, node not found. node=",e);this.childNodes.splice(s,1),e.parentNode=null,this.jsvChildChangedCallback?.(),t.insertBeforeInner(e,i)}jsvGetEventListenerSet(e){const t=this.jsvEventListenerMap?.get(e);return t}insertBeforeInner(e,t){let i=this.childNodes.length;if(void 0===t)throw new DOMException("TypeError: Failed to execute 'insertBefore' on 'Node': 2 arguments required, but only 1 present.");if(null!==t&&(i=this.childNodes.indexOf(t)),i<0)throw new DOMException("Failed to call insert node, before node not found. beforeNode=",t);this.childNodes.splice(i,0,e),e.parentNode=this,this.jsvChildChangedCallback?.()}}function I(e,t,i){return"symbol"==typeof t&&(t=t.description?"[".concat(t.description,"]"):""),Object.defineProperty(e,"name",{configurable:!0,value:i?"".concat(i," ",t):t})}N.ELEMENT_NODE=1,N.TEXT_NODE=3,N.COMMENT_NODE=8,N.DOCUMENT_NODE=9,N.NOLAYOUT_NODE=10;class D{static HasGetterMethod(e){switch(e){case D.Layout.Height:case D.Layout.Left:case D.Layout.Top:case D.Layout.Width:case D.Effect.ObjectFit:return!0;default:return!1}}static ToConst(e){return e==D.Layout.Height?D.Layout.Height:e==D.Layout.Left?D.Layout.Left:e==D.Layout.Top?D.Layout.Top:e==D.Layout.Width?D.Layout.Width:e==D.Flex.FlexDirection?D.Flex.FlexDirection:e==D.Flex.FlexWrap?D.Flex.FlexWrap:e==D.Flex.JustifyContent?D.Flex.JustifyContent:e==D.Flex.AlignItems?D.Flex.AlignItems:e==D.Flex.AlignContent?D.Flex.AlignContent:e==D.Flex.AlignSelf?D.Flex.AlignSelf:e==D.Flex.FlexGrow?D.Flex.FlexGrow:e==D.Background.BackgroundColor?D.Background.BackgroundColor:e==D.Background.BackgroundImage?D.Background.BackgroundImage:e==D.Background.BorderRadius?D.Background.BorderRadius:e==D.Effect.BackfaceVisibility?D.Effect.BackfaceVisibility:e==D.Effect.BorderImage?D.Effect.BorderImage:e==D.Effect.BorderImageWidth?D.Effect.BorderImageWidth:e==D.Effect.BorderImageOutset?D.Effect.BorderImageOutset:e==D.Effect.Display?D.Effect.Display:e==D.Effect.ObjectFit?D.Effect.ObjectFit:e==D.Effect.Opacity?D.Effect.Opacity:e==D.Effect.Overflow?D.Effect.Overflow:e==D.Effect.Perspective?D.Effect.Perspective:e==D.Effect.PerspectiveOrigin?D.Effect.PerspectiveOrigin:e==D.Effect.Transform?D.Effect.Transform:e==D.Effect.TransformOrigin?D.Effect.TransformOrigin:e==D.Effect.TransformStyle?D.Effect.TransformStyle:e==D.Effect.Visibility?D.Effect.Visibility:e==D.Effect.ZIndex?D.Effect.ZIndex:e==D.Text.Color?D.Text.Color:e==D.Text.FontFamily?D.Text.FontFamily:e==D.Text.FontSize?D.Text.FontSize:e==D.Text.FontStyle?D.Text.FontStyle:e==D.Text.FontWeight?D.Text.FontWeight:e==D.Text.LineHeight?D.Text.LineHeight:e==D.Text.TextAlign?D.Text.TextAlign:e==D.Text.TextOverflow?D.Text.TextOverflow:e==D.Text.TextShadow?D.Text.TextShadow:e==D.Text.WebkitTextStroke?D.Text.WebkitTextStroke:e==D.Text.WhiteSpace?D.Text.WhiteSpace:e==D.Text.WordWrap?D.Text.WordWrap:e==D.Text.Direction?D.Text.Direction:e==D.Text.JsvTextEmoji?D.Text.JsvTextEmoji:e==D.Text.JsvTextLatex?D.Text.JsvTextLatex:e==D.Text.JsvTextAlignMinWidth?D.Text.JsvTextAlignMinWidth:e==D.Text.JsvTextVerticalAlign?D.Text.JsvTextVerticalAlign:e==D.Text.JsvTextLineAlign?D.Text.JsvTextLineAlign:e==D.Text.JsvTextInnerDirection?D.Text.JsvTextInnerDirection:e==D.Motion.Animation?D.Motion.Animation:e==D.Motion.Transition?D.Motion.Transition:e==D.Motion.AnimationFillMode?D.Motion.AnimationFillMode:null}constructor(){throw new Error("new StyleName() is forbidden.")}}D.Layout=(I(o=class{constructor(){throw new Error("new StyleName.Layout() is forbidden.")}},"Layout"),o.Height="height",o.Left="left",o.Top="top",o.Width="width",o),D.Flex=(I(r=class{constructor(){throw new Error("new StyleName.Flex() is forbidden.")}},"Flex"),r.FlexDirection="flexDirection",r.FlexWrap="flexWrap",r.JustifyContent="justifyContent",r.AlignItems="alignItems",r.AlignContent="alignContent",r.AlignSelf="alignSelf",r.FlexGrow="flexGrow",r),D.Background=(I(a=class{constructor(){throw new Error("new StyleName.Background() is forbidden.")}},"Background"),a.BackgroundColor="backgroundColor",a.BackgroundImage="backgroundImage",a.BorderRadius="borderRadius",a),D.Effect=(I(l=class{constructor(){throw new Error("new StyleName.Effect() is forbidden.")}},"Effect"),l.BackfaceVisibility="backfaceVisibility",l.BorderImage="borderImage",l.BorderImageWidth="borderImageWidth",l.BorderImageOutset="borderImageOutset",l.Display="display",l.ObjectFit="objectFit",l.Opacity="opacity",l.Overflow="overflow",l.Perspective="perspective",l.PerspectiveOrigin="perspectiveOrigin",l.Transform="transform",l.TransformOrigin="transformOrigin",l.TransformStyle="transformStyle",l.Visibility="visibility",l.ZIndex="zIndex",l),D.Text=(I(c=class{constructor(){throw new Error("new StyleName.Text() is forbidden.")}},"Text"),c.Color="color",c.FontFamily="fontFamily",c.FontSize="fontSize",c.FontStyle="fontStyle",c.FontWeight="fontWeight",c.LineHeight="lineHeight",c.TextAlign="textAlign",c.TextOverflow="textOverflow",c.TextShadow="textShadow",c.WebkitTextStroke="WebkitTextStroke",c.WhiteSpace="whiteSpace",c.WordWrap="wordWrap",c.Direction="direction",c.JsvTextEmoji="JsvTextEmoji",c.JsvTextLatex="JsvTextLatex",c.JsvTextAlignMinWidth="JsvTextAlignMinWidth",c.JsvTextVerticalAlign="JsvTextVerticalAlign",c.JsvTextLineAlign="JsvTextLineAlign",c.JsvTextInnerDirection="JsvTextInnerDirection",c),D.Motion=(I(d=class{constructor(){throw new Error("new StyleName.Motion() is forbidden.")}},"Motion"),d.Animation="animation",d.Transition="transition",d.AnimationFillMode="animationFillMode",d);class E{constructor(e){let t=-1,i=null;null==e?t=E.DataType.Null:Number(e)===e&&e%1==0?t=E.DataType.Int32:Number(e)===e&&e%1!=0?t=E.DataType.Float:"string"==typeof e||e instanceof String?t=E.DataType.String:e instanceof E.AnimationImpl?t=E.DataType.Animation:e instanceof E.CornerImpl?t=E.DataType.Corner:e instanceof E.RectImpl?t=E.DataType.Rect:e instanceof E.TextShadowImpl?t=E.DataType.TextShadow:e instanceof E.WebkitTextStrokeImpl?t=E.DataType.WebkitTextStroke:e instanceof E.TransitionImpl?t=E.DataType.Transition:e instanceof E.BorderImageImpl&&(t=E.DataType.BorderImage),e!=E.InvalidInt32&&e!=E.InvalidFloat&&e!=E.InvalidPointer?i=e:(t=E.DataType.Null,i=null),this.data=new E.DataInfo,this.data.index=t,this.data.value=i}toString(){let e=null;switch(this.data.index){case E.DataType.Null:return"";case E.DataType.Int32:case E.DataType.Float:return String(this.get());case E.DataType.String:e=this.get();break;case E.DataType.Animation:case E.DataType.Corner:case E.DataType.Rect:case E.DataType.TextShadow:case E.DataType.WebkitTextStroke:case E.DataType.Transition:case E.DataType.BorderImage:case E.DataType.BackgroundImage:e=this.get().rawValue;break;default:console.error("Failed to do StyleValue.toString()")}return e??""}is(e){return this.data.index==e}get(){return this.data.value}reset(e){this.data.value=e.data.value,this.data.index=e.data.index}equals(e){return this.data.value===e.data.value&&this.data.index===e.data.index}}E.Base=class{constructor(e){this.rawValue=e}},E.AnimationImpl=class extends E.Base{constructor(e){super(e),this.name="",this.duration=0,this.timingFunction=null,this.delay=0,this.iterationCount=0,this.direction=!1}},E.CornerImpl=class extends E.Base{constructor(e){super(e),this.topLeft=0,this.topRight=0,this.bottomRight=0,this.bottomLeft=0}},E.RectImpl=class extends E.Base{constructor(e){super(e),this.top=0,this.right=0,this.left=0,this.bottom=0}},E.TextShadowImpl=class extends E.Base{constructor(e){super(e),this.hShadow=0,this.vShadow=0,this.blur=0,this.color=void 0}},E.WebkitTextStrokeImpl=class extends E.Base{constructor(e){super(e),this.length=0,this.color=void 0}},E.TransitionImpl=class extends E.Base{constructor(e){super(e),this.animationMap=new Map}},E.BorderImageImpl=class extends E.Base{constructor(e){super(e),this.source="",this.slice=null}},E.BackgroundImageImpl=(I(h=class extends E.Base{constructor(e){super(e),this.type=0,this.urlPath=""}},"BackgroundImageImpl"),h.eType={UNKNOWN:0,LINEAR_GRADIENT:1,URL_PATH:2},h.LinearGradient=class{constructor(){this.fromX=0,this.fromY=0,this.toX=0,this.toY=0,this.stops=[]}},h),E.DataType=(I(u=class{},"DataType"),u.Null=0,u.Int32=1,u.Float=2,u.String=3,u.Animation=4,u.Corner=5,u.Rect=6,u.TextShadow=7,u.WebkitTextStroke=8,u.Transition=9,u.BorderImage=10,u.BackgroundImage=11,u),E.InvalidInt32=Number.MIN_VALUE,E.InvalidFloat=Number.NaN,E.InvalidPointer=null,E.DataInfo=class{constructor(){this.value=null,this.index=-1}},I(m=class{},"Text"),m.Color="#000000",m.FontFamily="黑体",m.FontSize=10,m.FontStyle="normal",m.FontWeight="normal",m.LineHeight=0,m.TextAlign="start",m.TextOverflow="clip",m.TextShadow=null,m.WebkitTextStroke=null,m.WhiteSpace="normal",m.WordWrap="normal",m.Direction="ltr",m.JsvTextEmoji=0,m.JsvTextLatex=0,m.JsvTextAlignMinWidth=0,m.JsvTextVerticalAlign="top",m.JsvTextLineAlign="middle",m.JsvTextInnerDirection="unset",I(p=class{constructor(){this.height=E.InvalidInt32,this.left=E.InvalidInt32,this.top=E.InvalidInt32,this.width=E.InvalidInt32}},"Layout"),p.Name="layout",I(f=class{constructor(){this.flexDirection=E.InvalidInt32,this.flexWrap=E.InvalidInt32,this.justifyContent=E.InvalidInt32,this.alignItems=E.InvalidInt32,this.alignContent=E.InvalidInt32,this.alignSelf=E.InvalidInt32,this.flexGrow=E.InvalidFloat}},"Flex"),f.Name="flex",I(v=class{constructor(){this.backgroundColor=E.InvalidPointer,this.backgroundImage=E.InvalidPointer,this.borderRadius=E.InvalidPointer}},"Background"),v.Name="background",I(g=class{constructor(){this.backfaceVisibility=E.InvalidPointer,this.borderImage=E.InvalidPointer,this.borderImageWidth=E.InvalidPointer,this.borderImageOutset=E.InvalidPointer,this.display=E.InvalidPointer,this.objectFit=E.InvalidPointer,this.opacity=E.InvalidFloat,this.overflow=E.InvalidPointer,this.perspective=E.InvalidInt32,this.perspectiveOrigin=E.InvalidPointer,this.transform=E.InvalidPointer,this.transformOrigin=E.InvalidPointer,this.transformStyle=E.InvalidPointer,this.visibility=E.InvalidPointer,this.zIndex=E.InvalidInt32}},"Effect"),g.Name="effect",I(w=class{constructor(){this.color=E.InvalidPointer,this.fontFamily=E.InvalidPointer,this.fontSize=E.InvalidInt32,this.fontStyle=E.InvalidPointer,this.fontWeight=E.InvalidPointer,this.lineHeight=E.InvalidInt32,this.textAlign=E.InvalidPointer,this.textOverflow=E.InvalidPointer,this.textShadow=E.InvalidPointer,this.webkitTextStroke=E.InvalidPointer,this.whiteSpace=E.InvalidPointer,this.wordWrap=E.InvalidPointer,this.direction=E.InvalidPointer,this.jsvTextEmoji=E.InvalidInt32,this.jsvTextLatex=E.InvalidInt32,this.jsvTextAlignMinWidth=E.InvalidInt32,this.jsvTextVerticalAlign=E.InvalidPointer,this.jsvTextLineAlign=E.InvalidPointer,this.jsvTextInnerDirection=E.InvalidPointer}},"Text"),w.Name="text",I(y=class{constructor(){this.animation=E.InvalidPointer,this.transition=E.InvalidPointer,this.animationFillMode="none"}},"Motion"),y.Name="motion";class S{static JsvDeclarePrototype(){for(let e in D){let t=D[e];for(let e in t){let i=t[e];if("string"!=typeof i)continue;const s={set:function(e){this.setProperty(i,e)},get:function(){return this.getPropertyValue(i)}};Object.defineProperty(S.prototype,i,s)}}}constructor(e){this.cachedProps={},this.nativeId=e}setProperty(e,t){if(window.JsvCode.Dom.CheckStyleFormat?.(e,t),e==D.Background.BackgroundImage&&"string"==typeof t)if(0==t.indexOf("linear-gradient")){const e=t.match(/\(/g)?.length,i=t.match(/\)/g)?.length;e!=i&&(console.error(`StyleError: illegal linear-gradient value '${t}'`),t="")}else{t=new C(t).href}else if(e==D.Effect.BorderImage&&"string"==typeof t){const e=t.split(" ");e.length>0&&(e[0]=new C(e[0]).href),t=e.join(" ")}else e==D.Effect.Display&&(this.cachedProps[e]=t);x.Dom.SetStyleProperty(this.nativeId,e,t)}getPropertyValue(e){if(e==D.Effect.Display)return this.cachedProps[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),i=x.Dom.GetStyleProperties(this.nativeId,t);return JSON.parse(i)}}class F extends t{constructor(e){super(e)}}class O extends N{static JsvEnableEventListener(){x.Dom.EnableEventListener((function(e,t,...i){let s=O.JsvEventListenerMap.get(e);const n=s?.get(t);n?.(t,...i)}))}constructor(e){super(N.ELEMENT_NODE),this.jsvNativeId=-1,this.jsvAttrStore={},this.jsvClientSizeStore={},this.tagName=e,this.tagName!=O.JsvTagName.Audio&&this.tagName!=O.JsvTagName.Div&&this.tagName!=O.JsvTagName.Image&&this.tagName!=O.JsvTagName.Video&&this.tagName!=O.JsvTagName.JsvFDiv||(this.jsvNativeId=b.GenerateId(),this.style=new S(this.jsvNativeId),x.Dom.CreateElement(this.jsvNativeId,e))}appendChild(e){e.parentNode?this.moveChildNode(e,null):(super.appendChild(e),this.jsvInsertChild(e,null))}removeChild(e){super.removeChild(e),this.jsvRemoveChild(e),e instanceof O&&e.jsvNativeId>0&&x.Dom.RemoveElementChild(this.jsvNativeId,e.jsvNativeId)}insertBefore(e,t){e.parentNode?e.parentNode==this?(this.jsvMoveChildReOrder(e,t),this.jsvReOrderChildNode(e,t)):this.moveChildNode(e,t):(super.insertBefore(e,t),this.jsvInsertChild(e,t))}addEventListener(e,t,i){const s=this.jsvGetEventListenerSet(e);s?.has(t)?console.warn("Element.addEventListener() Faild to add listener, func is exists"):(i=this.jsvCheckEventOptions(i),this.jsvNativeId&&(this.jsvAddListener(this.jsvNativeId,e),x.Dom.AddElementEventListener(this.jsvNativeId,e,i)),super.addEventListener(e,t,i))}removeEventListener(e,t,i){const s=this.jsvGetEventListenerSet(e);0!=!!s?.has(t)&&(i=this.jsvCheckEventOptions(i),super.removeEventListener(e,t,i),this.jsvNativeId&&(this.jsvRemoveListener(this.jsvNativeId,e),x.Dom.RemoveElementEventListener(this.jsvNativeId,e,i)))}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.jsvClientSizeStore.clientWidth||(this.jsvClientSizeStore.clientWidth=x.Dom.GetElementAttribute(this.jsvNativeId,"clientWidth")),this.jsvClientSizeStore.clientWidth}get clientHeight(){return this.jsvClientSizeStore.clientHeight||(this.jsvClientSizeStore.clientHeight=x.Dom.GetElementAttribute(this.jsvNativeId,"clientHeight")),this.jsvClientSizeStore.clientHeight}setAttribute(e,t){e&&(this.jsvAttrStore[e]=t,this.jsvNativeId&&(e.startsWith("data-jsv-vw-")?x.Dom.SetForgeViewInnerProps(this.jsvNativeId,e,t):"class"===e||e.startsWith("data-v-")||e.startsWith("data-jsv")||e.startsWith("dataJsv")?x.Dom.SetElementAttribute(this.jsvNativeId,e,t):"id"===e&&x.Dom.SetForgeViewInnerProps(this.jsvNativeId,"data-jsv-vw-id",t)))}removeAttribute(e){delete this.jsvAttrStore[e],("class"==e||e.startsWith("data-v-")||"src"==e)&&this.jsvNativeId&&x.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 n(n.JsvType.Blur);t.target=e,document.dispatchEvent(t)}let t=new n(n.JsvType.Focus);document.dispatchEvent(t)}jsvGetBoundingClientRect(){const e="jsv-getbound",t=b.GenerateId();return new Promise(((i,s)=>{const n=o=>{const r=o.jsvParams?.[1];if(r!=t)return;o.preventDefault(),this.removeEventListener(e,n);const a=JSON.parse(o.jsvParams?.[0]??"{}");0===a.status?i(a.data):s(a.error)};this.addEventListener(e,n,{jsvtoken:t})}))}jsvSetOnLazyTaskSyncedListener(e){x.Dom.AppendLazyTaskSyncedListener(this.jsvNativeId,e)}jsvOnEvent(e,...n){let o;e.startsWith("animation")?(o=new i(e),o.animationName=n[0]):e.startsWith("transition")?(o=new F(e),o.propertyName=n[0]):e.startsWith("jsv")?(o=new s(e),o.options={detail:n[0]},o.jsvParams=n):"click"==e&&(o=new t(e),o.target=this),o&&(o.target=this,this.dispatchEvent(o))}jsvGetProxyView(e){return e?(this.maskViewProxy||(this.maskViewProxy=k.NewDomProxyView(this.jsvNativeId,!0)),this.maskViewProxy):(this.mainViewProxy||(this.mainViewProxy=k.NewDomProxyView(this.jsvNativeId,!1)),this.mainViewProxy)}jsvGetProxyTexture(e){return this.mainViewTextureProxy||(this.mainViewTextureProxy=e.GetDomProxyTexture(this.jsvNativeId)),this.mainViewTextureProxy}jsvGetRelativePosition(e){return x.Dom.GetRelativePosition(this.jsvNativeId,e.jsvNativeId)}jsvAddListener(e,t){let i=O.JsvEventListenerMap.get(e);i||(i=new Map,O.JsvEventListenerMap.set(e,i));this.jsvGetEventListenerSet(t)||i.set(t,this.jsvOnEvent.bind(this))}jsvRemoveListener(e,t){let i=O.JsvEventListenerMap.get(e);if(!i)return;this.jsvGetEventListenerSet(t)||i.delete(t)}moveChildNode(e,t){console.log("Do move child node");let i=e.parentNode;i.jsvMoveChildToNewParent(e,this,t),this.jsvMoveChildNode(i,e,t)}jsvMoveChildNode(e,t,i){t.jsvNativeId&&(i=O.JsvFindBackwardForgeView(i),x.Dom.MoveElementChild(this.jsvNativeId,e.jsvNativeId,t.jsvNativeId,i?.jsvNativeId))}jsvReOrderChildNode(e,t){e.jsvNativeId&&(t=O.JsvFindBackwardForgeView(t),x.Dom.ReOrderElementChild(this.jsvNativeId,e.jsvNativeId,t?.jsvNativeId))}jsvInsertChild(e,t){e.parentNode=this,e.nodeType===N.TEXT_NODE?this.textContent=e.nodeValue:e instanceof O&&e.jsvNativeId>0&&(t=O.JsvFindBackwardForgeView(t),x.Dom.InsertElementChild(this.jsvNativeId,e.jsvNativeId,t?.jsvNativeId))}jsvRemoveChild(e){if(e instanceof O!=0){for(const t of e.childNodes)e.jsvRemoveChild(t);e.jsvFinalize(),x.Dom.RemoveLazyTaskSyncedListener(e.jsvNativeId),O.JsvEventListenerMap.delete(e.jsvNativeId)}}jsvCheckEventOptions(e){if(null==e)return null;if("object"!=typeof e||e instanceof Array)return console.warn("Event options is invalid for ",e),null;const t=["capture","once","passive","signal"];for(const[i,s]of Object.entries(e))0==t.includes(i)&&0==i.startsWith("jsv")&&(console.warn("Event options name is invalid: ",i),delete e[i]),"boolean"==typeof s?e[i]=+e[i]:"number"!=typeof s&&(console.warn("Event options value is invalid: ",s),delete e[i]);return e}static JsvFindBackwardForgeView(e){let t=e;for(;t&&!(t instanceof O);)t=t.nextSibling;return t}}O.JsvTagName={Anchor:"A",Audio:"AUDIO",Div:"DIV",Head:"HEAD",Image:"IMG",IFrame:"IFRAME",Link:"LINK",Script:"SCRIPT",Style:"STYLE",Svg:"SVG",Video:"VIDEO",JsvAudioTrack:"JSV-AUDIOTRACK",JsvFDiv:"FDIV"},O.JsvEventListenerMap=new Map;class L extends O{constructor(){super(O.JsvTagName.Anchor),this.href="",this.protocol="",this.host="",this.search="",this.hash="",this.hostname="",this.port="",this.pathname="",console.warn("Warnig: <a> is fake in JsView system")}jsvGetTagName(){return O.JsvTagName.Anchor}}class P extends N{constructor(e){super(N.COMMENT_NODE),this.textContent=e}}class B extends O{constructor(){super(O.JsvTagName.Div),this.textContentStore=null}get textContent(){return this.textContentStore}set textContent(e){this.textContentStore=e,this.jsvClientSizeStore={},x.Dom.SetElementText(this.jsvNativeId,e)}}const M="FocusDebug",J="__AppRoot__";let R=!1,j=!1;function A(e,t){let i=function(e){let t="";if(e){let i=e,s=i.RouterDelegate?.ref?.NameSpace;for(s=s==J?"":s,t=`[${s?s+", ":""}${i.BranchName}]`,i=i.GetParentPage();i;)s=i.RouterDelegate?.ref?.NameSpace,s=s==J?"":s,t=`[${s?s+", ":""}${i.BranchName}]->`+t,i=i.GetParentPage()}return t}(e);if(t.stack){let e=t.stack.split("\n");e.length>=3&&(t.stack=e.slice(2,6))}let s="";for(let e of t.stack)s+=e+"\n";delete t.stack,console.log(M,`focusChange(${t?.from}):${t?.askName}\n:focusStack:${i}\n:trace:${s}:`,t)}class _{constructor(e,t){this._DefaultFocusNameSpace=null,this._DefaultFocusNameSpace=null,this.RouterDelegate={ref:null},e||(this.RouterDelegate.ref=new W(!1,t))}enableFocusTrace(e){R=!0,j=e}getNameSpace(){let e=this.RouterDelegate.ref.NameSpace;return e==J?"":e}wrapWithNameSpace(e){let t=new _(!0);return t._DefaultFocusNameSpace=e,t.RouterDelegate=this.RouterDelegate,t}getNodeByName(e){return this.RouterDelegate.ref.getNodeByName(e)}focusByNameBeforeMount(e,t,i){if("string"==typeof e)return e.includes(".")&&(e=e.split(".")),this.RouterDelegate.ref.focusBeforeMount(e,t,i);console.error(`setFocus name=${e} is invalid`)}setFocus(e,t){this._DefaultFocusNameSpace&&this._DefaultFocusNameSpace.length>0&&(e=`${this._DefaultFocusNameSpace}.${e}`);let i=null;R&&(i={askName:e,deepToChild:t,from:"setFocus",stack:j?new Error("simulate-stack").stack:null});return this.focusByNameBeforeMount(e,t,i)}printAllFocusable(){this.RouterDelegate.ref.printAllFocusRecursive(this._DefaultFocusNameSpace,"")}getCurrentFocusStack(){const e=[];if(this.RouterDelegate.ref){let t=this.RouterDelegate.ref.getCurrentFocusNode();for(;t&&t instanceof U;){let i=t.RouterDelegate?.ref?.NameSpace;e.push({nameSpace:i==J||i==t.BranchName?"":i,name:t.BranchName}),t=t.GetParentPage()}}else console.error("getCurrentFocusStack failed: router delegate is null.");return e}getLastFocus(){if(U.sLastFocus){let e=U.sLastFocus;for(;e._LatestFocusChild;)e=e._LatestFocusChild;return e.BranchName}return null}getCurrentFocus(){if(this.RouterDelegate.ref){const e=this.RouterDelegate.ref.getCurrentFocusNode();if(e)return e.BranchName}return null}getDeactivedPageFocus(){return this.RouterDelegate.ref?this.RouterDelegate.ref.getDeactivePageFocusName():null}returnFocusToParent(){const e=this.RouterDelegate.ref.getCurrentFocusNode();e?e.ReturnFocusToParent():console.warn("returnFocusToParent: current focus node is null.")}}class W{constructor(e,t){this._ChildMap={},this._FocusNameBeforeMount=null,this._BeforeMountStack=null,this._FocusNodeName=null,this._IsTemp=!!e,this.NameSpace=t}getDeactivePageFocusName(){return this._FocusNodeName}getCurrentFocusNode(){if(null==this._FocusNodeName)return null;let e=this._ChildMap[this._FocusNodeName];if(!e)return console.error("Erorr: node not mounted name="+this._FocusNodeName),null;if(e.RouterDelegate.ref!=this){let t=e.RouterDelegate.ref.getCurrentFocusNode();return null==t?e:t}return e}getNodeByName(e,t){let i=e.split(".");return this._FindRouterSearchBase(i,t)._GetNodeFromPathArray(i,e)}printAllFocusRecursive(e,t){let i=this.NameSpace==J?"":this.NameSpace,s=t+(t&&t.length>0?".":"")+i;for(let t in this._ChildMap){let i=this._ChildMap[t];if(!e||0==e.length||s.indexOf(e)>=0){let e=s===J?t:s+"."+t;console.log(e,i)}i.RouterDelegate.ref!=this&&i.RouterDelegate.ref.printAllFocusRecursive(e,s)}}_FindRouterSearchBase(e,t){if(0==e[0].length){let t,i;for(let e in this._ChildMap){t=this._ChildMap[e];break}do{i=t,t=t.GetParentPage()}while(null!=t);return e.splice(0,1),i.RouterDelegate.ref}return t&&t.AsHub&&t.GetParentPage()?t.GetParentPage().RouterDelegate.ref:this}_GetNodeFromPathArray(e,t){let i=0,s=this;for(;i<e.length-1;){let n=!1;for(let t in s._ChildMap){let o=s._ChildMap[t].RouterDelegate.ref;if(o!=s&&o.NameSpace==e[i]){s=o,i++,n=!0;break}}if(!n)return void console.error(`Error: no found subpath fname=${t}`)}let n=e[i];return s._ChildMap.hasOwnProperty(n)?s._ChildMap[n]:void console.error(`Error: no found fname=${t}`)}add(e,t){if(e.indexOf(".")>=0)console.error("ERROR: FDiv name can not contains '.'");else if(this._ChildMap.hasOwnProperty(e)&&this._ChildMap[e]!==t)console.error(`ERROR: FDiv router branch name duplicated:[${e}]`);else if(this._ChildMap[e]=t,this._FocusNameBeforeMount)if("string"==typeof this._FocusNameBeforeMount)this._FocusNameBeforeMount==e&&t.RouterDelegate.ref.focusBeforeMount(this._FocusNameBeforeMount,!1,this._BeforeMountStack);else{this._FocusNameBeforeMount[0]==e&&t.RouterDelegate.ref.focusBeforeMount(this._FocusNameBeforeMount.slice(1),!1,this._BeforeMountStack)}}remove(e,t,i,s){let n=this._ChildMap[e];n&&n==t&&(delete this._ChildMap[e],n.OnRemoveFromTree()),this._FocusNodeName==e&&i&&(s||(this._FocusNodeName=i))}rename(e,t){if(!this._ChildMap.hasOwnProperty(e))return void console.error(`ERROR: alter name failed ${e}->${t}`);let i=this._ChildMap[e];delete this._ChildMap[e],this.add(t,i),this._FocusNodeName==e&&(this._FocusNodeName=t)}clearChildFocus(){this._FocusNodeName=null,this._FocusNameBeforeMount=null}hasPendingFocusRequest(){return!this._FocusNameBeforeMount}focusBeforeMount(e,t,i){R&&!i&&console.error(M,`Error: found debug info missing from ${new Error("simulate-stack").stack}`);let s=!1;if("string"==typeof e){if(!e.includes(".")){s=!0;let n=this._ChildMap[e];if(this._FocusNodeName=e,n){this._FocusNameBeforeMount=null,this._BeforeMountStack=i,n.Focus(!t);let e=n.GetFocusChild();for(;e;){let t=e.GetFocusChild();if(!t){this._FocusNodeName=e.BranchName;break}e=t}return R&&A(e??n,i),n.RouterDelegate.ref!=this&&n.RouterDelegate.ref.clearChildFocus(),!0}return this._FocusNameBeforeMount=e,this._BeforeMountStack=i,!1}console.error("error: name contain .")}else if("object"==typeof e&&Array.isArray(e)&&e.length>0){if(s=!0,1==e.length)return this.focusBeforeMount(e[0],t,i);{let s=e[0],n=this._ChildMap[s];return this._FocusNodeName=s,n?n.RouterDelegate.ref.focusBeforeMount(e.slice(1),t,i):(this._FocusNameBeforeMount=e,this._BeforeMountStack=i,!1)}}return s||console.error("illegal name param",e),!1}focus(e,t,i){let s=this.focusBeforeMount(e,t,i);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 U extends k.PageBase{constructor(e){super(e),this._OnKeyDown=null,this._OnKeyUp=null,this._OnFocus=null,this._OnBlur=null,this._DispatchKeyDown=null,this._DispatchKeyUp=null,this._OnCustomEvent=null,this._DKeyDownProxy=void 0,this._DKeyUpProxy=void 0,this._Mounted=!1,this._MountWaitingList=null,this.AsHub=!1,this.InterfaceHub=null,this._TmpRouter=null,this._AutoShow=null,this.BranchName=e,this.RouterDelegate={ref:null},this._TmpRouter=null,this._OriginDispatchKeyDown=this._OriginDispatchKeyDown.bind(this),this._OriginDispatchKeyUp=this._OriginDispatchKeyUp.bind(this),this._AutoShow=!1}async waitMounted(){if(this._Mounted)return;let e=this;return new Promise(((t,i)=>{e._MountWaitingList||(e._MountWaitingList=[]),e._MountWaitingList.push(t)}))}updateMountState(){this._Mounted=!0;let e=this.SubPages;for(let t in e)e[t].updateMountState();if(this._MountWaitingList&&this._MountWaitingList.length>0){for(const e of this._MountWaitingList)e();this._MountWaitingList=null}}getHub(){return this.InterfaceHub||(this.InterfaceHub=new _(!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 W(!0)),this.RouterDelegate.ref.add(e,t)}routerRenameChild(e,t){this.RouterDelegate.ref.rename(e,t)}routerUnbind(e,t){let i;this.AsHub?this.GetParentPage()&&(i=this.GetParentPage().RouterDelegate.ref):i=this.RouterDelegate.ref,i&&i.remove(this.BranchName,this,e,t),this.RouterDelegate={ref:null}}setBranchName(e){if(e===this.BranchName)return;let t=this.BranchName;this.BranchName=e,this.PageName=e,this._ParentPage&&this._ParentPage.routerRenameChild(t,e)}static safeCallback(e){return e&&e instanceof Function?function(...t){try{return e(...t)}catch(t){console.error("FocusNode: callback error",e.name,t)}}:null}setOnKeyDown(e){this._OnKeyDown=U.safeCallback(e)}setOnKeyUp(e){this._OnKeyUp=U.safeCallback(e)}setOnFocus(e){this._OnFocus=U.safeCallback(e)}setOnBlur(e){this._OnBlur=U.safeCallback(e)}setDispatchKeyUp(e){this._DispatchKeyUp=U.safeCallback(e)}setDispatchKeyDown(e){this._DispatchKeyDown=U.safeCallback(e)}setOnCustomEvent(e){this._OnCustomEvent=U.safeCallback(e)}setDispatchKeyProxy(e,t){this._DKeyDownProxy=U.safeCallback(e),this._DKeyUpProxy=U.safeCallback(t)}requestFocus(e){let t=null;R&&(t={askName:this.BranchName,deepToChild:e,from:"requestFocus",stack:j?new Error("simulate-stack").stack:null}),this.requestFocusInner(e,t)}ReturnFocusToParent(){if(this.IsFocus()){let e=this.GetParentPage();if(e){const t=e.BranchName;let i=null;R&&(i={askName:t,deepToChild:!1,from:"returnFocusToParent",stack:j?new Error("simulate-stack").stack:null}),e.RouterDelegate.ref.focus(t,!1,i)}}else super.ReturnFocusToParent()}requestFocusInner(e,t){let i=this.RouterDelegate.ref;return this.AsHub&&this.GetParentPage()&&(i=this.GetParentPage().RouterDelegate.ref),i?i.focus(this.BranchName,e,t):(console.error("error: lost router"),!1)}OnKeyDown(e){return!!this._OnKeyDown&&this._OnKeyDown(e)}OnKeyUp(e){return!!this._OnKeyUp&&this._OnKeyUp(e)}OnCustomEvent(e){return!!this._OnCustomEvent&&this._OnCustomEvent(e)}bubbleCustomEvent(e){this.BubbleCustomEvent(e)}dispatchKeyDown(e){return this.DispatchKeyDown(e)}DispatchKeyDown(e){return 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(),V()),e instanceof U)){if(this.RouterDelegate.ref&&this.RouterDelegate.ref._IsTemp){let t=this.RouterDelegate.ref;this.RouterDelegate.ref=null,t.forEach(((t,i)=>{e.routerAdd(i,t)}))}e.routerAdd(this.BranchName,this)}}focus(e){this.Focus(e)}Focus(e){if(!this._Mounted)return U.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(){U.sLastFocus=this,this._OnBlur&&this._OnBlur()}onUnMount(e){U.sLastFocus==this&&(U.sLastFocus=null);let t=this.IsFocus();if(R&&t){let t=this.GetParentPage();if(t){let i=null;i={askName:t.BranchName,deepToChild:!1,from:e?"deactive":"unmount",stack:j?new Error("simulate-stack").stack:null},A(t,i)}}let i=this.GetParentPage();i&&i.RemoveSubPage(this),this.ClearSubPages(),this.routerUnbind(i?.BranchName,e),this._Mounted=!1}getFullName(){let e=this,t=[this.RouterDelegate.ref.NameSpace];this.AsHub||t.push(this.BranchName);let i=this.RouterDelegate.ref;do{if(e=e.GetParentPage(),t[0]==J)break;e&&e.RouterDelegate.ref!=i&&(i=e.RouterDelegate.ref,t.unshift(i.NameSpace))}while(e);return t[0]==J?t.shift():console.error("ERROR: missing app root"),t.join(".")}getNodeByName(e){return this.RouterDelegate.ref.getNodeByName(e,this)}}U.sFocusMemos=[],U.sLastFocus=null,U.sRootPageNode=null;let V=()=>{let e=U.sFocusMemos.length;if(e>0){let t=U.sFocusMemos;U.sFocusMemos=[];for(let i=0;i<e;i++)t[i].obj.Focus(t[i].bcf)}},z={};class G{constructor(e,t,i){this._Element=i,z.hasOwnProperty(e)&&console.error(`Warn: FDivRoot duplicate name=${e}`),z[e]=this,this._DoInit(t)}_DoInit(e){let t=this._Element.FocusNodeRef;this._Element.setAttribute("new-namespace","__AppRoot__"),e&&t.setDispatchKeyProxy(e.keyDown,e.keyUp),window.JsView?t.attachToActivity(window.JsvCode.ForgeHandles.RootActivity,window.JsvCode.ForgeHandles.RootView):(window.addEventListener("keydown",(e=>{var i=document.activeElement?.tagName;i&&"input"===i.toLowerCase()||(t.dispatchKeyDown(e),e.preventDefault&&e.preventDefault())})),window.addEventListener("keyup",(e=>{var i=document.activeElement?.tagName;i&&"input"===i.toLowerCase()||(t.dispatchKeyUp(e),e.preventDefault&&e.preventDefault())})))}getElement(){return this._Element}getHub(){return this._Element.jsvGetHub()}onMounted(){this._Element.FocusNodeRef.updateMountState(),V()}}class K extends O{constructor(){super(O.JsvTagName.Image)}setAttribute(e,t){if("src"===e){t=new C(t).href,this.jsvClientSizeStore={}}super.setAttribute(e,t),this.jsvNativeId&&"src"===e&&x.Dom.SetElementAttribute(this.jsvNativeId,e,t)}jsvOnEvent(e,...i){let s;super.jsvOnEvent(e,...i),"load"==e&&(s=new t(e),s.target=this),s&&this.dispatchEvent(s)}}class H extends O{constructor(){super(O.JsvTagName.Link)}setAttribute(e,t){this[e]=t}jsvLoadResource(){let e=!1,t=null;if(null!=this.href){var i=new C(this.href);console.log("Ignore to load link from url="+i.href),e=!0}else console.warn("Failed to load link, href is not exists."),t="NoSrc";this.jsvOnLoadResult(e,t)}jsvOnLoadResult(e,i){if(console.log("Load link result: isSuccess:"+e+", errCode:"+i),e){if(this.onload){let e=new t("load");this.onload(e)}}else this.onerror&&this.onerror({type:"jsvErr_"+i,target:this})}}class $ extends O{constructor(){super(O.JsvTagName.Script)}setAttribute(e,t){this[e]=t}jsvLoadResource(){if(null!=this.src){var e=new C(this.src);console.log("Load script with url="+e.href);var t=this;window.JsView.runJsWithUrl(e.href,!1,((e,i)=>{t.jsvOnLoadResult(e,i)}))}}jsvOnLoadResult(e,i){if(console.log("Load script result: isSuccess:"+e+", errCode:"+i),e){if(this.onload){let e=new t("load");this.onload(e)}}else this.onerror&&this.onerror({type:"jsvErr_"+i,target:this})}}class q extends O{constructor(){super(O.JsvTagName.Style),this.jsvAttrStore={left:0,top:0,width:0,height:0}}}class X extends O{constructor(){super(O.JsvTagName.Svg)}}class Y extends N{constructor(e){super(N.TEXT_NODE),this.textContent=e}get nodeValue(){return this.textContent}set nodeValue(e){this.textContent=e,this.parentNode&&(this.parentNode.textContent=this.textContent)}}let Z=1;class Q extends O{constructor(){super(O.JsvTagName.JsvFDiv),this.FocusNodeRef=new U("unnamed-"+Z++),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 _(!1,t);this.hubRef=e,this.FocusNodeRef.setHub(e),this.FocusNodeRef.setBranchName(t)}}removeAttribute(e){}jsvGetHub(){return this.hubRef}}class ee extends N{constructor(){super(N.DOCUMENT_NODE),this.location=window.location,this.rootElement=new B,this.rootElement.ownerDocument=this,this.rootElement.id="root",x.Dom.BindElementToRootView(this.rootElement.jsvNativeId),this.activeElement=this.rootElement,this.head=null}createComment(e){return new P(e)}createElement(e){switch(e=e.toUpperCase()){case O.JsvTagName.Anchor:return new L;case O.JsvTagName.Div:return new B;case O.JsvTagName.Image:return new K;case O.JsvTagName.Link:return new H;case O.JsvTagName.Script:return new $;case O.JsvTagName.Style:return new q;case O.JsvTagName.Svg:return new X;case O.JsvTagName.JsvFDiv:return new Q;case O.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"CUSTOMEVENT"===(e=e.toUpperCase())?new s(e):new t(e)}createTextNode(e){return new Y(e)}getElementById(e){if("root"===e||"app"===e)return this.rootElement;throw new DOMException("Failed to get element by id, id="+e+" is UNIMPLEMENTED.")}getElementsByTagName(e){if((e=e.toUpperCase())===O.JsvTagName.Head)return[this.head];if(e===O.JsvTagName.Link||e===O.JsvTagName.Script||e===O.JsvTagName.Style)return[];throw new DOMException("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("title"===e)return null;if(e.startsWith("style[")&&e.endsWith("]"))return null;throw new DOMException("Failed to query selector, selectors="+e+" is UNIMPLEMENTED.")}querySelectorAll(e){return[]}jsvInitFDivRoot(e,t,i){if(!i){let e=document.createElement("fdiv");this.rootElement.appendChild(e),this.rootElement=e,i=this.rootElement}return new G(e,t,i)}}class te extends O{constructor(){super(O.JsvTagName.Head)}appendChild(e){super.appendChild(e),(e instanceof H||e instanceof $)&&e.jsvLoadResource()}removeChild(e){super.removeChild(e)}}class ie{constructor(){this.ready=!1,this.callbacks=[]}listenToReady(e){this.ready?e?.():this.callbacks.push(e)}dataReady(){this.ready=!0;for(let e of this.callbacks)e?.()}}class se extends ie{constructor(){super(),this.TextureManager=null,this.RootActivity=null,this.RootView=null}setHandles(e,t,i){this.TextureManager=e,this.RootActivity=i,this.RootView=t,this.dataReady()}}let ne="@keyframes";class oe{constructor(e){this._AnchorTag=e,this._NamesCache=new Set}insertRule(e){let t=this.getName(e);this._NamesCache.has(t)&&console.warn(`Warn: keyframe replace of name ${t}`),this._NamesCache.add(t),x.Dom.InsertKeyFrame(t,e)}hasRule(e){return this._NamesCache.has(e)}removeRule(e){this._NamesCache.has(e)?(this._NamesCache.delete(e),x.Dom.RemoveKeyFrame(e)):console.error(`Error: keyFrame(${e}) is not exist.`)}removeMultiRules(e){for(let t of e)this.removeRule(t)}getName(e){let t=e.indexOf(ne)+10,i=e.indexOf("{");return e.substring(t,i).trim()}}let re=null;function ae(e){return re||(re={global:new oe("global")}),re.global}class le{static EnsureGlobalEnv(e,t){const i=window.navigator?.userAgent?.toLowerCase();window.jsvInAndroidWebView=i?.indexOf("android")>=0,le.EnsureGlobalJsvCode(e,t),O.JsvEnableEventListener(),S.JsvDeclarePrototype()}static EnsureGlobalJsvCode(e,t){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=x.Dom.DeclareStyleSheets),window.JsvCode.Dom.UndeclareStyleSheets||(window.JsvCode.Dom.UndeclareStyleSheets=x.Dom.UndeclareStyleSheets),window.JsvCode.Dom.getKeyFrameGroup||(window.JsvCode.Dom.getKeyFrameGroup=ae),window.JsvCode.ForgeHandles||(window.JsvCode.ForgeHandles=new se)}}class ce{static SetLevel(e){switch(ce.E=ce.W=ce.I=ce.D=function(){},e){case ce.Level.Verbose:ce.V=console.debug.bind(console);case ce.Level.Debug:ce.D=console.debug.bind(console);case ce.Level.Info:ce.I=console.info.bind(console)}}}ce.E=console.error.bind(console),ce.W=console.warn.bind(console),ce.I=console.info.bind(console),ce.D=function(){},ce.V=function(){},ce.Level={Error:0,Warning:1,Info:2,Debug:3,Verbose:4};class de{constructor(e){this.callback=e}observe(e,t){if(!(e instanceof N))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 he{constructor(){this.init(),he.Render?.()}init(){k.sRenderBridge.AddWillSwapListener("forgeSwap",(()=>{x.Dom.RequestSwapAllCachedTasks()})),window.JsvCode.ForgeHandles.setHandles(new k.TextureManager,null,null);let e=null;k.DesignMap&&(e=k.DesignMap(),k.sRenderBridge.InitScreenBuffer(e.displayScale,e.width)),k.DomElementGetter=e=>{let t=window.JsvCode.Dom.PlatformBridge.JsViewId;return window.JsvCode.Dom.PlatformBridge.GetInstance(t).forgeElementGetter(e)}}static SetRender(e){he.Render=e,k.RunApp({})}}he.Render=void 0;class ue extends q{constructor(){super(),this.jsvBrowserElement=window.JsvCode.Dom.BrowserDocument.createElement(q.JsvTagName.Style)}}class me extends te{constructor(){super()}appendChild(e){"HTMLLinkElement"==e.constructor.name||"HTMLScriptElement"==e.constructor.name?window.JsvCode.Dom.BrowserDocument.head.appendChild(e):e instanceof ue?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 ue?window.JsvCode.Dom.BrowserDocument.head.removeChild(e.jsvBrowserElement):super.removeChild(e)}}class pe extends ee{constructor(){super(),this.head=new me}createElement(e){switch(e=e.toUpperCase()){case O.JsvTagName.IFrame:case O.JsvTagName.Link:case O.JsvTagName.Script:return window.JsvCode.Dom.BrowserDocument.createElement(e);case O.JsvTagName.Style:return new ue;default:return super.createElement(e)}}getElementsByTagName(e){return e.toUpperCase()===O.JsvTagName.Head?window.JsvCode.Dom.BrowserDocument.getElementsByTagName(e):super.getElementsByTagName(e)}}class fe{static Get(e){return fe.ValidStyleMap[e]}static IsUndefinedOrNumber(e,t){return!!fe.IsUndefined(e,t)||(""===t||"number"==typeof t)}static IsUndefined(e,t){let i=void 0===t;return i&&console.error(e+" property is undefined!"),i}static KeyframesCheck(e,t){fe.IsUndefined(e,t)||t.indexOf("transform")<0&&t.indexOf("opacity")<0&&console.error("keyframes property is only support transform and opacity, value:",t)}static ObjectFit(e,t){if(fe.IsUndefined(e,t))return;const i="fill contain cover none scale-down";i.indexOf(t)<0&&console.error(" objectFit is only support one of string["+i+"]")}static TransitionOtherCheck(e,t){fe.IsUndefined(e,t)||console.error(e+" property is not support, you can use transition property, e.g. transition='width 2s'")}static TransitionCheck(e,t){fe.IsUndefined(e,t)||t.length>0&&(t.indexOf("left")<0&&t.indexOf("top")<0&&t.indexOf("width")<0&&t.indexOf("height")<0&&t.indexOf("transform")<0||t.indexOf("all")>=0)&&console.error("transition property's value only support [top, left, width, height, transform] value:",t)}static TransformCheck(e,t){fe.IsUndefined(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 TransformOriginCheck(e,t){fe.IsUndefined(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 TextOverflowCheck(e,t){if(!fe.IsUndefined(e,t))switch(t){case"clip":case"ellipsis":break;default:console.error("textOverflow property's value is not support, value:",t)}}static WhiteSpaceCheck(e,t){if(!fe.IsUndefined(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 TextAlignCheck(e,t){if(!fe.IsUndefined(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 LineHeightCheck(e,t){if(!fe.IsUndefinedOrNumber(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 ColorCheck(e,t){fe.IsUndefined(e,t)||fe.CheckColorFormat("Color()",t)}static VisibilityCheck(e,t){fe.IsUndefined(e,t)||"visible"!==t&&"hidden"!==t&&"inherit"!==t&&console.error("visibility property's value is not support, value:",t)}static DisplayCheck(e,t){fe.IsUndefined(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 OverflowCheck(e,t){fe.IsUndefined(e,t)||"visible"!==t&&"hidden"!==t&&console.error("overflow property's value is support visible or hidden only, value:",t)}static TopCheck(e,t){if(!fe.IsUndefinedOrNumber(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 LeftCheck(e,t){if(!fe.IsUndefinedOrNumber(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 HeightCheck(e,t){if(!fe.IsUndefinedOrNumber(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 WidthCheck(e,t){if(!fe.IsUndefinedOrNumber(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 BackfaceVisibility(e,t){if(!fe.IsUndefined(e,t))switch(t){case"visible":case"hidden":break;default:console.error("backfaceVisibility property's value is support visible/hidden only, value: ",t)}}static PerspectiveCheck(e,t){fe.IsUndefined(e,t)}static WebkitTextStroke(e,t){if(fe.IsUndefined(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 ZIndexCheck(e,t){fe.IsUndefined(e,t)||isNaN(t)&&console.error("zIndex property's value is support number only, value: ",t)}static OpacityCheck(e,t){fe.IsUndefined(e,t)||(isNaN(t)||t>1)&&console.error("opacity property's value is support number only(0.0 ~ 1.0), value: ",t)}static FontSizeCheck(e,t){if(!fe.IsUndefinedOrNumber(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 FontWeightCheck(e,t){fe.IsUndefined(e,t)||"bold"!==t&&console.error("fontWeight property's value is support bold only, value:",t)}static FontStyleCheck(e,t){fe.IsUndefined(e,t)||"italic"!==t&&console.error("fontWeight property's value is support italic only, value:",t)}static BorderRadiusCheck(e,t){if(fe.IsUndefined(e,t))return;let i=[t];"string"==typeof t&&(i=t.split(" ")),i.length>4&&console.error("borderRadius property's value is not support, value:",t)}static BorderImageWidthCheck(e,t){fe.IsUndefinedOrNumber(e,t)}static BorderImageOutsetCheck(e,t){if(fe.IsUndefined(e,t))return;t.split(" ").length>4&&console.error("borderImageOutsetCheck property's value is not support, value:",t)}static BorderImageCheck(e,t){fe.IsUndefined(e,t)||t.indexOf("fill")<0&&console.error("borderImage property's value is not contain fill, e.g. source slice, but value:",t)}static BackgroundOtherCheck(e,t){console.error(e+" property not support, you can use backgroundImage property, e.g. backgroundImage=`url(${iconImgPath})`")}static BackgroundImageCheck(e,t){fe.IsUndefined(e,t)||"inherit"==t&&console.error("backgroundImage property's value is not support, value:",t)}static BackgroundColorCheck(e,t){if(!fe.IsUndefined(e,t))return fe.CheckColorFormat("backgroundColor",t)}static AnimationCheck(e,t){}static AnimationFillModeCheck(e,t){if(!fe.IsUndefined(e,t))switch(t){case"none":case"forwards":break;case"backwards":console.error("animationFillMode 'backwards' is not supported yet.");break;case"both":console.error("animationFillMode 'both' is not supported yet.");break;default:console.error("animationFillMode property value is not valid",t)}}static AnimationOtherNotSupport(e,t){console.error(e+" property is not support, you can use animation property, e.g. animation='mymove 5s infinite'")}static TransformStyleCheck(e,t){if(!fe.IsUndefined(e,t))switch(t){case"flat":case"preserve-3d":break;default:console.error("transformStyle property value is not valid",t)}}static PerspectiveOriginCheck(e,t){fe.IsUndefined(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 TextShadowCheck(e,t){if(!fe.IsUndefined(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(!fe.CheckColorFormat("textShadow",e[3]))return}}}static CheckColorFormat(e,t){if(0===t.indexOf("rgba(")||0===t.indexOf("rgb("));else{if(0!==t.indexOf("#"))return console.error(`${e} color value is not valid, need startwith rgba or #, value:[${t}]`),!1;if(4!==t.length&&7!==t.length&&9!==t.length)return console.error(`${e} color value's length is not valid, value:${t}`),!1}return!0}static JsvTextLatexCheck(e,t){fe.IsUndefined(e,t)||"number"!=typeof t&&console.error("JsvTextLatex property's value is support number only, value: ",t)}static JsvTextEmojiCheck(e,t){fe.IsUndefined(e,t)||"number"!=typeof t&&console.error("JsvTextEmoji property's value is support number only, value: ",t)}static DirectionCheck(e,t){if(!fe.IsUndefined(e,t))switch(t){case"ltr":case"rtl":break;default:console.error("direction property's value is not support, value:",t)}}static JsvTextAlignMinWidthCheck(e,t){fe.IsUndefined(e,t)||"number"!=typeof t&&console.error("JsvTextAlignMinWidth property's value is support number only, value: ",t)}static JsvTextVerticalAlignCheck(e,t){if(!fe.IsUndefined(e,t))switch(t){case"top":case"middle":case"bottom":break;default:console.error("JsvTextVerticalAlign property's value is not support, value: ",t)}}static JsvTextLineAlignCheck(e,t){if(!fe.IsUndefined(e,t))switch(t){case"top":case"middle":case"bottom":break;default:console.error("JsvTextLineAlign property's value is not support, value: ",t)}}static JsvTextInnerDirectionCheck(e,t){if(!fe.IsUndefined(e,t))switch(t){case"unset":case"ltr":case"rtl":break;default:console.error("JsvTextInnerDirection property's value is not support, value: ",t)}}static FlexDirectionCheck(e,t){if(!fe.IsUndefined(e,t))switch(t){case"row":case"row-reverse":case"column":case"column-reverse":break;default:console.error("flexDirection out of range: row|row-reverse|column|column-reverse, value: ",t)}}static FlexWrapCheck(e,t){if(!fe.IsUndefined(e,t))switch(t){case"nowrap":case"wrap":break;default:console.error("flexWrap out of range: nowrap|wrap, value: ",t)}}static JustifyContentCheck(e,t){if(!fe.IsUndefined(e,t))switch(t){case"flex-start":case"flex-end":case"center":break;default:console.error("flexWrap out of range: flex-start|flex-end|center, value: ",t)}}static AlignItemsCheck(e,t){if(!fe.IsUndefined(e,t))switch(t){case"flex-start":case"flex-end":case"center":case"stretch":break;default:console.error("alignItems out of range: flex-start|flex-end|center|stretch, value: ",t)}}static AlignContentCheck(e,t){if(!fe.IsUndefined(e,t))switch(t){case"flex-start":case"flex-end":case"center":break;default:console.error("alignContent out of range: flex-start|flex-end|center, value: ",t)}}static AlignSelfCheck(e,t){if(!fe.IsUndefined(e,t))switch(t){case"auto":case"flex-start":case"flex-end":case"center":case"stretch":break;default:console.error("alignSelf out of range: auto|flex-start|flex-end|center|stretch, value: ",t)}}static FlexGrowCheck(e,t){fe.IsUndefined(e,t)||isNaN(t)&&console.error("flexGrow must be number, value: ",t)}}fe.ValidStyleMap={animation:{check:fe.AnimationCheck},animationName:{check:fe.AnimationOtherNotSupport},animationDuration:{check:fe.AnimationOtherNotSupport},animationTimingFunction:{check:fe.AnimationOtherNotSupport},animationDelay:{check:fe.AnimationOtherNotSupport},animationIterationCount:{check:fe.AnimationOtherNotSupport},animationDirection:{check:fe.AnimationOtherNotSupport},animationPlayState:{check:fe.AnimationOtherNotSupport},animationFillMode:{check:fe.AnimationFillModeCheck},background:{check:fe.BackgroundOtherCheck},backgroundColor:{check:fe.BackgroundColorCheck},backgroundImage:{check:fe.BackgroundImageCheck},borderImage:{check:fe.BorderImageCheck},borderImageOutset:{check:fe.BorderImageOutsetCheck},borderImageWidth:{check:fe.BorderImageWidthCheck},borderRadius:{check:fe.BorderRadiusCheck},height:{check:fe.HeightCheck},width:{check:fe.WidthCheck},zIndex:{check:fe.ZIndexCheck},opacity:{check:fe.OpacityCheck},fontFamily:{check:null},fontSize:{check:fe.FontSizeCheck},fontStyle:{check:fe.FontStyleCheck},fontWeight:{check:fe.FontWeightCheck},left:{check:fe.LeftCheck},overflow:{check:fe.OverflowCheck},top:{check:fe.TopCheck},visibility:{check:fe.VisibilityCheck},display:{check:fe.DisplayCheck},color:{check:fe.ColorCheck},lineHeight:{check:fe.LineHeightCheck},textAlign:{check:fe.TextAlignCheck},direction:{check:fe.DirectionCheck},whiteSpace:{check:fe.WhiteSpaceCheck},textOverflow:{check:fe.TextOverflowCheck},transform:{check:fe.TransformCheck},transformOrigin:{check:fe.TransformOriginCheck},transition:{check:fe.TransitionCheck},transitionProperty:{check:fe.TransitionOtherCheck},transitionDuration:{check:fe.TransitionOtherCheck},transitionTimingFunction:{check:fe.TransitionOtherCheck},transitionDelay:{check:fe.TransitionOtherCheck},keyframes:{check:fe.KeyframesCheck},objectFit:{check:fe.ObjectFit},perspective:{check:fe.PerspectiveCheck},backfaceVisibility:{check:fe.BackfaceVisibility},transformStyle:{check:fe.TransformStyleCheck},perspectiveOrigin:{check:fe.PerspectiveCheck},WebkitTextStroke:{check:fe.WebkitTextStroke},textShadow:{check:fe.TextShadowCheck},JsvTextLatex:{check:fe.JsvTextLatexCheck},JsvTextEmoji:{check:fe.JsvTextEmojiCheck},JsvTextAlignMinWidth:{check:fe.JsvTextAlignMinWidthCheck},JsvTextVerticalAlign:{check:fe.JsvTextVerticalAlignCheck},JsvTextLineAlign:{check:fe.JsvTextLineAlignCheck},JsvTextInnerDirection:{check:fe.JsvTextInnerDirectionCheck},flexDirection:{check:fe.FlexDirectionCheck},flexWrap:{check:fe.FlexWrapCheck},justifyContent:{check:fe.JustifyContentCheck},alignItems:{check:fe.AlignItemsCheck},alignContent:{check:fe.AlignContentCheck},alignSelf:{check:fe.AlignSelfCheck},flexGrow:{check:fe.FlexGrowCheck}};class ve{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){ve.HookDocument(e),ve.HookOthers(),ve.DeclareAddition()}static HookDocument(e){window.JsvCode.Dom.BrowserDocument=e;const t=new pe;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 HookOthers(){window.MutationObserver=de,window.Element=O,window.SVGElement=X}static DeclareAddition(){const e=window.JsvCode.Dom.JsViewDocument;window.document.jsvInitFDivRoot=e.jsvInitFDivRoot.bind(e),window.JsvCode.Dom.CheckStyleFormat=window.jsvInAndroidWebView?null:ve.CheckStyleFormat}static CheckStyleFormat(e,t){if(e.startsWith("--"))return;let i=fe.Get(e);i?i.check&&t&&i.check(e,t):console.error(e+" property is not support.")}}window.jsvIsBrowserDebug=!0;const ge=window.JsvCode.BrowserPlatformDomBridge,we=window.JsvCode.BrowserPlatformMediaBridge;function ye(){const e=ve.BackupBrowser();ge.RegisterOriginDocument(e),le.EnsureGlobalEnv(ge,we),ve.HookBrowser(e),ce.I("Using JsView HTML Environment.")}export{he as BrowserForgeApp,ye as InitEnv};
2
2
 
@@ -1,2 +1,2 @@
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.prevented=!1,this.target=t,this.timeStamp=Date.now(),this.type=e}preventDefault(){this.prevented=!0}jsvIsPrevented(){return this.prevented}}class s extends t{constructor(e){super(e)}}class i extends t{constructor(e,t){super(e),this.options=t}initCustomEvent(e,t,s,i){this.type=e}get detail(){return this.options?.detail}}class n extends t{constructor(e){super(e)}}n.JsvType={Focus:"focus",Blur:"blur"},void 0===window.Forge?(window.Forge={},console.log("Define forge browser")):console.log("Define using JsView forge engine-js");var o,r,a,l,h,c,d,u,v,m,f,p,g,w=window.Forge;class y{constructor(e,t){if(this.href="",this.origin="",this.protocol="",this.host="",this.hostname="",this.port="",this.pathname="",this.search="",this.hash="",!e)return;if(!0===e.startsWith("url")){let t=e.indexOf("(")+1,s=e.lastIndexOf(")");if("undefined"===(e=e.substring(t,s).trim())||"null"===e||0===e.length)return}if(!0===e.startsWith("data:")||!0===e.startsWith("jsvtexturestore:"))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,n=i.indexOf("#");n>0&&(this.hash=i.substring(n),i=i.substring(0,n));let o=i.indexOf("?");o>1&&(this.search=i.substring(o),i=i.substring(0,o));let r=i,a=r.indexOf("://");this.protocol=a>0?r.substring(0,a+1):"";let l=a>1?r.substring(a+3):"";a=l.indexOf("/"),this.host=a>0?l.substring(0,a):"",this.pathname=a>=1?l.substring(a):"","file:"==this.protocol&&(this.host="",this.pathname=l),this.origin=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}}class T{static EnableEventListener(e){const t=window.JsvCode.Dom.PlatformBridge.JsViewId;window.JsvCode.Dom.PlatformBridge.SetOnEventListener(t,e)}static CreateElement(e,t){T.PushLazyTask(T.LazyTaskType.CreateElement,e,t)}static BindElementToRootView(e){T.PushLazyTask(T.LazyTaskType.BindElementToRootView,e)}static InsertElementChild(e,t,s){T.PushLazyTask(T.LazyTaskType.InsertElementChild,e,t,s)}static RemoveElementChild(e,t){T.PushLazyTask(T.LazyTaskType.RemoveElementChild,e,t)}static MoveElementChild(e,t,s,i){T.PushLazyTask(T.LazyTaskType.MoveElementChild,e,t,s,i)}static ReOrderElementChild(e,t,s){T.PushLazyTask(T.LazyTaskType.ReOrderElementChild,e,t,s)}static AddElementEventListener(e,t,s){T.PushLazyTask(T.LazyTaskType.AddElementEventListener,e,t,s)}static RemoveElementEventListener(e,t,s){T.PushLazyTask(T.LazyTaskType.RemoveElementEventListener,e,t,s)}static SetElementText(e,t){T.PushLazyTask(T.LazyTaskType.SetElementText,e,t)}static SetElementAttribute(e,t,s){T.PushLazyTask(T.LazyTaskType.SetElementAttribute,e,t,s),T.LazyTaskSyncedListenerMap.has(e)&&T.CachedSyncListenIdSet.add(e)}static GetElementBoundingClientStyles(e,t){return T.RunSyncTask(T.LazyTaskType.GetElementBoundingClientStyles,e,t)}static SetForgeViewInnerProps(e,t,s){let i=0;(t=t.substr(12)).startsWith("mask-")&&(i=1,t=t.substr(5)),T.PushLazyTask(T.LazyTaskType.SetForgeViewInnerProps,e,t,i,""+s)}static DeclareStyleSheets(e){T.PushLazyTask(T.LazyTaskType.DeclareStyleSheets,-1,e)}static UndeclareStyleSheets(e){T.PushLazyTask(T.LazyTaskType.UndeclareStyleSheets,-1,e)}static SetStyleProperty(e,t,s){T.PushLazyTask(T.LazyTaskType.SetStyleProperty,e,t,s),T.LazyTaskSyncedListenerMap.has(e)&&T.CachedSyncListenIdSet.add(e)}static GetStyleProperties(e,t){return T.RunSyncTask(T.LazyTaskType.GetStyleProperties,e,t)}static AppendLazyTaskSyncedListener(e,t){T.LazyTaskSyncedListenerMap.set(e,t)}static RemoveLazyTaskSyncedListener(e){T.LazyTaskSyncedListenerMap.delete(e)}static RequestSwapAllCachedTasks(){if(0==T.CachedLazyTaskList.length)return;const e=JSON.stringify(T.CachedLazyTaskList);T.CachedLazyTaskList=[];const t=window.JsvCode.Dom.PlatformBridge.JsViewId;window.JsvCode.Dom.PlatformBridge.RunLazyTaskList(t,e);for(const e of T.CachedSyncListenIdSet){const t=T.LazyTaskSyncedListenerMap.get(e);t?.()}T.CachedSyncListenIdSet.clear()}static GetElementAttribute(e,t){return T.RunSyncTask(T.LazyTaskType.GetElementAttribute,e,t)}static InsertKeyFrame(e,t){T.PushLazyTask(T.LazyTaskType.InsertKeyFrameDefine,-1,e,t)}static RemoveKeyFrame(e){T.PushLazyTask(T.LazyTaskType.RemoveKeyFrameDefine,-1,e)}static GetRelativePosition(e,t){const s=T.RunSyncTask(T.LazyTaskType.GetRelativePosition,e,t);return JSON.parse(s)}static RunSyncTask(e,t,...s){T.RequestSwapAllCachedTasks();const i=window.JsvCode.Dom.PlatformBridge.JsViewId;return window.JsvCode.Dom.PlatformBridge.RunSyncTask(i,e,t,...s)}static PushLazyTask(e,t,...s){T.CachedLazyTaskList.push([e,t,...s]),w.sRenderBridge?.RequestSwap()}}T.CachedLazyTaskList=new Array,T.CachedSyncListenIdSet=new Set,T.LazyTaskSyncedListenerMap=new Map,T.LazyTaskType={CreateElement:10,BindElementToRootView:11,InsertElementChild:12,RemoveElementChild:13,AddElementEventListener:14,RemoveElementEventListener:15,SetElementText:16,SetElementAttribute:17,GetElementBoundingClientStyles:18,GetElementAttribute:19,MoveElementChild:20,GetRelativePosition:21,ReOrderElementChild:22,DeclareStyleSheets:30,SetStyleProperty:31,GetStyleProperties:32,UndeclareStyleSheets:39,SetForgeViewInnerProps:40,InsertKeyFrameDefine:41,RemoveKeyFrameDefine:42};class N{}N.Dom=T,N.Media=class{static CreateAudioPlayer(){return window.JsvCode.Media.PlatformBridge.CreateAudioPlayer()}static CreateVideoPlayer(){return window.JsvCode.Media.PlatformBridge.CreateVideoPlayer()}};class D{static GenerateId(){const e=this.UniqueId++;if(e>=this.MaxUniqueId)throw new Error("JsvUniqueId.GenerateId() Failed to create unique id. id is overflow.");return e}}D.UniqueId=0,D.MaxUniqueId=Math.pow(2,31)-1;class E{constructor(e){this.childNodes=[],this.nodeType=e,this.ownerDocument=window.document,this.parentNode=null,this.jsvEventListenerMap=null,this.jsvChildChangedCallback=null}jsvFinalize(){}appendChild(e){this.childNodes.push(e),e.parentNode=this,this.jsvChildChangedCallback?.()}removeChild(e){let t=this.childNodes.indexOf(e);if(t<0)throw new DOMException("Failed to remove node, child node is not found. node=",e);this.childNodes.splice(t,1),e.parentNode=null,this.jsvChildChangedCallback?.()}insertBefore(e,t){this.insertBeforeInner(e,t)}get previousSibling(){const e=this.parentNode?.childNodes;let t=e?.indexOf(this);if(void 0===t||t<0)throw new DOMException("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(void 0===t||t<0)throw new DOMException("Failed to call Node.nextSibling(), this node not found. this=",this);return e[t+1]}addEventListener(e,t,s){this.jsvEventListenerMap||(this.jsvEventListenerMap=new Map);let i=this.jsvEventListenerMap?.get(e);i||(i=new Set,this.jsvEventListenerMap?.set(e,i)),i.add(t)}removeEventListener(e,t,s){let i=this.jsvEventListenerMap?.get(e);i&&(i.delete(t),i.size<=0&&this.jsvEventListenerMap?.delete(e),0==this.jsvEventListenerMap?.size&&(this.jsvEventListenerMap=null))}dispatchEvent(e){if(!this.jsvEventListenerMap)return void console.warn("Node.dispatchEvent() Ignore to dispatch event: "+e.type+". No event added.");let t=this.jsvEventListenerMap?.get(e.type);if(t){e.target||(e.target=document.activeElement);for(let s of t)if(s?.(e),e.jsvIsPrevented())break}else console.warn("Node.dispatchEvent() Ignore to dispatch event: "+e.type+". No listener added.")}jsvObserveChildChanged(e){this.jsvChildChangedCallback=e}jsvMoveChildReOrder(e,t){{let t=this.childNodes.indexOf(e);if(t<0)throw new DOMException("Failed to call jsvMoveChildReOrder, node not found. node=",e);this.childNodes.splice(t,1)}{let s=this.childNodes.length;if(t&&(s=this.childNodes.indexOf(t),s<0))throw new DOMException("Failed to call move node, before node not found. beforeNode=",t);this.childNodes.splice(s,0,e)}this.jsvChildChangedCallback?.()}jsvMoveChildToNewParent(e,t,s){let i=this.childNodes.indexOf(e);if(i<0)throw new DOMException("Failed to call jsvMoveChildToNewParent, node not found. node=",e);this.childNodes.splice(i,1),e.parentNode=null,this.jsvChildChangedCallback?.(),t.insertBeforeInner(e,s)}jsvGetEventListenerSet(e){const t=this.jsvEventListenerMap?.get(e);return t}insertBeforeInner(e,t){let s=this.childNodes.length;if(void 0===t)throw new DOMException("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 DOMException("Failed to call insert node, before node not found. beforeNode=",t);this.childNodes.splice(s,0,e),e.parentNode=this,this.jsvChildChangedCallback?.()}}function S(e,t,s){return"symbol"==typeof t&&(t=t.description?"[".concat(t.description,"]"):""),Object.defineProperty(e,"name",{configurable:!0,value:s?"".concat(s," ",t):t})}E.ELEMENT_NODE=1,E.TEXT_NODE=3,E.COMMENT_NODE=8,E.DOCUMENT_NODE=9,E.NOLAYOUT_NODE=10;class C{static HasGetterMethod(e){switch(e){case C.Layout.Height:case C.Layout.Left:case C.Layout.Top:case C.Layout.Width:case C.Effect.ObjectFit:return!0;default:return!1}}static ToConst(e){return e==C.Layout.Height?C.Layout.Height:e==C.Layout.Left?C.Layout.Left:e==C.Layout.Top?C.Layout.Top:e==C.Layout.Width?C.Layout.Width:e==C.Background.BackgroundColor?C.Background.BackgroundColor:e==C.Background.BackgroundImage?C.Background.BackgroundImage:e==C.Background.BorderRadius?C.Background.BorderRadius:e==C.Effect.BackfaceVisibility?C.Effect.BackfaceVisibility:e==C.Effect.BorderImage?C.Effect.BorderImage:e==C.Effect.BorderImageWidth?C.Effect.BorderImageWidth:e==C.Effect.BorderImageOutset?C.Effect.BorderImageOutset:e==C.Effect.Display?C.Effect.Display:e==C.Effect.ObjectFit?C.Effect.ObjectFit:e==C.Effect.Opacity?C.Effect.Opacity:e==C.Effect.Overflow?C.Effect.Overflow:e==C.Effect.Perspective?C.Effect.Perspective:e==C.Effect.PerspectiveOrigin?C.Effect.PerspectiveOrigin:e==C.Effect.Transform?C.Effect.Transform:e==C.Effect.TransformOrigin?C.Effect.TransformOrigin:e==C.Effect.TransformStyle?C.Effect.TransformStyle:e==C.Effect.Visibility?C.Effect.Visibility:e==C.Effect.ZIndex?C.Effect.ZIndex:e==C.Text.Color?C.Text.Color:e==C.Text.FontFamily?C.Text.FontFamily:e==C.Text.FontSize?C.Text.FontSize:e==C.Text.FontStyle?C.Text.FontStyle:e==C.Text.FontWeight?C.Text.FontWeight:e==C.Text.LineHeight?C.Text.LineHeight:e==C.Text.TextAlign?C.Text.TextAlign:e==C.Text.TextOverflow?C.Text.TextOverflow:e==C.Text.TextShadow?C.Text.TextShadow:e==C.Text.WebkitTextStroke?C.Text.WebkitTextStroke:e==C.Text.WhiteSpace?C.Text.WhiteSpace:e==C.Text.WordWrap?C.Text.WordWrap:e==C.Text.Direction?C.Text.Direction:e==C.Text.JsvTextEmoji?C.Text.JsvTextEmoji:e==C.Text.JsvTextLatex?C.Text.JsvTextLatex:e==C.Text.JsvTextAlignMinWidth?C.Text.JsvTextAlignMinWidth:e==C.Text.JsvTextVerticalAlign?C.Text.JsvTextVerticalAlign:e==C.Text.JsvTextLineAlign?C.Text.JsvTextLineAlign:e==C.Text.JsvTextInnerDirection?C.Text.JsvTextInnerDirection:e==C.Motion.Animation?C.Motion.Animation:e==C.Motion.Transition?C.Motion.Transition:e==C.Motion.AnimationFillMode?C.Motion.AnimationFillMode:null}constructor(){throw new Error("new StyleName() is forbidden.")}}C.Layout=(S(o=class{constructor(){throw new Error("new StyleName.Layout() is forbidden.")}},"Layout"),o.Height="height",o.Left="left",o.Top="top",o.Width="width",o),C.Background=(S(r=class{constructor(){throw new Error("new StyleName.Background() is forbidden.")}},"Background"),r.BackgroundColor="backgroundColor",r.BackgroundImage="backgroundImage",r.BorderRadius="borderRadius",r),C.Effect=(S(a=class{constructor(){throw new Error("new StyleName.Effect() is forbidden.")}},"Effect"),a.BackfaceVisibility="backfaceVisibility",a.BorderImage="borderImage",a.BorderImageWidth="borderImageWidth",a.BorderImageOutset="borderImageOutset",a.Display="display",a.ObjectFit="objectFit",a.Opacity="opacity",a.Overflow="overflow",a.Perspective="perspective",a.PerspectiveOrigin="perspectiveOrigin",a.Transform="transform",a.TransformOrigin="transformOrigin",a.TransformStyle="transformStyle",a.Visibility="visibility",a.ZIndex="zIndex",a),C.Text=(S(l=class{constructor(){throw new Error("new StyleName.Text() is forbidden.")}},"Text"),l.Color="color",l.FontFamily="fontFamily",l.FontSize="fontSize",l.FontStyle="fontStyle",l.FontWeight="fontWeight",l.LineHeight="lineHeight",l.TextAlign="textAlign",l.TextOverflow="textOverflow",l.TextShadow="textShadow",l.WebkitTextStroke="WebkitTextStroke",l.WhiteSpace="whiteSpace",l.WordWrap="wordWrap",l.Direction="direction",l.JsvTextEmoji="JsvTextEmoji",l.JsvTextLatex="JsvTextLatex",l.JsvTextAlignMinWidth="JsvTextAlignMinWidth",l.JsvTextVerticalAlign="JsvTextVerticalAlign",l.JsvTextLineAlign="JsvTextLineAlign",l.JsvTextInnerDirection="JsvTextInnerDirection",l),C.Motion=(S(h=class{constructor(){throw new Error("new StyleName.Motion() is forbidden.")}},"Motion"),h.Animation="animation",h.Transition="transition",h.AnimationFillMode="animationFillMode",h);class I{constructor(e){let t=-1,s=null;null==e?t=I.DataType.Null:Number(e)===e&&e%1==0?t=I.DataType.Int32:Number(e)===e&&e%1!=0?t=I.DataType.Float:"string"==typeof e||e instanceof String?t=I.DataType.String:e instanceof I.AnimationImpl?t=I.DataType.Animation:e instanceof I.CornerImpl?t=I.DataType.Corner:e instanceof I.RectImpl?t=I.DataType.Rect:e instanceof I.TextShadowImpl?t=I.DataType.TextShadow:e instanceof I.WebkitTextStrokeImpl?t=I.DataType.WebkitTextStroke:e instanceof I.TransitionImpl?t=I.DataType.Transition:e instanceof I.BorderImageImpl&&(t=I.DataType.BorderImage),e!=I.InvalidInt32&&e!=I.InvalidFloat&&e!=I.InvalidPointer?s=e:(t=I.DataType.Null,s=null),this.data=new I.DataInfo,this.data.index=t,this.data.value=s}toString(){let e=null;switch(this.data.index){case I.DataType.Null:return"";case I.DataType.Int32:case I.DataType.Float:return String(this.get());case I.DataType.String:e=this.get();break;case I.DataType.Animation:case I.DataType.Corner:case I.DataType.Rect:case I.DataType.TextShadow:case I.DataType.WebkitTextStroke:case I.DataType.Transition:case I.DataType.BorderImage:case I.DataType.BackgroundImage:e=this.get().rawValue;break;default:console.error("Failed to do StyleValue.toString()")}return e??""}is(e){return this.data.index==e}get(){return this.data.value}reset(e){this.data.value=e.data.value,this.data.index=e.data.index}equals(e){return this.data.value===e.data.value&&this.data.index===e.data.index}}I.Base=class{constructor(e){this.rawValue=e}},I.AnimationImpl=class extends I.Base{constructor(e){super(e),this.name="",this.duration=0,this.timingFunction=null,this.delay=0,this.iterationCount=0,this.direction=!1}},I.CornerImpl=class extends I.Base{constructor(e){super(e),this.topLeft=0,this.topRight=0,this.bottomRight=0,this.bottomLeft=0}},I.RectImpl=class extends I.Base{constructor(e){super(e),this.top=0,this.right=0,this.left=0,this.bottom=0}},I.TextShadowImpl=class extends I.Base{constructor(e){super(e),this.hShadow=0,this.vShadow=0,this.blur=0,this.color=void 0}},I.WebkitTextStrokeImpl=class extends I.Base{constructor(e){super(e),this.length=0,this.color=void 0}},I.TransitionImpl=class extends I.Base{constructor(e){super(e),this.animationMap=new Map}},I.BorderImageImpl=class extends I.Base{constructor(e){super(e),this.source="",this.slice=null}},I.BackgroundImageImpl=(S(c=class extends I.Base{constructor(e){super(e),this.type=0,this.urlPath=""}},"BackgroundImageImpl"),c.eType={UNKNOWN:0,LINEAR_GRADIENT:1,URL_PATH:2},c.LinearGradient=class{constructor(){this.fromX=0,this.fromY=0,this.toX=0,this.toY=0,this.stops=[]}},c),I.DataType=(S(d=class{},"DataType"),d.Null=0,d.Int32=1,d.Float=2,d.String=3,d.Animation=4,d.Corner=5,d.Rect=6,d.TextShadow=7,d.WebkitTextStroke=8,d.Transition=9,d.BorderImage=10,d.BackgroundImage=11,d),I.InvalidInt32=Number.MIN_VALUE,I.InvalidFloat=Number.NaN,I.InvalidPointer=null,I.DataInfo=class{constructor(){this.value=null,this.index=-1}},S(u=class{},"Text"),u.Color="#000000",u.FontFamily="黑体",u.FontSize=10,u.FontStyle="normal",u.FontWeight="normal",u.LineHeight=0,u.TextAlign="start",u.TextOverflow="clip",u.TextShadow=null,u.WebkitTextStroke=null,u.WhiteSpace="normal",u.WordWrap="normal",u.Direction="ltr",u.JsvTextEmoji=0,u.JsvTextLatex=0,u.JsvTextAlignMinWidth=0,u.JsvTextVerticalAlign="top",u.JsvTextLineAlign="middle",u.JsvTextInnerDirection="unset",S(v=class{constructor(){this.height=I.InvalidInt32,this.left=I.InvalidInt32,this.top=I.InvalidInt32,this.width=I.InvalidInt32}},"Layout"),v.Name="layout",S(m=class{constructor(){this.backgroundColor=I.InvalidPointer,this.backgroundImage=I.InvalidPointer,this.borderRadius=I.InvalidPointer}},"Background"),m.Name="background",S(f=class{constructor(){this.backfaceVisibility=I.InvalidPointer,this.borderImage=I.InvalidPointer,this.borderImageWidth=I.InvalidPointer,this.borderImageOutset=I.InvalidPointer,this.display=I.InvalidPointer,this.objectFit=I.InvalidPointer,this.opacity=I.InvalidFloat,this.overflow=I.InvalidPointer,this.perspective=I.InvalidInt32,this.perspectiveOrigin=I.InvalidPointer,this.transform=I.InvalidPointer,this.transformOrigin=I.InvalidPointer,this.transformStyle=I.InvalidPointer,this.visibility=I.InvalidPointer,this.zIndex=I.InvalidInt32}},"Effect"),f.Name="effect",S(p=class{constructor(){this.color=I.InvalidPointer,this.fontFamily=I.InvalidPointer,this.fontSize=I.InvalidInt32,this.fontStyle=I.InvalidPointer,this.fontWeight=I.InvalidPointer,this.lineHeight=I.InvalidInt32,this.textAlign=I.InvalidPointer,this.textOverflow=I.InvalidPointer,this.textShadow=I.InvalidPointer,this.webkitTextStroke=I.InvalidPointer,this.whiteSpace=I.InvalidPointer,this.wordWrap=I.InvalidPointer,this.direction=I.InvalidPointer,this.jsvTextEmoji=I.InvalidInt32,this.jsvTextLatex=I.InvalidInt32,this.jsvTextAlignMinWidth=I.InvalidInt32,this.jsvTextVerticalAlign=I.InvalidPointer,this.jsvTextLineAlign=I.InvalidPointer,this.jsvTextInnerDirection=I.InvalidPointer}},"Text"),p.Name="text",S(g=class{constructor(){this.animation=I.InvalidPointer,this.transition=I.InvalidPointer,this.animationFillMode="none"}},"Motion"),g.Name="motion";class x{static JsvDeclarePrototype(){for(let e in C){let t=C[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(x.prototype,s,i)}}}constructor(e){this.cachedProps={},this.nativeId=e}setProperty(e,t){if(window.JsvCode.Dom.CheckStyleFormat?.(e,t),e==C.Background.BackgroundImage&&"string"==typeof t)if(0==t.indexOf("linear-gradient")){const e=t.match(/\(/g)?.length,s=t.match(/\)/g)?.length;e!=s&&(console.error(`StyleError: illegal linear-gradient value '${t}'`),t="")}else{t=new y(t).href}else if(e==C.Effect.BorderImage&&"string"==typeof t){const e=t.split(" ");e.length>0&&(e[0]=new y(e[0]).href),t=e.join(" ")}else e==C.Effect.Display&&(this.cachedProps[e]=t);N.Dom.SetStyleProperty(this.nativeId,e,t)}getPropertyValue(e){if(e==C.Effect.Display)return this.cachedProps[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=N.Dom.GetStyleProperties(this.nativeId,t);return JSON.parse(s)}}class b extends t{constructor(e){super(e)}}class P extends E{static JsvEnableEventListener(){N.Dom.EnableEventListener((function(e,t,...s){let i=P.JsvEventListenerMap.get(e);const n=i?.get(t);n?.(t,...s)}))}constructor(e){super(E.ELEMENT_NODE),this.jsvNativeId=-1,this.jsvAttrStore={},this.jsvClientSizeStore={},this.tagName=e,this.tagName!=P.JsvTagName.Audio&&this.tagName!=P.JsvTagName.Div&&this.tagName!=P.JsvTagName.Image&&this.tagName!=P.JsvTagName.Video&&this.tagName!=P.JsvTagName.JsvFDiv||(this.jsvNativeId=D.GenerateId(),this.style=new x(this.jsvNativeId),N.Dom.CreateElement(this.jsvNativeId,e))}appendChild(e){e.parentNode?this.moveChildNode(e,null):(super.appendChild(e),this.jsvInsertChild(e,null))}removeChild(e){super.removeChild(e),this.jsvRemoveChild(e),e instanceof P&&e.jsvNativeId>0&&N.Dom.RemoveElementChild(this.jsvNativeId,e.jsvNativeId)}insertBefore(e,t){e.parentNode?e.parentNode==this?(this.jsvMoveChildReOrder(e,t),this.jsvReOrderChildNode(e,t)):this.moveChildNode(e,t):(super.insertBefore(e,t),this.jsvInsertChild(e,t))}addEventListener(e,t,s){const i=this.jsvGetEventListenerSet(e);i?.has(t)?console.warn("Element.addEventListener() Faild to add listener, func is exists"):(s=this.jsvCheckEventOptions(s),this.jsvNativeId&&(this.jsvAddListener(this.jsvNativeId,e),N.Dom.AddElementEventListener(this.jsvNativeId,e,s)),super.addEventListener(e,t,s))}removeEventListener(e,t,s){const i=this.jsvGetEventListenerSet(e);0!=!!i?.has(t)&&(s=this.jsvCheckEventOptions(s),super.removeEventListener(e,t,s),this.jsvNativeId&&(this.jsvRemoveListener(this.jsvNativeId,e),N.Dom.RemoveElementEventListener(this.jsvNativeId,e,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.jsvClientSizeStore.clientWidth||(this.jsvClientSizeStore.clientWidth=N.Dom.GetElementAttribute(this.jsvNativeId,"clientWidth")),this.jsvClientSizeStore.clientWidth}get clientHeight(){return this.jsvClientSizeStore.clientHeight||(this.jsvClientSizeStore.clientHeight=N.Dom.GetElementAttribute(this.jsvNativeId,"clientHeight")),this.jsvClientSizeStore.clientHeight}setAttribute(e,t){e&&(this.jsvAttrStore[e]=t,this.jsvNativeId&&(e.startsWith("data-jsv-vw-")?N.Dom.SetForgeViewInnerProps(this.jsvNativeId,e,t):"class"===e||e.startsWith("data-v-")||e.startsWith("data-jsv")||e.startsWith("dataJsv")?N.Dom.SetElementAttribute(this.jsvNativeId,e,t):"id"===e&&N.Dom.SetForgeViewInnerProps(this.jsvNativeId,"data-jsv-vw-id",t)))}removeAttribute(e){delete this.jsvAttrStore[e],("class"==e||e.startsWith("data-v-")||"src"==e)&&this.jsvNativeId&&N.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 n(n.JsvType.Blur);t.target=e,document.dispatchEvent(t)}let t=new n(n.JsvType.Focus);document.dispatchEvent(t)}jsvGetBoundingClientRect(){const e="jsv-getbound",t=D.GenerateId();return new Promise(((s,i)=>{const n=o=>{const r=o.jsvParams?.[1];if(r!=t)return;o.preventDefault(),this.removeEventListener(e,n);const a=JSON.parse(o.jsvParams?.[0]??"{}");0===a.status?s(a.data):i(a.error)};this.addEventListener(e,n,{jsvtoken:t})}))}jsvSetOnLazyTaskSyncedListener(e){N.Dom.AppendLazyTaskSyncedListener(this.jsvNativeId,e)}jsvOnEvent(e,...n){let o;e.startsWith("animation")?(o=new s(e),o.animationName=n[0]):e.startsWith("transition")?(o=new b(e),o.propertyName=n[0]):e.startsWith("jsv")?(o=new i(e),o.options={detail:n[0]},o.jsvParams=n):"click"==e&&(o=new t(e),o.target=this),o&&(o.target=this,this.dispatchEvent(o))}jsvGetProxyView(e){return e?(this.maskViewProxy||(this.maskViewProxy=w.NewDomProxyView(this.jsvNativeId,!0)),this.maskViewProxy):(this.mainViewProxy||(this.mainViewProxy=w.NewDomProxyView(this.jsvNativeId,!1)),this.mainViewProxy)}jsvGetProxyTexture(e){return this.mainViewTextureProxy||(this.mainViewTextureProxy=e.GetDomProxyTexture(this.jsvNativeId)),this.mainViewTextureProxy}jsvGetRelativePosition(e){return N.Dom.GetRelativePosition(this.jsvNativeId,e.jsvNativeId)}jsvAddListener(e,t){let s=P.JsvEventListenerMap.get(e);s||(s=new Map,P.JsvEventListenerMap.set(e,s));this.jsvGetEventListenerSet(t)||s.set(t,this.jsvOnEvent.bind(this))}jsvRemoveListener(e,t){let s=P.JsvEventListenerMap.get(e);if(!s)return;this.jsvGetEventListenerSet(t)||s.delete(t)}moveChildNode(e,t){console.log("Do move child node");let s=e.parentNode;s.jsvMoveChildToNewParent(e,this,t),this.jsvMoveChildNode(s,e,t)}jsvMoveChildNode(e,t,s){t.jsvNativeId&&(s=P.JsvFindBackwardForgeView(s),N.Dom.MoveElementChild(this.jsvNativeId,e.jsvNativeId,t.jsvNativeId,s?.jsvNativeId))}jsvReOrderChildNode(e,t){e.jsvNativeId&&(t=P.JsvFindBackwardForgeView(t),N.Dom.ReOrderElementChild(this.jsvNativeId,e.jsvNativeId,t?.jsvNativeId))}jsvInsertChild(e,t){e.parentNode=this,e.nodeType===E.TEXT_NODE?this.textContent=e.nodeValue:e instanceof P&&e.jsvNativeId>0&&(t=P.JsvFindBackwardForgeView(t),N.Dom.InsertElementChild(this.jsvNativeId,e.jsvNativeId,t?.jsvNativeId))}jsvRemoveChild(e){if(e instanceof P!=0){for(const t of e.childNodes)e.jsvRemoveChild(t);e.jsvFinalize(),N.Dom.RemoveLazyTaskSyncedListener(e.jsvNativeId),P.JsvEventListenerMap.delete(e.jsvNativeId)}}jsvCheckEventOptions(e){if(null==e)return null;if("object"!=typeof e||e instanceof Array)return console.warn("Event options is invalid for ",e),null;const t=["capture","once","passive","signal"];for(const[s,i]of Object.entries(e))0==t.includes(s)&&0==s.startsWith("jsv")&&(console.warn("Event options name is invalid: ",s),delete e[s]),"boolean"==typeof i?e[s]=+e[s]:"number"!=typeof i&&(console.warn("Event options value is invalid: ",i),delete e[s]);return e}static JsvFindBackwardForgeView(e){let t=e;for(;t&&!(t instanceof P);)t=t.nextSibling;return t}}P.JsvTagName={Anchor:"A",Audio:"AUDIO",Div:"DIV",Head:"HEAD",Image:"IMG",IFrame:"IFRAME",Link:"LINK",Script:"SCRIPT",Style:"STYLE",Svg:"SVG",Video:"VIDEO",JsvAudioTrack:"JSV-AUDIOTRACK",JsvFDiv:"FDIV"},P.JsvEventListenerMap=new Map;class L extends P{constructor(){super(P.JsvTagName.Anchor),this.href="",this.protocol="",this.host="",this.search="",this.hash="",this.hostname="",this.port="",this.pathname="",console.warn("Warnig: <a> is fake in JsView system")}jsvGetTagName(){return P.JsvTagName.Anchor}}class F extends E{constructor(e){super(E.COMMENT_NODE),this.textContent=e}}class k extends P{constructor(){super(P.JsvTagName.Div),this.textContentStore=null}get textContent(){return this.textContentStore}set textContent(e){this.textContentStore=e,this.jsvClientSizeStore={},N.Dom.SetElementText(this.jsvNativeId,e)}}const R="FocusDebug",M="__AppRoot__";let j=!1,_=!1;function O(e,t){let s=function(e){let t="";if(e){let s=e,i=s.RouterDelegate?.ref?.NameSpace;for(i=i==M?"":i,t=`[${i?i+", ":""}${s.BranchName}]`,s=s.GetParentPage();s;)i=s.RouterDelegate?.ref?.NameSpace,i=i==M?"":i,t=`[${i?i+", ":""}${s.BranchName}]->`+t,s=s.GetParentPage()}return t}(e);if(t.stack){let e=t.stack.split("\n");e.length>=3&&(t.stack=e.slice(2,6))}let i="";for(let e of t.stack)i+=e+"\n";delete t.stack,console.log(R,`focusChange(${t?.from}):${t?.askName}\n:focusStack:${s}\n:trace:${i}:`,t)}class J{constructor(e,t){this._DefaultFocusNameSpace=null,this._DefaultFocusNameSpace=null,this.RouterDelegate={ref:null},e||(this.RouterDelegate.ref=new B(!1,t))}enableFocusTrace(e){j=!0,_=e}getNameSpace(){let e=this.RouterDelegate.ref.NameSpace;return e==M?"":e}wrapWithNameSpace(e){let t=new J(!0);return t._DefaultFocusNameSpace=e,t.RouterDelegate=this.RouterDelegate,t}getNodeByName(e){return this.RouterDelegate.ref.getNodeByName(e)}focusByNameBeforeMount(e,t,s){if("string"==typeof e)return e.includes(".")&&(e=e.split(".")),this.RouterDelegate.ref.focusBeforeMount(e,t,s);console.error(`setFocus name=${e} is invalid`)}setFocus(e,t){this._DefaultFocusNameSpace&&this._DefaultFocusNameSpace.length>0&&(e=`${this._DefaultFocusNameSpace}.${e}`);let s=null;j&&(s={askName:e,deepToChild:t,from:"setFocus",stack:_?new Error("simulate-stack").stack:null});return this.focusByNameBeforeMount(e,t,s)}printAllFocusable(){this.RouterDelegate.ref.printAllFocusRecursive(this._DefaultFocusNameSpace,"")}getCurrentFocusStack(){const e=[];if(this.RouterDelegate.ref){let t=this.RouterDelegate.ref.getCurrentFocusNode();for(;t&&t instanceof A;){let s=t.RouterDelegate?.ref?.NameSpace;e.push({nameSpace:s==M||s==t.BranchName?"":s,name:t.BranchName}),t=t.GetParentPage()}}else console.error("getCurrentFocusStack failed: router delegate is null.");return e}getLastFocus(){if(A.sLastFocus){let e=A.sLastFocus;for(;e._LatestFocusChild;)e=e._LatestFocusChild;return e.BranchName}return null}getCurrentFocus(){if(this.RouterDelegate.ref){const e=this.RouterDelegate.ref.getCurrentFocusNode();if(e)return e.BranchName}return null}getDeactivedPageFocus(){return this.RouterDelegate.ref?this.RouterDelegate.ref.getDeactivePageFocusName():null}returnFocusToParent(){const e=this.RouterDelegate.ref.getCurrentFocusNode();e?e.ReturnFocusToParent():console.warn("returnFocusToParent: current focus node is null.")}}class B{constructor(e,t){this._ChildMap={},this._FocusNameBeforeMount=null,this._BeforeMountStack=null,this._FocusNodeName=null,this._IsTemp=!!e,this.NameSpace=t}getDeactivePageFocusName(){return this._FocusNodeName}getCurrentFocusNode(){if(null==this._FocusNodeName)return null;let e=this._ChildMap[this._FocusNodeName];if(!e)return console.error("Erorr: node not mounted name="+this._FocusNodeName),null;if(e.RouterDelegate.ref!=this){let t=e.RouterDelegate.ref.getCurrentFocusNode();return null==t?e:t}return e}getNodeByName(e,t){let s=e.split(".");return this._FindRouterSearchBase(s,t)._GetNodeFromPathArray(s,e)}printAllFocusRecursive(e,t){let s=this.NameSpace==M?"":this.NameSpace,i=t+(t&&t.length>0?".":"")+s;for(let t in this._ChildMap){let s=this._ChildMap[t];if(!e||0==e.length||i.indexOf(e)>=0){let e=i===M?t:i+"."+t;console.log(e,s)}s.RouterDelegate.ref!=this&&s.RouterDelegate.ref.printAllFocusRecursive(e,i)}}_FindRouterSearchBase(e,t){if(0==e[0].length){let t,s;for(let e in this._ChildMap){t=this._ChildMap[e];break}do{s=t,t=t.GetParentPage()}while(null!=t);return e.splice(0,1),s.RouterDelegate.ref}return t&&t.AsHub&&t.GetParentPage()?t.GetParentPage().RouterDelegate.ref:this}_GetNodeFromPathArray(e,t){let s=0,i=this;for(;s<e.length-1;){let n=!1;for(let t in i._ChildMap){let o=i._ChildMap[t].RouterDelegate.ref;if(o!=i&&o.NameSpace==e[s]){i=o,s++,n=!0;break}}if(!n)return void console.error(`Error: no found subpath fname=${t}`)}let n=e[s];return i._ChildMap.hasOwnProperty(n)?i._ChildMap[n]:void console.error(`Error: no found fname=${t}`)}add(e,t){if(e.indexOf(".")>=0)console.error("ERROR: FDiv name can not contains '.'");else if(this._ChildMap.hasOwnProperty(e)&&this._ChildMap[e]!==t)console.error(`ERROR: FDiv router branch name duplicated:[${e}]`);else if(this._ChildMap[e]=t,this._FocusNameBeforeMount)if("string"==typeof this._FocusNameBeforeMount)this._FocusNameBeforeMount==e&&t.RouterDelegate.ref.focusBeforeMount(this._FocusNameBeforeMount,!1,this._BeforeMountStack);else{this._FocusNameBeforeMount[0]==e&&t.RouterDelegate.ref.focusBeforeMount(this._FocusNameBeforeMount.slice(1),!1,this._BeforeMountStack)}}remove(e,t,s,i){let n=this._ChildMap[e];n&&n==t&&(delete this._ChildMap[e],n.OnRemoveFromTree()),this._FocusNodeName==e&&s&&(i||(this._FocusNodeName=s))}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)}clearChildFocus(){this._FocusNodeName=null,this._FocusNameBeforeMount=null}hasPendingFocusRequest(){return!this._FocusNameBeforeMount}focusBeforeMount(e,t,s){j&&!s&&console.error(R,`Error: found debug info missing from ${new Error("simulate-stack").stack}`);let i=!1;if("string"==typeof e){if(!e.includes(".")){i=!0;let n=this._ChildMap[e];if(this._FocusNodeName=e,n){this._FocusNameBeforeMount=null,this._BeforeMountStack=s,n.Focus(!t);let e=n.GetFocusChild();for(;e;){let t=e.GetFocusChild();if(!t){this._FocusNodeName=e.BranchName;break}e=t}return j&&O(e??n,s),n.RouterDelegate.ref!=this&&n.RouterDelegate.ref.clearChildFocus(),!0}return this._FocusNameBeforeMount=e,this._BeforeMountStack=s,!1}console.error("error: name contain .")}else if("object"==typeof e&&Array.isArray(e)&&e.length>0){if(i=!0,1==e.length)return this.focusBeforeMount(e[0],t,s);{let i=e[0],n=this._ChildMap[i];return this._FocusNodeName=i,n?n.RouterDelegate.ref.focusBeforeMount(e.slice(1),t,s):(this._FocusNameBeforeMount=e,this._BeforeMountStack=s,!1)}}return i||console.error("illegal name param",e),!1}focus(e,t,s){let i=this.focusBeforeMount(e,t,s);return i||console.log("No found branch:"+e),i}forEach(e){for(let t in this._ChildMap)e(this._ChildMap[t],t,this._ChildMap)}printNodes(){console.log(this._ChildMap)}}class A extends w.PageBase{constructor(e){super(e),this._OnKeyDown=null,this._OnKeyUp=null,this._OnFocus=null,this._OnBlur=null,this._DispatchKeyDown=null,this._DispatchKeyUp=null,this._OnCustomEvent=null,this._DKeyDownProxy=void 0,this._DKeyUpProxy=void 0,this._Mounted=!1,this._MountWaitingList=null,this.AsHub=!1,this.InterfaceHub=null,this._TmpRouter=null,this._AutoShow=null,this.BranchName=e,this.RouterDelegate={ref:null},this._TmpRouter=null,this._OriginDispatchKeyDown=this._OriginDispatchKeyDown.bind(this),this._OriginDispatchKeyUp=this._OriginDispatchKeyUp.bind(this),this._AutoShow=!1}async waitMounted(){if(this._Mounted)return;let e=this;return new Promise(((t,s)=>{e._MountWaitingList||(e._MountWaitingList=[]),e._MountWaitingList.push(t)}))}updateMountState(){this._Mounted=!0;let e=this.SubPages;for(let t in e)e[t].updateMountState();if(this._MountWaitingList&&this._MountWaitingList.length>0){for(const e of this._MountWaitingList)e();this._MountWaitingList=null}}getHub(){return this.InterfaceHub||(this.InterfaceHub=new J(!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)}routerUnbind(e,t){let s;this.AsHub?this.GetParentPage()&&(s=this.GetParentPage().RouterDelegate.ref):s=this.RouterDelegate.ref,s&&s.remove(this.BranchName,this,e,t),this.RouterDelegate={ref:null}}setBranchName(e){if(e===this.BranchName)return;let t=this.BranchName;this.BranchName=e,this.PageName=e,this._ParentPage&&this._ParentPage.routerRenameChild(t,e)}static safeCallback(e){return e&&e instanceof Function?function(...t){try{return e(...t)}catch(t){console.error("FocusNode: callback error",e.name,t)}}:null}setOnKeyDown(e){this._OnKeyDown=A.safeCallback(e)}setOnKeyUp(e){this._OnKeyUp=A.safeCallback(e)}setOnFocus(e){this._OnFocus=A.safeCallback(e)}setOnBlur(e){this._OnBlur=A.safeCallback(e)}setDispatchKeyUp(e){this._DispatchKeyUp=A.safeCallback(e)}setDispatchKeyDown(e){this._DispatchKeyDown=A.safeCallback(e)}setOnCustomEvent(e){this._OnCustomEvent=A.safeCallback(e)}setDispatchKeyProxy(e,t){this._DKeyDownProxy=A.safeCallback(e),this._DKeyUpProxy=A.safeCallback(t)}requestFocus(e){let t=null;j&&(t={askName:this.BranchName,deepToChild:e,from:"requestFocus",stack:_?new Error("simulate-stack").stack:null}),this.requestFocusInner(e,t)}ReturnFocusToParent(){if(this.IsFocus()){let e=this.GetParentPage();if(e){const t=e.BranchName;let s=null;j&&(s={askName:t,deepToChild:!1,from:"returnFocusToParent",stack:_?new Error("simulate-stack").stack:null}),e.RouterDelegate.ref.focus(t,!1,s)}}else super.ReturnFocusToParent()}requestFocusInner(e,t){let s=this.RouterDelegate.ref;return this.AsHub&&this.GetParentPage()&&(s=this.GetParentPage().RouterDelegate.ref),s?s.focus(this.BranchName,e,t):(console.error("error: lost router"),!1)}OnKeyDown(e){return!!this._OnKeyDown&&this._OnKeyDown(e)}OnKeyUp(e){return!!this._OnKeyUp&&this._OnKeyUp(e)}OnCustomEvent(e){return!!this._OnCustomEvent&&this._OnCustomEvent(e)}bubbleCustomEvent(e){this.BubbleCustomEvent(e)}dispatchKeyDown(e){return this.DispatchKeyDown(e)}DispatchKeyDown(e){return 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(),V()),e instanceof A)){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 A.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(){A.sLastFocus=this,this._OnBlur&&this._OnBlur()}onUnMount(e){A.sLastFocus==this&&(A.sLastFocus=null);let t=this.IsFocus();if(j&&t){let t=this.GetParentPage();if(t){let s=null;s={askName:t.BranchName,deepToChild:!1,from:e?"deactive":"unmount",stack:_?new Error("simulate-stack").stack:null},O(t,s)}}let s=this.GetParentPage();s&&s.RemoveSubPage(this),this.ClearSubPages(),this.routerUnbind(s?.BranchName,e),this._Mounted=!1}getFullName(){let e=this,t=[this.RouterDelegate.ref.NameSpace];this.AsHub||t.push(this.BranchName);let s=this.RouterDelegate.ref;do{if(e=e.GetParentPage(),t[0]==M)break;e&&e.RouterDelegate.ref!=s&&(s=e.RouterDelegate.ref,t.unshift(s.NameSpace))}while(e);return t[0]==M?t.shift():console.error("ERROR: missing app root"),t.join(".")}getNodeByName(e){return this.RouterDelegate.ref.getNodeByName(e,this)}}A.sFocusMemos=[],A.sLastFocus=null,A.sRootPageNode=null;let V=()=>{let e=A.sFocusMemos.length;if(e>0){let t=A.sFocusMemos;A.sFocusMemos=[];for(let s=0;s<e;s++)t[s].obj.Focus(t[s].bcf)}},W={};class z{constructor(e,t,s){this._Element=s,W.hasOwnProperty(e)&&console.error(`Warn: FDivRoot duplicate name=${e}`),W[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(window.JsvCode.ForgeHandles.RootActivity,window.JsvCode.ForgeHandles.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(),V()}}class G extends P{constructor(){super(P.JsvTagName.Image)}setAttribute(e,t){if("src"===e){t=new y(t).href,this.jsvClientSizeStore={}}super.setAttribute(e,t),this.jsvNativeId&&"src"===e&&N.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 K extends P{constructor(){super(P.JsvTagName.Link)}setAttribute(e,t){this[e]=t}jsvLoadResource(){let e=!1,t=null;if(null!=this.href){var s=new y(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 U extends P{constructor(){super(P.JsvTagName.Script)}setAttribute(e,t){this[e]=t}jsvLoadResource(){if(null!=this.src){var e=new y(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})}}class H extends P{constructor(){super(P.JsvTagName.Style),this.jsvAttrStore={left:0,top:0,width:0,height:0}}}class $ extends P{constructor(){super(P.JsvTagName.Svg)}}class q extends E{constructor(e){super(E.TEXT_NODE),this.textContent=e}get nodeValue(){return this.textContent}set nodeValue(e){this.textContent=e,this.parentNode&&(this.parentNode.textContent=this.textContent)}}let X=1;class Y extends P{constructor(){super(P.JsvTagName.JsvFDiv),this.FocusNodeRef=new A("unnamed-"+X++),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 J(!1,t);this.hubRef=e,this.FocusNodeRef.setHub(e),this.FocusNodeRef.setBranchName(t)}}removeAttribute(e){}jsvGetHub(){return this.hubRef}}class Z extends E{constructor(){super(E.DOCUMENT_NODE),this.location=window.location,this.rootElement=new k,this.rootElement.ownerDocument=this,this.rootElement.id="root",N.Dom.BindElementToRootView(this.rootElement.jsvNativeId),this.activeElement=this.rootElement,this.head=null}createComment(e){return new F(e)}createElement(e){switch(e=e.toUpperCase()){case P.JsvTagName.Anchor:return new L;case P.JsvTagName.Div:return new k;case P.JsvTagName.Image:return new G;case P.JsvTagName.Link:return new K;case P.JsvTagName.Script:return new U;case P.JsvTagName.Style:return new H;case P.JsvTagName.Svg:return new $;case P.JsvTagName.JsvFDiv:return new Y;case P.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"CUSTOMEVENT"===(e=e.toUpperCase())?new i(e):new t(e)}createTextNode(e){return new q(e)}getElementById(e){if("root"===e||"app"===e)return this.rootElement;throw new DOMException("Failed to get element by id, id="+e+" is UNIMPLEMENTED.")}getElementsByTagName(e){if((e=e.toUpperCase())===P.JsvTagName.Head)return[this.head];if(e===P.JsvTagName.Link||e===P.JsvTagName.Script||e===P.JsvTagName.Style)return[];throw new DOMException("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("title"===e)return null;if(e.startsWith("style[")&&e.endsWith("]"))return null;throw new DOMException("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 z(e,t,s)}}class Q extends P{constructor(){super(P.JsvTagName.Head)}appendChild(e){super.appendChild(e),(e instanceof K||e instanceof U)&&e.jsvLoadResource()}removeChild(e){super.removeChild(e)}}class ee{constructor(){this.ready=!1,this.callbacks=[]}listenToReady(e){this.ready?e?.():this.callbacks.push(e)}dataReady(){this.ready=!0;for(let e of this.callbacks)e?.()}}class te extends ee{constructor(){super(),this.TextureManager=null,this.RootActivity=null,this.RootView=null}setHandles(e,t,s){this.TextureManager=e,this.RootActivity=s,this.RootView=t,this.dataReady()}}let se="@keyframes";class ie{constructor(e){this._AnchorTag=e,this._NamesCache=new Set}insertRule(e){let t=this.getName(e);this._NamesCache.has(t)&&console.warn(`Warn: keyframe replace of name ${t}`),this._NamesCache.add(t),N.Dom.InsertKeyFrame(t,e)}hasRule(e){return this._NamesCache.has(e)}removeRule(e){this._NamesCache.has(e)?(this._NamesCache.delete(e),N.Dom.RemoveKeyFrame(e)):console.error(`Error: keyFrame(${e}) is not exist.`)}removeMultiRules(e){for(let t of e)this.removeRule(t)}getName(e){let t=e.indexOf(se)+10,s=e.indexOf("{");return e.substring(t,s).trim()}}let ne=null;function oe(e){return ne||(ne={global:new ie("global")}),ne.global}class re{static EnsureGlobalEnv(e,t){const s=window.navigator?.userAgent?.toLowerCase();window.jsvInAndroidWebView=s?.indexOf("android")>=0,re.EnsureGlobalJsvCode(e,t),P.JsvEnableEventListener(),x.JsvDeclarePrototype()}static EnsureGlobalJsvCode(e,t){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=N.Dom.DeclareStyleSheets),window.JsvCode.Dom.UndeclareStyleSheets||(window.JsvCode.Dom.UndeclareStyleSheets=N.Dom.UndeclareStyleSheets),window.JsvCode.Dom.getKeyFrameGroup||(window.JsvCode.Dom.getKeyFrameGroup=oe),window.JsvCode.ForgeHandles||(window.JsvCode.ForgeHandles=new te)}}class ae{static SetLevel(e){switch(ae.E=ae.W=ae.I=ae.D=function(){},e){case ae.Level.Verbose:ae.V=console.debug.bind(console);case ae.Level.Debug:ae.D=console.debug.bind(console);case ae.Level.Info:ae.I=console.info.bind(console)}}}ae.E=console.error.bind(console),ae.W=console.warn.bind(console),ae.I=console.info.bind(console),ae.D=function(){},ae.V=function(){},ae.Level={Error:0,Warning:1,Info:2,Debug:3,Verbose:4};class le{constructor(e){this.callback=e}observe(e,t){if(!(e instanceof E))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 he extends Z{constructor(){super(),this.head=new Q}set cookie(e){window.__JsvCookies.setCookie(e)}get cookie(){return window.__JsvCookies.getCookie()}}class ce{static DeclareGlobal(){ce.DeclareDocument(),ce.DeclareOthers(),ce.DeclareAddition()}static DeclareDocument(){window.document=new he}static DeclareOthers(){window.MutationObserver=le,window.Element=P,window.SVGElement=$;let e=new y(window.JsView.getAppUrl(),!0);window.location.applyUrlInfo?window.location.applyUrlInfo(e):window.location=e,window.history={},window.navigator={userAgent:"jsview-runtime"}}static DeclareAddition(){window.JsView.Dom={Render:null,Extension:null,UrlRef:y}}}class de{constructor(e){this.activity=new w.ReactActivity("NativeForgeActivity",e,null,null),this.init()}init(){console.log("create NativeForgeActivity.");let e=new w.LayoutView;window.JsvCode.ForgeHandles.setHandles(this.activity.GetTextureManager(),e,this.activity);let t=null;w.DesignMap&&(t=w.DesignMap());let s=t?t.width:1280,i=Math.floor(9*s/16);this.activity.SetContentView(e,{x:0,y:0,width:s,height:i}),w.sRenderBridge.AddWillSwapListener("forgeSwap",(()=>{N.Dom.RequestSwapAllCachedTasks()})),window.JsView.Dom.Render()}}class ue{constructor(e){this.activityManager=e;let t=new de(e);e.RegisterActivity(t.activity),e.StartActivity(new w.Intent("NativeForgeActivity"))}}window.jsvIsBrowserDebug=!1;const ve=window.JsvCode.NativePlatformDomBridge,me=window.JsvCode.NativePlatformMediaBridge;function fe(){re.EnsureGlobalEnv(ve,me),ce.DeclareGlobal(),ae.I("Using JsView Native Environment.")}export{fe as InitEnv,ue 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.prevented=!1,this.target=t,this.timeStamp=Date.now(),this.type=e}preventDefault(){this.prevented=!0}jsvIsPrevented(){return this.prevented}}class s extends t{constructor(e){super(e)}}class i extends t{constructor(e,t){super(e),this.options=t}initCustomEvent(e,t,s,i){this.type=e}get detail(){return this.options?.detail}}class n extends t{constructor(e){super(e)}}n.JsvType={Focus:"focus",Blur:"blur"},void 0===window.Forge?(window.Forge={},console.log("Define forge browser")):console.log("Define using JsView forge engine-js");var o,r,a,l,h,c,d,u,v,m,f,p,g,w,y,T=window.Forge;class N{constructor(e,t){if(this.href="",this.origin="",this.protocol="",this.host="",this.hostname="",this.port="",this.pathname="",this.search="",this.hash="",!e)return;if(!0===e.startsWith("url")){let t=e.indexOf("(")+1,s=e.lastIndexOf(")");if("undefined"===(e=e.substring(t,s).trim())||"null"===e||0===e.length)return}if(!0===e.startsWith("data:")||!0===e.startsWith("jsvtexturestore:"))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,n=i.indexOf("#");n>0&&(this.hash=i.substring(n),i=i.substring(0,n));let o=i.indexOf("?");o>1&&(this.search=i.substring(o),i=i.substring(0,o));let r=i,a=r.indexOf("://");this.protocol=a>0?r.substring(0,a+1):"";let l=a>1?r.substring(a+3):"";a=l.indexOf("/"),this.host=a>0?l.substring(0,a):"",this.pathname=a>=1?l.substring(a):"","file:"==this.protocol&&(this.host="",this.pathname=l),this.origin=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}}class D{static EnableEventListener(e){const t=window.JsvCode.Dom.PlatformBridge.JsViewId;window.JsvCode.Dom.PlatformBridge.SetOnEventListener(t,e)}static CreateElement(e,t){D.PushLazyTask(D.LazyTaskType.CreateElement,e,t)}static BindElementToRootView(e){D.PushLazyTask(D.LazyTaskType.BindElementToRootView,e)}static InsertElementChild(e,t,s){D.PushLazyTask(D.LazyTaskType.InsertElementChild,e,t,s)}static RemoveElementChild(e,t){D.PushLazyTask(D.LazyTaskType.RemoveElementChild,e,t)}static MoveElementChild(e,t,s,i){D.PushLazyTask(D.LazyTaskType.MoveElementChild,e,t,s,i)}static ReOrderElementChild(e,t,s){D.PushLazyTask(D.LazyTaskType.ReOrderElementChild,e,t,s)}static AddElementEventListener(e,t,s){D.PushLazyTask(D.LazyTaskType.AddElementEventListener,e,t,s)}static RemoveElementEventListener(e,t,s){D.PushLazyTask(D.LazyTaskType.RemoveElementEventListener,e,t,s)}static SetElementText(e,t){D.PushLazyTask(D.LazyTaskType.SetElementText,e,t)}static SetElementAttribute(e,t,s){D.PushLazyTask(D.LazyTaskType.SetElementAttribute,e,t,s),D.LazyTaskSyncedListenerMap.has(e)&&D.CachedSyncListenIdSet.add(e)}static GetElementBoundingClientStyles(e,t){return D.RunSyncTask(D.LazyTaskType.GetElementBoundingClientStyles,e,t)}static SetForgeViewInnerProps(e,t,s){let i=0;(t=t.substr(12)).startsWith("mask-")&&(i=1,t=t.substr(5)),D.PushLazyTask(D.LazyTaskType.SetForgeViewInnerProps,e,t,i,""+s)}static DeclareStyleSheets(e){D.PushLazyTask(D.LazyTaskType.DeclareStyleSheets,-1,e)}static UndeclareStyleSheets(e){D.PushLazyTask(D.LazyTaskType.UndeclareStyleSheets,-1,e)}static SetStyleProperty(e,t,s){D.PushLazyTask(D.LazyTaskType.SetStyleProperty,e,t,s),D.LazyTaskSyncedListenerMap.has(e)&&D.CachedSyncListenIdSet.add(e)}static GetStyleProperties(e,t){return D.RunSyncTask(D.LazyTaskType.GetStyleProperties,e,t)}static AppendLazyTaskSyncedListener(e,t){D.LazyTaskSyncedListenerMap.set(e,t)}static RemoveLazyTaskSyncedListener(e){D.LazyTaskSyncedListenerMap.delete(e)}static RequestSwapAllCachedTasks(){if(0==D.CachedLazyTaskList.length)return;const e=JSON.stringify(D.CachedLazyTaskList);D.CachedLazyTaskList=[];const t=window.JsvCode.Dom.PlatformBridge.JsViewId;window.JsvCode.Dom.PlatformBridge.RunLazyTaskList(t,e);for(const e of D.CachedSyncListenIdSet){const t=D.LazyTaskSyncedListenerMap.get(e);t?.()}D.CachedSyncListenIdSet.clear()}static GetElementAttribute(e,t){return D.RunSyncTask(D.LazyTaskType.GetElementAttribute,e,t)}static InsertKeyFrame(e,t){D.PushLazyTask(D.LazyTaskType.InsertKeyFrameDefine,-1,e,t)}static RemoveKeyFrame(e){D.PushLazyTask(D.LazyTaskType.RemoveKeyFrameDefine,-1,e)}static GetRelativePosition(e,t){const s=D.RunSyncTask(D.LazyTaskType.GetRelativePosition,e,t);return JSON.parse(s)}static RunSyncTask(e,t,...s){D.RequestSwapAllCachedTasks();const i=window.JsvCode.Dom.PlatformBridge.JsViewId;return window.JsvCode.Dom.PlatformBridge.RunSyncTask(i,e,t,...s)}static PushLazyTask(e,t,...s){D.CachedLazyTaskList.push([e,t,...s]),T.sRenderBridge?.RequestSwap()}}D.CachedLazyTaskList=new Array,D.CachedSyncListenIdSet=new Set,D.LazyTaskSyncedListenerMap=new Map,D.LazyTaskType={CreateElement:10,BindElementToRootView:11,InsertElementChild:12,RemoveElementChild:13,AddElementEventListener:14,RemoveElementEventListener:15,SetElementText:16,SetElementAttribute:17,GetElementBoundingClientStyles:18,GetElementAttribute:19,MoveElementChild:20,GetRelativePosition:21,ReOrderElementChild:22,DeclareStyleSheets:30,SetStyleProperty:31,GetStyleProperties:32,UndeclareStyleSheets:39,SetForgeViewInnerProps:40,InsertKeyFrameDefine:41,RemoveKeyFrameDefine:42};class E{}E.Dom=D,E.Media=class{static CreateAudioPlayer(){return window.JsvCode.Media.PlatformBridge.CreateAudioPlayer()}static CreateVideoPlayer(){return window.JsvCode.Media.PlatformBridge.CreateVideoPlayer()}};class x{static GenerateId(){const e=this.UniqueId++;if(e>=this.MaxUniqueId)throw new Error("JsvUniqueId.GenerateId() Failed to create unique id. id is overflow.");return e}}x.UniqueId=0,x.MaxUniqueId=Math.pow(2,31)-1;class S{constructor(e){this.childNodes=[],this.nodeType=e,this.ownerDocument=window.document,this.parentNode=null,this.jsvEventListenerMap=null,this.jsvChildChangedCallback=null}jsvFinalize(){}appendChild(e){this.childNodes.push(e),e.parentNode=this,this.jsvChildChangedCallback?.()}removeChild(e){let t=this.childNodes.indexOf(e);if(t<0)throw new DOMException("Failed to remove node, child node is not found. node=",e);this.childNodes.splice(t,1),e.parentNode=null,this.jsvChildChangedCallback?.()}insertBefore(e,t){this.insertBeforeInner(e,t)}get previousSibling(){const e=this.parentNode?.childNodes;let t=e?.indexOf(this);if(void 0===t||t<0)throw new DOMException("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(void 0===t||t<0)throw new DOMException("Failed to call Node.nextSibling(), this node not found. this=",this);return e[t+1]}addEventListener(e,t,s){this.jsvEventListenerMap||(this.jsvEventListenerMap=new Map);let i=this.jsvEventListenerMap?.get(e);i||(i=new Set,this.jsvEventListenerMap?.set(e,i)),i.add(t)}removeEventListener(e,t,s){let i=this.jsvEventListenerMap?.get(e);i&&(i.delete(t),i.size<=0&&this.jsvEventListenerMap?.delete(e),0==this.jsvEventListenerMap?.size&&(this.jsvEventListenerMap=null))}dispatchEvent(e){if(!this.jsvEventListenerMap)return void console.warn("Node.dispatchEvent() Ignore to dispatch event: "+e.type+". No event added.");let t=this.jsvEventListenerMap?.get(e.type);if(t){e.target||(e.target=document.activeElement);for(let s of t)if(s?.(e),e.jsvIsPrevented())break}else console.warn("Node.dispatchEvent() Ignore to dispatch event: "+e.type+". No listener added.")}jsvObserveChildChanged(e){this.jsvChildChangedCallback=e}jsvMoveChildReOrder(e,t){{let t=this.childNodes.indexOf(e);if(t<0)throw new DOMException("Failed to call jsvMoveChildReOrder, node not found. node=",e);this.childNodes.splice(t,1)}{let s=this.childNodes.length;if(t&&(s=this.childNodes.indexOf(t),s<0))throw new DOMException("Failed to call move node, before node not found. beforeNode=",t);this.childNodes.splice(s,0,e)}this.jsvChildChangedCallback?.()}jsvMoveChildToNewParent(e,t,s){let i=this.childNodes.indexOf(e);if(i<0)throw new DOMException("Failed to call jsvMoveChildToNewParent, node not found. node=",e);this.childNodes.splice(i,1),e.parentNode=null,this.jsvChildChangedCallback?.(),t.insertBeforeInner(e,s)}jsvGetEventListenerSet(e){const t=this.jsvEventListenerMap?.get(e);return t}insertBeforeInner(e,t){let s=this.childNodes.length;if(void 0===t)throw new DOMException("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 DOMException("Failed to call insert node, before node not found. beforeNode=",t);this.childNodes.splice(s,0,e),e.parentNode=this,this.jsvChildChangedCallback?.()}}function C(e,t,s){return"symbol"==typeof t&&(t=t.description?"[".concat(t.description,"]"):""),Object.defineProperty(e,"name",{configurable:!0,value:s?"".concat(s," ",t):t})}S.ELEMENT_NODE=1,S.TEXT_NODE=3,S.COMMENT_NODE=8,S.DOCUMENT_NODE=9,S.NOLAYOUT_NODE=10;class I{static HasGetterMethod(e){switch(e){case I.Layout.Height:case I.Layout.Left:case I.Layout.Top:case I.Layout.Width:case I.Effect.ObjectFit:return!0;default:return!1}}static ToConst(e){return e==I.Layout.Height?I.Layout.Height:e==I.Layout.Left?I.Layout.Left:e==I.Layout.Top?I.Layout.Top:e==I.Layout.Width?I.Layout.Width:e==I.Flex.FlexDirection?I.Flex.FlexDirection:e==I.Flex.FlexWrap?I.Flex.FlexWrap:e==I.Flex.JustifyContent?I.Flex.JustifyContent:e==I.Flex.AlignItems?I.Flex.AlignItems:e==I.Flex.AlignContent?I.Flex.AlignContent:e==I.Flex.AlignSelf?I.Flex.AlignSelf:e==I.Flex.FlexGrow?I.Flex.FlexGrow:e==I.Background.BackgroundColor?I.Background.BackgroundColor:e==I.Background.BackgroundImage?I.Background.BackgroundImage:e==I.Background.BorderRadius?I.Background.BorderRadius:e==I.Effect.BackfaceVisibility?I.Effect.BackfaceVisibility:e==I.Effect.BorderImage?I.Effect.BorderImage:e==I.Effect.BorderImageWidth?I.Effect.BorderImageWidth:e==I.Effect.BorderImageOutset?I.Effect.BorderImageOutset:e==I.Effect.Display?I.Effect.Display:e==I.Effect.ObjectFit?I.Effect.ObjectFit:e==I.Effect.Opacity?I.Effect.Opacity:e==I.Effect.Overflow?I.Effect.Overflow:e==I.Effect.Perspective?I.Effect.Perspective:e==I.Effect.PerspectiveOrigin?I.Effect.PerspectiveOrigin:e==I.Effect.Transform?I.Effect.Transform:e==I.Effect.TransformOrigin?I.Effect.TransformOrigin:e==I.Effect.TransformStyle?I.Effect.TransformStyle:e==I.Effect.Visibility?I.Effect.Visibility:e==I.Effect.ZIndex?I.Effect.ZIndex:e==I.Text.Color?I.Text.Color:e==I.Text.FontFamily?I.Text.FontFamily:e==I.Text.FontSize?I.Text.FontSize:e==I.Text.FontStyle?I.Text.FontStyle:e==I.Text.FontWeight?I.Text.FontWeight:e==I.Text.LineHeight?I.Text.LineHeight:e==I.Text.TextAlign?I.Text.TextAlign:e==I.Text.TextOverflow?I.Text.TextOverflow:e==I.Text.TextShadow?I.Text.TextShadow:e==I.Text.WebkitTextStroke?I.Text.WebkitTextStroke:e==I.Text.WhiteSpace?I.Text.WhiteSpace:e==I.Text.WordWrap?I.Text.WordWrap:e==I.Text.Direction?I.Text.Direction:e==I.Text.JsvTextEmoji?I.Text.JsvTextEmoji:e==I.Text.JsvTextLatex?I.Text.JsvTextLatex:e==I.Text.JsvTextAlignMinWidth?I.Text.JsvTextAlignMinWidth:e==I.Text.JsvTextVerticalAlign?I.Text.JsvTextVerticalAlign:e==I.Text.JsvTextLineAlign?I.Text.JsvTextLineAlign:e==I.Text.JsvTextInnerDirection?I.Text.JsvTextInnerDirection:e==I.Motion.Animation?I.Motion.Animation:e==I.Motion.Transition?I.Motion.Transition:e==I.Motion.AnimationFillMode?I.Motion.AnimationFillMode:null}constructor(){throw new Error("new StyleName() is forbidden.")}}I.Layout=(C(o=class{constructor(){throw new Error("new StyleName.Layout() is forbidden.")}},"Layout"),o.Height="height",o.Left="left",o.Top="top",o.Width="width",o),I.Flex=(C(r=class{constructor(){throw new Error("new StyleName.Flex() is forbidden.")}},"Flex"),r.FlexDirection="flexDirection",r.FlexWrap="flexWrap",r.JustifyContent="justifyContent",r.AlignItems="alignItems",r.AlignContent="alignContent",r.AlignSelf="alignSelf",r.FlexGrow="flexGrow",r),I.Background=(C(a=class{constructor(){throw new Error("new StyleName.Background() is forbidden.")}},"Background"),a.BackgroundColor="backgroundColor",a.BackgroundImage="backgroundImage",a.BorderRadius="borderRadius",a),I.Effect=(C(l=class{constructor(){throw new Error("new StyleName.Effect() is forbidden.")}},"Effect"),l.BackfaceVisibility="backfaceVisibility",l.BorderImage="borderImage",l.BorderImageWidth="borderImageWidth",l.BorderImageOutset="borderImageOutset",l.Display="display",l.ObjectFit="objectFit",l.Opacity="opacity",l.Overflow="overflow",l.Perspective="perspective",l.PerspectiveOrigin="perspectiveOrigin",l.Transform="transform",l.TransformOrigin="transformOrigin",l.TransformStyle="transformStyle",l.Visibility="visibility",l.ZIndex="zIndex",l),I.Text=(C(h=class{constructor(){throw new Error("new StyleName.Text() is forbidden.")}},"Text"),h.Color="color",h.FontFamily="fontFamily",h.FontSize="fontSize",h.FontStyle="fontStyle",h.FontWeight="fontWeight",h.LineHeight="lineHeight",h.TextAlign="textAlign",h.TextOverflow="textOverflow",h.TextShadow="textShadow",h.WebkitTextStroke="WebkitTextStroke",h.WhiteSpace="whiteSpace",h.WordWrap="wordWrap",h.Direction="direction",h.JsvTextEmoji="JsvTextEmoji",h.JsvTextLatex="JsvTextLatex",h.JsvTextAlignMinWidth="JsvTextAlignMinWidth",h.JsvTextVerticalAlign="JsvTextVerticalAlign",h.JsvTextLineAlign="JsvTextLineAlign",h.JsvTextInnerDirection="JsvTextInnerDirection",h),I.Motion=(C(c=class{constructor(){throw new Error("new StyleName.Motion() is forbidden.")}},"Motion"),c.Animation="animation",c.Transition="transition",c.AnimationFillMode="animationFillMode",c);class b{constructor(e){let t=-1,s=null;null==e?t=b.DataType.Null:Number(e)===e&&e%1==0?t=b.DataType.Int32:Number(e)===e&&e%1!=0?t=b.DataType.Float:"string"==typeof e||e instanceof String?t=b.DataType.String:e instanceof b.AnimationImpl?t=b.DataType.Animation:e instanceof b.CornerImpl?t=b.DataType.Corner:e instanceof b.RectImpl?t=b.DataType.Rect:e instanceof b.TextShadowImpl?t=b.DataType.TextShadow:e instanceof b.WebkitTextStrokeImpl?t=b.DataType.WebkitTextStroke:e instanceof b.TransitionImpl?t=b.DataType.Transition:e instanceof b.BorderImageImpl&&(t=b.DataType.BorderImage),e!=b.InvalidInt32&&e!=b.InvalidFloat&&e!=b.InvalidPointer?s=e:(t=b.DataType.Null,s=null),this.data=new b.DataInfo,this.data.index=t,this.data.value=s}toString(){let e=null;switch(this.data.index){case b.DataType.Null:return"";case b.DataType.Int32:case b.DataType.Float:return String(this.get());case b.DataType.String:e=this.get();break;case b.DataType.Animation:case b.DataType.Corner:case b.DataType.Rect:case b.DataType.TextShadow:case b.DataType.WebkitTextStroke:case b.DataType.Transition:case b.DataType.BorderImage:case b.DataType.BackgroundImage:e=this.get().rawValue;break;default:console.error("Failed to do StyleValue.toString()")}return e??""}is(e){return this.data.index==e}get(){return this.data.value}reset(e){this.data.value=e.data.value,this.data.index=e.data.index}equals(e){return this.data.value===e.data.value&&this.data.index===e.data.index}}b.Base=class{constructor(e){this.rawValue=e}},b.AnimationImpl=class extends b.Base{constructor(e){super(e),this.name="",this.duration=0,this.timingFunction=null,this.delay=0,this.iterationCount=0,this.direction=!1}},b.CornerImpl=class extends b.Base{constructor(e){super(e),this.topLeft=0,this.topRight=0,this.bottomRight=0,this.bottomLeft=0}},b.RectImpl=class extends b.Base{constructor(e){super(e),this.top=0,this.right=0,this.left=0,this.bottom=0}},b.TextShadowImpl=class extends b.Base{constructor(e){super(e),this.hShadow=0,this.vShadow=0,this.blur=0,this.color=void 0}},b.WebkitTextStrokeImpl=class extends b.Base{constructor(e){super(e),this.length=0,this.color=void 0}},b.TransitionImpl=class extends b.Base{constructor(e){super(e),this.animationMap=new Map}},b.BorderImageImpl=class extends b.Base{constructor(e){super(e),this.source="",this.slice=null}},b.BackgroundImageImpl=(C(d=class extends b.Base{constructor(e){super(e),this.type=0,this.urlPath=""}},"BackgroundImageImpl"),d.eType={UNKNOWN:0,LINEAR_GRADIENT:1,URL_PATH:2},d.LinearGradient=class{constructor(){this.fromX=0,this.fromY=0,this.toX=0,this.toY=0,this.stops=[]}},d),b.DataType=(C(u=class{},"DataType"),u.Null=0,u.Int32=1,u.Float=2,u.String=3,u.Animation=4,u.Corner=5,u.Rect=6,u.TextShadow=7,u.WebkitTextStroke=8,u.Transition=9,u.BorderImage=10,u.BackgroundImage=11,u),b.InvalidInt32=Number.MIN_VALUE,b.InvalidFloat=Number.NaN,b.InvalidPointer=null,b.DataInfo=class{constructor(){this.value=null,this.index=-1}},C(v=class{},"Text"),v.Color="#000000",v.FontFamily="黑体",v.FontSize=10,v.FontStyle="normal",v.FontWeight="normal",v.LineHeight=0,v.TextAlign="start",v.TextOverflow="clip",v.TextShadow=null,v.WebkitTextStroke=null,v.WhiteSpace="normal",v.WordWrap="normal",v.Direction="ltr",v.JsvTextEmoji=0,v.JsvTextLatex=0,v.JsvTextAlignMinWidth=0,v.JsvTextVerticalAlign="top",v.JsvTextLineAlign="middle",v.JsvTextInnerDirection="unset",C(m=class{constructor(){this.height=b.InvalidInt32,this.left=b.InvalidInt32,this.top=b.InvalidInt32,this.width=b.InvalidInt32}},"Layout"),m.Name="layout",C(f=class{constructor(){this.flexDirection=b.InvalidInt32,this.flexWrap=b.InvalidInt32,this.justifyContent=b.InvalidInt32,this.alignItems=b.InvalidInt32,this.alignContent=b.InvalidInt32,this.alignSelf=b.InvalidInt32,this.flexGrow=b.InvalidFloat}},"Flex"),f.Name="flex",C(p=class{constructor(){this.backgroundColor=b.InvalidPointer,this.backgroundImage=b.InvalidPointer,this.borderRadius=b.InvalidPointer}},"Background"),p.Name="background",C(g=class{constructor(){this.backfaceVisibility=b.InvalidPointer,this.borderImage=b.InvalidPointer,this.borderImageWidth=b.InvalidPointer,this.borderImageOutset=b.InvalidPointer,this.display=b.InvalidPointer,this.objectFit=b.InvalidPointer,this.opacity=b.InvalidFloat,this.overflow=b.InvalidPointer,this.perspective=b.InvalidInt32,this.perspectiveOrigin=b.InvalidPointer,this.transform=b.InvalidPointer,this.transformOrigin=b.InvalidPointer,this.transformStyle=b.InvalidPointer,this.visibility=b.InvalidPointer,this.zIndex=b.InvalidInt32}},"Effect"),g.Name="effect",C(w=class{constructor(){this.color=b.InvalidPointer,this.fontFamily=b.InvalidPointer,this.fontSize=b.InvalidInt32,this.fontStyle=b.InvalidPointer,this.fontWeight=b.InvalidPointer,this.lineHeight=b.InvalidInt32,this.textAlign=b.InvalidPointer,this.textOverflow=b.InvalidPointer,this.textShadow=b.InvalidPointer,this.webkitTextStroke=b.InvalidPointer,this.whiteSpace=b.InvalidPointer,this.wordWrap=b.InvalidPointer,this.direction=b.InvalidPointer,this.jsvTextEmoji=b.InvalidInt32,this.jsvTextLatex=b.InvalidInt32,this.jsvTextAlignMinWidth=b.InvalidInt32,this.jsvTextVerticalAlign=b.InvalidPointer,this.jsvTextLineAlign=b.InvalidPointer,this.jsvTextInnerDirection=b.InvalidPointer}},"Text"),w.Name="text",C(y=class{constructor(){this.animation=b.InvalidPointer,this.transition=b.InvalidPointer,this.animationFillMode="none"}},"Motion"),y.Name="motion";class F{static JsvDeclarePrototype(){for(let e in I){let t=I[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(F.prototype,s,i)}}}constructor(e){this.cachedProps={},this.nativeId=e}setProperty(e,t){if(window.JsvCode.Dom.CheckStyleFormat?.(e,t),e==I.Background.BackgroundImage&&"string"==typeof t)if(0==t.indexOf("linear-gradient")){const e=t.match(/\(/g)?.length,s=t.match(/\)/g)?.length;e!=s&&(console.error(`StyleError: illegal linear-gradient value '${t}'`),t="")}else{t=new N(t).href}else if(e==I.Effect.BorderImage&&"string"==typeof t){const e=t.split(" ");e.length>0&&(e[0]=new N(e[0]).href),t=e.join(" ")}else e==I.Effect.Display&&(this.cachedProps[e]=t);E.Dom.SetStyleProperty(this.nativeId,e,t)}getPropertyValue(e){if(e==I.Effect.Display)return this.cachedProps[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=E.Dom.GetStyleProperties(this.nativeId,t);return JSON.parse(s)}}class P extends t{constructor(e){super(e)}}class L extends S{static JsvEnableEventListener(){E.Dom.EnableEventListener((function(e,t,...s){let i=L.JsvEventListenerMap.get(e);const n=i?.get(t);n?.(t,...s)}))}constructor(e){super(S.ELEMENT_NODE),this.jsvNativeId=-1,this.jsvAttrStore={},this.jsvClientSizeStore={},this.tagName=e,this.tagName!=L.JsvTagName.Audio&&this.tagName!=L.JsvTagName.Div&&this.tagName!=L.JsvTagName.Image&&this.tagName!=L.JsvTagName.Video&&this.tagName!=L.JsvTagName.JsvFDiv||(this.jsvNativeId=x.GenerateId(),this.style=new F(this.jsvNativeId),E.Dom.CreateElement(this.jsvNativeId,e))}appendChild(e){e.parentNode?this.moveChildNode(e,null):(super.appendChild(e),this.jsvInsertChild(e,null))}removeChild(e){super.removeChild(e),this.jsvRemoveChild(e),e instanceof L&&e.jsvNativeId>0&&E.Dom.RemoveElementChild(this.jsvNativeId,e.jsvNativeId)}insertBefore(e,t){e.parentNode?e.parentNode==this?(this.jsvMoveChildReOrder(e,t),this.jsvReOrderChildNode(e,t)):this.moveChildNode(e,t):(super.insertBefore(e,t),this.jsvInsertChild(e,t))}addEventListener(e,t,s){const i=this.jsvGetEventListenerSet(e);i?.has(t)?console.warn("Element.addEventListener() Faild to add listener, func is exists"):(s=this.jsvCheckEventOptions(s),this.jsvNativeId&&(this.jsvAddListener(this.jsvNativeId,e),E.Dom.AddElementEventListener(this.jsvNativeId,e,s)),super.addEventListener(e,t,s))}removeEventListener(e,t,s){const i=this.jsvGetEventListenerSet(e);0!=!!i?.has(t)&&(s=this.jsvCheckEventOptions(s),super.removeEventListener(e,t,s),this.jsvNativeId&&(this.jsvRemoveListener(this.jsvNativeId,e),E.Dom.RemoveElementEventListener(this.jsvNativeId,e,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.jsvClientSizeStore.clientWidth||(this.jsvClientSizeStore.clientWidth=E.Dom.GetElementAttribute(this.jsvNativeId,"clientWidth")),this.jsvClientSizeStore.clientWidth}get clientHeight(){return this.jsvClientSizeStore.clientHeight||(this.jsvClientSizeStore.clientHeight=E.Dom.GetElementAttribute(this.jsvNativeId,"clientHeight")),this.jsvClientSizeStore.clientHeight}setAttribute(e,t){e&&(this.jsvAttrStore[e]=t,this.jsvNativeId&&(e.startsWith("data-jsv-vw-")?E.Dom.SetForgeViewInnerProps(this.jsvNativeId,e,t):"class"===e||e.startsWith("data-v-")||e.startsWith("data-jsv")||e.startsWith("dataJsv")?E.Dom.SetElementAttribute(this.jsvNativeId,e,t):"id"===e&&E.Dom.SetForgeViewInnerProps(this.jsvNativeId,"data-jsv-vw-id",t)))}removeAttribute(e){delete this.jsvAttrStore[e],("class"==e||e.startsWith("data-v-")||"src"==e)&&this.jsvNativeId&&E.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 n(n.JsvType.Blur);t.target=e,document.dispatchEvent(t)}let t=new n(n.JsvType.Focus);document.dispatchEvent(t)}jsvGetBoundingClientRect(){const e="jsv-getbound",t=x.GenerateId();return new Promise(((s,i)=>{const n=o=>{const r=o.jsvParams?.[1];if(r!=t)return;o.preventDefault(),this.removeEventListener(e,n);const a=JSON.parse(o.jsvParams?.[0]??"{}");0===a.status?s(a.data):i(a.error)};this.addEventListener(e,n,{jsvtoken:t})}))}jsvSetOnLazyTaskSyncedListener(e){E.Dom.AppendLazyTaskSyncedListener(this.jsvNativeId,e)}jsvOnEvent(e,...n){let o;e.startsWith("animation")?(o=new s(e),o.animationName=n[0]):e.startsWith("transition")?(o=new P(e),o.propertyName=n[0]):e.startsWith("jsv")?(o=new i(e),o.options={detail:n[0]},o.jsvParams=n):"click"==e&&(o=new t(e),o.target=this),o&&(o.target=this,this.dispatchEvent(o))}jsvGetProxyView(e){return e?(this.maskViewProxy||(this.maskViewProxy=T.NewDomProxyView(this.jsvNativeId,!0)),this.maskViewProxy):(this.mainViewProxy||(this.mainViewProxy=T.NewDomProxyView(this.jsvNativeId,!1)),this.mainViewProxy)}jsvGetProxyTexture(e){return this.mainViewTextureProxy||(this.mainViewTextureProxy=e.GetDomProxyTexture(this.jsvNativeId)),this.mainViewTextureProxy}jsvGetRelativePosition(e){return E.Dom.GetRelativePosition(this.jsvNativeId,e.jsvNativeId)}jsvAddListener(e,t){let s=L.JsvEventListenerMap.get(e);s||(s=new Map,L.JsvEventListenerMap.set(e,s));this.jsvGetEventListenerSet(t)||s.set(t,this.jsvOnEvent.bind(this))}jsvRemoveListener(e,t){let s=L.JsvEventListenerMap.get(e);if(!s)return;this.jsvGetEventListenerSet(t)||s.delete(t)}moveChildNode(e,t){console.log("Do move child node");let s=e.parentNode;s.jsvMoveChildToNewParent(e,this,t),this.jsvMoveChildNode(s,e,t)}jsvMoveChildNode(e,t,s){t.jsvNativeId&&(s=L.JsvFindBackwardForgeView(s),E.Dom.MoveElementChild(this.jsvNativeId,e.jsvNativeId,t.jsvNativeId,s?.jsvNativeId))}jsvReOrderChildNode(e,t){e.jsvNativeId&&(t=L.JsvFindBackwardForgeView(t),E.Dom.ReOrderElementChild(this.jsvNativeId,e.jsvNativeId,t?.jsvNativeId))}jsvInsertChild(e,t){e.parentNode=this,e.nodeType===S.TEXT_NODE?this.textContent=e.nodeValue:e instanceof L&&e.jsvNativeId>0&&(t=L.JsvFindBackwardForgeView(t),E.Dom.InsertElementChild(this.jsvNativeId,e.jsvNativeId,t?.jsvNativeId))}jsvRemoveChild(e){if(e instanceof L!=0){for(const t of e.childNodes)e.jsvRemoveChild(t);e.jsvFinalize(),E.Dom.RemoveLazyTaskSyncedListener(e.jsvNativeId),L.JsvEventListenerMap.delete(e.jsvNativeId)}}jsvCheckEventOptions(e){if(null==e)return null;if("object"!=typeof e||e instanceof Array)return console.warn("Event options is invalid for ",e),null;const t=["capture","once","passive","signal"];for(const[s,i]of Object.entries(e))0==t.includes(s)&&0==s.startsWith("jsv")&&(console.warn("Event options name is invalid: ",s),delete e[s]),"boolean"==typeof i?e[s]=+e[s]:"number"!=typeof i&&(console.warn("Event options value is invalid: ",i),delete e[s]);return e}static JsvFindBackwardForgeView(e){let t=e;for(;t&&!(t instanceof L);)t=t.nextSibling;return t}}L.JsvTagName={Anchor:"A",Audio:"AUDIO",Div:"DIV",Head:"HEAD",Image:"IMG",IFrame:"IFRAME",Link:"LINK",Script:"SCRIPT",Style:"STYLE",Svg:"SVG",Video:"VIDEO",JsvAudioTrack:"JSV-AUDIOTRACK",JsvFDiv:"FDIV"},L.JsvEventListenerMap=new Map;class k extends L{constructor(){super(L.JsvTagName.Anchor),this.href="",this.protocol="",this.host="",this.search="",this.hash="",this.hostname="",this.port="",this.pathname="",console.warn("Warnig: <a> is fake in JsView system")}jsvGetTagName(){return L.JsvTagName.Anchor}}class R extends S{constructor(e){super(S.COMMENT_NODE),this.textContent=e}}class M extends L{constructor(){super(L.JsvTagName.Div),this.textContentStore=null}get textContent(){return this.textContentStore}set textContent(e){this.textContentStore=e,this.jsvClientSizeStore={},E.Dom.SetElementText(this.jsvNativeId,e)}}const j="FocusDebug",_="__AppRoot__";let O=!1,J=!1;function B(e,t){let s=function(e){let t="";if(e){let s=e,i=s.RouterDelegate?.ref?.NameSpace;for(i=i==_?"":i,t=`[${i?i+", ":""}${s.BranchName}]`,s=s.GetParentPage();s;)i=s.RouterDelegate?.ref?.NameSpace,i=i==_?"":i,t=`[${i?i+", ":""}${s.BranchName}]->`+t,s=s.GetParentPage()}return t}(e);if(t.stack){let e=t.stack.split("\n");e.length>=3&&(t.stack=e.slice(2,6))}let i="";for(let e of t.stack)i+=e+"\n";delete t.stack,console.log(j,`focusChange(${t?.from}):${t?.askName}\n:focusStack:${s}\n:trace:${i}:`,t)}class A{constructor(e,t){this._DefaultFocusNameSpace=null,this._DefaultFocusNameSpace=null,this.RouterDelegate={ref:null},e||(this.RouterDelegate.ref=new V(!1,t))}enableFocusTrace(e){O=!0,J=e}getNameSpace(){let e=this.RouterDelegate.ref.NameSpace;return e==_?"":e}wrapWithNameSpace(e){let t=new A(!0);return t._DefaultFocusNameSpace=e,t.RouterDelegate=this.RouterDelegate,t}getNodeByName(e){return this.RouterDelegate.ref.getNodeByName(e)}focusByNameBeforeMount(e,t,s){if("string"==typeof e)return e.includes(".")&&(e=e.split(".")),this.RouterDelegate.ref.focusBeforeMount(e,t,s);console.error(`setFocus name=${e} is invalid`)}setFocus(e,t){this._DefaultFocusNameSpace&&this._DefaultFocusNameSpace.length>0&&(e=`${this._DefaultFocusNameSpace}.${e}`);let s=null;O&&(s={askName:e,deepToChild:t,from:"setFocus",stack:J?new Error("simulate-stack").stack:null});return this.focusByNameBeforeMount(e,t,s)}printAllFocusable(){this.RouterDelegate.ref.printAllFocusRecursive(this._DefaultFocusNameSpace,"")}getCurrentFocusStack(){const e=[];if(this.RouterDelegate.ref){let t=this.RouterDelegate.ref.getCurrentFocusNode();for(;t&&t instanceof W;){let s=t.RouterDelegate?.ref?.NameSpace;e.push({nameSpace:s==_||s==t.BranchName?"":s,name:t.BranchName}),t=t.GetParentPage()}}else console.error("getCurrentFocusStack failed: router delegate is null.");return e}getLastFocus(){if(W.sLastFocus){let e=W.sLastFocus;for(;e._LatestFocusChild;)e=e._LatestFocusChild;return e.BranchName}return null}getCurrentFocus(){if(this.RouterDelegate.ref){const e=this.RouterDelegate.ref.getCurrentFocusNode();if(e)return e.BranchName}return null}getDeactivedPageFocus(){return this.RouterDelegate.ref?this.RouterDelegate.ref.getDeactivePageFocusName():null}returnFocusToParent(){const e=this.RouterDelegate.ref.getCurrentFocusNode();e?e.ReturnFocusToParent():console.warn("returnFocusToParent: current focus node is null.")}}class V{constructor(e,t){this._ChildMap={},this._FocusNameBeforeMount=null,this._BeforeMountStack=null,this._FocusNodeName=null,this._IsTemp=!!e,this.NameSpace=t}getDeactivePageFocusName(){return this._FocusNodeName}getCurrentFocusNode(){if(null==this._FocusNodeName)return null;let e=this._ChildMap[this._FocusNodeName];if(!e)return console.error("Erorr: node not mounted name="+this._FocusNodeName),null;if(e.RouterDelegate.ref!=this){let t=e.RouterDelegate.ref.getCurrentFocusNode();return null==t?e:t}return e}getNodeByName(e,t){let s=e.split(".");return this._FindRouterSearchBase(s,t)._GetNodeFromPathArray(s,e)}printAllFocusRecursive(e,t){let s=this.NameSpace==_?"":this.NameSpace,i=t+(t&&t.length>0?".":"")+s;for(let t in this._ChildMap){let s=this._ChildMap[t];if(!e||0==e.length||i.indexOf(e)>=0){let e=i===_?t:i+"."+t;console.log(e,s)}s.RouterDelegate.ref!=this&&s.RouterDelegate.ref.printAllFocusRecursive(e,i)}}_FindRouterSearchBase(e,t){if(0==e[0].length){let t,s;for(let e in this._ChildMap){t=this._ChildMap[e];break}do{s=t,t=t.GetParentPage()}while(null!=t);return e.splice(0,1),s.RouterDelegate.ref}return t&&t.AsHub&&t.GetParentPage()?t.GetParentPage().RouterDelegate.ref:this}_GetNodeFromPathArray(e,t){let s=0,i=this;for(;s<e.length-1;){let n=!1;for(let t in i._ChildMap){let o=i._ChildMap[t].RouterDelegate.ref;if(o!=i&&o.NameSpace==e[s]){i=o,s++,n=!0;break}}if(!n)return void console.error(`Error: no found subpath fname=${t}`)}let n=e[s];return i._ChildMap.hasOwnProperty(n)?i._ChildMap[n]:void console.error(`Error: no found fname=${t}`)}add(e,t){if(e.indexOf(".")>=0)console.error("ERROR: FDiv name can not contains '.'");else if(this._ChildMap.hasOwnProperty(e)&&this._ChildMap[e]!==t)console.error(`ERROR: FDiv router branch name duplicated:[${e}]`);else if(this._ChildMap[e]=t,this._FocusNameBeforeMount)if("string"==typeof this._FocusNameBeforeMount)this._FocusNameBeforeMount==e&&t.RouterDelegate.ref.focusBeforeMount(this._FocusNameBeforeMount,!1,this._BeforeMountStack);else{this._FocusNameBeforeMount[0]==e&&t.RouterDelegate.ref.focusBeforeMount(this._FocusNameBeforeMount.slice(1),!1,this._BeforeMountStack)}}remove(e,t,s,i){let n=this._ChildMap[e];n&&n==t&&(delete this._ChildMap[e],n.OnRemoveFromTree()),this._FocusNodeName==e&&s&&(i||(this._FocusNodeName=s))}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)}clearChildFocus(){this._FocusNodeName=null,this._FocusNameBeforeMount=null}hasPendingFocusRequest(){return!this._FocusNameBeforeMount}focusBeforeMount(e,t,s){O&&!s&&console.error(j,`Error: found debug info missing from ${new Error("simulate-stack").stack}`);let i=!1;if("string"==typeof e){if(!e.includes(".")){i=!0;let n=this._ChildMap[e];if(this._FocusNodeName=e,n){this._FocusNameBeforeMount=null,this._BeforeMountStack=s,n.Focus(!t);let e=n.GetFocusChild();for(;e;){let t=e.GetFocusChild();if(!t){this._FocusNodeName=e.BranchName;break}e=t}return O&&B(e??n,s),n.RouterDelegate.ref!=this&&n.RouterDelegate.ref.clearChildFocus(),!0}return this._FocusNameBeforeMount=e,this._BeforeMountStack=s,!1}console.error("error: name contain .")}else if("object"==typeof e&&Array.isArray(e)&&e.length>0){if(i=!0,1==e.length)return this.focusBeforeMount(e[0],t,s);{let i=e[0],n=this._ChildMap[i];return this._FocusNodeName=i,n?n.RouterDelegate.ref.focusBeforeMount(e.slice(1),t,s):(this._FocusNameBeforeMount=e,this._BeforeMountStack=s,!1)}}return i||console.error("illegal name param",e),!1}focus(e,t,s){let i=this.focusBeforeMount(e,t,s);return i||console.log("No found branch:"+e),i}forEach(e){for(let t in this._ChildMap)e(this._ChildMap[t],t,this._ChildMap)}printNodes(){console.log(this._ChildMap)}}class W extends T.PageBase{constructor(e){super(e),this._OnKeyDown=null,this._OnKeyUp=null,this._OnFocus=null,this._OnBlur=null,this._DispatchKeyDown=null,this._DispatchKeyUp=null,this._OnCustomEvent=null,this._DKeyDownProxy=void 0,this._DKeyUpProxy=void 0,this._Mounted=!1,this._MountWaitingList=null,this.AsHub=!1,this.InterfaceHub=null,this._TmpRouter=null,this._AutoShow=null,this.BranchName=e,this.RouterDelegate={ref:null},this._TmpRouter=null,this._OriginDispatchKeyDown=this._OriginDispatchKeyDown.bind(this),this._OriginDispatchKeyUp=this._OriginDispatchKeyUp.bind(this),this._AutoShow=!1}async waitMounted(){if(this._Mounted)return;let e=this;return new Promise(((t,s)=>{e._MountWaitingList||(e._MountWaitingList=[]),e._MountWaitingList.push(t)}))}updateMountState(){this._Mounted=!0;let e=this.SubPages;for(let t in e)e[t].updateMountState();if(this._MountWaitingList&&this._MountWaitingList.length>0){for(const e of this._MountWaitingList)e();this._MountWaitingList=null}}getHub(){return this.InterfaceHub||(this.InterfaceHub=new A(!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 V(!0)),this.RouterDelegate.ref.add(e,t)}routerRenameChild(e,t){this.RouterDelegate.ref.rename(e,t)}routerUnbind(e,t){let s;this.AsHub?this.GetParentPage()&&(s=this.GetParentPage().RouterDelegate.ref):s=this.RouterDelegate.ref,s&&s.remove(this.BranchName,this,e,t),this.RouterDelegate={ref:null}}setBranchName(e){if(e===this.BranchName)return;let t=this.BranchName;this.BranchName=e,this.PageName=e,this._ParentPage&&this._ParentPage.routerRenameChild(t,e)}static safeCallback(e){return e&&e instanceof Function?function(...t){try{return e(...t)}catch(t){console.error("FocusNode: callback error",e.name,t)}}:null}setOnKeyDown(e){this._OnKeyDown=W.safeCallback(e)}setOnKeyUp(e){this._OnKeyUp=W.safeCallback(e)}setOnFocus(e){this._OnFocus=W.safeCallback(e)}setOnBlur(e){this._OnBlur=W.safeCallback(e)}setDispatchKeyUp(e){this._DispatchKeyUp=W.safeCallback(e)}setDispatchKeyDown(e){this._DispatchKeyDown=W.safeCallback(e)}setOnCustomEvent(e){this._OnCustomEvent=W.safeCallback(e)}setDispatchKeyProxy(e,t){this._DKeyDownProxy=W.safeCallback(e),this._DKeyUpProxy=W.safeCallback(t)}requestFocus(e){let t=null;O&&(t={askName:this.BranchName,deepToChild:e,from:"requestFocus",stack:J?new Error("simulate-stack").stack:null}),this.requestFocusInner(e,t)}ReturnFocusToParent(){if(this.IsFocus()){let e=this.GetParentPage();if(e){const t=e.BranchName;let s=null;O&&(s={askName:t,deepToChild:!1,from:"returnFocusToParent",stack:J?new Error("simulate-stack").stack:null}),e.RouterDelegate.ref.focus(t,!1,s)}}else super.ReturnFocusToParent()}requestFocusInner(e,t){let s=this.RouterDelegate.ref;return this.AsHub&&this.GetParentPage()&&(s=this.GetParentPage().RouterDelegate.ref),s?s.focus(this.BranchName,e,t):(console.error("error: lost router"),!1)}OnKeyDown(e){return!!this._OnKeyDown&&this._OnKeyDown(e)}OnKeyUp(e){return!!this._OnKeyUp&&this._OnKeyUp(e)}OnCustomEvent(e){return!!this._OnCustomEvent&&this._OnCustomEvent(e)}bubbleCustomEvent(e){this.BubbleCustomEvent(e)}dispatchKeyDown(e){return this.DispatchKeyDown(e)}DispatchKeyDown(e){return 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(),z()),e instanceof W)){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 W.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(){W.sLastFocus=this,this._OnBlur&&this._OnBlur()}onUnMount(e){W.sLastFocus==this&&(W.sLastFocus=null);let t=this.IsFocus();if(O&&t){let t=this.GetParentPage();if(t){let s=null;s={askName:t.BranchName,deepToChild:!1,from:e?"deactive":"unmount",stack:J?new Error("simulate-stack").stack:null},B(t,s)}}let s=this.GetParentPage();s&&s.RemoveSubPage(this),this.ClearSubPages(),this.routerUnbind(s?.BranchName,e),this._Mounted=!1}getFullName(){let e=this,t=[this.RouterDelegate.ref.NameSpace];this.AsHub||t.push(this.BranchName);let s=this.RouterDelegate.ref;do{if(e=e.GetParentPage(),t[0]==_)break;e&&e.RouterDelegate.ref!=s&&(s=e.RouterDelegate.ref,t.unshift(s.NameSpace))}while(e);return t[0]==_?t.shift():console.error("ERROR: missing app root"),t.join(".")}getNodeByName(e){return this.RouterDelegate.ref.getNodeByName(e,this)}}W.sFocusMemos=[],W.sLastFocus=null,W.sRootPageNode=null;let z=()=>{let e=W.sFocusMemos.length;if(e>0){let t=W.sFocusMemos;W.sFocusMemos=[];for(let s=0;s<e;s++)t[s].obj.Focus(t[s].bcf)}},G={};class K{constructor(e,t,s){this._Element=s,G.hasOwnProperty(e)&&console.error(`Warn: FDivRoot duplicate name=${e}`),G[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(window.JsvCode.ForgeHandles.RootActivity,window.JsvCode.ForgeHandles.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(),z()}}class U extends L{constructor(){super(L.JsvTagName.Image)}setAttribute(e,t){if("src"===e){t=new N(t).href,this.jsvClientSizeStore={}}super.setAttribute(e,t),this.jsvNativeId&&"src"===e&&E.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 H extends L{constructor(){super(L.JsvTagName.Link)}setAttribute(e,t){this[e]=t}jsvLoadResource(){let e=!1,t=null;if(null!=this.href){var s=new N(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 $ extends L{constructor(){super(L.JsvTagName.Script)}setAttribute(e,t){this[e]=t}jsvLoadResource(){if(null!=this.src){var e=new N(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})}}class q extends L{constructor(){super(L.JsvTagName.Style),this.jsvAttrStore={left:0,top:0,width:0,height:0}}}class X extends L{constructor(){super(L.JsvTagName.Svg)}}class Y extends S{constructor(e){super(S.TEXT_NODE),this.textContent=e}get nodeValue(){return this.textContent}set nodeValue(e){this.textContent=e,this.parentNode&&(this.parentNode.textContent=this.textContent)}}let Z=1;class Q extends L{constructor(){super(L.JsvTagName.JsvFDiv),this.FocusNodeRef=new W("unnamed-"+Z++),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 A(!1,t);this.hubRef=e,this.FocusNodeRef.setHub(e),this.FocusNodeRef.setBranchName(t)}}removeAttribute(e){}jsvGetHub(){return this.hubRef}}class ee extends S{constructor(){super(S.DOCUMENT_NODE),this.location=window.location,this.rootElement=new M,this.rootElement.ownerDocument=this,this.rootElement.id="root",E.Dom.BindElementToRootView(this.rootElement.jsvNativeId),this.activeElement=this.rootElement,this.head=null}createComment(e){return new R(e)}createElement(e){switch(e=e.toUpperCase()){case L.JsvTagName.Anchor:return new k;case L.JsvTagName.Div:return new M;case L.JsvTagName.Image:return new U;case L.JsvTagName.Link:return new H;case L.JsvTagName.Script:return new $;case L.JsvTagName.Style:return new q;case L.JsvTagName.Svg:return new X;case L.JsvTagName.JsvFDiv:return new Q;case L.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"CUSTOMEVENT"===(e=e.toUpperCase())?new i(e):new t(e)}createTextNode(e){return new Y(e)}getElementById(e){if("root"===e||"app"===e)return this.rootElement;throw new DOMException("Failed to get element by id, id="+e+" is UNIMPLEMENTED.")}getElementsByTagName(e){if((e=e.toUpperCase())===L.JsvTagName.Head)return[this.head];if(e===L.JsvTagName.Link||e===L.JsvTagName.Script||e===L.JsvTagName.Style)return[];throw new DOMException("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("title"===e)return null;if(e.startsWith("style[")&&e.endsWith("]"))return null;throw new DOMException("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 K(e,t,s)}}class te extends L{constructor(){super(L.JsvTagName.Head)}appendChild(e){super.appendChild(e),(e instanceof H||e instanceof $)&&e.jsvLoadResource()}removeChild(e){super.removeChild(e)}}class se{constructor(){this.ready=!1,this.callbacks=[]}listenToReady(e){this.ready?e?.():this.callbacks.push(e)}dataReady(){this.ready=!0;for(let e of this.callbacks)e?.()}}class ie extends se{constructor(){super(),this.TextureManager=null,this.RootActivity=null,this.RootView=null}setHandles(e,t,s){this.TextureManager=e,this.RootActivity=s,this.RootView=t,this.dataReady()}}let ne="@keyframes";class oe{constructor(e){this._AnchorTag=e,this._NamesCache=new Set}insertRule(e){let t=this.getName(e);this._NamesCache.has(t)&&console.warn(`Warn: keyframe replace of name ${t}`),this._NamesCache.add(t),E.Dom.InsertKeyFrame(t,e)}hasRule(e){return this._NamesCache.has(e)}removeRule(e){this._NamesCache.has(e)?(this._NamesCache.delete(e),E.Dom.RemoveKeyFrame(e)):console.error(`Error: keyFrame(${e}) is not exist.`)}removeMultiRules(e){for(let t of e)this.removeRule(t)}getName(e){let t=e.indexOf(ne)+10,s=e.indexOf("{");return e.substring(t,s).trim()}}let re=null;function ae(e){return re||(re={global:new oe("global")}),re.global}class le{static EnsureGlobalEnv(e,t){const s=window.navigator?.userAgent?.toLowerCase();window.jsvInAndroidWebView=s?.indexOf("android")>=0,le.EnsureGlobalJsvCode(e,t),L.JsvEnableEventListener(),F.JsvDeclarePrototype()}static EnsureGlobalJsvCode(e,t){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=E.Dom.DeclareStyleSheets),window.JsvCode.Dom.UndeclareStyleSheets||(window.JsvCode.Dom.UndeclareStyleSheets=E.Dom.UndeclareStyleSheets),window.JsvCode.Dom.getKeyFrameGroup||(window.JsvCode.Dom.getKeyFrameGroup=ae),window.JsvCode.ForgeHandles||(window.JsvCode.ForgeHandles=new ie)}}class he{static SetLevel(e){switch(he.E=he.W=he.I=he.D=function(){},e){case he.Level.Verbose:he.V=console.debug.bind(console);case he.Level.Debug:he.D=console.debug.bind(console);case he.Level.Info:he.I=console.info.bind(console)}}}he.E=console.error.bind(console),he.W=console.warn.bind(console),he.I=console.info.bind(console),he.D=function(){},he.V=function(){},he.Level={Error:0,Warning:1,Info:2,Debug:3,Verbose:4};class ce{constructor(e){this.callback=e}observe(e,t){if(!(e instanceof S))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 de extends ee{constructor(){super(),this.head=new te}set cookie(e){window.__JsvCookies.setCookie(e)}get cookie(){return window.__JsvCookies.getCookie()}}class ue{static DeclareGlobal(){ue.DeclareDocument(),ue.DeclareOthers(),ue.DeclareAddition()}static DeclareDocument(){window.document=new de}static DeclareOthers(){window.MutationObserver=ce,window.Element=L,window.SVGElement=X;let e=new N(window.JsView.getAppUrl(),!0);window.location.applyUrlInfo?window.location.applyUrlInfo(e):window.location=e,window.history={},window.navigator={userAgent:"jsview-runtime"}}static DeclareAddition(){window.JsView.Dom={Render:null,Extension:null,UrlRef:N}}}class ve{constructor(e){this.activity=new T.ReactActivity("NativeForgeActivity",e,null,null),this.init()}init(){console.log("create NativeForgeActivity.");let e=new T.LayoutView;window.JsvCode.ForgeHandles.setHandles(this.activity.GetTextureManager(),e,this.activity);let t=null;T.DesignMap&&(t=T.DesignMap());let s=t?t.width:1280,i=Math.floor(9*s/16);this.activity.SetContentView(e,{x:0,y:0,width:s,height:i}),T.sRenderBridge.AddWillSwapListener("forgeSwap",(()=>{E.Dom.RequestSwapAllCachedTasks()})),window.JsView.Dom.Render()}}class me{constructor(e){this.activityManager=e;let t=new ve(e);e.RegisterActivity(t.activity),e.StartActivity(new T.Intent("NativeForgeActivity"))}}window.jsvIsBrowserDebug=!1;const fe=window.JsvCode.NativePlatformDomBridge,pe=window.JsvCode.NativePlatformMediaBridge;function ge(){le.EnsureGlobalEnv(fe,pe),ue.DeclareGlobal(),he.I("Using JsView Native Environment.")}export{ge as InitEnv,me as NativeForgeApp};
2
2