@shijiu/jsview-vue 0.9.276 → 0.9.277

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shijiu/jsview-vue",
3
- "version": "0.9.276",
3
+ "version": "0.9.277",
4
4
  "bin": {
5
5
  "jsview-post-build": "./scripts/jsview-post-build.js",
6
6
  "jsview-post-install": "./scripts/jsview-post-install.js",
@@ -21,5 +21,12 @@
21
21
  "license": "MIT",
22
22
  "engines": {
23
23
  "node": ">=14.0.0"
24
+ },
25
+ "dependencies": {
26
+ "vue": "3.2.8",
27
+ "vue-router": "4.0.11"
28
+ },
29
+ "devDependencies": {
30
+ "@vue/compiler-sfc": "3.2.8"
24
31
  }
25
32
  }
@@ -1 +1 @@
1
- import{openBlock as t,createElementBlock as e,normalizeStyle as i,renderSlot as s,createCommentVNode as n,resolveComponent as o,Fragment as h,renderList as r,createBlock as a,withCtx as l,normalizeProps as d,guardReactiveProps as c,createElementVNode as g,createVNode as p,reactive as u,ref as m}from"vue";class b{constructor(){this._Component=null,this.registerComponent=this.registerComponent.bind(this),this.unregisterComponent=this.unregisterComponent.bind(this),this.dispatch=this.dispatch.bind(this)}registerComponent(t){this._Component=t}unregisterComponent(){this._Component=null}dispatch(t){t&&this._Component&&this._Component._dispatchEvent(t)}}const f={left:Symbol("left"),right:Symbol("right"),top:Symbol("top"),bottom:Symbol("bottom"),opposite:t=>{switch(t){case f.left:return f.right;case f.right:return f.left;case f.top:return f.bottom;case f.bottom:return f.top}}},I={seamLess:Symbol("seamless"),wholePage:Symbol("wholePage"),seamlessFixedId:Symbol("seamlessFixedId")},x=Symbol("vertical"),_=Symbol("horizontal"),L=(t,e,i,s)=>({width:t,height:e,focusable:i,hasSub:s}),y="fdivRouter";class E extends b{}E.Type={setFocusId:Symbol("setFocusId"),setFocusRect:Symbol("setFocusRect"),updateItem:Symbol("updateItem"),slideToItem:Symbol("slideTo")},void 0===window.Forge&&(window.Forge={});const w=window.Forge;var S={props:{data:Object,loadAll:Boolean,enableTouch:Boolean,controlObj:Object,onEdge:Function,widgetHandler:Object},setup:t=>({onAction:{register(t,e){this[t]=e}},element:{},queryObj:{id:t.data.id,position:t.widgetHandler.queryTemplatePosition,absolutePosition:t.widgetHandler.queryPosition}}),methods:{onFocus(t){this.onAction.onFocus&&this.onAction.onFocus(t)},onBlur(){this.onAction.onBlur&&this.onAction.onBlur()},onClick(){return!!this.onAction.onClick&&this.onAction.onClick()}},created(){this.widgetHandler.registerItemFunc(this.data.id,{onFocus:this.onFocus,onBlur:this.onBlur,onClick:this.onClick})},mounted(){if(this.$refs.element&&this.enableTouch){let e=this.$refs.element.jsvMaskView;var t=new w.DragSetting(w.DragSetting.DIRECTION_DISABLE,20,!1,new w.RectArea(0,0,0,0),-1,3/4);let i={OnTap:t=>(console.log("Item View Container OnTap:",t),this.onClick(this.data.id))};e.EnableDrag(t,i,"translateMat(dx,dy,0)")}},updated(){},beforeUnmount(){}};S.render=function(o,h,r,a,l,d){return r.loadAll||r.controlObj.visible?(t(),e("div",{key:r.data.xPos+"_"+r.data.yPos,ref:"element",style:i({left:r.data.xPos,top:r.data.yPos,width:r.data.width,height:r.data.height,zIndex:r.controlObj.zIndex})},[s(o.$slots,"renderItem",{data:r.data.data,onEdge:r.onEdge,onAction:a.onAction,query:a.queryObj})],4)):n("v-if",!0)},S.__file="src/SimpleWidget/ItemView.vue";var P={props:{onItemEdge:Function,data:Object,loadAll:Boolean,enableTouch:Boolean,onLoad:Function,widgetHandler:Object},components:{ItemView:S},mounted(){this.onLoad()},updated(){this.onLoad()}};P.render=function(i,n,g,p,u,m){const b=o("item-view");return t(!0),e(h,null,r(g.data.data,(e=>(t(),a(b,{key:e.id,data:e.data,loadAll:g.loadAll,enableTouch:g.enableTouch,onEdge:g.onItemEdge,controlObj:e.controller,widgetHandler:g.widgetHandler},{renderItem:l((t=>[s(i.$slots,"renderItem",d(c(t)))])),_:2},1032,["data","loadAll","enableTouch","onEdge","controlObj","widgetHandler"])))),128)},P.__file="src/SimpleWidget/ContentView.vue";var v={props:{data:Object,onItemEdge:Function,onLoad:Function,register:Function,widgetHandler:Object,x:Number,y:Number,width:Number,height:Number,loadAll:Boolean,enableTouch:Boolean,touchListener:Function,flingPageWidth:Number,flingPageEdge:Number,slidePile:Object,direction:Number},components:{ContentView:P},data:()=>({innerX:0,innerY:0}),setup:()=>({element:{}}),methods:{$_rootView_initTouch_(){if(this.touchListener&&this.$refs.element){let e=this.$refs.element.jsvMaskView,i=this.flingPageWidth,s=this.flingPageEdge,n=this.slidePile;var t=new w.DragSetting(this.direction,20,!1,n,i,s);e.EnableDrag(t,this.touchListener,"translateMat(dx,dy,0)")}},updatePosition(t,e,i){if(this.$refs.element){let s=this.$refs.element.jsvMaskView.GetLayoutParams();if(this.innerX=t,this.innerY=e,i){let n=Math.abs(s.MarginLeft-t),o=Math.abs(s.MarginTop-e),h=Math.round(0===n?o/i.speed:n/i.speed),r=new w.TranslateAnimation(s.MarginLeft-t,0,s.MarginTop-e,0,h,i.easing);r.SetAnimationListener(new w.AnimationListener(i.onstart,i.onend,null)),this.$refs.element.jsvMaskView.StartAnimation(r)}}}},created(){this.register&&this.register(this)},mounted(){this.$_rootView_initTouch_()}};v.render=function(n,h,r,a,u,m){const b=o("content-view");return t(),e("div",{style:i({left:r.x,top:r.y})},[g("div",{key:"touchcontainer",ref:"element",style:i({left:u.innerX,top:u.innerY,width:r.width,height:r.height})},[p(b,{data:r.data,onItemEdge:r.onItemEdge,loadAll:r.loadAll,enableTouch:r.enableTouch,onLoad:r.onLoad,widgetHandler:r.widgetHandler},{renderItem:l((t=>[s(n.$slots,"renderItem",d(c(t)))])),_:3},8,["data","onItemEdge","loadAll","enableTouch","onLoad","widgetHandler"])],4)],4)},v.__file="src/SimpleWidget/RootView.vue";class F{constructor(t,e){this.Start=t,this.End=e}Merge(t){return this.IsInterAct(t)?(this.Start>t.Start&&(this.Start=t.Start),this.End<t.End&&(this.End=t.End),!0):this.End+1===t.Start?(this.End=t.End,!0):this.Start===t.End+1&&(this.Start=t.Start,!0)}IsInterAct(t){return t.Start<this.Start?!(t.End<this.Start):t.Start<=this.End}Exclude(t){const e={success:!1,newSplitedRange:null};return this.IsInterAct(t)?(t.Start<=this.Start?t.End<this.End?this.Start=t.End+1:this.Clear():(t.End<this.End&&(e.newSplitedRange=new F(t.End+1,this.End)),this.End=t.Start-1),e.success=!0,e):e}IsEmpty(){return this.Start>this.End}Clear(){this.End=this.Start-1}Clone(){return new F(this.Start,this.End)}}class N{constructor(t,e){this.Ranges=[],void 0!==t&&void 0!==e&&this.Ranges.push(new F(t,e))}Merge(t){let e=!1,i=this.Ranges.length;for(let s=0;s<this.Ranges.length;s++){if(t.End+1<this.Ranges[s].Start){i=s;break}if(this.Ranges[s].Merge(t)){for(e=!0;s+1<this.Ranges.length&&this.Ranges[s].Merge(this.Ranges[s+1]);)this.Ranges.splice(s+1,1);break}}e||this.Ranges.splice(i,0,t)}Exclude(t){for(let e=0;e<this.Ranges.length&&!(t.End<this.Ranges[e].Start);e++){const i=this.Ranges[e].Exclude(t);if(this.Ranges[e].IsEmpty()&&(this.Ranges.splice(e,1),e--),null!==i.newSplitedRange){this.Ranges.splice(e+1,0,i.newSplitedRange);break}}}ForEach(t,e){if(t)if(e)for(let e=this.Ranges.length-1;e>=0;e--)for(let i=this.Ranges[e].End;i>=this.Ranges[e].Start;i--)t(i);else for(let e=0;e<this.Ranges.length;e++)for(let i=this.Ranges[e].Start;i<=this.Ranges[e].End;i++)t(i);else console.log("Callback function is invalid")}}class k{constructor(t,e,i,s){this.x="number"==typeof t?t:0,this.y="number"==typeof e?e:0,("number"!=typeof i||i<0)&&(i=0),this.width=i,("number"!=typeof s||s<0)&&(s=0),this.height=s}Equals(t){return null!==t&&(t.x===this.x&&t.y===this.y&&t.width===this.width&&t.height===this.height)}}class T{constructor(t,e,i){this.IdsMap=[],this._IdsTotal=-1,this.List=[],this.Orient={type:t,widthMax:e},this.Layout={type:i||"relative"}}SetIdsMap(t,e){this.IdsMap[t]=e,this._IdsTotal=-1,this.List[e].id=t}AddItem(t){this.List.push(t)}GetIdsTotal(){if(this._IdsTotal<0){let t=0;for(let e=0;e<this.List.length;e++)this.List[e].id>=0&&t++;this._IdsTotal=t}return this._IdsTotal}}T.getTemplateItem=function(t,e){return{id:-1,hasSub:!!t.hasSub,xPos:t.x?t.x:0,yPos:t.y?t.y:0,centerXPos:0,centerYPos:0,width:void 0!==t.width?t.width:t.blocks.w,height:void 0!==t.height?t.height:t.blocks.h,focusAble:void 0===t.focusable||t.focusable,needRedraw:void 0===t.needRedraw||t.needRedraw,onBottomLine:!1,view:null,data:e,mounted:!1}};class R{constructor(t,e,i,s){this._Gaps=[{GapStart:0,GapEnd:i-1}],this._FenceTotalWidth=i,this.AheadOffset=s,e>0&&this._SplitGap(0,t,e)}HasGapFor(t){for(let e=0;e<this._Gaps.length;e++)if(this._Gaps[e].GapEnd-this._Gaps[e].GapStart+1>=t)return{startPos:this._Gaps[e].GapStart};return null}MarkGapUsed(t,e){if(e<=0)return this._Gaps.length;const i=t+e-1;let s=-1;for(let e=0;e<this._Gaps.length;e++)if(this._Gaps[e].GapStart<=t&&this._Gaps[e].GapEnd>=i){s=e;break}return-1===s&&console.log(`Error in mark gap used, not found suitable gap of offset=${this.AheadOffset}`),this._SplitGap(s,t,e),this._Gaps.length}_SplitGap(t,e,i){const s=this._Gaps.splice(t,1)[0],n=e+i-1;(e<s.GapStart||n>s.GapEnd)&&console.log("ERROR in split Fence Gap, range overflow"),n!==s.GapEnd&&this._Gaps.splice(t,0,{GapStart:n+1,GapEnd:s.GapEnd}),e!==s.GapStart&&this._Gaps.splice(t,0,{GapStart:s.GapStart,GapEnd:e-1})}Fork(t){const e=new R(0,0,0,0);return e._Gaps=JSON.parse(JSON.stringify(this._Gaps)),e._FenceTotalWidth=this._FenceTotalWidth,e.AheadOffset=t,e}}class O{constructor(t,e,i,s,n){this._Template=new T(t,e,i),this._FenceStack=[new R(0,0,this._Template.Orient.widthMax,0)],this._Identity=0,this._MoveLimitArea=new k(0,0,s,n),this._FenceEdge={StartX:0,StartY:0},this._NotOccupiedEdgeList=[],this._SupportHistoryPath=!1,this._VisibleRangeSearchBaseItem=null}_CheckNeighborItemMatching(t,e,i){let s=!1;const n=e.edgeObj,o=i.edgeObj;let h="rightEdge",r="leftEdge";switch(t){case"left":h="rightEdge",r="leftEdge";break;case"right":h="leftEdge",r="rightEdge";break;case"top":h="bottomEdge",r="topEdge";break;case"bottom":r="bottomEdge",h="topEdge";break;default:console.log(`_CheckNeighborItemMatching unknown direction:${t}`)}const a=o[h].range.Start,l=o[h].range.Clone();o[h].range.Exclude(n[r].range),n[r].range.Exclude(l);const d=o[h].range.Start;return o[h].range.IsEmpty()&&(o[h]=null,s=!0),n[r].range.IsEmpty()&&(n[r]=null,s=!0),a!==d&&(s=!0),s}_FindNearestNeighbor(t){const e=t.edgeObj;let i=-1,s=-1,n=-1,o=-1,h=-1,r=-1,a=-1,l=-1;for(let d=0;d<this._NotOccupiedEdgeList.length;d++){const c=this._NotOccupiedEdgeList[d],g=c.edgeObj;if(t!==c){if(null!==e.leftEdge&&null!==g.rightEdge&&e.leftEdge.x>=g.rightEdge.x&&e.leftEdge.range.IsInterAct(g.rightEdge.range)){if(-1===h){h=e.leftEdge.x-g.rightEdge.x,i=d;continue}if(h>e.leftEdge.x-g.rightEdge.x){h=e.leftEdge.x-g.rightEdge.x,i=d;continue}}if(null!==e.rightEdge&&null!==g.leftEdge&&e.rightEdge.x<=g.leftEdge.x&&e.rightEdge.range.IsInterAct(g.leftEdge.range)){if(-1===r){r=g.leftEdge.x-e.rightEdge.x,s=d;continue}if(r>g.leftEdge.x-e.rightEdge.x){r=g.leftEdge.x-e.rightEdge.x,s=d;continue}}if(null!==e.topEdge&&null!==g.bottomEdge&&e.topEdge.y>=g.bottomEdge.y&&e.topEdge.range.IsInterAct(g.bottomEdge.range)){if(-1===a){a=e.topEdge.y-g.bottomEdge.y,n=d;continue}if(a>e.topEdge.y-g.bottomEdge.y){a=e.topEdge.y-g.bottomEdge.y,n=d;continue}}if(null!==e.bottomEdge&&null!==g.topEdge&&e.bottomEdge.y<=g.topEdge.y&&e.bottomEdge.range.IsInterAct(g.topEdge.range)){if(-1===l){l=g.topEdge.y-e.bottomEdge.y,o=d;continue}if(l>g.topEdge.y-e.bottomEdge.y){l=g.topEdge.y-e.bottomEdge.y,o=d;continue}}}}return{left:i,right:s,top:n,bottom:o}}_CalculateNeighborItem(t){const e=this._Template.List;for(let i=0;i<this._NotOccupiedEdgeList.length;i++){const s=this._NotOccupiedEdgeList[i],n=s.edgeObj,o=s.index;if(this._Template.Orient.type===x){if(null===n.bottomEdge){this._NotOccupiedEdgeList.splice(i,1),i--;continue}if(!t&&n.bottomEdge.y>this._FenceEdge.StartY)continue}else{if(null===n.rightEdge){this._NotOccupiedEdgeList.splice(i,1),i--;continue}if(!t&&n.rightEdge.x>this._FenceEdge.StartX)continue}const h=this._FindNearestNeighbor(s);if(-1!==h.left){const i=this._NotOccupiedEdgeList[h.left],n=i.index;if(t)e[n].tmpNeighborIndexList.right.push(o),e[o].tmpNeighborIndexList.left.push(n);else{this._CheckNeighborItemMatching("left",s,i)&&(e[n].neighborIndexList.right.push(o),e[o].neighborIndexList.left.push(n),e[n].tmpNeighborIndexList.right=[],e[o].tmpNeighborIndexList.left=[])}}if(-1!==h.right){const i=this._NotOccupiedEdgeList[h.right],n=i.index;if(t)e[n].tmpNeighborIndexList.left.push(o),e[o].tmpNeighborIndexList.right.push(n);else{this._CheckNeighborItemMatching("right",s,i)&&(e[n].neighborIndexList.left.push(o),e[o].neighborIndexList.right.push(n),e[n].tmpNeighborIndexList.left=[],e[o].tmpNeighborIndexList.right=[])}}if(-1!==h.top){const i=this._NotOccupiedEdgeList[h.top],n=i.index;if(t)e[n].tmpNeighborIndexList.bottom.push(o),e[o].tmpNeighborIndexList.top.push(n);else{this._CheckNeighborItemMatching("top",s,i)&&(e[n].neighborIndexList.bottom.push(o),e[o].neighborIndexList.top.push(n),e[n].tmpNeighborIndexList.bottom=[],e[o].tmpNeighborIndexList.top=[])}}if(-1!==h.bottom){const i=this._NotOccupiedEdgeList[h.bottom],n=i.index;if(t)e[n].tmpNeighborIndexList.top.push(o),e[o].tmpNeighborIndexList.bottom.push(n);else{this._CheckNeighborItemMatching("bottom",s,i)&&(e[n].neighborIndexList.top.push(o),e[o].neighborIndexList.bottom.push(n),e[n].tmpNeighborIndexList.top=[],e[o].tmpNeighborIndexList.bottom=[])}}}}_TryCalculateNeighborItem(t,e,i,s,n){const o={index:t,edgeObj:{leftEdge:{x:e,range:new F(i,i+n-1)},rightEdge:{x:e+s,range:new F(i,i+n-1)},topEdge:{y:i,range:new F(e,e+s-1)},bottomEdge:{y:i+n,range:new F(e,e+s-1)}}};0===e&&(o.edgeObj.leftEdge=null),0===i&&(o.edgeObj.topEdge=null);let h=!1;const r=this._Template.Orient.widthMax;let a=this._FenceEdge.StartX,l=this._FenceEdge.StartY;this._Template.Orient.type===x?(e+s===r&&(o.edgeObj.rightEdge=null),i>this._FenceEdge.StartY&&(h=!0,l=i)):(i+n===r&&(o.edgeObj.bottomEdge=null),e>this._FenceEdge.StartX&&(h=!0,a=e)),this._FenceEdge.StartX=a,this._FenceEdge.StartY=l,this._NotOccupiedEdgeList.push(o),h&&this._CalculateNeighborItem()}_UpdateLastFenceEdge(){const t=this._FenceEdge,e={StartX:-1,StartY:-1};for(let i=0;i<this._NotOccupiedEdgeList.length;i++){const s=this._NotOccupiedEdgeList[i].edgeObj;this._Template.Orient.type===x?null!==s.bottomEdge&&s.bottomEdge.y>t.StartY&&(-1===e.StartY||s.bottomEdge.y<e.StartY)&&(e.StartY=s.bottomEdge.y):null!==s.rightEdge&&s.rightEdge.x>t.StartX&&(-1===e.StartX||s.rightEdge.y<e.StartX)&&(e.StartX=s.rightEdge.x)}this._FenceEdge=e}ParseTemplateItem(t,e){const i=T.getTemplateItem(t,e),s=this._FenceStack;let n=-1,o=1;const h=i.id,r=i.width,a=i.height;let l,d,c,g,p=0,u=0,m=0,b=0,f=0;if("relative"===this._Template.Layout.type){b=this._Template.Orient.type===x?r:a,f=this._Template.Orient.type===x?a:r;let t=null,e=null;for(;s.length>0;){const i=s[s.length-1];if(e=i.HasGapFor(b),null!==e){t=i;break}s.pop()}null!==e?(p=e.startPos,u=t.AheadOffset):console.log("ERROR: coding error, header full gap fence lost"),this._Template.Orient.type===x?(l=p,d=u,c=b,g=f,m=(d+g)/this._MoveLimitArea.height):(l=u,d=p,c=f,g=b,m=(l+c)/this._MoveLimitArea.width)}else l=i.xPos,d=i.yPos,c=r,g=a,m=this._Template.Orient.type===x?(d+g)/this._MoveLimitArea.height:(l+c)/this._MoveLimitArea.width;-1===n&&(n=h);const I=Math.ceil(m);m>=0&&I!==o&&(o=I,n=h),i.curPageHeadId=n,i.neighborIndexList={left:[],top:[],right:[],bottom:[]},i.tmpNeighborIndexList={left:[],top:[],right:[],bottom:[]},i.pathHistory={left:null,top:null,right:null,bottom:null},i.xPos=l,i.yPos=d,i.centerXPos=Math.floor(l+c/2)-1,i.centerYPos=Math.floor(d+g/2)-1,this._Template.Orient.type!==x&&d+g===this._Template.Orient.widthMax&&(i.onBottomLine=!0),this._Template.AddItem(i),i.focusAble&&this._Template.SetIdsMap(this._Identity++,this._Template.List.length-1),this._TryCalculateNeighborItem(this._Template.List.length-1,i.xPos,i.yPos,i.width,i.height);const _=u+f-1;s[0].AheadOffset<=_&&s.splice(0,0,new R(0,0,this._Template.Orient.widthMax,_+1));let L=!1,y=!1,E=-1;for(let t=s.length-1;t>=0;t--){if(!(s[t].AheadOffset<=_)){s[t].AheadOffset===_+1&&(y=!0),E=t;break}s[t].AheadOffset===_&&(L=!0);0===s[t].MarkGapUsed(p,b)&&s.splice(t,1)}const w=_;if(!L&&E+1<=s.length-1){const t=s[E+1].Fork(w);s.splice(E+1,0,t)}if(!y&&E>0){const t=s[E].Fork(w+1);s.splice(E+1,0,t)}}GetItem(t){return this._Template.List[this._Template.IdsMap[t]]}GetIndex(t){return this._Template.IdsMap[t]}_CheckIdsHasFocusable(t){const e=this._Template.List;let i=!1;for(let s=0;s<t.length;s++){if(e[t[s]].focusAble){i=!0;break}}return i}_IsInNeighborList(t,e){let i=!1;for(let s=t.length-1;s>=0;s--)if(t[s]===e){i=!0;break}return i}_GetValidNeighborIndex(t,e,i){const s=this._Template.List;let n=-1;const o=s[e],h=s[t];let r=null,a=null;if("top"===i?(a=o.neighborIndexList.left,r=o.neighborIndexList.right):(a=o.neighborIndexList.right,r=o.neighborIndexList.left),r.length>0)for(let t=0;t<r.length;t++){const e=r[t],o=s[e];if(o.focusAble&&("top"===i&&o.yPos+o.height<=h.yPos||"bottom"===i&&o.yPos>=h.yPos+h.height)){n=e;break}}if(-1===n&&a.length>0)for(let t=0;t<a.length;t++){const e=a[t],o=s[e];if(o.focusAble&&("top"===i&&o.yPos+o.height<=h.yPos||"bottom"===i&&o.yPos>=h.yPos+h.height)){n=e;break}}return n}_CaculateNeighborItem(t){const e=this._Template.List;for(let i=0;i<this._NotOccupiedEdgeList.length;i++){const s=this._NotOccupiedEdgeList[i],n=s.edgeObj,o=s.index;if(this._Template.Orient.type===x){if(null===n.bottomEdge){this._NotOccupiedEdgeList.splice(i,1),i--;continue}if(!t&&n.bottomEdge.y>this._FenceEdge.StartY)continue}else{if(null===n.rightEdge){this._NotOccupiedEdgeList.splice(i,1),i--;continue}if(!t&&n.rightEdge.x>this._FenceEdge.StartX)continue}const h=this._FindNearestNeighbor(s);if(-1!==h.left){const i=this._NotOccupiedEdgeList[h.left],n=i.index;if(t)e[n].tmpNeighborIndexList.right.push(o),e[o].tmpNeighborIndexList.left.push(n);else{this._CheckNeighborItemMatching("left",s,i)&&(e[n].neighborIndexList.right.push(o),e[o].neighborIndexList.left.push(n),e[n].tmpNeighborIndexList.right=[],e[o].tmpNeighborIndexList.left=[])}}if(-1!==h.right){const i=this._NotOccupiedEdgeList[h.right],n=i.index;if(t)e[n].tmpNeighborIndexList.left.push(o),e[o].tmpNeighborIndexList.right.push(n);else{this._CheckNeighborItemMatching("right",s,i)&&(e[n].neighborIndexList.left.push(o),e[o].neighborIndexList.right.push(n),e[n].tmpNeighborIndexList.left=[],e[o].tmpNeighborIndexList.right=[])}}if(-1!==h.top){const i=this._NotOccupiedEdgeList[h.top],n=i.index;if(t)e[n].tmpNeighborIndexList.bottom.push(o),e[o].tmpNeighborIndexList.top.push(n);else{this._CheckNeighborItemMatching("top",s,i)&&(e[n].neighborIndexList.bottom.push(o),e[o].neighborIndexList.top.push(n),e[n].tmpNeighborIndexList.bottom=[],e[o].tmpNeighborIndexList.top=[])}}if(-1!==h.bottom){const i=this._NotOccupiedEdgeList[h.bottom],n=i.index;if(t)e[n].tmpNeighborIndexList.top.push(o),e[o].tmpNeighborIndexList.bottom.push(n);else{this._CheckNeighborItemMatching("bottom",s,i)&&(e[n].neighborIndexList.top.push(o),e[o].neighborIndexList.bottom.push(n),e[n].tmpNeighborIndexList.top=[],e[o].tmpNeighborIndexList.bottom=[])}}}}CalculateNeighborWhenAddStop(){this._UpdateLastFenceEdge(),this._CaculateNeighborItem();this._CaculateNeighborItem(!0);const t=this._Template.List;let e=t.length-1,i=t[e];for(let s=t.length-1;s>=0;s--)if(i=t[s],i.focusAble){e=s;break}for(let e=t.length-1;e>=0;e--){const i=t[e];if(i.focusAble){if(i.neighborIndexList.bottom.length>0&&!this._CheckIdsHasFocusable(i.neighborIndexList.bottom)){const t=i.neighborIndexList.bottom[i.neighborIndexList.bottom.length-1],s=this._GetValidNeighborIndex(e,t,"bottom");-1!==s&&(i.neighborIndexList.bottom=[],i.neighborIndexList.bottom.push(s))}if(i.neighborIndexList.top.length>0&&!this._CheckIdsHasFocusable(i.neighborIndexList.top)){const t=this._GetValidNeighborIndex(e,i.neighborIndexList.top[i.neighborIndexList.top.length-1],"top");-1!==t&&(i.neighborIndexList.top=[],i.neighborIndexList.top.push(t))}}}if(this._Template.Orient.type!==x){let s=null,n=-1,o=0;for(let h=e-1;h>=0;h--){const r=t[h];r.focusAble&&r.yPos>=i.yPos+i.height&&(0!==r.neighborIndexList.right.length&&this._CheckIdsHasFocusable(r.neighborIndexList.right)&&!this._IsInNeighborList(r.neighborIndexList.right,e)||(o=(i.xPos-r.xPos)**2+(i.yPos-r.yPos)**2,(-1===n||n>o)&&(n=o,s=h)))}s&&(i.neighborIndexList.bottom=[],i.neighborIndexList.bottom.push(s))}else for(let s=e-1;s>=0;s--){const n=t[s];n.focusAble&&n.yPos+n.height<i.yPos+i.height&&0===n.neighborIndexList.bottom.length&&n.neighborIndexList.bottom.push(e)}}GetNextItem(t,e,i,s){0===e&&0===i&&console.log("GetNextItem(): offset is 0"),0!==e&&0!==i&&console.log("GetNextItem(): not support change vertical and horizontal and the same time");const n=this._Template.IdsMap[t];let o;return o=0!==e?this._GetNextItemVertical(n,e):this._GetNextItemHorizontal(n,i),s&&null===o&&(o=0!==e?this._GetNextLoopItemVertical(n,e):this._GetNextLoopItemHorizontal(n,i)),null===o?-1:o.id}_GetNextItemVertical(t,e){const i=this._Template.List,s=i[t].centerXPos;let n="top",o="bottom";e>0&&(o="top",n="bottom");let h=i.length-1;const r=this._Template.Orient.type;for(let t=i.length-1;t>=0;t--){if(i[t].focusAble){h=t;break}}let a=!1,l=-1,d=null;if(this._SupportHistoryPath&&(d=i[t].pathHistory[n]),null===d){let e=i[t].neighborIndexList[n];if(i[t].tmpNeighborIndexList[n].length>0&&(e=e.concat(i[t].tmpNeighborIndexList[n])),1===e.length)l=e[0],h===t&&"bottom"===n&&r===_||(i[t].pathHistory[n]=l,i[l].pathHistory[o]=t),a=!0;else{for(let d=0;d<e.length;d++){l=e[d];const c=i[l];if(s<=c.xPos+c.width-1&&s>=c.xPos){h===t&&"bottom"===n&&r===_||(i[t].pathHistory[n]=l,i[l].pathHistory[o]=t),a=!0;break}}if(!a||!i[l].focusAble)for(let s=0;s<e.length;s++){const d=e[s];if(i[d].focusAble){h===t&&"bottom"===n&&r===_||(i[t].pathHistory[n]=l,i[l].pathHistory[o]=t),l=d,a=!0;break}}}}else l=d,h===t&&"bottom"===n&&r===_||(i[l].pathHistory[o]=t),a=!0;return a?i[l].focusAble?i[l]:this._GetNextItemVertical(l,e):null}_GetNextItemHorizontal(t,e){const i=this._Template.List,s=i[t].centerYPos;let n="left",o="right";e>0&&(o="left",n="right");let h=i.length-1;const r=this._Template.Orient.type;for(let t=i.length-1;t>=0;t--){if(i[t].focusAble){h=t;break}}let a=!1,l=-1,d=null;if(this._SupportHistoryPath&&(d=i[t].pathHistory[n]),null===d){let e=i[t].neighborIndexList[n];if(i[t].tmpNeighborIndexList[n].length>0&&(e=e.concat(i[t].tmpNeighborIndexList[n])),1===e.length)l=e[0],h===t&&"right"===n&&r===x||(i[t].pathHistory[n]=l,i[l].pathHistory[o]=t),a=!0;else{for(let d=0;d<e.length;d++){l=e[d];const c=i[l];if(s<=c.yPos+c.height-1&&s>=c.yPos){h===t&&"right"===n&&r===x||(i[t].pathHistory[n]=l,i[l].pathHistory[o]=t),a=!0;break}}if(!a||!i[l].focusAble)for(let s=0;s<e.length;s++){const d=e[s];if(i[d].focusAble){h===t&&"right"===n&&r===x||(i[t].pathHistory[n]=l,i[l].pathHistory[o]=t),l=d,a=!0;break}}}}else l=d,h===t&&"right"===n&&r===x||(i[l].pathHistory[o]=t),a=!0;return a?i[l].focusAble?i[l]:this._GetNextItemHorizontal(l,e):null}_GetNextLoopItemVertical(t,e){const i=this._Template.List,s=i[t].centerXPos;let n="bottom";e>0&&(n="top");let o=!1,h=-1,r=i[t].neighborIndexList[n];for(i[t].tmpNeighborIndexList[n].length>0&&(r=r.concat(i[t].tmpNeighborIndexList[n]));r.length>=1;)for(let t=0;t<r.length;t++){h=r[t];const e=i[h];if(s<=e.xPos+e.width-1&&s>=e.xPos){r=i[h].neighborIndexList[n],o=!0;break}}return o?i[h].focusAble?i[h]:this._GetNextLoopItemVertical(h,e):null}_GetNextLoopItemHorizontal(t,e){const i=this._Template.List,s=i[t].centerYPos;let n="right";e>0&&(n="left");let o=!1,h=-1,r=i[t].neighborIndexList[n];for(i[t].tmpNeighborIndexList[n].length>0&&(r=r.concat(i[t].tmpNeighborIndexList[n]));r.length>=1;)for(let t=0;t<r.length;t++){h=r[t];const e=i[h];if(s<=e.yPos+e.height-1&&s>=e.yPos){r=i[h].neighborIndexList[n],o=!0;break}}return o?i[h].focusAble?i[h]:this._GetNextLoopItemHorizontal(h,e):null}GetTemplate(){return this._Template}GetVisibleItemList(t,e,i){if(t>e)return null;t=Math.round(t),e=Math.round(e);const s=this._Template.IdsMap[i],n={resultStartIdx:-1,resultEndIdx:-1,enableBackwardSearching:!0,enableForwardSearching:!0,checkingStartLinePos:t,checkingEndLinePos:e},o={searchDirect:-1,baseIdx:s,checkingStartLineRanges:new N,startLineRangesFulled:!1,latestOverStartLineIdx:-1,checkingEndLineRanges:new N,endLineRangesFulled:!1,latestOverEndLineIdx:-1,endSearchingIndex:0,firstStartLineBlockIdx:-1,firstEndLineBlockIdx:-1,searchToBorder:!1,common:n},h={searchDirect:1,baseIdx:s,checkingStartLineRanges:new N,startLineRangesFulled:!1,latestOverStartLineIdx:-1,checkingEndLineRanges:new N,endLineRangesFulled:!1,latestOverEndLineIdx:-1,endSearchingIndex:this._Template.List.length-1,firstStartLineBlockIdx:-1,firstEndLineBlockIdx:-1,searchToBorder:!1,common:n},r=this._Template.Orient.type===x;let a=0;for(;n.enableBackwardSearching||n.enableForwardSearching;)n.enableBackwardSearching&&this._DoSearching(o,-a,r),n.enableForwardSearching&&this._DoSearching(h,a,r),a++;if(n.resultStartIdx<0&&(o.latestOverStartLineIdx>=0&&o.firstStartLineBlockIdx>=0?n.resultStartIdx=o.latestOverStartLineIdx:h.firstStartLineBlockIdx>=0&&(n.resultStartIdx=h.firstStartLineBlockIdx)),n.resultEndIdx<0&&(h.latestOverEndLineIdx>=0&&h.firstEndLineBlockIdx>=0?n.resultEndIdx=h.latestOverEndLineIdx:o.firstEndLineBlockIdx>=0&&(n.resultEndIdx=o.firstEndLineBlockIdx)),n.resultStartIdx<0&&n.resultEndIdx<0){const i=this._Template.List[0],s=r?i.yPos:i.xPos,o=this._Template.List[this._Template.List.length-1],h=r?o.yPos:o.xPos,a=r?o.height:o.width;s>t&&h+a<e&&(n.resultStartIdx=0,n.resultEndIdx=this._Template.List.length-1)}let l=null;if(n.resultStartIdx>=0||n.resultEndIdx>=0){l={visibleStart:n.resultStartIdx>=0?n.resultStartIdx:0,visibleEnd:n.resultEndIdx>=0?n.resultEndIdx:this._Template.List.length-1}}return l}_DoSearching(t,e,i){const s=this._Template.List[t.baseIdx+e],n=i?s.xPos:s.yPos,o=i?s.width:s.height,h=i?s.yPos:s.xPos,r=i?s.height:s.width;if(t.common.resultStartIdx<0&&!t.startLineRangesFulled){let i=!1;if(h<=t.common.checkingStartLinePos&&h+r-1>=t.common.checkingStartLinePos?(t.latestOverStartLineIdx=t.baseIdx+e,t.firstStartLineBlockIdx<0&&(t.firstStartLineBlockIdx=t.baseIdx+e),t.checkingStartLineRanges.Merge(new F(n,n+o-1)),i=!0):t.searchDirect<0&&h+r-1<=t.common.checkingStartLinePos&&(t.checkingStartLineRanges.Merge(new F(n,n+o-1)),i=!0),i){const e=t.checkingStartLineRanges.Ranges[0];e&&this.DebugPrint&&e.Start<=0&&e.End>=this._Template.Orient.widthMax-1&&((e.End>this._Template.Orient.widthMax-1||e.Start<0)&&(t.startLineRangesFulled=!0),t.searchDirect>0?t.common.resultStartIdx=t.firstStartLineBlockIdx:t.common.resultStartIdx=t.latestOverStartLineIdx,t.common.resultStartIdx>=0&&(t.common.enableBackwardSearching=!1))}}if(t.common.resultEndIdx<0&&!t.endLineRangesFulled){let i=!1;if(h<=t.common.checkingEndLinePos&&h+r-1>=t.common.checkingEndLinePos?(t.latestOverEndLineIdx=t.baseIdx+e,t.firstEndLineBlockIdx<0&&(t.firstEndLineBlockIdx=t.baseIdx+e),t.checkingEndLineRanges.Merge(new F(n,n+o-1)),i=!0):t.searchDirect>0&&h>=t.common.checkingEndLinePos&&(t.checkingEndLineRanges.Merge(new F(n,n+o-1)),i=!0),i){const e=t.checkingEndLineRanges.Ranges[0];e&&this.DebugPrint&&e.Start<=0&&e.End>=this._Template.Orient.widthMax-1&&((e.End>this._Template.Orient.widthMax-1||e.Start<0)&&(t.endLineRangesFulled=!0),t.searchDirect<0?t.common.resultEndIdx=t.firstEndLineBlockIdx:t.common.resultEndIdx=t.latestOverEndLineIdx,t.common.resultEndIdx>=0&&(t.common.enableForwardSearching=!1))}}t.baseIdx+e===t.endSearchingIndex&&(t.searchDirect>0?t.common.enableForwardSearching=!1:t.common.enableBackwardSearching=!1,t.searchToBorder=!0)}}let A=()=>{};const M=function(t){let e={left:0,right:0,top:0,bottom:0};return null!=t&&Object.assign(e,t),e},C=function(t,e,i,s){for(let n=s;n<t.length;n++){let s=e(t[n]);i.ParseTemplateItem(s,t[n])}i.CalculateNeighborWhenAddStop()},D=function(t,e,i,s){let n=M(s),o=i===x?t-n.left-n.right:e-n.top-n.bottom;return new O(i,o,"relative",t,e)},B={components:{RootView:v},props:{padding:{type:Object,default:()=>({top:0,left:0,right:0,bottom:0})},direction:{type:Symbol,default:_},height:{type:Number,required:!0},width:{type:Number,required:!0},slideStyle:{default:I.seamLess},slideSpeed:{type:Number,default:1.5},slideEasing:{type:String,default:"cubic-bezier(0.14,0.68,0.19,0.87)"},onClick:{type:Function,default:A},loopFocus:{type:Boolean,default:!1},onEdge:{type:Function,default:A},onFocus:{type:Function,default:A},onBlur:{type:Function,default:A},loadAll:{type:Boolean,default:!1},enableTouch:{type:Boolean,default:!1},flingPageWidth:{type:Number,default:-1},flingPageEdge:{type:Number,default:1/4},dispatcher:{type:Object},measures:{type:Function,required:!0},baseAnchor:{type:Object},initFocusId:{type:Number,default:0},data:{type:Array,required:!0},left:{type:Number,default:0},top:{type:Number,default:0},name:{type:String}},watch:{data:function(t,e){console.log("watch data change ",t,e)}},setup:()=>({templateParser:null,innerData:u({data:[]}),enterFocusId:-1,enterFocusRect:null,focusId:0,preFocusId:-1,preEdgeRect:null,isFocus:!1,perAnchor:null,rootElement:null,visibleStart:0,visibleRange:0,visibleItemList:[],needHideItemList:[],visibleRangeSearchBaseItem:0,touchContainerW:0,touchContainerH:0,touchListener:null,innerPadding:null,slidePile:null,dragDirection:w.DragSetting.DIRECTION_HORIZONTAL}),methods:{_initVisibleStart(t){if(0===t)return 0;let e=M(this.padding),i=0;const s=this.templateParser.GetItem(t),n=this.direction===x?"yPos":"xPos",o=this.direction===x?"height":"width";if(this.slideStyle===I.wholePage){const o=this.direction===x?this.height-e.top-e.bottom:this.width-e.left-e.right,h=Math.floor(s[n]/o);for(let e=t;e>=0;e--){const t=this.templateParser.GetItem(e);if(t[n]<o*h)break;i=t[n]}}else{const s=this.direction===x?this.height:this.width;let h=this.templateParser.GetTemplate().List,r=this.direction===x?"bottom":"right",a=h[h.length-1],l=a[n]+a[o]-s+e[r];for(let e=0;e<=t;e++){const t=this.templateParser.GetItem(e);t[n]+t[o]>i+4*s/5&&(i=t[n]+t[o]-4*s/5)}i=i>l?l:i,i=i<0?0:i}return i},_injectHandler(){return{onClick:this._onClick,queryPosition:this._queryPosition,queryTempPosition:this._queryTemplatePosition,registerItemFunc:this._registerItemFunc}},_registerItemFunc(t,e){this.innerData.data[t].itemHandler=e},_queryPosition(t){let e=this.templateParser.GetItem(t),i=this.direction===x?0:-this.visibleStart,s=this.direction===x?-this.visibleStart:0;return{xPos:e.xPos+i,yPos:e.yPos+s,width:e.width,height:e.height}},_queryTemplatePosition(t){let e=this.templateParser.GetItem(t);return{xPos:e.xPos,yPos:e.yPos,width:e.width,height:e.height}},_dispatchEvent(t){switch(t.type){case E.Type.setFocusId:this.enterFocusId=t.data;break;case E.Type.setFocusRect:this.enterFocusRect=t.data;break;case E.Type.updateItem:break;case E.Type.slideToItem:t.data&&this._slideViewToAnchor(t.data)}},_getVisibleItemList(t,e,i){let s=e-100>0?e-100:0,n=i+100,o=this.templateParser.GetVisibleItemList(s,n,t);return this.templateParser.GetTemplate().List.slice(o.visibleStart,o.visibleEnd+1)},_calculateNearestItemByRect(t,e){let i=e.direction,s=e.rect;var n="",o={x:0,y:0};switch(i){case f.left:n="left",o.x=s.x,o.y=s.y+s.height/4;break;case f.right:n="right",o.x=s.x+s.width,o.y=s.y+s.height/4;break;case f.top:n="up",o.x=s.x+s.width/4,o.y=s.y;break;case f.bottom:n="down",o.x=s.x+s.width/4,o.y=s.y+s.height}var h=new F(o.x,o.x),r=new F(o.y,o.y),a=null,l=-1,d=0,c=0,g=0;let p=this.direction===x?"yPos":"xPos",u=this.direction===x?"height":"width";for(let e of t){if(e[p]>=this.visibleStart&&e[p]+e[u]-1<=this.visibleStart+this.visibleRange-1){let t=this.direction===x?e.xPos:e.xPos-this.visibleStart,i=this.direction===x?e.yPos-this.visibleStart:e.yPos;var m=new F(t,t+e.width-1),b=new F(i,i+e.height-1);switch(n){case"left":if(o.x<t+e.width-1)continue;o.y<i?c=Math.pow(o.x-(t+e.width-1),2)+Math.pow(i-o.y,2):r.IsInterAct(b)?c=Math.pow(o.x-(t+e.width-1),2):o.y>i+e.height-1&&(c=Math.pow(o.x-(t+e.width-1),2)+Math.pow(o.y-(i+e.height-1),2)),g=Math.abs(o.x-(t+e.width-1));break;case"right":if(o.x>t)continue;o.y<i?c=Math.pow(t-o.x,2)+Math.pow(i-o.y,2):r.IsInterAct(b)?c=Math.pow(t-o.x,2):o.y>i+e.height-1&&(c=Math.pow(t-o.x,2)+Math.pow(o.y-(i+e.height-1),2)),g=Math.abs(o.x-t);break;case"up":if(o.y<i+e.height-1)continue;o.x<t?c=Math.pow(o.x-t,2)+Math.pow(o.y-(i+e.height-1),2):h.IsInterAct(m)?c=Math.pow(o.y-(i+e.height-1),2):o.x>t+e.width-1&&(c=Math.pow(o.x-(t+e.width-1),2)+Math.pow(o.y-(i+e.height-1),2)),g=Math.abs(o.y-(i+e.height-1));break;case"down":if(o.y>i)continue;o.x<t?c=Math.pow(o.x-t,2)+Math.pow(i-o.y,2):h.IsInterAct(m)?c=Math.pow(i-o.y,2):o.x>t+e.width-1&&(c=Math.pow(o.x-(t+e.width-1),2)+Math.pow(i-o.y,2)),g=Math.abs(o.y-i);break;default:console.log("direction is error:"+n)}(l<0||d>g||d===g&&l>c)&&(l=c,d=g,a=e)}}return a?a.id:0},_updateItemVisibility(t,e){let i=this.templateParser.GetTemplate();for(let s=0;s<t.length;++s)this.innerData.data[i.IdsMap[t[s].id]].controller.visible=e},_onClick(t){return this.innerData.data[t].itemHandler.onClick()},onKeyDown(t){let e=0,i=0;switch(t.keyCode){case 37:e=-1,this._moveToNext(e,i);break;case 38:i=-1,this._moveToNext(e,i);break;case 39:e=1,this._moveToNext(e,i);break;case 40:i=1,this._moveToNext(e,i);break;case 13:this._onClick(this.focusId);break;default:return!1}return!0},_updateVisibleList(t,e,i){let s=this.visibleItemList;this.visibleItemList=this._getVisibleItemList(t,e,i);for(let t of s)this.visibleItemList.indexOf(t)<0&&this.needHideItemList.indexOf(t)<0&&this.needHideItemList.push(t);for(let t of this.visibleItemList){let e=this.needHideItemList.indexOf(t);e>=0&&this.needHideItemList.splice(e,1)}this.visibleStart=e,this._updateItemVisibility(this.visibleItemList,!0)},_moveToNext(t,e,i){let s=this.templateParser.GetTemplate(),n=s.IdsMap[this.focusId],o=this.templateParser.GetNextItem(this.focusId,e,t,this.loopFocus);if(o>=0){this.preFocusId=this.focusId;let h=this.templateParser.GetItem(o);this.focusId=h.id;let r,a=this.direction===x?e:t,l=this.visibleStart,d=this._CalculateSlide(h,a,this.visibleStart);if(l!==d){let t=this.visibleItemList;this.visibleItemList=this._getVisibleItemList(o,d,d+this.visibleRange-1);for(let e of t)this.visibleItemList.indexOf(e)<0&&this.needHideItemList.indexOf(e)<0&&this.needHideItemList.push(e);for(let t of this.visibleItemList){let e=this.needHideItemList.indexOf(t);e>=0&&this.needHideItemList.splice(e,1)}this.visibleStart=d;let e={easing:"",onstart:null,speed:this.slideSpeed,onend:this._onTransitionEnd};this.direction===_?this.rootElement.updatePosition(-this.visibleStart,0,e):this.rootElement.updatePosition(0,-this.visibleStart,e),this.visibleRangeSearchBaseItem=o,this._updateVisibleList(o,d,d+this.visibleRange-1)}let c=s.List[n].xPos-s.List[o].xPos,g=s.List[n].yPos-s.List[o].yPos;i?(i.rect.x+=c,i.rect.y+=g,r=i):r={direction:null,rect:{x:c,y:g,width:s.List[n].width,height:s.List[n].height}},this.preEdgeRect=r,this._updateBlurItem(),this._updateFocusItem(),this.isFocus&&this.innerData.data[this.preFocusId].itemHandler.onBlur(),this.isFocus&&this.innerData.data[this.focusId].itemHandler.onFocus(this.preEdgeRect)}else if(this.onEdge){let i,o=this.direction===x?0:this.visibleStart,h=this.direction===x?this.visibleStart:0;1===t&&(i=f.right),-1===t&&(i=f.left),1===e&&(i=f.bottom),-1===e&&(i=f.top);let r={x:s.List[n].xPos-o,y:s.List[n].yPos-h,width:s.List[n].width,height:s.List[n].height};this.onEdge({direction:i,rect:r})}},_CalculateSlide(t,e,i){let s,n=i,o=n,h=this.templateParser.GetTemplate().List,r=h[h.length-1],a=this.direction===x?"yPos":"xPos",l=this.direction===x?"height":"width",d=this.direction===x?"bottom":"right",c=this.direction===x?this.height:this.width;switch(this.slideStyle){case I.seamLess:s=r[a]+r[l]-c+M(this.padding)[d],e>0?t[a]+t[l]>n+4*c/5&&(o=t[a]+t[l]-4*c/5):e<0?t[a]<n+c/5&&(o=t[a]-c/5):t[a]<n?o=t[a]-c/5:t[a]+t[l]>n+c&&(o=t[a]+t[l]-4*c/5),o=o>s?s:o,o=o<0?0:o;break;case I.wholePage:e>0?t[a]+t[l]>n+c+1&&(o=t[a]):e<0&&t[a]<n&&(o=t[a]+t[l]-c,o=o<0?0:o)}return o},_onFocusableItemEdge(t){let e=0,i=0;switch(t.direction){case f.left:e=-1;break;case f.right:e=1;break;case f.top:i=-1;break;case f.bottom:i=1}this._moveToNext(e,i,t)},_ifValidEnterRect:t=>t&&t.direction&&t.rect,_setZIndex(t,e){this.innerData.data[t].controller.zIndex=e},_onFocus(){let t=void 0!==this.enterFocusId&&this.enterFocusId>=0&&this.enterFocusId<this.templateParser.GetTemplate().List.length?this.enterFocusId:this.focusId;t=this._ifValidEnterRect(this.enterFocusRect)?this._calculateNearestItemByRect(this.visibleItemList,this.enterFocusRect):t,this.isFocus=!0,this.focusId=t,this.preFocusId=-1,this._updateFocusItem(),this.isFocus&&Promise.resolve().then((()=>{this.innerData.data[t].itemHandler.onFocus(this.preEdgeRect)})),this.onFocus&&this.onFocus()},_onBlur(){this.isFocus=!1,this.enterFocusId=-1,this.enterFocusRect=null,this.preFocusId=this.focusId,this.preEdgeRect=null,this._updateBlurItem(),this.innerData.data[this.preFocusId].itemHandler.onBlur(),this.onBlur&&this.onBlur()},_onTransitionEnd(t){t&&t.stopPropagation&&t.stopPropagation(),this._updateItemVisibility(this.needHideItemList,!1),this.needHideItemList=[]},_onContentUpdate(){this._updateItemVisibility(this.visibleItemList,!0),this._updateFocusItem()},_updateFocusItem(){this.templateParser.GetItem(this.focusId)&&this._setZIndex(this.templateParser.GetTemplate().IdsMap[this.focusId],this.data.length)},_updateBlurItem(){this._setZIndex(this.templateParser.GetTemplate().IdsMap[this.preFocusId],0)},_onFocusUpdate(){},_BaseAnchorInfo2Pos(t,e,i){let s=t.id,n=M(this.padding),o={xPos:this.direction===x?0:e,yPos:this.direction===x?e:0};if(null!=s){let e=this.templateParser.GetTemplate().List,h=e[s],r=e[e.length-1];if(h){let e=void 0!==t.type?t.type:"start",s=this.direction===x?"yPos":"xPos",a=this.direction===x?"height":"width",l=this.direction===x?"bottom":"right";switch(e){case"start":o[s]=h[s];break;case"center":o[s]=h[s]-i/2+h[a]/2;break;case"end":o[s]=h[s]+h[a]-1-i+n[l]}let d=r[s]+r[a]-i+n[l];o[s]=o[s]>d?d:o[s],o[s]=o[s]<0?0:o[s]}}return o},_slideViewToAnchor(t){if(t.id<0||t.id>=this.templateParser.GetTemplate().List.length)return;let e=this._BaseAnchorInfo2Pos(t,this.visibleStart,this.visibleRange);if(this.visibleStart=this.direction===x?e.yPos:e.xPos,this._updateVisibleList(this.visibleRangeSearchBaseItem,this.visibleStart,this.visibleStart+this.visibleRange-1),void 0===t.doAnim||null===t.doAnim||t.doAnim){if(this.rootElement){let t={easing:"",onstart:null,speed:this.slideSpeed,onend:this._onTransitionEnd};this.direction===_?this.rootElement.updatePosition(-this.visibleStart,0,t):this.rootElement.updatePosition(0,-this.visibleStart,t)}}else this._updateItemVisibility(this.needHideItemList,!1),this.needHideItemList=[];this.visibleRangeSearchBaseItem=t.id},_updateFocusByDragInfo(t,e){let i=null;i=this.direction===x?{direction:f.top,rect:{x:this.left-t,y:this.top-e,width:10,height:10}}:{direction:f.left,rect:{x:this.left-t,y:this.top-e,width:10,height:10}},this.focusId=this._calculateNearestItemByRect(this.visibleItemList,i)},_registerRootView(t){this.rootElement=t},_tryReoprtVisibleEvent(t){void 0!==t.viewY&&void 0!==t.viewX&&(this.direction===x?this.visibleStart=-t.viewY:this.visibleStart=-t.viewX,this.visibleStart<0&&(this.visibleStart=0));let e=this.visibleStart-2*this.visibleRange,i=this.visibleStart+3*this.visibleRange-1,s=this.visibleRangeSearchBaseItem?this.visibleRangeSearchBaseItem:0;this._updateVisibleList(s,e,i)},_getTouchListener(){if(!this.enableTouch)return null;return{OnDragStart:t=>(Promise.resolve().then((()=>{this._tryReoprtVisibleEvent(t),w.sRenderBridge.InstantPerformSwap()})),!0),OnMoved:t=>(Promise.resolve().then((()=>{this._tryReoprtVisibleEvent(t),w.sRenderBridge.InstantPerformSwap()})),!0),OnDragEnd:t=>(this._tryReoprtVisibleEvent(t),this._updateFocusByDragInfo(t.viewX,t.viewY),this.needHideItemList.length>0&&this._onTransitionEnd(),!0),OnFling:t=>(this._tryReoprtVisibleEvent(t),this._updateFocusByDragInfo(t.viewX,t.viewY),this.needHideItemList.length>0&&this._onTransitionEnd(),!0),OnRelease:()=>!0}},_getFocusBlockActions(){return{onFocus:this._onFocus,onBlur:this._onBlur,onKeyDown:this.onKeyDown}}},created(){this.dispatcher&&this.dispatcher.registerComponent(this);let t=D(this.width,this.height,this.direction,this.padding);C(this.data,this.measures,t,0),this.templateParser=t;let e=this.templateParser.GetTemplate().List,i=e[e.length-1];this.touchListener=this._getTouchListener(),this.innerPadding=M(this.padding),this.touchContainerW=this.direction===x?this.width:i.xPos+i.width,this.touchContainerH=this.direction===x?i.yPos+i.height:this.height,this.slidePile=new w.RectArea(0,0,this.width-this.innerPadding.left-this.innerPadding.right,this.height-this.innerPadding.top-this.innerPadding.bottom),this.dragDirection=this.direction===x?w.DragSetting.DIRECTION_VERTICAL:w.DragSetting.DIRECTION_HORIZONTAL,this.innerData.data=e.map((t=>({data:t,controller:{visible:m(!1),zIndex:m(0)},itemHandler:{register(t,e){this[t]=e}}})));let s=0,n=0,o=this.direction===x?this.height:this.width;if(this.visibleItemList=this._getVisibleItemList(s,n,n+o-1),void 0!==this.baseAnchor){let t=this._BaseAnchorInfo2Pos(this.baseAnchor,0,o);n=this.direction===x?t.yPos:t.xPos,this.visibleItemList=this._getVisibleItemList(this.baseAnchor.id,n,n+o-1)}this.initFocusId&&(s=this.initFocusId,void 0===this.baseAnchor&&(n=this._initVisibleStart(s),this.visibleItemList=this._getVisibleItemList(s,n,n+o-1))),this.focusId=s,this.visibleStart=n,this.visibleRange=o,this.perAnchor=this.baseAnchor},updated(){let t=this.templateParser.GetTemplate().List,e=this.data,i=0;for(i=0;i<e.length;++i){let s=!1;for(let n=0;n<t.length;++n)if(e[i]===t[n].data){s=!0;break}if(!s)break}let s=!1;if(i===t.length)i!==e.length?(s=!0,C(this.data,this.measures,this.templateParser,i)):!this.baseAnchor||this.baseAnchor.id===this.perAnchor.id&&this.baseAnchor.type===this.perAnchor.type||(this.perAnchor=this.baseAnchor,this._slideViewToAnchor(this.perAnchor));else{s=!0;let t=D(this.width,this.height,this.direction,this.padding);C(this.data,this.measures,t,0),this.templateParser=t}if(s){let t=this.templateParser.GetTemplate().List,e=t[t.length-1];this.touchListener=this._getTouchListener(),this.innerPadding=M(this.padding),this.touchContainerW=this.direction===x?this.width:e.xPos+e.width,this.touchContainerH=this.direction===x?e.yPos+e.height:this.height,this.slidePile=new w.RectArea(0,0,this.width-this.innerPadding.left-this.innerPadding.right,this.height-this.innerPadding.top-this.innerPadding.bottom),this.dragDirection=this.direction===x?w.DragSetting.DIRECTION_VERTICAL:w.DragSetting.DIRECTION_HORIZONTAL,this.innerData.data=t.map(((t,e)=>({data:t,controller:{visible:m(!1),zIndex:m(0)},itemHandler:this.innerData.data[e]?{...this.innerData.data[e].itemHandler}:{}})))}this.focusId>=this.data.length&&(this.focusId=0,this.preFocusId=-1,this.visibleRangeSearchBaseItem=0,0!==this.visibleStart&&(this.visibleStart=0,this.rootElement.updatePosition(0,0,null))),this.visibleItemList=this._getVisibleItemList(this.visibleRangeSearchBaseItem,this.visibleStart,this.visibleStart+this.visibleRange-1),this.isFocus&&(this._updateFocusItem(),Promise.resolve().then((()=>{this.innerData.data[this.focusId].itemHandler.onFocus(null)})))},mounted(){},beforeUnmount(){this.dispatcher&&this.dispatcher.unregisterComponent()}};B.render=function(e,n,h,r,u,m){const b=o("root-view"),f=o("jsv-focus-block");return t(),a(f,{name:e.name,onAction:e._getFocusBlockActions()},{default:l((()=>[g("div",{style:i({left:e.left,top:e.top,width:e.width,height:e.height,overflow:"hidden"})},[p(b,{x:e.innerPadding.left,y:e.innerPadding.top,width:e.touchContainerW,height:e.touchContainerH,flingPageWidth:e.flingPageWidth,flingPageEdge:e.flingPageEdge,slidePile:e.slidePile,direction:e.dragDirection,touchListener:e.touchListener,enableTouch:e.enableTouch,loadAll:e.loadAll,register:e._registerRootView,data:e.innerData,onLoad:e._onContentUpdate,onItemEdge:e._onFocusableItemEdge,widgetHandler:e._injectHandler()},{renderItem:l((t=>[s(e.$slots,"renderItem",d(c(t)))])),_:3},8,["x","y","width","height","flingPageWidth","flingPageEdge","slidePile","direction","touchListener","enableTouch","loadAll","register","data","onLoad","onItemEdge","widgetHandler"])],4)])),_:3},8,["name","onAction"])},B.__file="src/SimpleWidget/SimpleWidget.vue";var G={props:{name:String,namespace:String,autoFocus:String,onAction:Object,onDispatchKeyUp:Function,onDispatchKeyDown:Function,onKeyUp:Function,onKeyDown:Function,onFocus:Function,onBlur:Function},setup(t){if(t.namespace&&t.name)throw new Error("JsvFocusBlock Error: Either name or namespace can be set.");if(""===t.namespace)throw new Error("JsvFocusBlock Error: Invalid namespace of empty value.");if(t.namespace&&t.namespace.indexOf(".")>=0)throw new Error('JsvFocusBlock Error: Invalid namespace of "'+t.namespace+'". namespace must not contains "."');if(t.name&&t.name.indexOf(".")>=0)throw new Error('JsvFocusBlock Error: Invalid name of "'+t.name+'". name must not contains "."');return{actionCallback:{}}},mounted(){this.$_mountToFocusSystem(),(this.$props.autoFocus||""===this.$props.autoFocus)&&this.requestFocus("exact"!==this.$props.autoFocus)},beforeUnmount(){this.$el.FocusNodeRef.onUnMount()},methods:{getName(){return this.$el.FocusNodeRef.getName()},getNamespace(){let t=this.$el.FocusNodeRef;t?.AsHub&&(t=this.$el.FocusNodeRef.GetParentPage());const e=t.getName();return".__AppRoot__"!==e?e:""},findBlockByName(t){return this.$el.FocusNodeRef.getNodeByName(t)?.jsvVueComponent},requestFocus(t){this.$el.FocusNodeRef.requestFocus(t)},debugPrintFocusChain(){this.$el.FocusNodeRef.printFocusNodeList()},debugPrintLastFocus(){this.$el.FocusNodeRef.printGlobalLastFocus()},$_mountToFocusSystem(){const t=this.$el.FocusNodeRef;t.jsvVueComponent=this,this.actionCallback.onDispatchKeyDown=this.$props.onDispatchKeyDown||this.$props.onAction?.onDispatchKeyDown,this.actionCallback.onDispatchKeyDown&&t.setOnDispatchKeyDown(this.$_onDispatchKeyDown),this.actionCallback.onDispatchKeyUp=this.$props.onDispatchKeyUp||this.$props.onAction?.onDispatchKeyUp,this.actionCallback.onDispatchKeyUp&&t.setOnDispatchKeyUp(this.$_onDispatchKeyUp),this.actionCallback.onKeyDown=this.$props.onKeyDown||this.$props.onAction?.onKeyDown,this.actionCallback.onKeyDown&&t.setOnKeyDown(this.$_onKeyDown),this.actionCallback.onKeyUp=this.$props.onKeyUp||this.$props.onAction?.onKeyUp,this.actionCallback.onKeyUp&&t.setOnKeyUp(this.$_onKeyUp),this.actionCallback.onFocus=this.$props.onFocus||this.$props.onAction?.onFocus,this.actionCallback.onFocus&&t.setOnFocus(this.$_onFocus),this.actionCallback.onBlur=this.$props.onBlur||this.$props.onAction?.onBlur,this.actionCallback.onBlur&&t.setOnBlur(this.$_onBlur);let e=this.$el,i=e.parentElement;for(;i&&!e.FocusNodeRef.GetParentPage();)"FDIV"===i.tagName?(e.FocusNodeRef.setParent(i.FocusNodeRef),e=i,i=e.parentElement):i=i.parentElement},$_onDispatchKeyDown(t){return t.ownerNode=this,this.actionCallback?.onDispatchKeyDown(t)||!1},$_onDispatchKeyUp(t){return t.ownerNode=this,this.actionCallback?.onDispatchKeyUp(t)||!1},$_onKeyDown(t){return t.ownerNode=this,this.actionCallback?.onKeyDown(t)||!1},$_onKeyUp(t){return t.ownerNode=this,this.actionCallback?.onKeyUp(t)||!1},$_onFocus(){this.actionCallback?.onFocus(this)},$_onBlur(){this.actionCallback?.onBlur(this)}}};const H=["fname","new-namespace"];G.render=function(i,n,o,h,r,a){return t(),e("fdiv",{fname:i.$props.name,"new-namespace":i.$props.namespace},[s(i.$slots,"default")],8,H)},G.__file="src/JsvFocusBlock.vue";class ${constructor(){}install(t,...e){if("string"!=typeof e[0])throw new Error("JsvFocusManager Error: 2nd argument is required. Such as: app.use(FocusManager, '#app')");const i=this.$_hookMount(t,e[0]);t.mount=i,t.component("JsvFocusBlock",G),t.config.globalProperties.$jsvFocusManager=this}$_hookMount(t,e){return e=e.replace("#",""),this.$_topFDiv=document.jsvInitFDivRoot(e),this.$_appMount=t.mount.bind(t),this.$_doAppMount.bind(this)}$_doAppMount(t){const e=this.$_appMount(t);return this.$_topFDiv.onMounted(),e}$_appMount=void 0;$_topFDiv=void 0}function V(){return new $}export{b as BaseDispatcher,f as EdgeDirection,y as FDIV_ROUTER_NAME,_ as HORIZONTAL,G as JsvFocusBlock,E as SWidgetDispatcher,B as SimpleWidget,I as SlideStyle,x as VERTICAL,L as getMeasureObj,V as jsvCreateFocusManager};
1
+ import{openBlock as t,createElementBlock as e,normalizeStyle as i,renderSlot as s,createCommentVNode as n,resolveComponent as o,Fragment as h,renderList as r,createBlock as a,withCtx as l,normalizeProps as d,guardReactiveProps as c,createElementVNode as g,createVNode as u,reactive as p,ref as m}from"vue";class b{constructor(){this._Component=null,this.registerComponent=this.registerComponent.bind(this),this.unregisterComponent=this.unregisterComponent.bind(this),this.dispatch=this.dispatch.bind(this)}registerComponent(t){this._Component=t}unregisterComponent(){this._Component=null}dispatch(t){t&&this._Component&&this._Component._dispatchEvent(t)}}const I={left:Symbol("left"),right:Symbol("right"),top:Symbol("top"),bottom:Symbol("bottom"),opposite:t=>{switch(t){case I.left:return I.right;case I.right:return I.left;case I.top:return I.bottom;case I.bottom:return I.top}}},f={seamLess:Symbol("seamless"),wholePage:Symbol("wholePage"),seamlessFixedId:Symbol("seamlessFixedId")},x=Symbol("vertical"),_=Symbol("horizontal"),L=(t,e,i,s)=>({width:t,height:e,focusable:i,hasSub:s}),y="fdivRouter";class E extends b{}E.Type={setFocusId:Symbol("setFocusId"),setFocusRect:Symbol("setFocusRect"),updateItem:Symbol("updateItem"),slideToItem:Symbol("slideTo")},void 0===window.Forge&&(window.Forge={});const w=window.Forge;var S={props:{data:Object,loadAll:Boolean,enableTouch:Boolean,controlObj:Object,onEdge:Function,widgetHandler:Object},setup:t=>({onAction:{register(t,e){this[t]=e}},element:{},queryObj:{id:t.data.id,position:t.widgetHandler.queryTemplatePosition,absolutePosition:t.widgetHandler.queryPosition,getCurrentFocusId:t.widgetHandler.getCurrentFocusId}}),methods:{onFocus(t){this.onAction.onFocus&&this.onAction.onFocus(t)},onBlur(){this.onAction.onBlur&&this.onAction.onBlur()},onClick(){return!!this.onAction.onClick&&this.onAction.onClick()},reachEdge(t){this.onAction.onWidgetEdge&&this.onAction.onWidgetEdge(t)}},created(){this.widgetHandler.registerItemFunc(this.data.id,{onFocus:this.onFocus,onBlur:this.onBlur,onClick:this.onClick,reachEdge:this.reachEdge})},mounted(){if(this.$refs.element&&this.enableTouch){let e=this.$refs.element.jsvMaskView;var t=new w.DragSetting(w.DragSetting.DIRECTION_DISABLE,20,!1,new w.RectArea(0,0,0,0),-1,3/4);let i={OnTap:t=>(console.log("Item View Container OnTap:",t),this.onClick(this.data.id))};e.EnableDrag(t,i,"translateMat(dx,dy,0)")}},updated(){},beforeUnmount(){}};S.render=function(o,h,r,a,l,d){return r.loadAll||r.controlObj.visible?(t(),e("div",{key:r.data.xPos+"_"+r.data.yPos,ref:"element",style:i({left:r.data.xPos,top:r.data.yPos,width:r.data.width,height:r.data.height,zIndex:r.controlObj.zIndex})},[s(o.$slots,"renderItem",{data:r.data.data,onEdge:r.onEdge,onAction:a.onAction,query:a.queryObj})],4)):n("v-if",!0)},S.__file="src/SimpleWidget/ItemView.vue";var P={props:{onItemEdge:Function,data:Object,loadAll:Boolean,enableTouch:Boolean,onLoad:Function,widgetHandler:Object},components:{ItemView:S},mounted(){this.onLoad()},updated(){this.onLoad()}};P.render=function(i,n,g,u,p,m){const b=o("item-view");return t(!0),e(h,null,r(g.data.data,(e=>(t(),a(b,{key:e.id,data:e.data,loadAll:g.loadAll,enableTouch:g.enableTouch,onEdge:g.onItemEdge,controlObj:e.controller,widgetHandler:g.widgetHandler},{renderItem:l((t=>[s(i.$slots,"renderItem",d(c(t)))])),_:2},1032,["data","loadAll","enableTouch","onEdge","controlObj","widgetHandler"])))),128)},P.__file="src/SimpleWidget/ContentView.vue";var F={props:{data:Object,onItemEdge:Function,onLoad:Function,register:Function,widgetHandler:Object,x:Number,y:Number,width:Number,height:Number,loadAll:Boolean,enableTouch:Boolean,touchListener:Function,flingPageWidth:Number,flingPageEdge:Number,slidePile:Object,direction:Number},components:{ContentView:P},data:()=>({innerX:0,innerY:0}),setup:()=>({element:{}}),methods:{$_rootView_initTouch_(){if(this.touchListener&&this.$refs.element){let e=this.$refs.element.jsvMaskView,i=this.flingPageWidth,s=this.flingPageEdge,n=this.slidePile;var t=new w.DragSetting(this.direction,20,!1,n,i,s);e.EnableDrag(t,this.touchListener,"translateMat(dx,dy,0)")}},updatePosition(t,e,i){if(this.$refs.element){let s=this.$refs.element.jsvMaskView.GetLayoutParams();if(this.innerX=t,this.innerY=e,i){let n=Math.abs(s.MarginLeft-t),o=Math.abs(s.MarginTop-e),h=Math.round(0===n?o/i.speed:n/i.speed),r=new w.TranslateAnimation(s.MarginLeft-t,0,s.MarginTop-e,0,h,i.easing);r.SetAnimationListener(new w.AnimationListener(i.onstart,i.onend,null)),this.$refs.element.jsvMaskView.StartAnimation(r)}}}},created(){this.register&&this.register(this)},mounted(){this.$_rootView_initTouch_()}};F.render=function(n,h,r,a,p,m){const b=o("content-view");return t(),e("div",{style:i({left:r.x,top:r.y})},[g("div",{key:"touchcontainer",ref:"element",style:i({left:p.innerX,top:p.innerY,width:r.width,height:r.height})},[u(b,{data:r.data,onItemEdge:r.onItemEdge,loadAll:r.loadAll,enableTouch:r.enableTouch,onLoad:r.onLoad,widgetHandler:r.widgetHandler},{renderItem:l((t=>[s(n.$slots,"renderItem",d(c(t)))])),_:3},8,["data","onItemEdge","loadAll","enableTouch","onLoad","widgetHandler"])],4)],4)},F.__file="src/SimpleWidget/RootView.vue";class v{constructor(t,e){this.Start=t,this.End=e}Merge(t){return this.IsInterAct(t)?(this.Start>t.Start&&(this.Start=t.Start),this.End<t.End&&(this.End=t.End),!0):this.End+1===t.Start?(this.End=t.End,!0):this.Start===t.End+1&&(this.Start=t.Start,!0)}IsInterAct(t){return t.Start<this.Start?!(t.End<this.Start):t.Start<=this.End}Exclude(t){const e={success:!1,newSplitedRange:null};return this.IsInterAct(t)?(t.Start<=this.Start?t.End<this.End?this.Start=t.End+1:this.Clear():(t.End<this.End&&(e.newSplitedRange=new v(t.End+1,this.End)),this.End=t.Start-1),e.success=!0,e):e}IsEmpty(){return this.Start>this.End}Clear(){this.End=this.Start-1}Clone(){return new v(this.Start,this.End)}}class N{constructor(t,e){this.Ranges=[],void 0!==t&&void 0!==e&&this.Ranges.push(new v(t,e))}Merge(t){let e=!1,i=this.Ranges.length;for(let s=0;s<this.Ranges.length;s++){if(t.End+1<this.Ranges[s].Start){i=s;break}if(this.Ranges[s].Merge(t)){for(e=!0;s+1<this.Ranges.length&&this.Ranges[s].Merge(this.Ranges[s+1]);)this.Ranges.splice(s+1,1);break}}e||this.Ranges.splice(i,0,t)}Exclude(t){for(let e=0;e<this.Ranges.length&&!(t.End<this.Ranges[e].Start);e++){const i=this.Ranges[e].Exclude(t);if(this.Ranges[e].IsEmpty()&&(this.Ranges.splice(e,1),e--),null!==i.newSplitedRange){this.Ranges.splice(e+1,0,i.newSplitedRange);break}}}ForEach(t,e){if(t)if(e)for(let e=this.Ranges.length-1;e>=0;e--)for(let i=this.Ranges[e].End;i>=this.Ranges[e].Start;i--)t(i);else for(let e=0;e<this.Ranges.length;e++)for(let i=this.Ranges[e].Start;i<=this.Ranges[e].End;i++)t(i);else console.log("Callback function is invalid")}}class k{constructor(t,e,i,s){this.x="number"==typeof t?t:0,this.y="number"==typeof e?e:0,("number"!=typeof i||i<0)&&(i=0),this.width=i,("number"!=typeof s||s<0)&&(s=0),this.height=s}Equals(t){return null!==t&&(t.x===this.x&&t.y===this.y&&t.width===this.width&&t.height===this.height)}}class T{constructor(t,e,i){this.IdsMap=[],this._IdsTotal=-1,this.List=[],this.Orient={type:t,widthMax:e},this.Layout={type:i||"relative"}}SetIdsMap(t,e){this.IdsMap[t]=e,this._IdsTotal=-1,this.List[e].id=t}AddItem(t){this.List.push(t)}GetIdsTotal(){if(this._IdsTotal<0){let t=0;for(let e=0;e<this.List.length;e++)this.List[e].id>=0&&t++;this._IdsTotal=t}return this._IdsTotal}}T.getTemplateItem=function(t,e){return{id:-1,hasSub:!!t.hasSub,xPos:t.x?t.x:0,yPos:t.y?t.y:0,centerXPos:0,centerYPos:0,width:void 0!==t.width?t.width:t.blocks.w,height:void 0!==t.height?t.height:t.blocks.h,focusAble:void 0===t.focusable||t.focusable,needRedraw:void 0===t.needRedraw||t.needRedraw,onBottomLine:!1,view:null,data:e,mounted:!1}};class R{constructor(t,e,i,s){this._Gaps=[{GapStart:0,GapEnd:i-1}],this._FenceTotalWidth=i,this.AheadOffset=s,e>0&&this._SplitGap(0,t,e)}HasGapFor(t){for(let e=0;e<this._Gaps.length;e++)if(this._Gaps[e].GapEnd-this._Gaps[e].GapStart+1>=t)return{startPos:this._Gaps[e].GapStart};return null}MarkGapUsed(t,e){if(e<=0)return this._Gaps.length;const i=t+e-1;let s=-1;for(let e=0;e<this._Gaps.length;e++)if(this._Gaps[e].GapStart<=t&&this._Gaps[e].GapEnd>=i){s=e;break}return-1===s&&console.log(`Error in mark gap used, not found suitable gap of offset=${this.AheadOffset}`),this._SplitGap(s,t,e),this._Gaps.length}_SplitGap(t,e,i){const s=this._Gaps.splice(t,1)[0],n=e+i-1;(e<s.GapStart||n>s.GapEnd)&&console.log("ERROR in split Fence Gap, range overflow"),n!==s.GapEnd&&this._Gaps.splice(t,0,{GapStart:n+1,GapEnd:s.GapEnd}),e!==s.GapStart&&this._Gaps.splice(t,0,{GapStart:s.GapStart,GapEnd:e-1})}Fork(t){const e=new R(0,0,0,0);return e._Gaps=JSON.parse(JSON.stringify(this._Gaps)),e._FenceTotalWidth=this._FenceTotalWidth,e.AheadOffset=t,e}}class O{constructor(t,e,i,s,n){this._Template=new T(t,e,i),this._FenceStack=[new R(0,0,this._Template.Orient.widthMax,0)],this._Identity=0,this._MoveLimitArea=new k(0,0,s,n),this._FenceEdge={StartX:0,StartY:0},this._NotOccupiedEdgeList=[],this._SupportHistoryPath=!1,this._VisibleRangeSearchBaseItem=null}_CheckNeighborItemMatching(t,e,i){let s=!1;const n=e.edgeObj,o=i.edgeObj;let h="rightEdge",r="leftEdge";switch(t){case"left":h="rightEdge",r="leftEdge";break;case"right":h="leftEdge",r="rightEdge";break;case"top":h="bottomEdge",r="topEdge";break;case"bottom":r="bottomEdge",h="topEdge";break;default:console.log(`_CheckNeighborItemMatching unknown direction:${t}`)}const a=o[h].range.Start,l=o[h].range.Clone();o[h].range.Exclude(n[r].range),n[r].range.Exclude(l);const d=o[h].range.Start;return o[h].range.IsEmpty()&&(o[h]=null,s=!0),n[r].range.IsEmpty()&&(n[r]=null,s=!0),a!==d&&(s=!0),s}_FindNearestNeighbor(t){const e=t.edgeObj;let i=-1,s=-1,n=-1,o=-1,h=-1,r=-1,a=-1,l=-1;for(let d=0;d<this._NotOccupiedEdgeList.length;d++){const c=this._NotOccupiedEdgeList[d],g=c.edgeObj;if(t!==c){if(null!==e.leftEdge&&null!==g.rightEdge&&e.leftEdge.x>=g.rightEdge.x&&e.leftEdge.range.IsInterAct(g.rightEdge.range)){if(-1===h){h=e.leftEdge.x-g.rightEdge.x,i=d;continue}if(h>e.leftEdge.x-g.rightEdge.x){h=e.leftEdge.x-g.rightEdge.x,i=d;continue}}if(null!==e.rightEdge&&null!==g.leftEdge&&e.rightEdge.x<=g.leftEdge.x&&e.rightEdge.range.IsInterAct(g.leftEdge.range)){if(-1===r){r=g.leftEdge.x-e.rightEdge.x,s=d;continue}if(r>g.leftEdge.x-e.rightEdge.x){r=g.leftEdge.x-e.rightEdge.x,s=d;continue}}if(null!==e.topEdge&&null!==g.bottomEdge&&e.topEdge.y>=g.bottomEdge.y&&e.topEdge.range.IsInterAct(g.bottomEdge.range)){if(-1===a){a=e.topEdge.y-g.bottomEdge.y,n=d;continue}if(a>e.topEdge.y-g.bottomEdge.y){a=e.topEdge.y-g.bottomEdge.y,n=d;continue}}if(null!==e.bottomEdge&&null!==g.topEdge&&e.bottomEdge.y<=g.topEdge.y&&e.bottomEdge.range.IsInterAct(g.topEdge.range)){if(-1===l){l=g.topEdge.y-e.bottomEdge.y,o=d;continue}if(l>g.topEdge.y-e.bottomEdge.y){l=g.topEdge.y-e.bottomEdge.y,o=d;continue}}}}return{left:i,right:s,top:n,bottom:o}}_CalculateNeighborItem(t){const e=this._Template.List;for(let i=0;i<this._NotOccupiedEdgeList.length;i++){const s=this._NotOccupiedEdgeList[i],n=s.edgeObj,o=s.index;if(this._Template.Orient.type===x){if(null===n.bottomEdge){this._NotOccupiedEdgeList.splice(i,1),i--;continue}if(!t&&n.bottomEdge.y>this._FenceEdge.StartY)continue}else{if(null===n.rightEdge){this._NotOccupiedEdgeList.splice(i,1),i--;continue}if(!t&&n.rightEdge.x>this._FenceEdge.StartX)continue}const h=this._FindNearestNeighbor(s);if(-1!==h.left){const i=this._NotOccupiedEdgeList[h.left],n=i.index;if(t)e[n].tmpNeighborIndexList.right.push(o),e[o].tmpNeighborIndexList.left.push(n);else{this._CheckNeighborItemMatching("left",s,i)&&(e[n].neighborIndexList.right.push(o),e[o].neighborIndexList.left.push(n),e[n].tmpNeighborIndexList.right=[],e[o].tmpNeighborIndexList.left=[])}}if(-1!==h.right){const i=this._NotOccupiedEdgeList[h.right],n=i.index;if(t)e[n].tmpNeighborIndexList.left.push(o),e[o].tmpNeighborIndexList.right.push(n);else{this._CheckNeighborItemMatching("right",s,i)&&(e[n].neighborIndexList.left.push(o),e[o].neighborIndexList.right.push(n),e[n].tmpNeighborIndexList.left=[],e[o].tmpNeighborIndexList.right=[])}}if(-1!==h.top){const i=this._NotOccupiedEdgeList[h.top],n=i.index;if(t)e[n].tmpNeighborIndexList.bottom.push(o),e[o].tmpNeighborIndexList.top.push(n);else{this._CheckNeighborItemMatching("top",s,i)&&(e[n].neighborIndexList.bottom.push(o),e[o].neighborIndexList.top.push(n),e[n].tmpNeighborIndexList.bottom=[],e[o].tmpNeighborIndexList.top=[])}}if(-1!==h.bottom){const i=this._NotOccupiedEdgeList[h.bottom],n=i.index;if(t)e[n].tmpNeighborIndexList.top.push(o),e[o].tmpNeighborIndexList.bottom.push(n);else{this._CheckNeighborItemMatching("bottom",s,i)&&(e[n].neighborIndexList.top.push(o),e[o].neighborIndexList.bottom.push(n),e[n].tmpNeighborIndexList.top=[],e[o].tmpNeighborIndexList.bottom=[])}}}}_TryCalculateNeighborItem(t,e,i,s,n){const o={index:t,edgeObj:{leftEdge:{x:e,range:new v(i,i+n-1)},rightEdge:{x:e+s,range:new v(i,i+n-1)},topEdge:{y:i,range:new v(e,e+s-1)},bottomEdge:{y:i+n,range:new v(e,e+s-1)}}};0===e&&(o.edgeObj.leftEdge=null),0===i&&(o.edgeObj.topEdge=null);let h=!1;const r=this._Template.Orient.widthMax;let a=this._FenceEdge.StartX,l=this._FenceEdge.StartY;this._Template.Orient.type===x?(e+s===r&&(o.edgeObj.rightEdge=null),i>this._FenceEdge.StartY&&(h=!0,l=i)):(i+n===r&&(o.edgeObj.bottomEdge=null),e>this._FenceEdge.StartX&&(h=!0,a=e)),this._FenceEdge.StartX=a,this._FenceEdge.StartY=l,this._NotOccupiedEdgeList.push(o),h&&this._CalculateNeighborItem()}_UpdateLastFenceEdge(){const t=this._FenceEdge,e={StartX:-1,StartY:-1};for(let i=0;i<this._NotOccupiedEdgeList.length;i++){const s=this._NotOccupiedEdgeList[i].edgeObj;this._Template.Orient.type===x?null!==s.bottomEdge&&s.bottomEdge.y>t.StartY&&(-1===e.StartY||s.bottomEdge.y<e.StartY)&&(e.StartY=s.bottomEdge.y):null!==s.rightEdge&&s.rightEdge.x>t.StartX&&(-1===e.StartX||s.rightEdge.y<e.StartX)&&(e.StartX=s.rightEdge.x)}this._FenceEdge=e}ParseTemplateItem(t,e){const i=T.getTemplateItem(t,e),s=this._FenceStack;let n=-1,o=1;const h=i.id,r=i.width,a=i.height;let l,d,c,g,u=0,p=0,m=0,b=0,I=0;if("relative"===this._Template.Layout.type){b=this._Template.Orient.type===x?r:a,I=this._Template.Orient.type===x?a:r;let t=null,e=null;for(;s.length>0;){const i=s[s.length-1];if(e=i.HasGapFor(b),null!==e){t=i;break}s.pop()}null!==e?(u=e.startPos,p=t.AheadOffset):console.log("ERROR: coding error, header full gap fence lost"),this._Template.Orient.type===x?(l=u,d=p,c=b,g=I,m=(d+g)/this._MoveLimitArea.height):(l=p,d=u,c=I,g=b,m=(l+c)/this._MoveLimitArea.width)}else l=i.xPos,d=i.yPos,c=r,g=a,m=this._Template.Orient.type===x?(d+g)/this._MoveLimitArea.height:(l+c)/this._MoveLimitArea.width;-1===n&&(n=h);const f=Math.ceil(m);m>=0&&f!==o&&(o=f,n=h),i.curPageHeadId=n,i.neighborIndexList={left:[],top:[],right:[],bottom:[]},i.tmpNeighborIndexList={left:[],top:[],right:[],bottom:[]},i.pathHistory={left:null,top:null,right:null,bottom:null},i.xPos=l,i.yPos=d,i.centerXPos=Math.floor(l+c/2)-1,i.centerYPos=Math.floor(d+g/2)-1,this._Template.Orient.type!==x&&d+g===this._Template.Orient.widthMax&&(i.onBottomLine=!0),this._Template.AddItem(i),i.focusAble&&this._Template.SetIdsMap(this._Identity++,this._Template.List.length-1),this._TryCalculateNeighborItem(this._Template.List.length-1,i.xPos,i.yPos,i.width,i.height);const _=p+I-1;s[0].AheadOffset<=_&&s.splice(0,0,new R(0,0,this._Template.Orient.widthMax,_+1));let L=!1,y=!1,E=-1;for(let t=s.length-1;t>=0;t--){if(!(s[t].AheadOffset<=_)){s[t].AheadOffset===_+1&&(y=!0),E=t;break}s[t].AheadOffset===_&&(L=!0);0===s[t].MarkGapUsed(u,b)&&s.splice(t,1)}const w=_;if(!L&&E+1<=s.length-1){const t=s[E+1].Fork(w);s.splice(E+1,0,t)}if(!y&&E>0){const t=s[E].Fork(w+1);s.splice(E+1,0,t)}}GetItem(t){return this._Template.List[this._Template.IdsMap[t]]}GetIndex(t){return this._Template.IdsMap[t]}_CheckIdsHasFocusable(t){const e=this._Template.List;let i=!1;for(let s=0;s<t.length;s++){if(e[t[s]].focusAble){i=!0;break}}return i}_IsInNeighborList(t,e){let i=!1;for(let s=t.length-1;s>=0;s--)if(t[s]===e){i=!0;break}return i}_GetValidNeighborIndex(t,e,i){const s=this._Template.List;let n=-1;const o=s[e],h=s[t];let r=null,a=null;if("top"===i?(a=o.neighborIndexList.left,r=o.neighborIndexList.right):(a=o.neighborIndexList.right,r=o.neighborIndexList.left),r.length>0)for(let t=0;t<r.length;t++){const e=r[t],o=s[e];if(o.focusAble&&("top"===i&&o.yPos+o.height<=h.yPos||"bottom"===i&&o.yPos>=h.yPos+h.height)){n=e;break}}if(-1===n&&a.length>0)for(let t=0;t<a.length;t++){const e=a[t],o=s[e];if(o.focusAble&&("top"===i&&o.yPos+o.height<=h.yPos||"bottom"===i&&o.yPos>=h.yPos+h.height)){n=e;break}}return n}_CaculateNeighborItem(t){const e=this._Template.List;for(let i=0;i<this._NotOccupiedEdgeList.length;i++){const s=this._NotOccupiedEdgeList[i],n=s.edgeObj,o=s.index;if(this._Template.Orient.type===x){if(null===n.bottomEdge){this._NotOccupiedEdgeList.splice(i,1),i--;continue}if(!t&&n.bottomEdge.y>this._FenceEdge.StartY)continue}else{if(null===n.rightEdge){this._NotOccupiedEdgeList.splice(i,1),i--;continue}if(!t&&n.rightEdge.x>this._FenceEdge.StartX)continue}const h=this._FindNearestNeighbor(s);if(-1!==h.left){const i=this._NotOccupiedEdgeList[h.left],n=i.index;if(t)e[n].tmpNeighborIndexList.right.push(o),e[o].tmpNeighborIndexList.left.push(n);else{this._CheckNeighborItemMatching("left",s,i)&&(e[n].neighborIndexList.right.push(o),e[o].neighborIndexList.left.push(n),e[n].tmpNeighborIndexList.right=[],e[o].tmpNeighborIndexList.left=[])}}if(-1!==h.right){const i=this._NotOccupiedEdgeList[h.right],n=i.index;if(t)e[n].tmpNeighborIndexList.left.push(o),e[o].tmpNeighborIndexList.right.push(n);else{this._CheckNeighborItemMatching("right",s,i)&&(e[n].neighborIndexList.left.push(o),e[o].neighborIndexList.right.push(n),e[n].tmpNeighborIndexList.left=[],e[o].tmpNeighborIndexList.right=[])}}if(-1!==h.top){const i=this._NotOccupiedEdgeList[h.top],n=i.index;if(t)e[n].tmpNeighborIndexList.bottom.push(o),e[o].tmpNeighborIndexList.top.push(n);else{this._CheckNeighborItemMatching("top",s,i)&&(e[n].neighborIndexList.bottom.push(o),e[o].neighborIndexList.top.push(n),e[n].tmpNeighborIndexList.bottom=[],e[o].tmpNeighborIndexList.top=[])}}if(-1!==h.bottom){const i=this._NotOccupiedEdgeList[h.bottom],n=i.index;if(t)e[n].tmpNeighborIndexList.top.push(o),e[o].tmpNeighborIndexList.bottom.push(n);else{this._CheckNeighborItemMatching("bottom",s,i)&&(e[n].neighborIndexList.top.push(o),e[o].neighborIndexList.bottom.push(n),e[n].tmpNeighborIndexList.top=[],e[o].tmpNeighborIndexList.bottom=[])}}}}CalculateNeighborWhenAddStop(){this._UpdateLastFenceEdge(),this._CaculateNeighborItem();this._CaculateNeighborItem(!0);const t=this._Template.List;let e=t.length-1,i=t[e];for(let s=t.length-1;s>=0;s--)if(i=t[s],i.focusAble){e=s;break}for(let e=t.length-1;e>=0;e--){const i=t[e];if(i.focusAble){if(i.neighborIndexList.bottom.length>0&&!this._CheckIdsHasFocusable(i.neighborIndexList.bottom)){const t=i.neighborIndexList.bottom[i.neighborIndexList.bottom.length-1],s=this._GetValidNeighborIndex(e,t,"bottom");-1!==s&&(i.neighborIndexList.bottom=[],i.neighborIndexList.bottom.push(s))}if(i.neighborIndexList.top.length>0&&!this._CheckIdsHasFocusable(i.neighborIndexList.top)){const t=this._GetValidNeighborIndex(e,i.neighborIndexList.top[i.neighborIndexList.top.length-1],"top");-1!==t&&(i.neighborIndexList.top=[],i.neighborIndexList.top.push(t))}}}if(this._Template.Orient.type!==x){let s=null,n=-1,o=0;for(let h=e-1;h>=0;h--){const r=t[h];r.focusAble&&r.yPos>=i.yPos+i.height&&(0!==r.neighborIndexList.right.length&&this._CheckIdsHasFocusable(r.neighborIndexList.right)&&!this._IsInNeighborList(r.neighborIndexList.right,e)||(o=(i.xPos-r.xPos)**2+(i.yPos-r.yPos)**2,(-1===n||n>o)&&(n=o,s=h)))}s&&(i.neighborIndexList.bottom=[],i.neighborIndexList.bottom.push(s))}else for(let s=e-1;s>=0;s--){const n=t[s];n.focusAble&&n.yPos+n.height<i.yPos+i.height&&0===n.neighborIndexList.bottom.length&&n.neighborIndexList.bottom.push(e)}}GetNextItem(t,e,i,s){0===e&&0===i&&console.log("GetNextItem(): offset is 0"),0!==e&&0!==i&&console.log("GetNextItem(): not support change vertical and horizontal and the same time");const n=this._Template.IdsMap[t];let o;return o=0!==e?this._GetNextItemVertical(n,e):this._GetNextItemHorizontal(n,i),s&&null===o&&(o=0!==e?this._GetNextLoopItemVertical(n,e):this._GetNextLoopItemHorizontal(n,i)),null===o?-1:o.id}_GetNextItemVertical(t,e){const i=this._Template.List,s=i[t].centerXPos;let n="top",o="bottom";e>0&&(o="top",n="bottom");let h=i.length-1;const r=this._Template.Orient.type;for(let t=i.length-1;t>=0;t--){if(i[t].focusAble){h=t;break}}let a=!1,l=-1,d=null;if(this._SupportHistoryPath&&(d=i[t].pathHistory[n]),null===d){let e=i[t].neighborIndexList[n];if(i[t].tmpNeighborIndexList[n].length>0&&(e=e.concat(i[t].tmpNeighborIndexList[n])),1===e.length)l=e[0],h===t&&"bottom"===n&&r===_||(i[t].pathHistory[n]=l,i[l].pathHistory[o]=t),a=!0;else{for(let d=0;d<e.length;d++){l=e[d];const c=i[l];if(s<=c.xPos+c.width-1&&s>=c.xPos){h===t&&"bottom"===n&&r===_||(i[t].pathHistory[n]=l,i[l].pathHistory[o]=t),a=!0;break}}if(!a||!i[l].focusAble)for(let s=0;s<e.length;s++){const d=e[s];if(i[d].focusAble){h===t&&"bottom"===n&&r===_||(i[t].pathHistory[n]=l,i[l].pathHistory[o]=t),l=d,a=!0;break}}}}else l=d,h===t&&"bottom"===n&&r===_||(i[l].pathHistory[o]=t),a=!0;return a?i[l].focusAble?i[l]:this._GetNextItemVertical(l,e):null}_GetNextItemHorizontal(t,e){const i=this._Template.List,s=i[t].centerYPos;let n="left",o="right";e>0&&(o="left",n="right");let h=i.length-1;const r=this._Template.Orient.type;for(let t=i.length-1;t>=0;t--){if(i[t].focusAble){h=t;break}}let a=!1,l=-1,d=null;if(this._SupportHistoryPath&&(d=i[t].pathHistory[n]),null===d){let e=i[t].neighborIndexList[n];if(i[t].tmpNeighborIndexList[n].length>0&&(e=e.concat(i[t].tmpNeighborIndexList[n])),1===e.length)l=e[0],h===t&&"right"===n&&r===x||(i[t].pathHistory[n]=l,i[l].pathHistory[o]=t),a=!0;else{for(let d=0;d<e.length;d++){l=e[d];const c=i[l];if(s<=c.yPos+c.height-1&&s>=c.yPos){h===t&&"right"===n&&r===x||(i[t].pathHistory[n]=l,i[l].pathHistory[o]=t),a=!0;break}}if(!a||!i[l].focusAble)for(let s=0;s<e.length;s++){const d=e[s];if(i[d].focusAble){h===t&&"right"===n&&r===x||(i[t].pathHistory[n]=l,i[l].pathHistory[o]=t),l=d,a=!0;break}}}}else l=d,h===t&&"right"===n&&r===x||(i[l].pathHistory[o]=t),a=!0;return a?i[l].focusAble?i[l]:this._GetNextItemHorizontal(l,e):null}_GetNextLoopItemVertical(t,e){const i=this._Template.List,s=i[t].centerXPos;let n="bottom";e>0&&(n="top");let o=!1,h=-1,r=i[t].neighborIndexList[n];for(i[t].tmpNeighborIndexList[n].length>0&&(r=r.concat(i[t].tmpNeighborIndexList[n]));r.length>=1;)for(let t=0;t<r.length;t++){h=r[t];const e=i[h];if(s<=e.xPos+e.width-1&&s>=e.xPos){r=i[h].neighborIndexList[n],o=!0;break}}return o?i[h].focusAble?i[h]:this._GetNextLoopItemVertical(h,e):null}_GetNextLoopItemHorizontal(t,e){const i=this._Template.List,s=i[t].centerYPos;let n="right";e>0&&(n="left");let o=!1,h=-1,r=i[t].neighborIndexList[n];for(i[t].tmpNeighborIndexList[n].length>0&&(r=r.concat(i[t].tmpNeighborIndexList[n]));r.length>=1;)for(let t=0;t<r.length;t++){h=r[t];const e=i[h];if(s<=e.yPos+e.height-1&&s>=e.yPos){r=i[h].neighborIndexList[n],o=!0;break}}return o?i[h].focusAble?i[h]:this._GetNextLoopItemHorizontal(h,e):null}GetTemplate(){return this._Template}GetVisibleItemList(t,e,i){if(t>e)return null;t=Math.round(t),e=Math.round(e);const s=this._Template.IdsMap[i],n={resultStartIdx:-1,resultEndIdx:-1,enableBackwardSearching:!0,enableForwardSearching:!0,checkingStartLinePos:t,checkingEndLinePos:e},o={searchDirect:-1,baseIdx:s,checkingStartLineRanges:new N,startLineRangesFulled:!1,latestOverStartLineIdx:-1,checkingEndLineRanges:new N,endLineRangesFulled:!1,latestOverEndLineIdx:-1,endSearchingIndex:0,firstStartLineBlockIdx:-1,firstEndLineBlockIdx:-1,searchToBorder:!1,common:n},h={searchDirect:1,baseIdx:s,checkingStartLineRanges:new N,startLineRangesFulled:!1,latestOverStartLineIdx:-1,checkingEndLineRanges:new N,endLineRangesFulled:!1,latestOverEndLineIdx:-1,endSearchingIndex:this._Template.List.length-1,firstStartLineBlockIdx:-1,firstEndLineBlockIdx:-1,searchToBorder:!1,common:n},r=this._Template.Orient.type===x;let a=0;for(;n.enableBackwardSearching||n.enableForwardSearching;)n.enableBackwardSearching&&this._DoSearching(o,-a,r),n.enableForwardSearching&&this._DoSearching(h,a,r),a++;if(n.resultStartIdx<0&&(o.latestOverStartLineIdx>=0&&o.firstStartLineBlockIdx>=0?n.resultStartIdx=o.latestOverStartLineIdx:h.firstStartLineBlockIdx>=0&&(n.resultStartIdx=h.firstStartLineBlockIdx)),n.resultEndIdx<0&&(h.latestOverEndLineIdx>=0&&h.firstEndLineBlockIdx>=0?n.resultEndIdx=h.latestOverEndLineIdx:o.firstEndLineBlockIdx>=0&&(n.resultEndIdx=o.firstEndLineBlockIdx)),n.resultStartIdx<0&&n.resultEndIdx<0){const i=this._Template.List[0],s=r?i.yPos:i.xPos,o=this._Template.List[this._Template.List.length-1],h=r?o.yPos:o.xPos,a=r?o.height:o.width;s>t&&h+a<e&&(n.resultStartIdx=0,n.resultEndIdx=this._Template.List.length-1)}let l=null;if(n.resultStartIdx>=0||n.resultEndIdx>=0){l={visibleStart:n.resultStartIdx>=0?n.resultStartIdx:0,visibleEnd:n.resultEndIdx>=0?n.resultEndIdx:this._Template.List.length-1}}return l}_DoSearching(t,e,i){const s=this._Template.List[t.baseIdx+e],n=i?s.xPos:s.yPos,o=i?s.width:s.height,h=i?s.yPos:s.xPos,r=i?s.height:s.width;if(t.common.resultStartIdx<0&&!t.startLineRangesFulled){let i=!1;if(h<=t.common.checkingStartLinePos&&h+r-1>=t.common.checkingStartLinePos?(t.latestOverStartLineIdx=t.baseIdx+e,t.firstStartLineBlockIdx<0&&(t.firstStartLineBlockIdx=t.baseIdx+e),t.checkingStartLineRanges.Merge(new v(n,n+o-1)),i=!0):t.searchDirect<0&&h+r-1<=t.common.checkingStartLinePos&&(t.checkingStartLineRanges.Merge(new v(n,n+o-1)),i=!0),i){const e=t.checkingStartLineRanges.Ranges[0];e&&this.DebugPrint&&e.Start<=0&&e.End>=this._Template.Orient.widthMax-1&&((e.End>this._Template.Orient.widthMax-1||e.Start<0)&&(t.startLineRangesFulled=!0),t.searchDirect>0?t.common.resultStartIdx=t.firstStartLineBlockIdx:t.common.resultStartIdx=t.latestOverStartLineIdx,t.common.resultStartIdx>=0&&(t.common.enableBackwardSearching=!1))}}if(t.common.resultEndIdx<0&&!t.endLineRangesFulled){let i=!1;if(h<=t.common.checkingEndLinePos&&h+r-1>=t.common.checkingEndLinePos?(t.latestOverEndLineIdx=t.baseIdx+e,t.firstEndLineBlockIdx<0&&(t.firstEndLineBlockIdx=t.baseIdx+e),t.checkingEndLineRanges.Merge(new v(n,n+o-1)),i=!0):t.searchDirect>0&&h>=t.common.checkingEndLinePos&&(t.checkingEndLineRanges.Merge(new v(n,n+o-1)),i=!0),i){const e=t.checkingEndLineRanges.Ranges[0];e&&this.DebugPrint&&e.Start<=0&&e.End>=this._Template.Orient.widthMax-1&&((e.End>this._Template.Orient.widthMax-1||e.Start<0)&&(t.endLineRangesFulled=!0),t.searchDirect<0?t.common.resultEndIdx=t.firstEndLineBlockIdx:t.common.resultEndIdx=t.latestOverEndLineIdx,t.common.resultEndIdx>=0&&(t.common.enableForwardSearching=!1))}}t.baseIdx+e===t.endSearchingIndex&&(t.searchDirect>0?t.common.enableForwardSearching=!1:t.common.enableBackwardSearching=!1,t.searchToBorder=!0)}}let A=()=>{};const C=function(t){let e={left:0,right:0,top:0,bottom:0};return null!=t&&Object.assign(e,t),e},M=function(t,e,i,s){for(let n=s;n<t.length;n++){let s=e(t[n]);i.ParseTemplateItem(s,t[n])}i.CalculateNeighborWhenAddStop()},D=function(t,e,i,s){let n=C(s),o=i===x?t-n.left-n.right:e-n.top-n.bottom;return new O(i,o,"relative",t,e)},B={components:{RootView:F},props:{padding:{type:Object,default:()=>({top:0,left:0,right:0,bottom:0})},direction:{type:Symbol,default:_},height:{type:Number,required:!0},width:{type:Number,required:!0},slideStyle:{default:f.seamLess},slideSpeed:{type:Number,default:1.5},slideEasing:{type:String,default:"cubic-bezier(0.14,0.68,0.19,0.87)"},onClick:{type:Function,default:A},loopFocus:{type:Boolean,default:!1},onEdge:{type:Function,default:A},onFocus:{type:Function,default:A},onBlur:{type:Function,default:A},loadAll:{type:Boolean,default:!1},enableTouch:{type:Boolean,default:!1},flingPageWidth:{type:Number,default:-1},flingPageEdge:{type:Number,default:1/4},dispatcher:{type:Object},measures:{type:Function,required:!0},baseAnchor:{type:Object},initFocusId:{type:Number,default:0},data:{type:Array,required:!0},left:{type:Number,default:0},top:{type:Number,default:0},name:{type:String},slideFunction:{type:Function}},watch:{data:function(t,e){console.log("watch data change ",t,e)}},setup:()=>({templateParser:null,innerData:p({data:[]}),enterFocusId:-1,enterFocusRect:null,focusId:0,preFocusId:-1,preEdgeRect:null,isFocus:!1,perAnchor:null,rootElement:null,visibleStart:0,visibleRange:0,visibleItemList:[],needHideItemList:[],visibleRangeSearchBaseItem:0,touchContainerW:0,touchContainerH:0,touchListener:null,innerPadding:null,slidePile:null,dragDirection:w.DragSetting.DIRECTION_HORIZONTAL}),methods:{_initVisibleStart(t){if(0===t)return 0;let e=C(this.padding),i=0;const s=this.templateParser.GetItem(t),n=this.direction===x?"yPos":"xPos",o=this.direction===x?"height":"width";if(this.slideStyle===f.wholePage){const o=this.direction===x?this.height-e.top-e.bottom:this.width-e.left-e.right,h=Math.floor(s[n]/o);for(let e=t;e>=0;e--){const t=this.templateParser.GetItem(e);if(t[n]<o*h)break;i=t[n]}}else{const s=this.direction===x?this.height:this.width;let h=this.templateParser.GetTemplate().List,r=this.direction===x?"bottom":"right",a=h[h.length-1],l=a[n]+a[o]-s+e[r];for(let e=0;e<=t;e++){const t=this.templateParser.GetItem(e);t[n]+t[o]>i+4*s/5&&(i=t[n]+t[o]-4*s/5)}i=i>l?l:i,i=i<0?0:i}return i},_injectHandler(){return{onClick:this._onClick,queryPosition:this._queryPosition,queryTemplatePosition:this._queryTemplatePosition,registerItemFunc:this._registerItemFunc,getCurrentFocusId:this._getCurrentId}},_getCurrentId(){return this.focusId},_registerItemFunc(t,e){this.innerData.data[t].itemHandler=e},_queryPosition(t){let e=this.templateParser.GetItem(t),i=this.direction===x?0:-this.visibleStart,s=this.direction===x?-this.visibleStart:0;return{xPos:e.xPos+i,yPos:e.yPos+s,width:e.width,height:e.height}},_queryTemplatePosition(t){let e=this.templateParser.GetItem(t);return{xPos:e.xPos,yPos:e.yPos,width:e.width,height:e.height}},_dispatchEvent(t){switch(t.type){case E.Type.setFocusId:this.enterFocusId=t.data;break;case E.Type.setFocusRect:this.enterFocusRect=t.data;break;case E.Type.updateItem:break;case E.Type.slideToItem:t.data&&this._slideViewToAnchor(t.data)}},_getVisibleItemList(t,e,i){let s=e-100>0?e-100:0,n=i+100,o=this.templateParser.GetVisibleItemList(s,n,t);return this.templateParser.GetTemplate().List.slice(o.visibleStart,o.visibleEnd+1)},_calculateNearestItemByRect(t,e){let i=e.direction,s=e.rect;var n="",o={x:0,y:0};switch(i){case I.left:n="left",o.x=s.x,o.y=s.y+s.height/4;break;case I.right:n="right",o.x=s.x+s.width,o.y=s.y+s.height/4;break;case I.top:n="up",o.x=s.x+s.width/4,o.y=s.y;break;case I.bottom:n="down",o.x=s.x+s.width/4,o.y=s.y+s.height}var h=new v(o.x,o.x),r=new v(o.y,o.y),a=null,l=-1,d=0,c=0,g=0;let u=this.direction===x?"yPos":"xPos",p=this.direction===x?"height":"width";for(let e of t){if(e[u]>=this.visibleStart&&e[u]+e[p]-1<=this.visibleStart+this.visibleRange-1){let t=this.direction===x?e.xPos:e.xPos-this.visibleStart,i=this.direction===x?e.yPos-this.visibleStart:e.yPos;var m=new v(t,t+e.width-1),b=new v(i,i+e.height-1);switch(n){case"left":if(o.x<t+e.width-1)continue;o.y<i?c=Math.pow(o.x-(t+e.width-1),2)+Math.pow(i-o.y,2):r.IsInterAct(b)?c=Math.pow(o.x-(t+e.width-1),2):o.y>i+e.height-1&&(c=Math.pow(o.x-(t+e.width-1),2)+Math.pow(o.y-(i+e.height-1),2)),g=Math.abs(o.x-(t+e.width-1));break;case"right":if(o.x>t)continue;o.y<i?c=Math.pow(t-o.x,2)+Math.pow(i-o.y,2):r.IsInterAct(b)?c=Math.pow(t-o.x,2):o.y>i+e.height-1&&(c=Math.pow(t-o.x,2)+Math.pow(o.y-(i+e.height-1),2)),g=Math.abs(o.x-t);break;case"up":if(o.y<i+e.height-1)continue;o.x<t?c=Math.pow(o.x-t,2)+Math.pow(o.y-(i+e.height-1),2):h.IsInterAct(m)?c=Math.pow(o.y-(i+e.height-1),2):o.x>t+e.width-1&&(c=Math.pow(o.x-(t+e.width-1),2)+Math.pow(o.y-(i+e.height-1),2)),g=Math.abs(o.y-(i+e.height-1));break;case"down":if(o.y>i)continue;o.x<t?c=Math.pow(o.x-t,2)+Math.pow(i-o.y,2):h.IsInterAct(m)?c=Math.pow(i-o.y,2):o.x>t+e.width-1&&(c=Math.pow(o.x-(t+e.width-1),2)+Math.pow(i-o.y,2)),g=Math.abs(o.y-i);break;default:console.log("direction is error:"+n)}(l<0||d>g||d===g&&l>c)&&(l=c,d=g,a=e)}}return a?a.id:0},_updateItemVisibility(t,e){let i=this.templateParser.GetTemplate();for(let s=0;s<t.length;++s)this.innerData.data[i.IdsMap[t[s].id]].controller.visible=e},_onClick(t){return this.innerData.data[t].itemHandler.onClick()},onKeyDown(t){let e=0,i=0;switch(t.keyCode){case 37:e=-1,this._moveToNext(e,i);break;case 38:i=-1,this._moveToNext(e,i);break;case 39:e=1,this._moveToNext(e,i);break;case 40:i=1,this._moveToNext(e,i);break;case 13:this._onClick(this.focusId);break;default:return!1}return!0},_updateVisibleList(t,e,i){let s=this.visibleItemList;this.visibleItemList=this._getVisibleItemList(t,e,i);for(let t of s)this.visibleItemList.indexOf(t)<0&&this.needHideItemList.indexOf(t)<0&&this.needHideItemList.push(t);for(let t of this.visibleItemList){let e=this.needHideItemList.indexOf(t);e>=0&&this.needHideItemList.splice(e,1)}this.visibleStart=e,this._updateItemVisibility(this.visibleItemList,!0)},_moveToNext(t,e,i){let s=this.templateParser.GetTemplate(),n=s.IdsMap[this.focusId],o=this.templateParser.GetNextItem(this.focusId,e,t,this.loopFocus);if(o>=0){this.preFocusId=this.focusId;let h=this.templateParser.GetItem(o);this.focusId=h.id;let r,a=this.direction===x?e:t,l=this.visibleStart,d=this.slideFunction?this.slideFunction(h,a,this.visibleStart):this._CalculateSlide(h,a,this.visibleStart);if(d=this._adjustToValidPosition(d),l!==d){let t=this.visibleItemList;this.visibleItemList=this._getVisibleItemList(o,d,d+this.visibleRange-1);for(let e of t)this.visibleItemList.indexOf(e)<0&&this.needHideItemList.indexOf(e)<0&&this.needHideItemList.push(e);for(let t of this.visibleItemList){let e=this.needHideItemList.indexOf(t);e>=0&&this.needHideItemList.splice(e,1)}this.visibleStart=d;let e={easing:"",onstart:null,speed:this.slideSpeed,onend:this._onTransitionEnd};this.direction===_?this.rootElement.updatePosition(-this.visibleStart,0,e):this.rootElement.updatePosition(0,-this.visibleStart,e),this.visibleRangeSearchBaseItem=o,this._updateVisibleList(o,d,d+this.visibleRange-1)}let c=s.List[n].xPos-s.List[o].xPos,g=s.List[n].yPos-s.List[o].yPos;i?(i.rect.x+=c,i.rect.y+=g,r=i):r={direction:null,rect:{x:c,y:g,width:s.List[n].width,height:s.List[n].height}},this.preEdgeRect=r,this._updateBlurItem(),this._updateFocusItem(),this.isFocus&&this.innerData.data[this.preFocusId].itemHandler.onBlur(),this.isFocus&&this.innerData.data[this.focusId].itemHandler.onFocus(this.preEdgeRect)}else{let i,o=this.direction===x?0:this.visibleStart,h=this.direction===x?this.visibleStart:0;1===t&&(i=I.right),-1===t&&(i=I.left),1===e&&(i=I.bottom),-1===e&&(i=I.top);let r={x:s.List[n].xPos-o,y:s.List[n].yPos-h,width:s.List[n].width,height:s.List[n].height};this.onEdge&&this.onEdge({direction:i,rect:r}),this.innerData.data[this.focusId].itemHandler.reachEdge({direction:i})}},_adjustToValidPosition(t){let e=this.templateParser.GetTemplate().List,i=e[e.length-1],s=this.direction===x?"yPos":"xPos",n=this.direction===x?"height":"width",o=C(this.padding),h=this.direction===x?o.bottom+o.top:o.right+o.left,r=this.direction===x?this.height:this.width,a=i[s]+i[n]-r+h;return a=a<0?0:a,t>a?a:t<0?0:t},_CalculateSlide(t,e,i){let s=i,n=s,o=this.direction===x?"yPos":"xPos",h=this.direction===x?"height":"width",r=this.direction===x?this.height:this.width;switch(this.slideStyle){case f.seamLess:e>0?t[o]+t[h]>s+4*r/5&&(n=t[o]+t[h]-4*r/5):e<0?t[o]<s+r/5&&(n=t[o]-r/5):t[o]<s?n=t[o]-r/5:t[o]+t[h]>s+r&&(n=t[o]+t[h]-4*r/5);break;case f.wholePage:e>0?t[o]+t[h]>s+r+1&&(n=t[o]):e<0&&t[o]<s&&(n=t[o]+t[h]-r)}return n},_onFocusableItemEdge(t){let e=0,i=0;switch(t.direction){case I.left:e=-1;break;case I.right:e=1;break;case I.top:i=-1;break;case I.bottom:i=1}this._moveToNext(e,i,t)},_ifValidEnterRect:t=>t&&t.direction&&t.rect,_setZIndex(t,e){this.innerData.data[t].controller.zIndex=e},_onFocus(){let t=void 0!==this.enterFocusId&&this.enterFocusId>=0&&this.enterFocusId<this.templateParser.GetTemplate().List.length?this.enterFocusId:this.focusId;t=this._ifValidEnterRect(this.enterFocusRect)?this._calculateNearestItemByRect(this.visibleItemList,this.enterFocusRect):t,this.isFocus=!0,this.focusId=t,this.preFocusId=-1,this._updateFocusItem(),this.isFocus&&Promise.resolve().then((()=>{this.innerData.data[t].itemHandler.onFocus(this.preEdgeRect)})),this.onFocus&&this.onFocus()},_onBlur(){this.isFocus=!1,this.enterFocusId=-1,this.enterFocusRect=null,this.preFocusId=this.focusId,this.preEdgeRect=null,this._updateBlurItem(),this.innerData.data[this.preFocusId].itemHandler.onBlur(),this.onBlur&&this.onBlur()},_onTransitionEnd(t){t&&t.stopPropagation&&t.stopPropagation(),this._updateItemVisibility(this.needHideItemList,!1),this.needHideItemList=[]},_onContentUpdate(){this._updateItemVisibility(this.visibleItemList,!0),this._updateFocusItem()},_updateFocusItem(){this.templateParser.GetItem(this.focusId)&&this._setZIndex(this.templateParser.GetTemplate().IdsMap[this.focusId],this.data.length)},_updateBlurItem(){this._setZIndex(this.templateParser.GetTemplate().IdsMap[this.preFocusId],0)},_onFocusUpdate(){},_BaseAnchorInfo2Pos(t,e,i){let s=t.id,n=C(this.padding),o={xPos:this.direction===x?0:e,yPos:this.direction===x?e:0};if(null!=s){let e=this.templateParser.GetTemplate().List,h=e[s],r=e[e.length-1];if(h){let e=void 0!==t.type?t.type:"start",s=this.direction===x?"yPos":"xPos",a=this.direction===x?"height":"width",l=this.direction===x?"bottom":"right";switch(e){case"start":o[s]=h[s];break;case"center":o[s]=h[s]-i/2+h[a]/2;break;case"end":o[s]=h[s]+h[a]-1-i+n[l]}let d=r[s]+r[a]-i+n[l];o[s]=o[s]>d?d:o[s],o[s]=o[s]<0?0:o[s]}}return o},_slideViewToAnchor(t){if(t.id<0||t.id>=this.templateParser.GetTemplate().List.length)return;let e=this._BaseAnchorInfo2Pos(t,this.visibleStart,this.visibleRange);if(this.visibleStart=this.direction===x?e.yPos:e.xPos,this._updateVisibleList(this.visibleRangeSearchBaseItem,this.visibleStart,this.visibleStart+this.visibleRange-1),void 0===t.doAnim||null===t.doAnim||t.doAnim){if(this.rootElement){let t={easing:"",onstart:null,speed:this.slideSpeed,onend:this._onTransitionEnd};this.direction===_?this.rootElement.updatePosition(-this.visibleStart,0,t):this.rootElement.updatePosition(0,-this.visibleStart,t)}}else this._updateItemVisibility(this.needHideItemList,!1),this.needHideItemList=[];this.visibleRangeSearchBaseItem=t.id},_updateFocusByDragInfo(t,e){let i=null;i=this.direction===x?{direction:I.top,rect:{x:this.left-t,y:this.top-e,width:10,height:10}}:{direction:I.left,rect:{x:this.left-t,y:this.top-e,width:10,height:10}},this.focusId=this._calculateNearestItemByRect(this.visibleItemList,i)},_registerRootView(t){this.rootElement=t},_tryReoprtVisibleEvent(t){void 0!==t.viewY&&void 0!==t.viewX&&(this.direction===x?this.visibleStart=-t.viewY:this.visibleStart=-t.viewX,this.visibleStart<0&&(this.visibleStart=0));let e=this.visibleStart-2*this.visibleRange,i=this.visibleStart+3*this.visibleRange-1,s=this.visibleRangeSearchBaseItem?this.visibleRangeSearchBaseItem:0;this._updateVisibleList(s,e,i)},_getTouchListener(){if(!this.enableTouch)return null;return{OnDragStart:t=>(Promise.resolve().then((()=>{this._tryReoprtVisibleEvent(t),w.sRenderBridge.InstantPerformSwap()})),!0),OnMoved:t=>(Promise.resolve().then((()=>{this._tryReoprtVisibleEvent(t),w.sRenderBridge.InstantPerformSwap()})),!0),OnDragEnd:t=>(this._tryReoprtVisibleEvent(t),this._updateFocusByDragInfo(t.viewX,t.viewY),this.needHideItemList.length>0&&this._onTransitionEnd(),!0),OnFling:t=>(this._tryReoprtVisibleEvent(t),this._updateFocusByDragInfo(t.viewX,t.viewY),this.needHideItemList.length>0&&this._onTransitionEnd(),!0),OnRelease:()=>!0}},_getFocusBlockActions(){return{onFocus:this._onFocus,onBlur:this._onBlur,onKeyDown:this.onKeyDown}}},created(){this.dispatcher&&this.dispatcher.registerComponent(this);let t=D(this.width,this.height,this.direction,this.padding);M(this.data,this.measures,t,0),this.templateParser=t;let e=this.templateParser.GetTemplate().List,i=e[e.length-1];this.touchListener=this._getTouchListener(),this.innerPadding=C(this.padding),this.touchContainerW=this.direction===x?this.width:i.xPos+i.width,this.touchContainerH=this.direction===x?i.yPos+i.height:this.height,this.slidePile=new w.RectArea(0,0,this.width-this.innerPadding.left-this.innerPadding.right,this.height-this.innerPadding.top-this.innerPadding.bottom),this.dragDirection=this.direction===x?w.DragSetting.DIRECTION_VERTICAL:w.DragSetting.DIRECTION_HORIZONTAL,this.innerData.data=e.map((t=>({data:t,controller:{visible:m(!1),zIndex:m(0)},itemHandler:{register(t,e){this[t]=e}}})));let s=0,n=0,o=this.direction===x?this.height:this.width;if(this.visibleItemList=this._getVisibleItemList(s,n,n+o-1),void 0!==this.baseAnchor){let t=this._BaseAnchorInfo2Pos(this.baseAnchor,0,o);n=this.direction===x?t.yPos:t.xPos,this.visibleItemList=this._getVisibleItemList(this.baseAnchor.id,n,n+o-1)}this.initFocusId&&(s=this.initFocusId,void 0===this.baseAnchor&&(n=this._initVisibleStart(s),this.visibleItemList=this._getVisibleItemList(s,n,n+o-1))),this.focusId=s,this.visibleStart=n,this.visibleRange=o,this.perAnchor=this.baseAnchor},updated(){let t=this.templateParser.GetTemplate().List,e=this.data,i=0;for(i=0;i<e.length;++i){let s=!1;for(let n=0;n<t.length;++n)if(e[i]===t[n].data){s=!0;break}if(!s)break}let s=!1;if(i===t.length)i!==e.length?(s=!0,M(this.data,this.measures,this.templateParser,i)):!this.baseAnchor||this.baseAnchor.id===this.perAnchor.id&&this.baseAnchor.type===this.perAnchor.type||(this.perAnchor=this.baseAnchor,this._slideViewToAnchor(this.perAnchor));else{s=!0;let t=D(this.width,this.height,this.direction,this.padding);M(this.data,this.measures,t,0),this.templateParser=t}if(s){let t=this.templateParser.GetTemplate().List,e=t[t.length-1];this.touchListener=this._getTouchListener(),this.innerPadding=C(this.padding),this.touchContainerW=this.direction===x?this.width:e.xPos+e.width,this.touchContainerH=this.direction===x?e.yPos+e.height:this.height,this.slidePile=new w.RectArea(0,0,this.width-this.innerPadding.left-this.innerPadding.right,this.height-this.innerPadding.top-this.innerPadding.bottom),this.dragDirection=this.direction===x?w.DragSetting.DIRECTION_VERTICAL:w.DragSetting.DIRECTION_HORIZONTAL,this.innerData.data=t.map(((t,e)=>({data:t,controller:{visible:m(!1),zIndex:m(0)},itemHandler:this.innerData.data[e]?{...this.innerData.data[e].itemHandler}:{}})))}this.focusId>=this.data.length&&(this.focusId=0,this.preFocusId=-1,this.visibleRangeSearchBaseItem=0,0!==this.visibleStart&&(this.visibleStart=0,this.rootElement.updatePosition(0,0,null))),this.visibleItemList=this._getVisibleItemList(this.visibleRangeSearchBaseItem,this.visibleStart,this.visibleStart+this.visibleRange-1),this.isFocus&&(this._updateFocusItem(),Promise.resolve().then((()=>{this.innerData.data[this.focusId].itemHandler.onFocus(null)})))},mounted(){},beforeUnmount(){this.dispatcher&&this.dispatcher.unregisterComponent()}};B.render=function(e,n,h,r,p,m){const b=o("root-view"),I=o("jsv-focus-block");return t(),a(I,{name:e.name,onAction:e._getFocusBlockActions()},{default:l((()=>[g("div",{style:i({left:e.left,top:e.top,width:e.width,height:e.height,overflow:"hidden"})},[u(b,{x:e.innerPadding.left,y:e.innerPadding.top,width:e.touchContainerW,height:e.touchContainerH,flingPageWidth:e.flingPageWidth,flingPageEdge:e.flingPageEdge,slidePile:e.slidePile,direction:e.dragDirection,touchListener:e.touchListener,enableTouch:e.enableTouch,loadAll:e.loadAll,register:e._registerRootView,data:e.innerData,onLoad:e._onContentUpdate,onItemEdge:e._onFocusableItemEdge,widgetHandler:e._injectHandler()},{renderItem:l((t=>[s(e.$slots,"renderItem",d(c(t)))])),_:3},8,["x","y","width","height","flingPageWidth","flingPageEdge","slidePile","direction","touchListener","enableTouch","loadAll","register","data","onLoad","onItemEdge","widgetHandler"])],4)])),_:3},8,["name","onAction"])},B.__file="src/SimpleWidget/SimpleWidget.vue";var G={props:{name:String,namespace:String,autoFocus:String,onAction:Object,onDispatchKeyUp:Function,onDispatchKeyDown:Function,onKeyUp:Function,onKeyDown:Function,onFocus:Function,onBlur:Function},setup(t){if(t.namespace&&t.name)throw new Error("JsvFocusBlock Error: Either name or namespace can be set.");if(""===t.namespace)throw new Error("JsvFocusBlock Error: Invalid namespace of empty value.");if(t.namespace&&t.namespace.indexOf(".")>=0)throw new Error('JsvFocusBlock Error: Invalid namespace of "'+t.namespace+'". namespace must not contains "."');if(t.name&&t.name.indexOf(".")>=0)throw new Error('JsvFocusBlock Error: Invalid name of "'+t.name+'". name must not contains "."');return{actionCallback:{}}},mounted(){this.$_mountToFocusSystem(),(this.$props.autoFocus||""===this.$props.autoFocus)&&this.requestFocus("exact"!==this.$props.autoFocus)},beforeUnmount(){this.$el.FocusNodeRef.onUnMount()},methods:{getName(){return this.$el.FocusNodeRef.getName()},getNamespace(){let t=this.$el.FocusNodeRef;t?.AsHub&&(t=this.$el.FocusNodeRef.GetParentPage());const e=t.getName();return".__AppRoot__"!==e?e:""},findBlockByName(t){return this.$el.FocusNodeRef.getNodeByName(t)?.jsvVueComponent},requestFocus(t){this.$el.FocusNodeRef.requestFocus(t)},debugPrintFocusChain(){this.$el.FocusNodeRef.printFocusNodeList()},debugPrintLastFocus(){this.$el.FocusNodeRef.printGlobalLastFocus()},$_mountToFocusSystem(){const t=this.$el.FocusNodeRef;t.jsvVueComponent=this,this.actionCallback.onDispatchKeyDown=this.$props.onDispatchKeyDown||this.$props.onAction?.onDispatchKeyDown,this.actionCallback.onDispatchKeyDown&&t.setOnDispatchKeyDown(this.$_onDispatchKeyDown),this.actionCallback.onDispatchKeyUp=this.$props.onDispatchKeyUp||this.$props.onAction?.onDispatchKeyUp,this.actionCallback.onDispatchKeyUp&&t.setOnDispatchKeyUp(this.$_onDispatchKeyUp),this.actionCallback.onKeyDown=this.$props.onKeyDown||this.$props.onAction?.onKeyDown,this.actionCallback.onKeyDown&&t.setOnKeyDown(this.$_onKeyDown),this.actionCallback.onKeyUp=this.$props.onKeyUp||this.$props.onAction?.onKeyUp,this.actionCallback.onKeyUp&&t.setOnKeyUp(this.$_onKeyUp),this.actionCallback.onFocus=this.$props.onFocus||this.$props.onAction?.onFocus,this.actionCallback.onFocus&&t.setOnFocus(this.$_onFocus),this.actionCallback.onBlur=this.$props.onBlur||this.$props.onAction?.onBlur,this.actionCallback.onBlur&&t.setOnBlur(this.$_onBlur);let e=this.$el,i=e.parentElement;for(;i&&!e.FocusNodeRef.GetParentPage();)"FDIV"===i.tagName?(e.FocusNodeRef.setParent(i.FocusNodeRef),e=i,i=e.parentElement):i=i.parentElement},$_onDispatchKeyDown(t){return t.ownerNode=this,this.actionCallback?.onDispatchKeyDown(t)||!1},$_onDispatchKeyUp(t){return t.ownerNode=this,this.actionCallback?.onDispatchKeyUp(t)||!1},$_onKeyDown(t){return t.ownerNode=this,this.actionCallback?.onKeyDown(t)||!1},$_onKeyUp(t){return t.ownerNode=this,this.actionCallback?.onKeyUp(t)||!1},$_onFocus(){this.actionCallback?.onFocus(this)},$_onBlur(){this.actionCallback?.onBlur(this)}}};const H=["fname","new-namespace"];G.render=function(i,n,o,h,r,a){return t(),e("fdiv",{fname:i.$props.name,"new-namespace":i.$props.namespace},[s(i.$slots,"default")],8,H)},G.__file="src/JsvFocusBlock.vue";class ${constructor(){}install(t,...e){if("string"!=typeof e[0])throw new Error("JsvFocusManager Error: 2nd argument is required. Such as: app.use(FocusManager, '#app')");const i=this.$_hookMount(t,e[0]);t.mount=i,t.component("JsvFocusBlock",G),t.config.globalProperties.$jsvFocusManager=this}$_hookMount(t,e){return e=e.replace("#",""),this.$_topFDiv=document.jsvInitFDivRoot(e),this.$_appMount=t.mount.bind(t),this.$_doAppMount.bind(this)}$_doAppMount(t){const e=this.$_appMount(t);return this.$_topFDiv.onMounted(),e}$_appMount=void 0;$_topFDiv=void 0}function V(){return new $}export{b as BaseDispatcher,I as EdgeDirection,y as FDIV_ROUTER_NAME,_ as HORIZONTAL,G as JsvFocusBlock,E as SWidgetDispatcher,B as SimpleWidget,f as SlideStyle,x as VERTICAL,L as getMeasureObj,V as jsvCreateFocusManager};