@shijiu/jsview 2.1.200 → 2.1.340-test.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dom/bin/jsview-dom-browser.min.js +1 -1
- package/dom/bin/jsview-dom-native.min.js +1 -1
- package/dom/bin/jsview-engine-js-browser.min.js +1 -1
- package/dom/bin/jsview-forge-define.min.js +1 -1
- package/dom/index.mjs +3 -6
- package/dom/target_core_revision.mjs +5 -5
- package/package.json +1 -1
- package/patches/node_modules/@vitejs/plugin-vue/dist/index.mjs +337 -123
- package/patches/node_modules/@vitejs/plugin-vue/package.json +16 -18
- package/patches/node_modules/@vue/compiler-sfc/dist/jsview-css-to-js.js +8 -2
- package/patches/node_modules/@vue/compiler-sfc/dist/jsview-style-checker.js +4 -4
- package/patches/node_modules/@vue/compiler-sfc/dist/jsview-style-formator.cjs.js +5 -0
- package/patches/node_modules/@vue/runtime-core/dist/runtime-core.esm-bundler.js +21 -1
- package/patches/node_modules/vite/dist/node/chunks/{dep-ed9cb113.js → dep-V3BH7oO1.js} +48169 -42865
- package/patches/node_modules/vite/dist/node/constants.js +7 -1
- package/patches/node_modules/vite/dist/node/jsview-vite-extension.js +19 -8
- package/patches/node_modules/vite/package.json +86 -64
- package/tools/jsview-logger.js +3 -1
- package/tsconfig.json +0 -34
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/* eslint-disable */ class e{static CreateAudioPlayer(){return new window.Audio}static CreateVideoPlayer(){const t=window.originDocument.createElement("video");return t.jsvOnCssStyleChanged=e.OnCssStyleChanged.bind(t),t.jsvFinalize=e.JsvFinalize.bind(t),t}static OnCssStyleChanged(e,t){const s=this;s.parentNode,s.style.position="fixed",s.style.left=(t.left?t.left:0)+"px",s.style.top=(t.top?t.top:0)+"px",s.style.width=(t.width?t.width:0)+"px",s.style.height=(t.height?t.height:0)+"px",s.style.objectFit=t.objectFit,s.style.visibility=t.visibility}static JsvFinalize(){console.log("BrowserPlatformMediaBridge.JsvFinalize()");this.pause()}}window.JsvCode.BrowserPlatformMediaBridge||(window.JsvCode.BrowserPlatformMediaBridge=e);class t{constructor(e,t){this.target=t,this.timeStamp=Date.now(),this.type=e}preventDefault(){this.#e=!0}jsvIsPrevented(){return this.#e}#e=!1}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}options}class o extends t{constructor(e){super(e)}}void 0===window.Forge?(window.Forge={},console.log("Define forge browser")):console.log("Define using JsView forge engine-js");var r=window.Forge;class n{constructor(e,t){if(!e)return;if(!0===e.startsWith("url")){let t=e.indexOf("(")+1,s=e.lastIndexOf(")");if("undefined"===(e=e.substring(t,s).trim())||"null"===e||0===e.length)return}if(!0===e.startsWith("data:")||!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,o=i.indexOf("#");o>0&&(this.hash=i.substring(o),i=i.substring(0,o));let r=i.indexOf("?");r>1&&(this.search=i.substring(r),i=i.substring(0,r));let n=i,a=n.indexOf("://");this.protocol=a>0?n.substring(0,a+1):"";let l=a>1?n.substring(a+3):"";a=l.indexOf("/"),this.host=a>0?l.substring(0,a):"",this.pathname=a>=1?l.substring(a):"","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}href="";origin="";protocol="";host="";hostname="";port="";pathname="";search="";hash=""}class a{static EnableEventListener(e){const t=window.JsvCode.Dom.PlatformBridge.JsViewId;window.JsvCode.Dom.PlatformBridge.SetOnEventListener(t,e)}static CreateElement(e,t){a.#t(a.#s.CreateElement,e,t)}static BindElementToRootView(e){a.#t(a.#s.BindElementToRootView,e)}static InsertElementChild(e,t,s){a.#t(a.#s.InsertElementChild,e,t,s)}static RemoveElementChild(e,t){a.#t(a.#s.RemoveElementChild,e,t)}static MoveElementChild(e,t,s,i){a.#t(a.#s.MoveElementChild,e,t,s,i)}static ReOrderElementChild(e,t,s){a.#t(a.#s.ReOrderElementChild,e,t,s)}static AddElementEventListener(e,t,s){a.#t(a.#s.AddElementEventListener,e,t,s)}static RemoveElementEventListener(e,t,s){a.#t(a.#s.RemoveElementEventListener,e,t,s)}static SetElementText(e,t){a.#t(a.#s.SetElementText,e,t)}static SetElementAttribute(e,t,s){a.#t(a.#s.SetElementAttribute,e,t,s),a.#i.has(e)&&a.#o.add(e)}static GetElementBoundingClientStyles(e,t){return a.#r(a.#s.GetElementBoundingClientStyles,e,t)}static SetForgeViewInnerProps(e,t,s){let i=0;(t=t.substr(12)).startsWith("mask-")&&(i=1,t=t.substr(5)),a.#t(a.#s.SetForgeViewInnerProps,e,t,i,""+s)}static DeclareStyleSheets(e){a.#t(a.#s.DeclareStyleSheets,-1,e)}static UndeclareStyleSheets(e){a.#t(a.#s.UndeclareStyleSheets,-1,e)}static SetStyleProperty(e,t,s){a.#t(a.#s.SetStyleProperty,e,t,s),a.#i.has(e)&&a.#o.add(e)}static GetStyleProperties(e,t){return a.#r(a.#s.GetStyleProperties,e,t)}static AppendLazyTaskSyncedListener(e,t){a.#i.set(e,t)}static RemoveLazyTaskSyncedListener(e){a.#i.delete(e)}static RequestSwapAllCachedTasks(){if(0==a.#n.length)return;const e=JSON.stringify(a.#n);a.#n=[];const t=window.JsvCode.Dom.PlatformBridge.JsViewId;window.JsvCode.Dom.PlatformBridge.RunLazyTaskList(t,e);for(const e of a.#o){const t=a.#i.get(e);t?.()}a.#o.clear()}static GetElementAttribute(e,t){return a.#r(a.#s.GetElementAttribute,e,t)}static InsertKeyFrame(e,t){a.#t(a.#s.InsertKeyFrameDefine,-1,e,t)}static RemoveKeyFrame(e){a.#t(a.#s.RemoveKeyFrameDefine,-1,e)}static GetRelativePosition(e,t){const s=a.#r(a.#s.GetRelativePosition,e,t);return JSON.parse(s)}static#r(e,t,...s){a.RequestSwapAllCachedTasks();const i=window.JsvCode.Dom.PlatformBridge.JsViewId;return window.JsvCode.Dom.PlatformBridge.RunSyncTask(i,e,t,...s)}static#t(e,t,...s){a.#n.push([e,t,...s]),r.sRenderBridge?.RequestSwap()}static#n=[];static#o=new Set;static#i=new Map;static#s={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 l{static CreateAudioPlayer(e){return window.JsvCode.Media.PlatformBridge.CreateAudioPlayer(e)}static CreateVideoPlayer(){return window.JsvCode.Media.PlatformBridge.CreateVideoPlayer()}}class c{static Dom=a;static Media=l}class d{static GenerateId(){const e=this.#a++;if(e>=this.#l)throw new Error("JsvUniqueId.GenerateId() Failed to create unique id. id is overflow.");return e}static#a=0;static#l=Math.pow(2,31)-1}class h{constructor(e){this.ownerDocument=window.document,this.nodeType=e,this.parentNode=void 0,this.childNodes=[]}jsvFinalize(){}appendChild(e){this.childNodes.push(e),e.parentNode=this,this.#c?.()}removeChild(e){let t=this.childNodes.indexOf(e);if(t<0)throw new DOMError("Failed to remove node, child node is not found. node=",e);this.childNodes.splice(t,1),e.parentNode=void 0,this.#c?.()}insertBefore(e,t){this.#d(e,t)}get previousSibling(){const e=this.parentNode.childNodes;let t=e.indexOf(this);if(t<0)throw new DOMError("Failed to call Node.previousSibling(), this node not found. this=",this);return e[t-1]}get nextSibling(){const e=this.parentNode.childNodes;let t=e.indexOf(this);if(t<0)throw new DOMError("Failed to call Node.nextSibling(), this node not found. this=",this);return e[t+1]}addEventListener(e,t,s){this.#h||(this.#h={});let i=this.#h[e];i||(i=new Set,this.#h[e]=i),i.add(t)}removeEventListener(e,t,s){let i=this.#h?.[e];i&&(i.delete(t),i.size<=0&&this.#h.hasOwnProperty(e)&&delete this.#h[e],0===Object.values(this.#h).length&&(this.#h=void 0))}dispatchEvent(e){if(!this.#h)return void console.warn("Node.dispatchEvent() Ignore to dispatch event: "+e.type+". No event added.");let t=this.#h[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.#c=e}jsvMoveChildReOrder(e,t){{let t=this.childNodes.indexOf(e);t<0&&Log.Throw("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 DOMError("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);i<0&&Log.Throw("Failed to call jsvMoveChildToNewParent, node not found. node=",e),this.childNodes.splice(i,1),e.parentNode=void 0,this.jsvChildChangedCallback?.(),t.#d(e,s)}jsvGetEventListenerSet(e){const t=this.#h?.[e];return t}#d(e,t){let s=this.childNodes.length;if(void 0===t)throw new DOMError("TypeError: Failed to execute 'insertBefore' on 'Node': 2 arguments required, but only 1 present.");if(null!==t&&(s=this.childNodes.indexOf(t)),s<0)throw new DOMError("Failed to call insert node, before node not found. beforeNode=",t);this.childNodes.splice(s,0,e),e.parentNode=this,this.#c?.()}#h=void 0;#c=void 0;static ELEMENT_NODE=1;static TEXT_NODE=3;static COMMENT_NODE=8;static DOCUMENT_NODE=9;static NOLAYOUT_NODE=10}class u{static Layout=class{static Height="height";static Left="left";static Top="top";static Width="width";constructor(){throw new Error("new StyleName.Layout() is forbidden.")}};static Background=class{static BackgroundColor="backgroundColor";static BackgroundImage="backgroundImage";static BorderRadius="borderRadius";constructor(){throw new Error("new StyleName.Background() is forbidden.")}};static Effect=class{static BackfaceVisibility="backfaceVisibility";static BorderImage="borderImage";static BorderImageWidth="borderImageWidth";static BorderImageOutset="borderImageOutset";static Display="display";static ObjectFit="objectFit";static Opacity="opacity";static Overflow="overflow";static Perspective="perspective";static PerspectiveOrigin="perspectiveOrigin";static Transform="transform";static TransformOrigin="transformOrigin";static TransformStyle="transformStyle";static Visibility="visibility";static ZIndex="zIndex";constructor(){throw new Error("new StyleName.Effect() is forbidden.")}};static Text=class{static Color="color";static FontFamily="fontFamily";static FontSize="fontSize";static FontStyle="fontStyle";static FontWeight="fontWeight";static LineHeight="lineHeight";static TextAlign="textAlign";static TextOverflow="textOverflow";static TextShadow="textShadow";static WebkitTextStroke="WebkitTextStroke";static WhiteSpace="whiteSpace";static WordWrap="wordWrap";static Direction="direction";static JsvTextEmoji="JsvTextEmoji";static JsvTextLatex="JsvTextLatex";static JsvTextAlignMinWidth="JsvTextAlignMinWidth";static JsvTextVerticalAlign="JsvTextVerticalAlign";static JsvTextLineAlign="JsvTextLineAlign";static JsvTextInnerDirection="JsvTextInnerDirection";constructor(){throw new Error("new StyleName.Text() is forbidden.")}};static Motion=class{static Animation="animation";static Transition="transition";static AnimationFillMode="animationFillMode";constructor(){throw new Error("new StyleName.Motion() is forbidden.")}};static HasGetterMethod(e){switch(e){case u.Layout.Height:case u.Layout.Left:case u.Layout.Top:case u.Layout.Width:case u.Effect.ObjectFit:return!0;default:return!1}}static ToConst(e){return e==u.Layout.Height?u.Layout.Height:e==u.Layout.Left?u.Layout.Left:e==u.Layout.Top?u.Layout.Top:e==u.Layout.Width?u.Layout.Width:e==u.Background.BackgroundColor?u.Background.BackgroundColor:e==u.Background.BackgroundImage?u.Background.BackgroundImage:e==u.Background.BorderRadius?u.Background.BorderRadius:e==u.Effect.BackfaceVisibility?u.Effect.BackfaceVisibility:e==u.Effect.BorderImage?u.Effect.BorderImage:e==u.Effect.BorderImageWidth?u.Effect.BorderImageWidth:e==u.Effect.BorderImageOutset?u.Effect.BorderImageOutset:e==u.Effect.Display?u.Effect.Display:e==u.Effect.ObjectFit?u.Effect.ObjectFit:e==u.Effect.Opacity?u.Effect.Opacity:e==u.Effect.Overflow?u.Effect.Overflow:e==u.Effect.Perspective?u.Effect.Perspective:e==u.Effect.PerspectiveOrigin?u.Effect.PerspectiveOrigin:e==u.Effect.Transform?u.Effect.Transform:e==u.Effect.TransformOrigin?u.Effect.TransformOrigin:e==u.Effect.TransformStyle?u.Effect.TransformStyle:e==u.Effect.Visibility?u.Effect.Visibility:e==u.Effect.ZIndex?u.Effect.ZIndex:e==u.Text.Color?u.Text.Color:e==u.Text.FontFamily?u.Text.FontFamily:e==u.Text.FontSize?u.Text.FontSize:e==u.Text.FontStyle?u.Text.FontStyle:e==u.Text.FontWeight?u.Text.FontWeight:e==u.Text.LineHeight?u.Text.LineHeight:e==u.Text.TextAlign?u.Text.TextAlign:e==u.Text.TextOverflow?u.Text.TextOverflow:e==u.Text.TextShadow?u.Text.TextShadow:e==u.Text.WebkitTextStroke?u.Text.WebkitTextStroke:e==u.Text.WhiteSpace?u.Text.WhiteSpace:e==u.Text.WordWrap?u.Text.WordWrap:e==u.Text.Direction?u.Text.Direction:e==u.Text.JsvTextEmoji?u.Text.JsvTextEmoji:e==u.Text.JsvTextLatex?u.Text.JsvTextLatex:e==u.Text.JsvTextAlignMinWidth?u.Text.JsvTextAlignMinWidth:e==u.Text.JsvTextVerticalAlign?u.Text.JsvTextVerticalAlign:e==u.Text.JsvTextLineAlign?u.Text.JsvTextLineAlign:e==u.Text.JsvTextInnerDirection?u.Text.JsvTextInnerDirection:e==u.Motion.Animation?u.Motion.Animation:e==u.Motion.Transition?u.Motion.Transition:e==u.Motion.AnimationFillMode?u.Motion.AnimationFillMode:null}constructor(){throw new Error("new StyleName() is forbidden.")}}class m{static Base=class{constructor(e){this.rawValue=e}rawValue};static AnimationImpl=class extends m.Base{constructor(e){super(e)}name="";duration=0;timingFunction=null;delay=0;iterationCount=0;direction=!1};static CornerImpl=class extends m.Base{constructor(e){super(e)}topLeft=0;topRight=0;bottomRight=0;bottomLeft=0};static RectImpl=class extends m.Base{constructor(e){super(e)}top=0;right=0;left=0;bottom=0};static TextShadowImpl=class extends m.Base{constructor(e){super(e)}hShadow=0;vShadow=0;blur=0;color=void 0};static WebkitTextStrokeImpl=class extends m.Base{constructor(e){super(e)}length=0;color=void 0};static TransitionImpl=class extends m.Base{constructor(e){super(e)}animationMap=new Map};static BorderImageImpl=class extends m.Base{constructor(e){super(e)}source="";slice=null};static BackgroundImageImpl=class extends m.Base{constructor(e){super(e)}type=0;static eType={UNKNOWN:0,LINEAR_GRADIENT:1,URL_PATH:2};static LinearGradient=class{fromX=0;fromY=0;toX=0;toY=0;stops=[]};linearGradient;urlPath=""};static DataType=class{static Null=0;static Int32=1;static Float=2;static String=3;static Animation=4;static Corner=5;static Rect=6;static TextShadow=7;static WebkitTextStroke=8;static Transition=9;static BorderImage=10;static BackgroundImage=11};static InvalidInt32=Number.MIN_VALUE;static InvalidFloat=Number.NaN;static InvalidPointer=null;constructor(e){let t=-1,s=null;null==e?t=m.DataType.Null:Number(e)===e&&e%1==0?t=m.DataType.Int32:Number(e)===e&&e%1!=0?t=m.DataType.Float:"string"==typeof e||e instanceof String?t=m.DataType.String:e instanceof m.AnimationImpl?t=m.DataType.Animation:e instanceof m.CornerImpl?t=m.DataType.Corner:e instanceof m.RectImpl?t=m.DataType.Rect:e instanceof m.TextShadowImpl?t=m.DataType.TextShadow:e instanceof m.WebkitTextStrokeImpl?t=m.DataType.WebkitTextStroke:e instanceof m.TransitionImpl?t=m.DataType.Transition:e instanceof m.BorderImageImpl&&(t=m.DataType.BorderImage),e!=m.InvalidInt32&&e!=m.InvalidFloat&&e!=m.InvalidPointer?s=e:(t=m.DataType.Null,s=null),this.data=new m.DataInfo,this.data.index=t,this.data.value=s}toString(){let e=null;switch(this.data.index){case m.DataType.Null:return"";case m.DataType.Int32:case m.DataType.Float:return String(this.get());case m.DataType.String:e=this.get();break;case m.DataType.Animation:case m.DataType.Corner:case m.DataType.Rect:case m.DataType.TextShadow:case m.DataType.WebkitTextStroke:case m.DataType.Transition:case m.DataType.BorderImage:case m.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}static DataInfo=class{value=null;index=-1};data}class p{static JsvDeclarePrototype(){for(let e in u){let t=u[e];for(let e in t){let s=t[e];if("string"!=typeof s)continue;const i={set:function(e){this.setProperty(s,e)},get:function(){return this.getPropertyValue(s)}};Object.defineProperty(p.prototype,s,i)}}}constructor(e){this.#u=e}setProperty(e,t){if(document.jsvCheckStyleFormat?.(e,t),e==u.Background.BackgroundImage&&"string"==typeof t)if(0==t.indexOf("linear-gradient")){t.match(/\(/g).length!=t.match(/\)/g).length&&(console.error(`StyleError: illegal linear-gradient value '${t}'`),t="")}else{t=new n(t).href}else if(e==u.Effect.BorderImage&&"string"==typeof t){const e=t.split(" ");e.length>0&&(e[0]=new n(e[0]).href),t=e.join(" ")}else e==u.Effect.Display&&(this.#m[e]=t);c.Dom.SetStyleProperty(this.#u,e,t)}getPropertyValue(e){if(e==u.Effect.Display)return this.#m[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=c.Dom.GetStyleProperties(this.#u,t);return JSON.parse(s)}#u;#m={}}class v extends t{constructor(e){super(e)}}class f extends h{static 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"};static JsvEnableEventListener(){c.Dom.EnableEventListener((function(e,t,...s){let i=f.#p[e];const o=i?.[t];o?.(t,...s)}))}constructor(e){super(h.ELEMENT_NODE),this.tagName=e,this.tagName!=f.JsvTagName.Audio&&this.tagName!=f.JsvTagName.Div&&this.tagName!=f.JsvTagName.Image&&this.tagName!=f.JsvTagName.Video&&this.tagName!=f.JsvTagName.JsvFDiv||(this.jsvNativeId=d.GenerateId(),this.style=new p(this.jsvNativeId),c.Dom.CreateElement(this.jsvNativeId,e)),this.jsvAttrStore={},this.clientSizeStore={}}appendChild(e){e.parentNode?this.#v(e,null):(super.appendChild(e),this.#f(e,null))}removeChild(e){super.removeChild(e),this.#g(e),e.jsvNativeId&&c.Dom.RemoveElementChild(this.jsvNativeId,e.jsvNativeId)}insertBefore(e,t){e.parentNode?e.parentNode==this?this.#w(e,t):this.#v(e,t):(super.insertBefore(e,t),this.#f(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.#y(s),this.jsvNativeId&&(this.jsvAddListener(this.jsvNativeId,e),c.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.#y(s),super.removeEventListener(e,t,s),this.jsvNativeId&&(this.jsvRemoveListener(this.jsvNativeId,e),c.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.clientSizeStore.clientWidth||(this.clientSizeStore.clientWidth=c.Dom.GetElementAttribute(this.jsvNativeId,"clientWidth")),this.clientSizeStore.clientWidth}get clientHeight(){return this.clientSizeStore.clientHeight||(this.clientSizeStore.clientHeight=c.Dom.GetElementAttribute(this.jsvNativeId,"clientHeight")),this.clientSizeStore.clientHeight}setAttribute(e,t){e&&(this.jsvAttrStore[e]=t,this.jsvNativeId&&(e.startsWith("data-jsv-vw-")?c.Dom.SetForgeViewInnerProps(this.jsvNativeId,e,t):"class"===e||e.startsWith("data-v-")||e.startsWith("data-jsv")||e.startsWith("dataJsv")?c.Dom.SetElementAttribute(this.jsvNativeId,e,t):"id"===e&&c.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&&c.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 o(o.JsvType.Blur);t.target=e,document.dispatchEvent(t)}let t=new o(o.JsvType.Focus);document.dispatchEvent(t)}jsvGetBoundingClientRect(){const e="jsvgetbound",t=d.GenerateId();return new Promise(((s,i)=>{const o=r=>{const n=r.jsvParams?.[1];if(n!=t)return;r.preventDefault(),this.removeEventListener(e,o);const a=JSON.parse(r.jsvParams?.[0]??"{}");0===a.status?s(a.data):i(a.error)};this.addEventListener(e,o,{jsvtoken:t})}))}jsvSetOnLazyTaskSyncedListener(e){c.Dom.AppendLazyTaskSyncedListener(this.jsvNativeId,e)}jsvOnEvent(e,...o){let r;e.startsWith("animation")?(r=new s(e),r.animationName=o[0]):e.startsWith("transition")?(r=new v(e),r.propertyName=o[0]):e.startsWith("jsv")?(r=new i(e),r.options={detail:o[0]},r.jsvParams=o):"click"==e&&(r=new t(e),r.target=this),r&&(r.target=this,this.dispatchEvent(r))}jsvGetProxyView(e){return e?(this._MaskViewProxy||(this._MaskViewProxy=r.NewDomProxyView(this.jsvNativeId,!0)),this._MaskViewProxy):(this._MainViewProxy||(this._MainViewProxy=r.NewDomProxyView(this.jsvNativeId,!1)),this._MainViewProxy)}jsvGetProxyTexture(e){return this._MainViewTextureProxy||(this._MainViewTextureProxy=e.GetDomProxyTexture(this.jsvNativeId)),this._MainViewTextureProxy}jsvGetRelativePosition(e){return c.Dom.GetRelativePosition(this.jsvNativeId,e.jsvNativeId)}jsvAddListener(e,t){let s=f.#p[e];s||(s=new Map,f.#p[e]=s);this.jsvGetEventListenerSet(t)||(s[t]=this.jsvOnEvent.bind(this))}jsvRemoveListener(e,t){let s=f.#p[e];if(!s)return;this.jsvGetEventListenerSet(t)||s.delete(t)}#w(e,t){this.jsvMoveChildReOrder(e,t),this.#k(e,t)}#v(e,t){console.log("Do move child node");let s=e.parentNode;s.jsvMoveChildToNewParent(e,this,t),this.#C(s,e,t)}#C(e,t,s){t.jsvNativeId&&(s=f.#T(s),c.Dom.MoveElementChild(this.jsvNativeId,e.jsvNativeId,t.jsvNativeId,s?.jsvNativeId))}#k(e,t){e.jsvNativeId&&(t=f.#T(t),c.Dom.ReOrderElementChild(this.jsvNativeId,e.jsvNativeId,t?.jsvNativeId))}#f(e,t){e.parentNode=this,e.nodeType===h.TEXT_NODE?this.textContent=e.nodeValue:e.jsvNativeId&&(t=f.#T(t),c.Dom.InsertElementChild(this.jsvNativeId,e.jsvNativeId,t?.jsvNativeId))}#g(e){for(const t of e.childNodes)e.#g(t);e.jsvFinalize(),c.Dom.RemoveLazyTaskSyncedListener(e.jsvNativeId),delete f.#p[e.jsvNativeId]}#y(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#T(e){let t=e;for(;t&&!(t instanceof f);)t=t.nextSibling;return t}parentNode;tagName;style;jsvNativeId;jsvAttrStore;static#p={}}class g extends f{constructor(){super(f.JsvTagName.Anchor),console.warn("Warnig: <a> is fake in JsView system"),this.href="",this.protocol="",this.host="",this.search="",this.hash="",this.hostname="",this.port="",this.pathname=""}jsvGetTagName(){return f.TAG.ANCHOR}}class w extends h{constructor(e){super(h.COMMENT_NODE),this.textContent=e}}class y extends f{constructor(){super(f.JsvTagName.Div)}get textContent(){return this.#N}set textContent(e){this.#N=e,this.clientSizeStore={},c.Dom.SetElementText(this.jsvNativeId,e)}#N}const k="FocusDebug",C="__AppRoot__";let T=!1,N=!1;function b(e,t){let s=function(e){let t="";if(e){let s=e,i=s.RouterDelegate?.ref?.NameSpace;for(i=i==C?"":i,t=`[${i?i+", ":""}${s.BranchName}]`,s=s.GetParentPage();s;)i=s.RouterDelegate?.ref?.NameSpace,i=i==C?"":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(k,`focusChange(${t?.from}):${t?.askName}\n:focusStack:${s}\n:trace:${i}:`,t)}class D{constructor(e,t){this._DefaultFocusNameSpace=null,this.RouterDelegate={ref:null},e||(this.RouterDelegate.ref=new E(!1,t))}enableFocusTrace(e){T=!0,N=e}getNameSpace(){let e=this.RouterDelegate.ref.NameSpace;return e==C?"":e}wrapWithNameSpace(e){let t=new D(!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;T&&(s={askName:e,deepToChild:t,from:"setFocus",stack:N?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 x;){let s=t.RouterDelegate?.ref?.NameSpace;e.push({nameSpace:s==C||s==t.BranchName?"":s,name:t.BranchName}),t=t.GetParentPage()}}else console.error("getCurrentFocusStack failed: router delegate is null.");return e}getLastFocus(){if(x.sLastFocus){let e=x.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 E{constructor(e,t){this._IsTemp=!!e,this._ChildMap={},this._FocusNameBeforeMount=null,this._BeforeMountStack=null,this._FocusNodeName=null,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==C?"":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===C?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 o=!1;for(let t in i._ChildMap){let r=i._ChildMap[t].RouterDelegate.ref;if(r!=i&&r.NameSpace==e[s]){i=r,s++,o=!0;break}}if(!o)return void console.error(`Error: no found subpath fname=${t}`)}let o=e[s];return i._ChildMap.hasOwnProperty(o)?i._ChildMap[o]: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 o=this._ChildMap[e];o&&o==t&&(delete this._ChildMap[e],o.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){let i=!1;if("string"==typeof e){if(!e.includes(".")){i=!0;let o=this._ChildMap[e];if(this._FocusNodeName=e,o){this._FocusNameBeforeMount=null,this._BeforeMountStack=s,o.Focus(!t);let e=o.GetFocusChild();for(;e;){let t=e.GetFocusChild();if(!t){this._FocusNodeName=e.BranchName;break}e=t}return T&&b(e??o,s),o.RouterDelegate.ref!=this&&o.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],o=this._ChildMap[i];return this._FocusNodeName=i,o?o.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 x extends r.PageBase{constructor(e){super(e),this._OnKeyDown=null,this._OnKeyUp=null,this._OnFocus=null,this._OnBlur=null,this._DispatchKeyDown=null,this._DispatchKeyUp=null,this._OnCustomerEvent=null,this._DKeyDownProxy=void 0,this._DKeyUpProxy=void 0,this._Mounted=!1,this._MountWaitingList=null,this.BranchName=e,this.AsHub=!1,this.InterfaceHub=null,this.RouterDelegate={ref:null},this._TmpRouter=null,this._OriginDispatchKeyDown=this._OriginDispatchKeyDown.bind(this),this._OriginDispatchKeyUp=this._OriginDispatchKeyUp.bind(this),this._AutoShow=!1}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 D(!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 E(!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)}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=x.safeCallback(e)}setOnKeyUp(e){this._OnKeyUp=x.safeCallback(e)}setOnFocus(e){this._OnFocus=x.safeCallback(e)}setOnBlur(e){this._OnBlur=x.safeCallback(e)}setDispatchKeyUp(e){this._DispatchKeyUp=x.safeCallback(e)}setDispatchKeyDown(e){this._DispatchKeyDown=x.safeCallback(e)}setOnCustomerEvent(e){this._OnCustomerEvent=x.safeCallback(e)}setDispatchKeyProxy(e,t){this._DKeyDownProxy=x.safeCallback(e),this._DKeyUpProxy=x.safeCallback(t)}requestFocus(e){let t=null;T&&(t={askName:this.BranchName,deepToChild:e,from:"requestFocus",stack:N?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;T&&(s={askName:t,deepToChild:!1,from:"returnFocusToParent",stack:N?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)}OnCustomerEvent(e){return!!this._OnCustomerEvent&&this._OnCustomerEvent(e)}bubbleCustomerEvent(e){this.BubbleCustomerEvent(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(),S()),e instanceof x)){if(this.RouterDelegate.ref&&this.RouterDelegate.ref._IsTemp){let t=this.RouterDelegate.ref;this.RouterDelegate.ref=null,t.forEach(((t,s)=>{e.routerAdd(s,t)}))}e.routerAdd(this.BranchName,this)}}focus(e){this.Focus(e)}Focus(e){if(!this._Mounted)return x.sFocusMemos.push({obj:this,bcf:e}),void console.log("page base tree not build, cache focus");super.Focus(e)}OnFocus(){this._OnFocus&&this._OnFocus()}OnBlur(){x.sLastFocus=this,this._OnBlur&&this._OnBlur()}onUnMount(e){x.sLastFocus==this&&(x.sLastFocus=null);let t=this.IsFocus();if(T&&t){let t=this.GetParentPage();if(t){let s=null;s={askName:t.BranchName,deepToChild:!1,from:e?"deactive":"unmount",stack:N?new Error("simulate-stack").stack:null},b(t,s)}}let s=this.GetParentPage();s&&s.RemoveSubPage(this),this.ClearSubPages(),this.routerUnbind(s?.BranchName,e)}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]==C)break;e&&e.RouterDelegate.ref!=s&&(s=e.RouterDelegate.ref,t.unshift(s.NameSpace))}while(e);return t[0]==C?t.shift():console.error("ERROR: missing app root"),t.join(".")}getNodeByName(e){return this.RouterDelegate.ref.getNodeByName(e,this)}}x.sFocusMemos=[],x.sLastFocus=null,x.sRootPageNode=null;let S=()=>{let e=x.sFocusMemos.length;if(e>0){let t=x.sFocusMemos;x.sFocusMemos=[];for(let s=0;s<e;s++)t[s].obj.Focus(t[s].bcf)}},I={};class O{constructor(e,t,s){this._Element=s,I.hasOwnProperty(e)&&console.error(`Warn: FDivRoot duplicate name=${e}`),I[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(),S()}}class F extends f{constructor(){super(f.JsvTagName.Image)}setAttribute(e,t){if("src"===e){t=new n(t).href,this.clientSizeStore={}}super.setAttribute(e,t),this.jsvNativeId&&"src"===e&&c.Dom.SetElementAttribute(this.jsvNativeId,e,t)}jsvOnEvent(e,...s){let i;super.jsvOnEvent(e,...s),"load"==e&&(i=new t(e),i.target=this),i&&this.dispatchEvent(i)}}class L extends f{constructor(){super(f.JsvTagName.Link),this.src=null,this.onerror=null,this.onload=null}setAttribute(e,t){this[e]=t}jsvLoadResource(){let e=!1,t=null;if(null!=this.href){var s=new 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 M extends f{constructor(){super(f.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})}src=null;onerror=null;onload=null;charset=null;timeout=120}class B extends f{constructor(){super(f.JsvTagName.Style),this.jsvAttrStore={left:0,top:0,width:0,height:0}}}class R extends f{constructor(){super(f.JsvTagName.Svg)}}class P extends h{constructor(e){super(h.TEXT_NODE),this.textContent=e}get nodeValue(){return this.textContent}set nodeValue(e){this.textContent=e,this.parentNode&&(this.parentNode.textContent=this.textContent)}}let J=1;class _ extends f{constructor(){super(f.JsvTagName.JsvFDiv),this.FocusNodeRef=new x("unnamed-"+J++),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 D(!1,t);this.HubRef=e,this.FocusNodeRef.setHub(e),this.FocusNodeRef.setBranchName(t)}}removeAttribute(e){}jsvGetHub(){return this.HubRef}}class j extends h{constructor(){super(h.DOCUMENT_NODE),this.location=window.location,this.rootElement=new y,this.rootElement.ownerDocument=this,this.rootElement.id="root",c.Dom.BindElementToRootView(this.rootElement.jsvNativeId),this.activeElement=this.rootElement,this.head=null}createComment(e){return new w(e)}createElement(e){switch(e=e.toUpperCase()){case f.JsvTagName.Anchor:return new g;case f.JsvTagName.Div:return new y;case f.JsvTagName.Image:return new F;case f.JsvTagName.Link:return new L;case f.JsvTagName.Script:return new M;case f.JsvTagName.Style:return new B;case f.JsvTagName.Svg:return new R;case f.JsvTagName.JsvFDiv:return new _;case f.JsvTagName.IFrame:console.error("Unsupported element: "+e+". Your vue compilation may may have failed, please check it first.")}if("TEMPLATE"==e)return{};throw new TypeError("Unimplemented element: "+e)}createEvent(e){return"CUSTOMEVENT"===(e=e.toUpperCase())?new i:new t(e)}createTextNode(e){return new P(e)}getElementById(e){if("root"===e||"app"===e)return this.rootElement;throw new DOMError("Failed to get element by id, id="+e+" is UNIMPLEMENTED.")}getElementsByTagName(e){if((e=e.toUpperCase())===f.JsvTagName.Head)return[this.head];if(e===f.JsvTagName.Link||e===f.JsvTagName.Script||e===f.JsvTagName.Style)return[];throw new DOMError("Failed to get element by name, name="+e+" is UNIMPLEMENTED.")}querySelector(e){if("root"===e||"#app"===e)return this.rootElement;if("head"===e)return this.head;if("base"===e)return null;if(e.startsWith("style[")&&e.endsWith("]"))return null;throw new DOMError("Failed to query selector, selectors="+e+" is UNIMPLEMENTED.")}querySelectorAll(e){return[]}jsvInitFDivRoot(e,t,s){if(!s){let e=document.createElement("fdiv");this.rootElement.appendChild(e),this.rootElement=e,s=this.rootElement}return new O(e,t,s)}}class A extends f{constructor(){super(f.JsvTagName.Head)}appendChild(e){super.appendChild(e),(e instanceof L||e instanceof M)&&e.jsvLoadResource()}removeChild(e){super.removeChild(e)}}class U{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 V extends U{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 W="@keyframes",z=W.length;class G{constructor(e){this._AnchorTag=e,this._NamesCache=new Set}insertRule(e){let t=this.#b(e);this._NamesCache.has(t)&&console.warn(`Warn: keyframe replace of name ${t}`),this._NamesCache.add(t),c.Dom.InsertKeyFrame(t,e)}hasRule(e){return this._NamesCache.has(e)}removeRule(e){this._NamesCache.has(e)?(this._NamesCache.delete(e),c.Dom.RemoveKeyFrame(e)):console.error(`Error: keyFrame(${e}) is not exist.`)}removeMultiRules(e){for(let t of e)this.removeRule(t)}#b(e){let t=e.indexOf(W)+z,s=e.indexOf("{");return e.substring(t,s).trim()}}let H=null;function K(e){return H||(H={global:new G("global")}),H.global}class ${static EnsureGlobalEnv(e,t){const s=window.navigator?.userAgent?.toLowerCase();window.jsvInAndroidWebView=s?.indexOf("android")>=0,$.#D(e,t),f.JsvEnableEventListener(),p.JsvDeclarePrototype()}static#D(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=c.Dom.DeclareStyleSheets),window.JsvCode.Dom.UndeclareStyleSheets||(window.JsvCode.Dom.UndeclareStyleSheets=c.Dom.UndeclareStyleSheets),window.JsvCode.Dom.getKeyFrameGroup||(window.JsvCode.Dom.getKeyFrameGroup=K),window.JsvCode.ForgeHandles||(window.JsvCode.ForgeHandles=new V)}}class q{static SetLevel(e){switch(q.E=q.W=q.I=q.D=function(){},e){case q.Level.Verbose:q.V=console.debug.bind(console);case q.Level.Debug:q.D=console.debug.bind(console);case q.Level.Info:q.I=console.info.bind(console)}}static E=console.error.bind(console);static W=console.warn.bind(console);static I=console.info.bind(console);static D=function(){};static V=function(){};static Level={Error:0,Warning:1,Info:2,Debug:3,Verbose:4}}class X{constructor(e){this.callback=e}observe(e,t){if(!(e instanceof h))throw Error("TypeError: Failed to execute 'observe' on 'MutationObserver': parameter 1 is not of type JsView's 'Node'");for(const e of Object.keys(t))"childList"==e||console.warn("JsView: only childList config is supported! ignore "+e);t.childList&&e.jsvObserveChildChanged((()=>{this.callback?.()}))}disconnect(){this.callback=void 0}}class Y{constructor(){this.#E(),Y.#x()}#E(){r.sRenderBridge.AddWillSwapListener("forgeSwap",(()=>{c.Dom.RequestSwapAllCachedTasks()})),window.JsvCode.ForgeHandles.setHandles(new r.TextureManager,null,null);let e=null;r.DesignMap&&(e=r.DesignMap(),r.sRenderBridge.InitScreenBuffer(e.displayScale,e.width)),r.DomElementGetter=e=>{let t=window.JsvCode.Dom.PlatformBridge.JsViewId;return window.JsvCode.Dom.PlatformBridge.GetInstance(t).forgeElementGetter(e)}}static SetRender(e){Y.#x=e,window.Forge.RunApp({})}static#x=null}class Z extends B{constructor(){super(),this.jsvBrowserElement=window.JsvCode.Dom.BrowserDocument.createElement(Element.JsvTagName.Style)}jsvBrowserElement}class Q extends A{constructor(){super()}appendChild(e){"HTMLLinkElement"==e.constructor.name||"HTMLScriptElement"==e.constructor.name?window.JsvCode.Dom.BrowserDocument.head.appendChild(e):e instanceof Z?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 Z?window.JsvCode.Dom.BrowserDocument.head.removeChild(e.jsvBrowserElement):super.removeChild(e)}}class ee extends j{constructor(){super(),this.head=new Q}createElement(e){switch(e=e.toUpperCase()){case f.JsvTagName.IFrame:case f.JsvTagName.Link:case f.JsvTagName.Script:return window.JsvCode.Dom.BrowserDocument.createElement(e);case f.JsvTagName.Style:return new Z;default:return super.createElement(e)}}getElementsByTagName(e){return e.toUpperCase()===f.JsvTagName.Head?window.JsvCode.Dom.BrowserDocument.getElementsByTagName(e):super.getElementsByTagName(e)}}class te{static Get(e){return te.#S[e]}static#I(e,t){let s=void 0===t;return s&&console.error(e+" property is undefined!"),s}static#O(e,t){return!!te.#I(e,t)||(""===t||"number"==typeof t)}static#F(e,t){te.#I(e,t)||t.indexOf("transform")<0&&t.indexOf("opacity")<0&&console.error("keyframes property is only support transform and opacity, value:",t)}static#L(e,t){if(te.#I(e,t))return;const s="fill contain cover none scale-down";s.indexOf(t)<0&&console.error(" objectFit is only support one of string["+s+"]")}static#M(e,t){te.#I(e,t)||console.error(e+" property is not support, you can use transition property, e.g. transition='width 2s'")}static#B(e,t){te.#I(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#R(e,t){te.#I(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#P(e,t){te.#I(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#J(e,t){if(!te.#I(e,t))switch(t){case"clip":case"ellipsis":break;default:console.error("textOverflow property's value is not support, value:",t)}}static#_(e,t){if(!te.#I(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#j(e,t){if(!te.#I(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#A(e,t){if(!te.#O(e,t))switch(t){case"normal":case"inherit":console.error("lineHeight property's value is support number only, value:",t);break;default:t.indexOf("%")>=0&&console.error("lineHeight property's value is support number only, value:",t)}}static#U(e,t){te.#I(e,t)||te.#V("Color()",t)}static#W(e,t){te.#I(e,t)||"visible"!==t&&"hidden"!==t&&"inherit"!==t&&console.error("visibility property's value is not support, value:",t)}static#z(e,t){te.#I(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#G(e,t){te.#I(e,t)||"visible"!==t&&"hidden"!==t&&console.error("overflow property's value is support visible or hidden only, value:",t)}static#H(e,t){if(!te.#O(e,t))switch(t){case"auto":case"inherit":console.error("top property's value is support number only, value:",t);break;default:t.indexOf("%")>=0&&console.error("top property's value is support number only, value:",t)}}static#K(e,t){if(!te.#O(e,t))switch(t){case"auto":case"inherit":console.error("left property's value is support number only, value:",t);break;default:t.indexOf("%")>=0&&console.error("left property's value is support number only, value:",t)}}static#$(e,t){if(!te.#O(e,t))switch(t){case"auto":case"inherit":console.error("height property's value is support number only, value:",t);break;default:t.indexOf("%")>=0&&console.error("height property's value is support number only, value:",t)}}static#q(e,t){if(!te.#O(e,t))switch(t){case"auto":case"inherit":console.error("width property's value is support number only, value:",t);break;default:t.indexOf("%")>=0&&console.error("width property's value is support number only, value:",t)}}static#X(e,t){if(!te.#I(e,t))switch(t){case"visible":case"hidden":break;default:console.error("backfaceVisibility property's value is support visible/hidden only, value: ",t)}}static#Y(e,t){te.#I(e,t)}static#Z(e,t){if(te.#I(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#Q(e,t){te.#I(e,t)||isNaN(t)&&console.error("zIndex property's value is support number only, value: ",t)}static#ee(e,t){if(!te.#O(e,t))switch(t){case"smaller":case"larger":case"inherit":case"x-small":case"xx-small":case"small":case"large":case"medium":case"x-large":case"xx-large":console.error("fontSize property's value is support number only, value:",t);break;default:t.indexOf("%")>=0&&console.error("fontSize property's value is support number only, value:",t)}}static#te(e,t){te.#I(e,t)||"bold"!==t&&console.error("fontWeight property's value is support bold only, value:",t)}static#se(e,t){te.#I(e,t)||"italic"!==t&&console.error("fontWeight property's value is support italic only, value:",t)}static#ie(e,t){if(te.#I(e,t))return;let s=[t];"string"==typeof t&&(s=t.split(" ")),s.length>4&&console.error("borderRadius property's value is not support, value:",t)}static#oe(e,t){te.#O(e,t)}static#re(e,t){if(te.#I(e,t))return;t.split(" ").length>4&&console.error("borderImageOutsetCheck property's value is not support, value:",t)}static#ne(e,t){te.#I(e,t)||t.indexOf("fill")<0&&console.error("borderImage property's value is not contain fill, e.g. source slice, but value:",t)}static#ae(e,t){console.error(e+" property not support, you can use backgroundImage property, e.g. backgroundImage=`url(${iconImgPath})`")}static#le(e,t){te.#I(e,t)||"inherit"==t&&console.error("backgroundImage property's value is not support, value:",t)}static#ce(e,t){if(!te.#I(e,t))return te.#V("backgroundColor",t)}static#de(e,t){}static#he(e,t){if(!te.#I(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#ue(e,t){console.error(e+" property is not support, you can use animation property, e.g. animation='mymove 5s infinite'")}static#me(e,t){if(!te.#I(e,t))switch(t){case"flat":case"preserve-3d":break;default:console.error("transformStyle property value is not valid",t)}}static#pe(e,t){te.#I(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#ve(e,t){if(!te.#I(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(!te.#V("textShadow",e[3]))return}}}static#V(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#fe(e,t){te.#I(e,t)||"number"!=typeof t&&console.error("JsvTextLatex property's value is support number only, value: ",t)}static#ge(e,t){te.#I(e,t)||"number"!=typeof t&&console.error("JsvTextEmoji property's value is support number only, value: ",t)}static#we(e,t){if(!te.#I(e,t))switch(t){case"ltr":case"rtl":break;default:console.error("direction property's value is not support, value:",t)}}static#ye(e,t){te.#I(e,t)||"number"!=typeof t&&console.error("JsvTextAlignMinWidth property's value is support number only, value: ",t)}static#ke(e,t){if(!te.#I(e,t))switch(t){case"top":case"middle":case"bottom":break;default:console.error("JsvTextVerticalAlign property's value is not support, value: ",t)}}static#Ce(e,t){if(!te.#I(e,t))switch(t){case"top":case"middle":case"bottom":break;default:console.error("JsvTextLineAlign property's value is not support, value: ",t)}}static#Te(e,t){if(!te.#I(e,t))switch(t){case"unset":case"ltr":case"rtl":break;default:console.error("JsvTextInnerDirection property's value is not support, value: ",t)}}static#S={animation:{check:te.#de},animationName:{check:te.#ue},animationDuration:{check:te.#ue},animationTimingFunction:{check:te.#ue},animationDelay:{check:te.#ue},animationIterationCount:{check:te.#ue},animationDirection:{check:te.#ue},animationPlayState:{check:te.#ue},animationFillMode:{check:te.#he},background:{check:te.#ae},backgroundColor:{check:te.#ce},backgroundImage:{check:te.#le},borderImage:{check:te.#ne},borderImageOutset:{check:te.#re},borderImageWidth:{check:te.#oe},borderRadius:{check:te.#ie},height:{check:te.#$},width:{check:te.#q},zIndex:{check:te.#Q},fontFamily:{check:null},fontSize:{check:te.#ee},fontStyle:{check:te.#se},fontWeight:{check:te.#te},left:{check:te.#K},overflow:{check:te.#G},top:{check:te.#H},visibility:{check:te.#W},display:{check:te.#z},color:{check:te.#U},lineHeight:{check:te.#A},textAlign:{check:te.#j},direction:{check:te.#we},whiteSpace:{check:te.#_},textOverflow:{check:te.#J},transform:{check:te.#R},transformOrigin:{check:te.#P},transition:{check:te.#B},transitionProperty:{check:te.#M},transitionDuration:{check:te.#M},transitionTimingFunction:{check:te.#M},transitionDelay:{check:te.#M},keyframes:{check:te.#F},objectFit:{check:te.#L},perspective:{check:te.#Y},backfaceVisibility:{check:te.#X},transformStyle:{check:te.#me},perspectiveOrigin:{check:te.#Y},WebkitTextStroke:{check:te.#Z},textShadow:{check:te.#ve},JsvTextLatex:{check:te.#fe},JsvTextEmoji:{check:te.#ge},JsvTextAlignMinWidth:{check:te.#ye},JsvTextVerticalAlign:{check:te.#ke},JsvTextLineAlign:{check:te.#Ce},JsvTextInnerDirection:{check:te.#Te}}}class se{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){se.#Ne(e),se.#be(),se.#De()}static#Ne(e){window.JsvCode.Dom.BrowserDocument=e;const t=new ee;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#be(){window.MutationObserver=X,window.Element=f,window.SVGElement=R}static#De(){const e=window.JsvCode.Dom.JsViewDocument;window.document.jsvInitFDivRoot=e.jsvInitFDivRoot.bind(e),window.document.jsvCheckStyleFormat=window.jsvInAndroidWebView?null:se.#Ee}static#Ee(e,t){if(e.startsWith("--"))return;let s=te.Get(e);s?s.check&&t&&s.check(e,t):console.error(e+" property is not support.")}}window.jsvIsBrowserDebug=!0;const ie=window.JsvCode.BrowserPlatformDomBridge,oe=window.JsvCode.BrowserPlatformMediaBridge;function re(){const e=se.BackupBrowser();ie.RegisterOriginDocument(e),$.EnsureGlobalEnv(ie,oe),se.HookBrowser(e),q.I("Using JsView HTML Environment.")}export{Y as BrowserForgeApp,re 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,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 b{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 N(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})}b.ELEMENT_NODE=1,b.TEXT_NODE=3,b.COMMENT_NODE=8,b.DOCUMENT_NODE=9,b.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=(N(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=(N(r=class{constructor(){throw new Error("new StyleName.Background() is forbidden.")}},"Background"),r.BackgroundColor="backgroundColor",r.BackgroundImage="backgroundImage",r.BorderRadius="borderRadius",r),D.Effect=(N(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=(N(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=(N(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=(N(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=(N(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}},N(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",N(m=class{constructor(){this.height=x.InvalidInt32,this.left=x.InvalidInt32,this.top=x.InvalidInt32,this.width=x.InvalidInt32}},"Layout"),m.Name="layout",N(p=class{constructor(){this.backgroundColor=x.InvalidPointer,this.backgroundImage=x.InvalidPointer,this.borderRadius=x.InvalidPointer}},"Background"),p.Name="background",N(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",N(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",N(g=class{constructor(){this.animation=x.InvalidPointer,this.transition=x.InvalidPointer,this.animationFillMode="none"}},"Motion"),g.Name="motion";class E{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(E.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 I extends t{constructor(e){super(e)}}class S extends b{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(b.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 E(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))}insertAdjacentElement(e,t){switch(e){case"beforebegin":if(null==this.parentNode)return null;this.parentNode.insertBefore(t,this);break;case"afterend":if(null==this.parentNode)return null;const e=this.nextSibling;e?this.parentNode.insertBefore(t,e):this.parentNode.appendChild(t);break;case"afterbegin":const i=this.firstElementChild;i?this.insertBefore(t,i):this.appendChild(t);break;case"beforeend":this.appendChild(t);break;default:return console.error("Failed to insert adjacent element, where is not valid."),null}return 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 I(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===b.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 b{constructor(e){super(b.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(),V()),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 V=()=>{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)}},W={};class U{constructor(e,t,i){this._Element=i,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 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 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 b{constructor(e){super(b.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 b{constructor(){super(b.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(),E.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 b))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)}insertAdjacentElement(e,t){return t instanceof de==0?(console.error("Failed to insert adjacent element, only JsViewStyleElement is supported."),null):(this.jsvBrowserElement.insertAdjacentElement(e,t.jsvBrowserElement),t)}}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};
|
|
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.target=t,this.timeStamp=Date.now(),this.type=e}preventDefault(){this.#e=!0}jsvIsPrevented(){return this.#e}#e=!1}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}options}class n extends t{constructor(e){super(e)}}void 0===window.Forge?(window.Forge={},console.log("Define forge browser")):console.log("Define using JsView forge engine-js");var a=window.Forge;class o{constructor(e,t){if(!e)return;if(!0===e.startsWith("url")){let t=e.indexOf("(")+1,s=e.lastIndexOf(")");if("undefined"===(e=e.substring(t,s).trim())||"null"===e||0===e.length)return}if(!0===e.startsWith("data:")||!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 a=i.indexOf("?");a>1&&(this.search=i.substring(a),i=i.substring(0,a));let o=i,r=o.indexOf("://");this.protocol=r>0?o.substring(0,r+1):"";let l=r>1?o.substring(r+3):"";r=l.indexOf("/"),this.host=r>0?l.substring(0,r):"",this.pathname=r>=1?l.substring(r):"","file:"==this.protocol&&(this.host="",this.pathname=l),this.origin=this.protocol+"//"+this.host,r=this.host.indexOf(":"),this.hostname=r>0?this.host.substring(0,r):this.host,this.port=r>1?this.host.substring(r+1):""}replace(e){this.href=e}href="";origin="";protocol="";host="";hostname="";port="";pathname="";search="";hash=""}class r{static EnableEventListener(e){const t=window.JsvCode.Dom.PlatformBridge.JsViewId;window.JsvCode.Dom.PlatformBridge.SetOnEventListener(t,e)}static CreateElement(e,t){r.#t(r.#s.CreateElement,e,t)}static BindElementToRootView(e){r.#t(r.#s.BindElementToRootView,e)}static InsertElementChild(e,t,s){r.#t(r.#s.InsertElementChild,e,t,s)}static RemoveElementChild(e,t){r.#t(r.#s.RemoveElementChild,e,t)}static MoveElementChild(e,t,s,i){r.#t(r.#s.MoveElementChild,e,t,s,i)}static ReOrderElementChild(e,t,s){r.#t(r.#s.ReOrderElementChild,e,t,s)}static AddElementEventListener(e,t,s){r.#t(r.#s.AddElementEventListener,e,t,s)}static RemoveElementEventListener(e,t,s){r.#t(r.#s.RemoveElementEventListener,e,t,s)}static SetElementText(e,t){r.#t(r.#s.SetElementText,e,t)}static SetElementAttribute(e,t,s){r.#t(r.#s.SetElementAttribute,e,t,s),r.#i.has(e)&&r.#n.add(e)}static GetElementBoundingClientStyles(e,t){return r.#a(r.#s.GetElementBoundingClientStyles,e,t)}static SetForgeViewInnerProps(e,t,s){let i=0;(t=t.substr(12)).startsWith("mask-")&&(i=1,t=t.substr(5)),r.#t(r.#s.SetForgeViewInnerProps,e,t,i,""+s)}static DeclareStyleSheets(e){r.#t(r.#s.DeclareStyleSheets,-1,e)}static UndeclareStyleSheets(e){r.#t(r.#s.UndeclareStyleSheets,-1,e)}static SetStyleProperty(e,t,s){r.#t(r.#s.SetStyleProperty,e,t,s),r.#i.has(e)&&r.#n.add(e)}static GetStyleProperties(e,t){return r.#a(r.#s.GetStyleProperties,e,t)}static AppendLazyTaskSyncedListener(e,t){r.#i.set(e,t)}static RemoveLazyTaskSyncedListener(e){r.#i.delete(e)}static RequestSwapAllCachedTasks(){if(0==r.#o.length)return;const e=JSON.stringify(r.#o);r.#o=[];const t=window.JsvCode.Dom.PlatformBridge.JsViewId;window.JsvCode.Dom.PlatformBridge.RunLazyTaskList(t,e);for(const e of r.#n){const t=r.#i.get(e);t?.()}r.#n.clear()}static GetElementAttribute(e,t){return r.#a(r.#s.GetElementAttribute,e,t)}static InsertKeyFrame(e,t){r.#t(r.#s.InsertKeyFrameDefine,-1,e,t)}static RemoveKeyFrame(e){r.#t(r.#s.RemoveKeyFrameDefine,-1,e)}static GetRelativePosition(e,t){const s=r.#a(r.#s.GetRelativePosition,e,t);return JSON.parse(s)}static#a(e,t,...s){r.RequestSwapAllCachedTasks();const i=window.JsvCode.Dom.PlatformBridge.JsViewId;return window.JsvCode.Dom.PlatformBridge.RunSyncTask(i,e,t,...s)}static#t(e,t,...s){r.#o.push([e,t,...s]),a.sRenderBridge?.RequestSwap()}static#o=[];static#n=new Set;static#i=new Map;static#s={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 l{static CreateAudioPlayer(e){return window.JsvCode.Media.PlatformBridge.CreateAudioPlayer(e)}static CreateVideoPlayer(){return window.JsvCode.Media.PlatformBridge.CreateVideoPlayer()}}class c{static Dom=r;static Media=l}class h{static GenerateId(){const e=this.#r++;if(e>=this.#l)throw new Error("JsvUniqueId.GenerateId() Failed to create unique id. id is overflow.");return e}static#r=0;static#l=Math.pow(2,31)-1}class d{constructor(e){this.ownerDocument=window.document,this.nodeType=e,this.parentNode=void 0,this.childNodes=[]}jsvFinalize(){}appendChild(e){this.childNodes.push(e),e.parentNode=this,this.#c?.()}removeChild(e){let t=this.childNodes.indexOf(e);if(t<0)throw new DOMError("Failed to remove node, child node is not found. node=",e);this.childNodes.splice(t,1),e.parentNode=void 0,this.#c?.()}insertBefore(e,t){this.#h(e,t)}get previousSibling(){const e=this.parentNode.childNodes;let t=e.indexOf(this);if(t<0)throw new DOMError("Failed to call Node.previousSibling(), this node not found. this=",this);return e[t-1]}get nextSibling(){const e=this.parentNode.childNodes;let t=e.indexOf(this);if(t<0)throw new DOMError("Failed to call Node.nextSibling(), this node not found. this=",this);return e[t+1]}addEventListener(e,t,s){this.#d||(this.#d={});let i=this.#d[e];i||(i=new Set,this.#d[e]=i),i.add(t)}removeEventListener(e,t,s){let i=this.#d?.[e];i&&(i.delete(t),i.size<=0&&this.#d.hasOwnProperty(e)&&delete this.#d[e],0===Object.values(this.#d).length&&(this.#d=void 0))}dispatchEvent(e){if(!this.#d)return void console.warn("Node.dispatchEvent() Ignore to dispatch event: "+e.type+". No event added.");let t=this.#d[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.#c=e}jsvMoveChildReOrder(e,t){{let t=this.childNodes.indexOf(e);t<0&&Log.Throw("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 DOMError("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);i<0&&Log.Throw("Failed to call jsvMoveChildToNewParent, node not found. node=",e),this.childNodes.splice(i,1),e.parentNode=void 0,this.jsvChildChangedCallback?.(),t.#h(e,s)}jsvGetEventListenerSet(e){const t=this.#d?.[e];return t}#h(e,t){let s=this.childNodes.length;if(void 0===t)throw new DOMError("TypeError: Failed to execute 'insertBefore' on 'Node': 2 arguments required, but only 1 present.");if(null!==t&&(s=this.childNodes.indexOf(t)),s<0)throw new DOMError("Failed to call insert node, before node not found. beforeNode=",t);this.childNodes.splice(s,0,e),e.parentNode=this,this.#c?.()}#d=void 0;#c=void 0;static ELEMENT_NODE=1;static TEXT_NODE=3;static COMMENT_NODE=8;static DOCUMENT_NODE=9;static NOLAYOUT_NODE=10}class u{static Layout=class{static Height="height";static Left="left";static Top="top";static Width="width";constructor(){throw new Error("new StyleName.Layout() is forbidden.")}};static Background=class{static BackgroundColor="backgroundColor";static BackgroundImage="backgroundImage";static BorderRadius="borderRadius";constructor(){throw new Error("new StyleName.Background() is forbidden.")}};static Effect=class{static BackfaceVisibility="backfaceVisibility";static BorderImage="borderImage";static BorderImageWidth="borderImageWidth";static BorderImageOutset="borderImageOutset";static Display="display";static ObjectFit="objectFit";static Opacity="opacity";static Overflow="overflow";static Perspective="perspective";static PerspectiveOrigin="perspectiveOrigin";static Transform="transform";static TransformOrigin="transformOrigin";static TransformStyle="transformStyle";static Visibility="visibility";static ZIndex="zIndex";constructor(){throw new Error("new StyleName.Effect() is forbidden.")}};static Text=class{static Color="color";static FontFamily="fontFamily";static FontSize="fontSize";static FontStyle="fontStyle";static FontWeight="fontWeight";static LineHeight="lineHeight";static TextAlign="textAlign";static TextOverflow="textOverflow";static TextShadow="textShadow";static WebkitTextStroke="WebkitTextStroke";static WhiteSpace="whiteSpace";static WordWrap="wordWrap";static Direction="direction";static JsvTextEmoji="JsvTextEmoji";static JsvTextLatex="JsvTextLatex";static JsvTextAlignMinWidth="JsvTextAlignMinWidth";static JsvTextVerticalAlign="JsvTextVerticalAlign";static JsvTextLineAlign="JsvTextLineAlign";static JsvTextInnerDirection="JsvTextInnerDirection";constructor(){throw new Error("new StyleName.Text() is forbidden.")}};static Motion=class{static Animation="animation";static Transition="transition";static AnimationFillMode="animationFillMode";constructor(){throw new Error("new StyleName.Motion() is forbidden.")}};static HasGetterMethod(e){switch(e){case u.Layout.Height:case u.Layout.Left:case u.Layout.Top:case u.Layout.Width:case u.Effect.ObjectFit:return!0;default:return!1}}static ToConst(e){return e==u.Layout.Height?u.Layout.Height:e==u.Layout.Left?u.Layout.Left:e==u.Layout.Top?u.Layout.Top:e==u.Layout.Width?u.Layout.Width:e==u.Background.BackgroundColor?u.Background.BackgroundColor:e==u.Background.BackgroundImage?u.Background.BackgroundImage:e==u.Background.BorderRadius?u.Background.BorderRadius:e==u.Effect.BackfaceVisibility?u.Effect.BackfaceVisibility:e==u.Effect.BorderImage?u.Effect.BorderImage:e==u.Effect.BorderImageWidth?u.Effect.BorderImageWidth:e==u.Effect.BorderImageOutset?u.Effect.BorderImageOutset:e==u.Effect.Display?u.Effect.Display:e==u.Effect.ObjectFit?u.Effect.ObjectFit:e==u.Effect.Opacity?u.Effect.Opacity:e==u.Effect.Overflow?u.Effect.Overflow:e==u.Effect.Perspective?u.Effect.Perspective:e==u.Effect.PerspectiveOrigin?u.Effect.PerspectiveOrigin:e==u.Effect.Transform?u.Effect.Transform:e==u.Effect.TransformOrigin?u.Effect.TransformOrigin:e==u.Effect.TransformStyle?u.Effect.TransformStyle:e==u.Effect.Visibility?u.Effect.Visibility:e==u.Effect.ZIndex?u.Effect.ZIndex:e==u.Text.Color?u.Text.Color:e==u.Text.FontFamily?u.Text.FontFamily:e==u.Text.FontSize?u.Text.FontSize:e==u.Text.FontStyle?u.Text.FontStyle:e==u.Text.FontWeight?u.Text.FontWeight:e==u.Text.LineHeight?u.Text.LineHeight:e==u.Text.TextAlign?u.Text.TextAlign:e==u.Text.TextOverflow?u.Text.TextOverflow:e==u.Text.TextShadow?u.Text.TextShadow:e==u.Text.WebkitTextStroke?u.Text.WebkitTextStroke:e==u.Text.WhiteSpace?u.Text.WhiteSpace:e==u.Text.WordWrap?u.Text.WordWrap:e==u.Text.Direction?u.Text.Direction:e==u.Text.JsvTextEmoji?u.Text.JsvTextEmoji:e==u.Text.JsvTextLatex?u.Text.JsvTextLatex:e==u.Text.JsvTextAlignMinWidth?u.Text.JsvTextAlignMinWidth:e==u.Text.JsvTextVerticalAlign?u.Text.JsvTextVerticalAlign:e==u.Text.JsvTextLineAlign?u.Text.JsvTextLineAlign:e==u.Text.JsvTextInnerDirection?u.Text.JsvTextInnerDirection:e==u.Motion.Animation?u.Motion.Animation:e==u.Motion.Transition?u.Motion.Transition:e==u.Motion.AnimationFillMode?u.Motion.AnimationFillMode:null}constructor(){throw new Error("new StyleName() is forbidden.")}}class v{static Base=class{constructor(e){this.rawValue=e}rawValue};static AnimationImpl=class extends v.Base{constructor(e){super(e)}name="";duration=0;timingFunction=null;delay=0;iterationCount=0;direction=!1};static CornerImpl=class extends v.Base{constructor(e){super(e)}topLeft=0;topRight=0;bottomRight=0;bottomLeft=0};static RectImpl=class extends v.Base{constructor(e){super(e)}top=0;right=0;left=0;bottom=0};static TextShadowImpl=class extends v.Base{constructor(e){super(e)}hShadow=0;vShadow=0;blur=0;color=void 0};static WebkitTextStrokeImpl=class extends v.Base{constructor(e){super(e)}length=0;color=void 0};static TransitionImpl=class extends v.Base{constructor(e){super(e)}animationMap=new Map};static BorderImageImpl=class extends v.Base{constructor(e){super(e)}source="";slice=null};static BackgroundImageImpl=class extends v.Base{constructor(e){super(e)}type=0;static eType={UNKNOWN:0,LINEAR_GRADIENT:1,URL_PATH:2};static LinearGradient=class{fromX=0;fromY=0;toX=0;toY=0;stops=[]};linearGradient;urlPath=""};static DataType=class{static Null=0;static Int32=1;static Float=2;static String=3;static Animation=4;static Corner=5;static Rect=6;static TextShadow=7;static WebkitTextStroke=8;static Transition=9;static BorderImage=10;static BackgroundImage=11};static InvalidInt32=Number.MIN_VALUE;static InvalidFloat=Number.NaN;static InvalidPointer=null;constructor(e){let t=-1,s=null;null==e?t=v.DataType.Null:Number(e)===e&&e%1==0?t=v.DataType.Int32:Number(e)===e&&e%1!=0?t=v.DataType.Float:"string"==typeof e||e instanceof String?t=v.DataType.String:e instanceof v.AnimationImpl?t=v.DataType.Animation:e instanceof v.CornerImpl?t=v.DataType.Corner:e instanceof v.RectImpl?t=v.DataType.Rect:e instanceof v.TextShadowImpl?t=v.DataType.TextShadow:e instanceof v.WebkitTextStrokeImpl?t=v.DataType.WebkitTextStroke:e instanceof v.TransitionImpl?t=v.DataType.Transition:e instanceof v.BorderImageImpl&&(t=v.DataType.BorderImage),e!=v.InvalidInt32&&e!=v.InvalidFloat&&e!=v.InvalidPointer?s=e:(t=v.DataType.Null,s=null),this.data=new v.DataInfo,this.data.index=t,this.data.value=s}toString(){let e=null;switch(this.data.index){case v.DataType.Null:return"";case v.DataType.Int32:case v.DataType.Float:return String(this.get());case v.DataType.String:e=this.get();break;case v.DataType.Animation:case v.DataType.Corner:case v.DataType.Rect:case v.DataType.TextShadow:case v.DataType.WebkitTextStroke:case v.DataType.Transition:case v.DataType.BorderImage:case v.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}static DataInfo=class{value=null;index=-1};data}class m{static JsvDeclarePrototype(){for(let e in u){let t=u[e];for(let e in t){let s=t[e];if("string"!=typeof s)continue;const i={set:function(e){this.setProperty(s,e)},get:function(){return this.getPropertyValue(s)}};Object.defineProperty(m.prototype,s,i)}}}constructor(e){this.#u=e}setProperty(e,t){if(document.jsvCheckStyleFormat?.(e,t),e==u.Background.BackgroundImage&&"string"==typeof t)if(0==t.indexOf("linear-gradient")){t.match(/\(/g).length!=t.match(/\)/g).length&&(console.error(`StyleError: illegal linear-gradient value '${t}'`),t="")}else{t=new o(t).href}else if(e==u.Effect.BorderImage&&"string"==typeof t){const e=t.split(" ");e.length>0&&(e[0]=new o(e[0]).href),t=e.join(" ")}else e==u.Effect.Display&&(this.#v[e]=t);c.Dom.SetStyleProperty(this.#u,e,t)}getPropertyValue(e){if(e==u.Effect.Display)return this.#v[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=c.Dom.GetStyleProperties(this.#u,t);return JSON.parse(s)}#u;#v={}}class f extends t{constructor(e){super(e)}}class p extends d{static 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"};static JsvEnableEventListener(){c.Dom.EnableEventListener((function(e,t,...s){let i=p.#m[e];const n=i?.[t];n?.(t,...s)}))}constructor(e){super(d.ELEMENT_NODE),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=h.GenerateId(),this.style=new m(this.jsvNativeId),c.Dom.CreateElement(this.jsvNativeId,e)),this.jsvAttrStore={},this.clientSizeStore={}}appendChild(e){e.parentNode?this.#f(e,null):(super.appendChild(e),this.#p(e,null))}removeChild(e){super.removeChild(e),this.#g(e),e.jsvNativeId&&c.Dom.RemoveElementChild(this.jsvNativeId,e.jsvNativeId)}insertBefore(e,t){e.parentNode?e.parentNode==this?this.#w(e,t):this.#f(e,t):(super.insertBefore(e,t),this.#p(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.#y(s),this.jsvNativeId&&(this.jsvAddListener(this.jsvNativeId,e),c.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.#y(s),super.removeEventListener(e,t,s),this.jsvNativeId&&(this.jsvRemoveListener(this.jsvNativeId,e),c.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.clientSizeStore.clientWidth||(this.clientSizeStore.clientWidth=c.Dom.GetElementAttribute(this.jsvNativeId,"clientWidth")),this.clientSizeStore.clientWidth}get clientHeight(){return this.clientSizeStore.clientHeight||(this.clientSizeStore.clientHeight=c.Dom.GetElementAttribute(this.jsvNativeId,"clientHeight")),this.clientSizeStore.clientHeight}setAttribute(e,t){e&&(this.jsvAttrStore[e]=t,this.jsvNativeId&&(e.startsWith("data-jsv-vw-")?c.Dom.SetForgeViewInnerProps(this.jsvNativeId,e,t):"class"===e||e.startsWith("data-v-")||e.startsWith("data-jsv")||e.startsWith("dataJsv")?c.Dom.SetElementAttribute(this.jsvNativeId,e,t):"id"===e&&c.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&&c.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="jsvgetbound",t=h.GenerateId();return new Promise(((s,i)=>{const n=a=>{const o=a.jsvParams?.[1];if(o!=t)return;a.preventDefault(),this.removeEventListener(e,n);const r=JSON.parse(a.jsvParams?.[0]??"{}");0===r.status?s(r.data):i(r.error)};this.addEventListener(e,n,{jsvtoken:t})}))}jsvSetOnLazyTaskSyncedListener(e){c.Dom.AppendLazyTaskSyncedListener(this.jsvNativeId,e)}jsvOnEvent(e,...n){let a;e.startsWith("animation")?(a=new s(e),a.animationName=n[0]):e.startsWith("transition")?(a=new f(e),a.propertyName=n[0]):e.startsWith("jsv")?(a=new i(e),a.options={detail:n[0]},a.jsvParams=n):"click"==e&&(a=new t(e),a.target=this),a&&(a.target=this,this.dispatchEvent(a))}jsvGetProxyView(e){return e?(this._MaskViewProxy||(this._MaskViewProxy=a.NewDomProxyView(this.jsvNativeId,!0)),this._MaskViewProxy):(this._MainViewProxy||(this._MainViewProxy=a.NewDomProxyView(this.jsvNativeId,!1)),this._MainViewProxy)}jsvGetProxyTexture(e){return this._MainViewTextureProxy||(this._MainViewTextureProxy=e.GetDomProxyTexture(this.jsvNativeId)),this._MainViewTextureProxy}jsvGetRelativePosition(e){return c.Dom.GetRelativePosition(this.jsvNativeId,e.jsvNativeId)}jsvAddListener(e,t){let s=p.#m[e];s||(s=new Map,p.#m[e]=s);this.jsvGetEventListenerSet(t)||(s[t]=this.jsvOnEvent.bind(this))}jsvRemoveListener(e,t){let s=p.#m[e];if(!s)return;this.jsvGetEventListenerSet(t)||s.delete(t)}#w(e,t){this.jsvMoveChildReOrder(e,t),this.#N(e,t)}#f(e,t){console.log("Do move child node");let s=e.parentNode;s.jsvMoveChildToNewParent(e,this,t),this.#T(s,e,t)}#T(e,t,s){t.jsvNativeId&&(s=p.#D(s),c.Dom.MoveElementChild(this.jsvNativeId,e.jsvNativeId,t.jsvNativeId,s?.jsvNativeId))}#N(e,t){e.jsvNativeId&&(t=p.#D(t),c.Dom.ReOrderElementChild(this.jsvNativeId,e.jsvNativeId,t?.jsvNativeId))}#p(e,t){e.parentNode=this,e.nodeType===d.TEXT_NODE?this.textContent=e.nodeValue:e.jsvNativeId&&(t=p.#D(t),c.Dom.InsertElementChild(this.jsvNativeId,e.jsvNativeId,t?.jsvNativeId))}#g(e){for(const t of e.childNodes)e.#g(t);e.jsvFinalize(),c.Dom.RemoveLazyTaskSyncedListener(e.jsvNativeId),delete p.#m[e.jsvNativeId]}#y(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#D(e){let t=e;for(;t&&!(t instanceof p);)t=t.nextSibling;return t}parentNode;tagName;style;jsvNativeId;jsvAttrStore;static#m={}}class g extends p{constructor(){super(p.JsvTagName.Anchor),console.warn("Warnig: <a> is fake in JsView system"),this.href="",this.protocol="",this.host="",this.search="",this.hash="",this.hostname="",this.port="",this.pathname=""}jsvGetTagName(){return p.TAG.ANCHOR}}class w extends d{constructor(e){super(d.COMMENT_NODE),this.textContent=e}}class y extends p{constructor(){super(p.JsvTagName.Div)}get textContent(){return this.#E}set textContent(e){this.#E=e,this.clientSizeStore={},c.Dom.SetElementText(this.jsvNativeId,e)}#E}const N="FocusDebug",T="__AppRoot__";let D=!1,E=!1;function C(e,t){let s=function(e){let t="";if(e){let s=e,i=s.RouterDelegate?.ref?.NameSpace;for(i=i==T?"":i,t=`[${i?i+", ":""}${s.BranchName}]`,s=s.GetParentPage();s;)i=s.RouterDelegate?.ref?.NameSpace,i=i==T?"":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(N,`focusChange(${t?.from}):${t?.askName}\n:focusStack:${s}\n:trace:${i}:`,t)}class S{constructor(e,t){this._DefaultFocusNameSpace=null,this.RouterDelegate={ref:null},e||(this.RouterDelegate.ref=new b(!1,t))}enableFocusTrace(e){D=!0,E=e}getNameSpace(){let e=this.RouterDelegate.ref.NameSpace;return e==T?"":e}wrapWithNameSpace(e){let t=new S(!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;D&&(s={askName:e,deepToChild:t,from:"setFocus",stack:E?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 x;){let s=t.RouterDelegate?.ref?.NameSpace;e.push({nameSpace:s==T||s==t.BranchName?"":s,name:t.BranchName}),t=t.GetParentPage()}}else console.error("getCurrentFocusStack failed: router delegate is null.");return e}getLastFocus(){if(x.sLastFocus){let e=x.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._IsTemp=!!e,this._ChildMap={},this._FocusNameBeforeMount=null,this._BeforeMountStack=null,this._FocusNodeName=null,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==T?"":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?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 a=i._ChildMap[t].RouterDelegate.ref;if(a!=i&&a.NameSpace==e[s]){i=a,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){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 D&&C(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 x extends a.PageBase{constructor(e){super(e),this._OnKeyDown=null,this._OnKeyUp=null,this._OnFocus=null,this._OnBlur=null,this._DispatchKeyDown=null,this._DispatchKeyUp=null,this._OnCustomerEvent=null,this._DKeyDownProxy=void 0,this._DKeyUpProxy=void 0,this._Mounted=!1,this._MountWaitingList=null,this.BranchName=e,this.AsHub=!1,this.InterfaceHub=null,this.RouterDelegate={ref:null},this._TmpRouter=null,this._OriginDispatchKeyDown=this._OriginDispatchKeyDown.bind(this),this._OriginDispatchKeyUp=this._OriginDispatchKeyUp.bind(this),this._AutoShow=!1}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 S(!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)}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=x.safeCallback(e)}setOnKeyUp(e){this._OnKeyUp=x.safeCallback(e)}setOnFocus(e){this._OnFocus=x.safeCallback(e)}setOnBlur(e){this._OnBlur=x.safeCallback(e)}setDispatchKeyUp(e){this._DispatchKeyUp=x.safeCallback(e)}setDispatchKeyDown(e){this._DispatchKeyDown=x.safeCallback(e)}setOnCustomerEvent(e){this._OnCustomerEvent=x.safeCallback(e)}setDispatchKeyProxy(e,t){this._DKeyDownProxy=x.safeCallback(e),this._DKeyUpProxy=x.safeCallback(t)}requestFocus(e){let t=null;D&&(t={askName:this.BranchName,deepToChild:e,from:"requestFocus",stack:E?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;D&&(s={askName:t,deepToChild:!1,from:"returnFocusToParent",stack:E?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)}OnCustomerEvent(e){return!!this._OnCustomerEvent&&this._OnCustomerEvent(e)}bubbleCustomerEvent(e){this.BubbleCustomerEvent(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(),L()),e instanceof x)){if(this.RouterDelegate.ref&&this.RouterDelegate.ref._IsTemp){let t=this.RouterDelegate.ref;this.RouterDelegate.ref=null,t.forEach(((t,s)=>{e.routerAdd(s,t)}))}e.routerAdd(this.BranchName,this)}}focus(e){this.Focus(e)}Focus(e){if(!this._Mounted)return x.sFocusMemos.push({obj:this,bcf:e}),void console.log("page base tree not build, cache focus");super.Focus(e)}OnFocus(){this._OnFocus&&this._OnFocus()}OnBlur(){x.sLastFocus=this,this._OnBlur&&this._OnBlur()}onUnMount(e){x.sLastFocus==this&&(x.sLastFocus=null);let t=this.IsFocus();if(D&&t){let t=this.GetParentPage();if(t){let s=null;s={askName:t.BranchName,deepToChild:!1,from:e?"deactive":"unmount",stack:E?new Error("simulate-stack").stack:null},C(t,s)}}let s=this.GetParentPage();s&&s.RemoveSubPage(this),this.ClearSubPages(),this.routerUnbind(s?.BranchName,e)}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]==T)break;e&&e.RouterDelegate.ref!=s&&(s=e.RouterDelegate.ref,t.unshift(s.NameSpace))}while(e);return t[0]==T?t.shift():console.error("ERROR: missing app root"),t.join(".")}getNodeByName(e){return this.RouterDelegate.ref.getNodeByName(e,this)}}x.sFocusMemos=[],x.sLastFocus=null,x.sRootPageNode=null;let L=()=>{let e=x.sFocusMemos.length;if(e>0){let t=x.sFocusMemos;x.sFocusMemos=[];for(let s=0;s<e;s++)t[s].obj.Focus(t[s].bcf)}},F={};class k{constructor(e,t,s){this._Element=s,F.hasOwnProperty(e)&&console.error(`Warn: FDivRoot duplicate name=${e}`),F[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(),L()}}class I extends p{constructor(){super(p.JsvTagName.Image)}setAttribute(e,t){if("src"===e){t=new o(t).href,this.clientSizeStore={}}super.setAttribute(e,t),this.jsvNativeId&&"src"===e&&c.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 R extends p{constructor(){super(p.JsvTagName.Link),this.src=null,this.onerror=null,this.onload=null}setAttribute(e,t){this[e]=t}jsvLoadResource(){let e=!1,t=null;if(null!=this.href){var s=new o(this.href);console.log("Ignore to load link from url="+s.href),e=!0}else console.warn("Failed to load link, href is not exists."),t="NoSrc";this.jsvOnLoadResult(e,t)}jsvOnLoadResult(e,s){if(console.log("Load link result: isSuccess:"+e+", errCode:"+s),e){if(this.onload){let e=new t("load");this.onload(e)}}else this.onerror&&this.onerror({type:"jsvErr_"+s,target:this})}}class M extends p{constructor(){super(p.JsvTagName.Script)}setAttribute(e,t){this[e]=t}jsvLoadResource(){if(null!=this.src){var e=new o(this.src);console.log("Load script with url="+e.href);var t=this;window.JsView.runJsWithUrl(e.href,!1,((e,s)=>{t.jsvOnLoadResult(e,s)}))}}jsvOnLoadResult(e,s){if(console.log("Load script result: isSuccess:"+e+", errCode:"+s),e){if(this.onload){let e=new t("load");this.onload(e)}}else this.onerror&&this.onerror({type:"jsvErr_"+s,target:this})}src=null;onerror=null;onload=null;charset=null;timeout=120}class P 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 O extends d{constructor(e){super(d.TEXT_NODE),this.textContent=e}get nodeValue(){return this.textContent}set nodeValue(e){this.textContent=e,this.parentNode&&(this.parentNode.textContent=this.textContent)}}let j=1;class B extends p{constructor(){super(p.JsvTagName.JsvFDiv),this.FocusNodeRef=new x("unnamed-"+j++),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 S(!1,t);this.HubRef=e,this.FocusNodeRef.setHub(e),this.FocusNodeRef.setBranchName(t)}}removeAttribute(e){}jsvGetHub(){return this.HubRef}}class J extends d{constructor(){super(d.DOCUMENT_NODE),this.location=window.location,this.rootElement=new y,this.rootElement.ownerDocument=this,this.rootElement.id="root",c.Dom.BindElementToRootView(this.rootElement.jsvNativeId),this.activeElement=this.rootElement,this.head=null}createComment(e){return new w(e)}createElement(e){switch(e=e.toUpperCase()){case p.JsvTagName.Anchor:return new g;case p.JsvTagName.Div:return new y;case p.JsvTagName.Image:return new I;case p.JsvTagName.Link:return new R;case p.JsvTagName.Script:return new M;case p.JsvTagName.Style:return new P;case p.JsvTagName.Svg:return new _;case p.JsvTagName.JsvFDiv:return new B;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:new t(e)}createTextNode(e){return new O(e)}getElementById(e){if("root"===e||"app"===e)return this.rootElement;throw new DOMError("Failed to get element by id, id="+e+" is UNIMPLEMENTED.")}getElementsByTagName(e){if((e=e.toUpperCase())===p.JsvTagName.Head)return[this.head];if(e===p.JsvTagName.Link||e===p.JsvTagName.Script||e===p.JsvTagName.Style)return[];throw new DOMError("Failed to get element by name, name="+e+" is UNIMPLEMENTED.")}querySelector(e){if("root"===e||"#app"===e)return this.rootElement;if("head"===e)return this.head;if("base"===e)return null;if(e.startsWith("style[")&&e.endsWith("]"))return null;throw new DOMError("Failed to query selector, selectors="+e+" is UNIMPLEMENTED.")}querySelectorAll(e){return[]}jsvInitFDivRoot(e,t,s){if(!s){let e=document.createElement("fdiv");this.rootElement.appendChild(e),this.rootElement=e,s=this.rootElement}return new k(e,t,s)}}class A extends p{constructor(){super(p.JsvTagName.Head)}appendChild(e){super.appendChild(e),(e instanceof R||e instanceof M)&&e.jsvLoadResource()}removeChild(e){super.removeChild(e)}}class V{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 W extends V{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 z="@keyframes",G=z.length;class K{constructor(e){this._AnchorTag=e,this._NamesCache=new Set}insertRule(e){let t=this.#C(e);this._NamesCache.has(t)&&console.warn(`Warn: keyframe replace of name ${t}`),this._NamesCache.add(t),c.Dom.InsertKeyFrame(t,e)}hasRule(e){return this._NamesCache.has(e)}removeRule(e){this._NamesCache.has(e)?(this._NamesCache.delete(e),c.Dom.RemoveKeyFrame(e)):console.error(`Error: keyFrame(${e}) is not exist.`)}removeMultiRules(e){for(let t of e)this.removeRule(t)}#C(e){let t=e.indexOf(z)+G,s=e.indexOf("{");return e.substring(t,s).trim()}}let U=null;function H(e){return U||(U={global:new K("global")}),U.global}class q{static EnsureGlobalEnv(e,t){const s=window.navigator?.userAgent?.toLowerCase();window.jsvInAndroidWebView=s?.indexOf("android")>=0,q.#S(e,t),p.JsvEnableEventListener(),m.JsvDeclarePrototype()}static#S(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=c.Dom.DeclareStyleSheets),window.JsvCode.Dom.UndeclareStyleSheets||(window.JsvCode.Dom.UndeclareStyleSheets=c.Dom.UndeclareStyleSheets),window.JsvCode.Dom.getKeyFrameGroup||(window.JsvCode.Dom.getKeyFrameGroup=H),window.JsvCode.ForgeHandles||(window.JsvCode.ForgeHandles=new W)}}class ${static SetLevel(e){switch($.E=$.W=$.I=$.D=function(){},e){case $.Level.Verbose:$.V=console.debug.bind(console);case $.Level.Debug:$.D=console.debug.bind(console);case $.Level.Info:$.I=console.info.bind(console)}}static E=console.error.bind(console);static W=console.warn.bind(console);static I=console.info.bind(console);static D=function(){};static V=function(){};static Level={Error:0,Warning:1,Info:2,Debug:3,Verbose:4}}class X{constructor(e){this.callback=e}observe(e,t){if(!(e instanceof d))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 Y extends J{constructor(){super(),this.head=new A}set cookie(e){window.__JsvCookies.setCookie(e)}get cookie(){return window.__JsvCookies.getCookie()}}class Z{static DeclareGlobal(){Z.#b(),Z.#x(),Z.#L()}static#b(){window.document=new Y}static#x(){window.MutationObserver=X,window.Element=p,window.SVGElement=_;let e=new o(window.JsView.getAppUrl(),!0);window.location.applyUrlInfo?window.location.applyUrlInfo(e):window.location=e,window.history={},window.navigator={userAgent:"jsview-runtime"}}static#L(){window.JsView.Dom={Render:null,Extension:null,UrlRef:o}}}class Q{constructor(e){this.activity=new a.ReactActivity("NativeForgeActivity",e,null,null),this.#F()}#F(){console.log("create NativeForgeActivity.");let e=new a.LayoutView;window.JsvCode.ForgeHandles.setHandles(this.activity.GetTextureManager(),e,this.activity);let t=null;a.DesignMap&&(t=a.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}),a.sRenderBridge.AddWillSwapListener("forgeSwap",(()=>{c.Dom.RequestSwapAllCachedTasks()})),window.JsView.Dom.Render()}}class ee{constructor(e){this.activityManager=e;let t=new Q(e);e.RegisterActivity(t.activity),e.StartActivity(new a.Intent("NativeForgeActivity"))}}window.jsvIsBrowserDebug=!1;const te=window.JsvCode.NativePlatformDomBridge,se=window.JsvCode.NativePlatformMediaBridge;function ie(){q.EnsureGlobalEnv(te,se),Z.DeclareGlobal(),$.I("Using JsView Native Environment.")}export{ie as InitEnv,ee 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=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))}insertAdjacentElement(e,t){switch(e){case"beforebegin":if(null==this.parentNode)return null;this.parentNode.insertBefore(t,this);break;case"afterend":if(null==this.parentNode)return null;const e=this.nextSibling;e?this.parentNode.insertBefore(t,e):this.parentNode.appendChild(t);break;case"afterbegin":const s=this.firstElementChild;s?this.insertBefore(t,s):this.appendChild(t);break;case"beforeend":this.appendChild(t);break;default:return console.error("Failed to insert adjacent element, where is not valid."),null}return 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 k 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 L extends E{constructor(e){super(E.COMMENT_NODE),this.textContent=e}}class F 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 F,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 L(e)}createElement(e){switch(e=e.toUpperCase()){case P.JsvTagName.Anchor:return new k;case P.JsvTagName.Div:return new F;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};
|
|
2
2
|
|