text: !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t=t||self).fgui=t.fgui||{})}(this,(function(t){"use strict";var e,i,s,h,r,a,n,o,l,_,d,c,u,p,g,f,m,y,w,v;(e=t.ButtonMode||(t.ButtonMode={}))[e.Common=0]="Common",e[e.Check=1]="Check",e[e.Radio=2]="Radio",(i=t.AutoSizeType||(t.AutoSizeType={}))[i.None=0]="None",i[i.Both=1]="Both",i[i.Height=2]="Height",i[i.Shrink=3]="Shrink",(s=t.LoaderFillType||(t.LoaderFillType={}))[s.None=0]="None",s[s.Scale=1]="Scale",s[s.ScaleMatchHeight=2]="ScaleMatchHeight",s[s.ScaleMatchWidth=3]="ScaleMatchWidth",s[s.ScaleFree=4]="ScaleFree",s[s.ScaleNoBorder=5]="ScaleNoBorder",(h=t.ListLayoutType||(t.ListLayoutType={}))[h.SingleColumn=0]="SingleColumn",h[h.SingleRow=1]="SingleRow",h[h.FlowHorizontal=2]="FlowHorizontal",h[h.FlowVertical=3]="FlowVertical",h[h.Pagination=4]="Pagination",(r=t.ListSelectionMode||(t.ListSelectionMode={}))[r.Single=0]="Single",r[r.Multiple=1]="Multiple",r[r.Multiple_SingleClick=2]="Multiple_SingleClick",r[r.None=3]="None",(a=t.OverflowType||(t.OverflowType={}))[a.Visible=0]="Visible",a[a.Hidden=1]="Hidden",a[a.Scroll=2]="Scroll",(n=t.PackageItemType||(t.PackageItemType={}))[n.Image=0]="Image",n[n.MovieClip=1]="MovieClip",n[n.Sound=2]="Sound",n[n.Component=3]="Component",n[n.Atlas=4]="Atlas",n[n.Font=5]="Font",n[n.Swf=6]="Swf",n[n.Misc=7]="Misc",n[n.Unknown=8]="Unknown",n[n.Spine=9]="Spine",n[n.DragonBones=10]="DragonBones",(o=t.ObjectType||(t.ObjectType={}))[o.Image=0]="Image",o[o.MovieClip=1]="MovieClip",o[o.Swf=2]="Swf",o[o.Graph=3]="Graph",o[o.Loader=4]="Loader",o[o.Group=5]="Group",o[o.Text=6]="Text",o[o.RichText=7]="RichText",o[o.InputText=8]="InputText",o[o.Component=9]="Component",o[o.List=10]="List",o[o.Label=11]="Label",o[o.Button=12]="Button",o[o.ComboBox=13]="ComboBox",o[o.ProgressBar=14]="ProgressBar",o[o.Slider=15]="Slider",o[o.ScrollBar=16]="ScrollBar",o[o.Tree=17]="Tree",o[o.Loader3D=18]="Loader3D",(l=t.ProgressTitleType||(t.ProgressTitleType={}))[l.Percent=0]="Percent",l[l.ValueAndMax=1]="ValueAndMax",l[l.Value=2]="Value",l[l.Max=3]="Max",(_=t.ScrollBarDisplayType||(t.ScrollBarDisplayType={}))[_.Default=0]="Default",_[_.Visible=1]="Visible",_[_.Auto=2]="Auto",_[_.Hidden=3]="Hidden",(d=t.ScrollType||(t.ScrollType={}))[d.Horizontal=0]="Horizontal",d[d.Vertical=1]="Vertical",d[d.Both=2]="Both",(c=t.FlipType||(t.FlipType={}))[c.None=0]="None",c[c.Horizontal=1]="Horizontal",c[c.Vertical=2]="Vertical",c[c.Both=3]="Both",(u=t.ChildrenRenderOrder||(t.ChildrenRenderOrder={}))[u.Ascent=0]="Ascent",u[u.Descent=1]="Descent",u[u.Arch=2]="Arch",(p=t.GroupLayoutType||(t.GroupLayoutType={}))[p.None=0]="None",p[p.Horizontal=1]="Horizontal",p[p.Vertical=2]="Vertical",(g=t.PopupDirection||(t.PopupDirection={}))[g.Auto=0]="Auto",g[g.Up=1]="Up",g[g.Down=2]="Down",(f=t.RelationType||(t.RelationType={}))[f.Left_Left=0]="Left_Left",f[f.Left_Center=1]="Left_Center",f[f.Left_Right=2]="Left_Right",f[f.Center_Center=3]="Center_Center",f[f.Right_Left=4]="Right_Left",f[f.Right_Center=5]="Right_Center",f[f.Right_Right=6]="Right_Right",f[f.Top_Top=7]="Top_Top",f[f.Top_Middle=8]="Top_Middle",f[f.Top_Bottom=9]="Top_Bottom",f[f.Middle_Middle=10]="Middle_Middle",f[f.Bottom_Top=11]="Bottom_Top",f[f.Bottom_Middle=12]="Bottom_Middle",f[f.Bottom_Bottom=13]="Bottom_Bottom",f[f.Width=14]="Width",f[f.Height=15]="Height",f[f.LeftExt_Left=16]="LeftExt_Left",f[f.LeftExt_Right=17]="LeftExt_Right",f[f.RightExt_Left=18]="RightExt_Left",f[f.RightExt_Right=19]="RightExt_Right",f[f.TopExt_Top=20]="TopExt_Top",f[f.TopExt_Bottom=21]="TopExt_Bottom",f[f.BottomExt_Top=22]="BottomExt_Top",f[f.BottomExt_Bottom=23]="BottomExt_Bottom",f[f.Size=24]="Size",(m=t.FillMethod||(t.FillMethod={}))[m.None=0]="None",m[m.Horizontal=1]="Horizontal",m[m.Vertical=2]="Vertical",m[m.Radial90=3]="Radial90",m[m.Radial180=4]="Radial180",m[m.Radial360=5]="Radial360",(y=t.FillOrigin||(t.FillOrigin={}))[y.Top=0]="Top",y[y.Bottom=1]="Bottom",y[y.Left=2]="Left",y[y.Right=3]="Right",y[y.TopLeft=0]="TopLeft",y[y.TopRight=1]="TopRight",y[y.BottomLeft=2]="BottomLeft",y[y.BottomRight=3]="BottomRight",(w=t.FillOrigin90||(t.FillOrigin90={}))[w.TopLeft=0]="TopLeft",w[w.TopRight=1]="TopRight",w[w.BottomLeft=2]="BottomLeft",w[w.BottomRight=3]="BottomRight",(v=t.ObjectPropID||(t.ObjectPropID={}))[v.Text=0]="Text",v[v.Icon=1]="Icon",v[v.Color=2]="Color",v[v.OutlineColor=3]="OutlineColor",v[v.Playing=4]="Playing",v[v.Frame=5]="Frame",v[v.DeltaTime=6]="DeltaTime",v[v.TimeScale=7]="TimeScale",v[v.FontSize=8]="FontSize",v[v.Selected=9]="Selected";class x{constructor(t,e,i){this._init=e,this._reset=i,this._ct=t,this.pool=[]}borrow(...t){let e;return e=this.pool.length>0?this.pool.pop():new this._ct,this._init&&this._init(e,...t),e}returns(t){if(Array.isArray(t)){let e=t.length;for(let i=0;i<e;i++){let e=t[i];this._reset&&this._reset(e),this.pool.push(e)}t.length=0}else this._reset&&this._reset(t),this.pool.push(t)}}var b={x:0,y:0,mouseWheelDelta:0,touchId:0,button:0,clickCount:0,holdTime:0};class C{constructor(){this.data=null,this._callChain=[]}get type(){return this._type}get sender(){return this._sender}get initiator(){return this._initiator}get input(){return b}stopPropagation(){this._stopsPropagation=!0}preventDefault(){this._defaultPrevented=!0}captureTouch(){this._touchCapture=!0}get isDefaultPrevented(){return this._defaultPrevented}}var S=new x(C,t=>{t._stopsPropagation=!1,t._defaultPrevented=!1,t._touchCapture=!1},t=>{t.data=null,t._initiator=null,t._sender=null});class I{constructor(){this._listeners={}}on(t,e,i,s){let h=this._listeners[t];h||(h={dispatching:0,callbacks:[],captures:[]},this._listeners[t]=h);let r=s?h.captures:h.callbacks,a=r.findIndex((t,s,h)=>t==e&&h[s+1]==i);-1!=a?r[a+2]=!1:r.push(e,i,!1)}off(t,e,i,s){let h=this._listeners[t];if(!h)return;let r=s?h.captures:h.callbacks,a=r.findIndex((t,s,h)=>t==e&&h[s+1]==i);-1!=a&&(0!=h.dispatching?(r[a+2]=!0,h.dispatching=2):r.splice(a,3))}offAll(t){if(t){let e=this._listeners[t];e&&(0!=e.dispatching?(e.callbacks.forEach((t,e,i)=>i[e+2]=!0),e.captures.forEach((t,e,i)=>i[e+2]=!0),e.dispatching=2):(e.callbacks.length=0,e.captures.length=0))}else for(var e in this._listeners)delete this._listeners[e]}hasListener(t,e,i,s){let h=this._listeners[t];if(!h)return!1;let r=s?h.captures:h.callbacks;if(!e)return r.length>0;r.findIndex((t,s,h)=>t==e&&h[s+1]==i)}dispatchEvent(t,e){let i=this._listeners[t];if(!i||0==i.callbacks.length&&0==i.captures.length)return;let s=S.borrow(t);return s._type=t,s.data=e,this._dispatch(i,s,!0),this._dispatch(i,s,!1),S.returns(s),s._defaultPrevented}_dispatch(t,e,i){if(0!=t.dispatching)return;t.dispatching=1,e._sender=this;let s=i?t.captures:t.callbacks,h=s.length;for(let t=0;t<h;t+=3)s[t].call(s[t+1],e);if(2==t.dispatching){let t=s.length,e=0;for(;e<t;)s[e+2]?(s.splice(e,3),t-=3):e+=3}t.dispatching=0}}class T{constructor(t=0,e=0){this.x=t,this.y=e}set(t,e){return this.x=t,this.y=e,this}reset(){return this.x=this.y=0,this}distance(t,e){return Math.sqrt((this.x-t)*(this.x-t)+(this.y-e)*(this.y-e))}toString(){return this.x+","+this.y}normalize(){var t=Math.sqrt(this.x*this.x+this.y*this.y);if(t>0){var e=1/t;this.x*=e,this.y*=e}}copy(t){return this.set(t.x,t.y)}}class P{constructor(t,e,i,s){this.x=t||0,this.y=e||0,this.width=i||0,this.height=s||0}set(t,e,i,s){this.x=t,this.y=e,this.width=i,this.height=s}setMinMax(t,e,i,s){this.x=t,this.y=e,this.width=i-t,this.height=s-e}get position(){return new T(this.x,this.y)}get size(){return new T(this.width,this.height)}get xMin(){return this.x}set xMin(t){let e=t-this.x;this.x=t,this.width-=e}get xMax(){return this.x+this.width}set xMax(t){this.width=t-this.x}get yMin(){return this.y}set yMin(t){let e=t-this.y;this.y=t,this.height-=e}get yMax(){return this.y+this.height}set yMax(t){this.height=t-this.y}intersection(t){if(0==this.width||0==this.height||0==t.width||0==t.height)return new P(0,0,0,0);let e=this.x>t.x?this.x:t.x,i=this.xMax<t.xMax?this.xMax:t.xMax,s=this.y>t.y?this.y:t.y,h=this.yMax<t.yMax?this.yMax:t.yMax;return e>i||s>h?this.set(0,0,0,0):this.setMinMax(e,s,i,h),this}union(t){if(0==t.width||0==t.height)return this;if(0==this.width||0==this.height)return this.copy(t),this;let e=Math.min(this.x,t.x),i=Math.min(this.y,t.y);return this.setMinMax(e,i,Math.max(this.xMax,t.xMax),Math.max(this.yMax,t.yMax)),this}extend(t,e){this.x-=t,this.y-=e,this.width+=2*t,this.height+=2*e}contains(t,e){return t instanceof T&&(e=t.y,t=t.x),t>=this.x&&t<this.x+this.width&&e>=this.y&&e<this.y+this.height}copy(t){this.set(t.x,t.y,t.width,t.height)}clone(){return new P(this.x,this.y,this.width,this.height)}}class k{constructor(t=0,e=0,i=0){this.x=t,this.y=e,this.z=i}set(t,e,i){return this.x=t,this.y=e,this.z=i,this}reset(){return this.x=this.y=this.z=0,this}toString(){return this.x+","+this.y+","+this.z}add(t){this.x+=t.x,this.y+=t.y,this.z+=t.z}sub(t){this.x-=t.x,this.y-=t.y,this.z-=t.z}cross(t){let e=this;const i=e.x,s=e.y,h=e.z,r=t.x,a=t.y,n=t.z;this.x=s*n-h*a,this.y=h*r-i*n,this.z=i*a-s*r}multiplyScalar(t){this.x*=t,this.y*=t,this.z*=t}normalize(){var t=this.x,e=this.y,i=this.z,s=t*t+e*e+i*i;s>0&&(s=1/Math.sqrt(s),this.x=t*s,this.y=e*s,this.z=i*s)}copy(t){this.set(t.x,t.y,t.z)}}class O extends I{constructor(){super(),this._defaultDisplay="",this._timerID=0,this._node=document.createElement("div"),this._node.style.position="absolute",this._node.$owner=this,this._children=[],this._pos=new k,this._scale=new T(1,1),this._rot=0,this._pivot=new T,this._contentRect=new P,this._alpha=1,this._color=16777215,this._touchable=!0}get name(){return this._node.id}set name(t){this._node.id=t}get x(){return this._pos.x}set x(t){this.setPosition(t,-this._pos.y)}get y(){return-this._pos.y}set y(t){this.setPosition(this._pos.x,t)}setPosition(t,e,i){i&&(t-=this._pivot.x*this._contentRect.width,e-=this._pivot.y*this._contentRect.height),this._node.style.left=t+"px",this._node.style.top=e+"px"}get width(){return this._contentRect.width}set width(t){this._contentRect.width!=t&&(this._contentRect.width=t,this.onSizeChanged())}get height(){return this._contentRect.height}set height(t){this._contentRect.height!=t&&(this._contentRect.height=t,this.onSizeChanged())}setSize(t,e){t==this._contentRect.width&&e==this._contentRect.height||(this._contentRect.width=t,this._contentRect.height=e,this.onSizeChanged())}onSizeChanged(){this._node.style.width=this._contentRect.width+"px",this._node.style.height=this._contentRect.height+"px"}get pivotX(){return this._pivot.x}set pivotX(t){this.setPivot(t,this._pivot.y)}get pivotY(){return this._pivot.y}set pivotY(t){this.setPosition(this._pivot.x,t)}setPivot(t,e){this._pivot.x==t&&this._pivot.y==e||(this._pivot.set(t,e),this._node.style.transformOrigin=this._pivot.x+"%,"+this._pivot.y+"%")}get flip(){return this._flipX?this._flipY?t.FlipType.Both:t.FlipType.Horizontal:this._flipY?this._flipX?t.FlipType.Both:t.FlipType.Vertical:t.FlipType.None}set flip(e){let i=e==t.FlipType.Both||e==t.FlipType.Horizontal,s=e==t.FlipType.Both||e==t.FlipType.Vertical;i==this._flipX&&s==this._flipY||(this._flipX=i),this._flipY=s,this.updateTransform()}updateTransform(){0==this._timerID&&(this._timerID=window.requestAnimationFrame(()=>{this._timerID=0;let t=[];(1!=this._scale.x||this._flipX)&&(t.push("scaleX("),t.push(""+this._scale.x*(this._flipX?-1:1)),t.push(") ")),(1!=this._scale.y||this._flipY)&&(t.push("scaleY("),t.push(""+this._scale.y*(this._flipY?-1:1)),t.push(") ")),0!=this._rot&&(t.push("rotate("),t.push(""+this._rot),t.push("deg) ")),t.length>0?this._node.style.transform=t.join(""):this._node.style.transform="none"}))}updateFilters(){let t="";this._grayed&&(t+="grayscale(100%)"),this._node.style.filter=t}get scaleX(){return this._scale.x}set scaleX(t){this.setScale(t,this._scale.y)}get scaleY(){return this._scale.y}set scaleY(t){this.setScale(this._scale.x,t)}setScale(t,e){this._scale.x==t&&this._scale.y==e||(this._scale.set(t,e),this.updateTransform())}get rotation(){return this._rot}set rotation(t){this._rot!=t&&(this._rot=t,this.updateTransform())}get parent(){return this._parent}get alpha(){return this._alpha}set alpha(t){this._alpha!=t&&(this._alpha=t,this._node.style.opacity=this._alpha.toFixed(3))}get touchable(){return this._touchable}set touchable(t){this._touchable!=t&&(this._touchable=t,this._node.style.pointerEvents=t?"auto":"none")}get visible(){return this._visible}set visible(t){this._visible!=t&&(this._visible=t,t?this._node.style.display=this._defaultDisplay:(this._defaultDisplay=this._node.style.display,this._node.style.display="none"))}get grayed(){return this._grayed}set grayed(t){this._grayed!=t&&(this._grayed=t,this.updateFilters())}get onStage(){return this._node.isConnected}globalToLocal(t,e,i){let s=this._node.getBoundingClientRect(),h=s.width/this._contentRect.width,r=s.height/this._contentRect.height;return i||(i=new T),i.x=t-s.x/h,i.y=e-s.y/r,i}localToGlobal(t,e,i){let s=this._node.getBoundingClientRect(),h=s.width/this._contentRect.width,r=s.height/this._contentRect.height;return i||(i=new T),i.x=t*h+s.x,i.y=e*r+s.y,i}addChild(t){this.addChildAt(t,Number.POSITIVE_INFINITY)}addChildAt(t,e){if(t._parent==this)this.setChildIndex(t,e);else{if(e>this._children.length-1)this._node.appendChild(t._node);else{let i=this._children[e]._node;this._node.insertBefore(t._node,i)}this._children.splice(e,0,t),t._parent=this}this._node.isConnected&&t.broadcastEvent("added_to_stage")}removeChild(t){let e=this._children.indexOf(t);if(-1==e)throw"not a child";this.removeChildAt(e)}removeChildAt(t){let e=this._children[t];this._node.isConnected&&e.broadcastEvent("removed_from_stage"),this._children.splice(t,1),this._node.removeChild(e._node),e._parent=null}setChildIndex(t,e){let i=this._children.indexOf(t);if(i!=e){if(-1==i)throw"Not a child";if(this._children.splice(i,1),e>=this._children.length-1)this._children.push(t),this._node.appendChild(t._node);else{this._children.splice(e,0,t);let i=this._children[e+1]._node;this._node.insertBefore(t._node,i)}}}getIndex(t){return this._children.indexOf(t)}get numChildren(){return this._children.length}get clipping(){return this._clipping}set clipping(t){this._clipping!=t&&(this._clipping=t,this._clipping?this._node.style.overflow="hidden":this._node.style.overflow="visible")}hitTest(t){if(0==this._scale.x||0==this._scale.y)return null;let e,i=this.globalToLocal(t.screenPt.x,t.screenPt.y),s=i.x,h=i.y;if(this.hitArea){if(!this.hitArea.hitTest(this._contentRect,s,h))return null}else if(this._clipping&&!this._contentRect.contains(s,h))return null;if(this.mask){let e=this.mask.visible?this.mask.hitTest(t):null;if(!this.reversedMask&&!e||this.reversedMask&&e)return null}return e=this.hitTestChildren(t),!e&&this.opaque&&(this.hitArea||this._contentRect.contains(s,h))&&(e=this),e}dispose(){}traverseVisible(t){if(!1===this._visible)return;t(this);const e=this._children;for(let i=0,s=e.length;i<s;i++)e[i].traverseVisible(t)}traverseAncestors(t){const e=this._parent;null!==e&&(t(e),e.traverseAncestors(t))}broadcastEvent(t,e){let i=S.borrow();i._type=t,i.data=e;let s=i._callChain;this.traverseVisible(t=>{s.push(t)}),s.forEach(e=>{let s=e._listeners[t];s&&(s.captures.length>0&&e._dispatch(s,i,!0),s.callbacks.length>0&&e._dispatch(s,i,!1))}),s.length=0,S.returns(i)}hitTestChildren(t){for(let e=this._children.length-1;e>=0;--e){let i=this._children[e];if(i.visible&&(i!=this.mask&&!i._touchDisabled)){if(!t.forTouch||i._touchable){let e=i.hitTest(t);if(e)return e}if(i._children.length>0){let e=i.hitTestChildren(t);if(e)return e}}}}}class z{static add(t,e,i,s,h){let r,a=B.findIndex(t=>t.target==s&&t.callback==i);-1!=a?r=B[a]:(r=L.borrow(),r.callback=i,r.target=s,B.push(r)),r.delay=t,r.counter=0,r.repeat=e,r.param=h,r.end=!1}static callLater(t,e,i){this.add(0,1,t,e,i)}static callDelay(t,e,i,s){this.add(t,1,e,i,s)}static addUpdate(t,e,i){this.add(0,0,t,e,i)}static exists(t,e){return-1!=B.findIndex(i=>i.target==e&&i.callback==t)}static remove(t,e){let i=B.findIndex(i=>i.target==e&&i.callback==t);if(-1!=i){let t=B[i];B.splice(i,1),i<j&&j--,M--,L.returns(t)}}}z.deltaTime=0,z.time=0,z.frameCount=0;var B=new Array,L=new x(class{constructor(){this.delay=0,this.counter=0,this.repeat=0}advance(t){return this.counter+=t,this.counter>=this.delay&&(this.counter-=this.delay,this.counter>this.delay&&(this.counter=this.delay),this.repeat>0&&(this.repeat--,0==this.repeat&&(this.end=!0)),!0)}reset(){this.callback=null,this.target=null,this.param=null}},t=>t.reset()),j=0,M=0,F=0;requestAnimationFrame((function t(e){requestAnimationFrame(t),z.frameCount++,z.time=e;let i=e-F;z.deltaTime=i,F=e,j=0,M=B.length;for(;j<M;){var s=B[j];j++,s.advance(i)&&(s.end&&(j--,M--,B.splice(j,1)),s.callback.call(s.target,s.param),s.end&&L.returns(s))}return!1}));class A{constructor(){this.screenPt=new T}}class R{static get touchPos(){return W}static get touchScreen(){return D}static get touchTarget(){return V}static get touchCount(){return G}static getTouchPos(t,e){if(e||(e=new T),null==t||-1==t)e.copy(W);else{let i=K(t);i?e.set(i.x,i.y):e.copy(W)}return e}static addTouchMonitor(t,e){let i=K(t);-1==i.touchMonitors.indexOf(e)&&i.touchMonitors.push(e)}static removeTouchMonitor(t){for(let e=0;e<5;e++){let i=E[e],s=i.touchMonitors.indexOf(t);-1!=s&&(i.touchMonitors[s]=null)}}static cancelClick(t){for(let e=0;e<5;e++){let i=E[e];i.touchId==t&&(i.clickCancelled=!0)}}static hitTest(t,e,i){return $(t,e,i)}}R.rootObject=new O;var D,E,V,W,G,H,N=[],Y=[],U=new A;function X(t){R.rootObject.setSize(window.innerWidth,window.innerHeight)}function q(t,e){W.set(t.pageX,t.pageY);let i=E[0];if(i.shiftKey=t.shiftKey,i.ctrlKey=t.ctrlKey,i.target=V=$(W.x,W.y,!0),W.x==i.x&&W.y==i.y||(i.x=W.x,i.y=W.y,i.move()),i.lastRollOver!=i.target&&Z(i),0==e)i.began||(G=1,i.begin(),i.button=t.button,J(i),i.target&&et(i.target,"touch_begin"));else if(1==e&&i.began){G=0,i.end();let e=i.clickTest();e&&(J(i),1==t.button||2==t.button?et(e,"right_click"):et(e,"click")),i.button=-1}}function K(t){for(let e=0;e<5;e++){let i=E[e];if(-1==t&&-1!=i.touchId||-1!=t&&i.touchId==t)return i}return null}function Q(t,e){let i=t.changedTouches;for(let s=0;s<i.length;++s){let h,r,a=i[s];W.set(a.pageX,a.pageY);for(let t=0;t<5;t++){if(E[t].touchId==a.identifier){h=E[t];break}-1==E[t].touchId&&(r=E[t])}if(!h){if(h=r,!h||0!=e)continue;h.touchId=a.identifier}if(h.shiftKey=t.shiftKey,h.ctrlKey=t.ctrlKey,h.target=V=$(W.x,W.y,!0),h.x==W.x&&h.y==W.y||(h.x=W.x,h.y=W.y,h.began&&h.move()),h.lastRollOver!=h.target&&Z(h),0==e)h.began||(G++,h.begin(),h.button=0,J(h),h.target&&et(h.target,"touch_begin"));else if((1==e||3==e)&&h.began){if(G--,h.end(),3!=e){let t=h.clickTest();null!=t&&(J(h),et(t,"click"))}h.target=null,Z(h),h.touchId=-1}}}function Z(t){if(N.length=0,Y.length=0,t.lastRollOver&&(Y.push(t.lastRollOver),t.lastRollOver.traverseAncestors(t=>{Y.push(t)})),t.lastRollOver=t.target,t.target){let e=t.target;for(;e;){let t=Y.indexOf(e);if(-1!=t){Y.splice(t,Y.length-t);break}N.push(e),e=e.parent}}let e=Y.length;if(e>0){for(let t=0;t<e;t++){let e=Y[t];e.onStage&&e.dispatchEvent("roll_out",null)}Y.length=0}if(e=N.length,e>0){for(let t=0;t<e;t++){let e=N[t];e.onStage&&e.dispatchEvent("roll_over",null)}N.length=0}}function $(t,e,i){return U||(U=new A),U.screenPt.set(t,e),U.forTouch=null==i||i,R.rootObject.hitTestChildren(U)}function J(t){b.touchId=t.touchId,b.x=t.x,b.y=t.y,b.clickCount=t.clickCount,b.mouseWheelDelta=t.mouseWheelDelta,b.button=t.button,b.holdTime=t.holdTime,b.ctrlKey=t.ctrlKey,b.shiftKey=t.shiftKey,b.commandKey=t.commandKey}class tt{constructor(){this.downTargets=new Array,this.touchMonitors=new Array,this.reset()}reset(){this.touchId=-1,this.x=0,this.y=0,this.clickCount=0,this.button=-1,this.mouseWheelDelta=0,this.lastClickTime=0,this.began=!1,this.target=null,this.downTargets.length=0,this.lastRollOver=null,this.clickCancelled=!1,this.touchMonitors.length=0}begin(){this.began=!0,this.clickCancelled=!1,this.downX=this.x,this.downY=this.y,this.downTime=performance.now(),this.downFrame=z.frameCount,this.holdTime=0,this.downTargets.length=0,this.target&&(this.downTargets.push(this.target),this.target.traverseAncestors(t=>{this.downTargets.push(t)}))}move(){if(this.began&&(this.holdTime=z.frameCount-this.downFrame==1?1/60:performance.now()-this.downTime),J(this),(Math.abs(this.x-this.downX)>50||Math.abs(this.y-this.downY)>50)&&(this.clickCancelled=!0),this.touchMonitors.length>0){let t=this.touchMonitors.length;for(let e=0;e<t;e++){let t=this.touchMonitors[e];t instanceof O&&!t.onStage&&(this.touchMonitors[e]=null)}et(null,"touch_move",null,this.touchMonitors)}else R.rootObject.dispatchEvent("touch_move")}end(){this.began=!1;let t=performance.now();0==this.downTargets.length||this.clickCancelled||Math.abs(this.x-this.downX)>10||Math.abs(this.y-this.downY)>10?(this.clickCancelled=!0,this.lastClickTime=0,this.clickCount=1):(t-this.lastClickTime<.35&&Math.abs(this.x-this.lastClickX)<10&&Math.abs(this.y-this.lastClickY)<10&&this.lastClickButton==this.button?2==this.clickCount?this.clickCount=1:this.clickCount++:this.clickCount=1,this.lastClickTime=t,this.lastClickX=this.x,this.lastClickY=this.y,this.lastClickButton=this.button),this.holdTime=z.frameCount-this.downFrame==1?1/60:t-this.downTime,J(this);let e=this.target?this.target:R.rootObject;if(this.touchMonitors.length>0){let t=this.touchMonitors.length;for(let e=0;e<t;e++){let t=this.touchMonitors[e];t instanceof O&&!t.onStage&&(this.touchMonitors[e]=null)}et(e,"touch_end",null,this.touchMonitors),this.touchMonitors.length=0}else et(e,"touch_end")}clickTest(){if(this.clickCancelled)return this.downTargets.length=0,null;let t=this.downTargets[0];if(t.onStage)return this.downTargets.length=0,t;for(t=this.target;t;){if(-1!=this.downTargets.indexOf(t)&&t.onStage)break;t=t.parent}return this.downTargets.length=0,t}}function et(t,e,i,s){let h=S.borrow();h._type=e,h.data=i,h._initiator=t;let r=h._callChain;h.initiator&&r.push(h.initiator),t.traverseAncestors(t=>{r.push(t)});for(let t=r.length-1;t>=0;t--){let i=r[t],s=i._listeners[e];s&&s.captures.length>0&&(i._dispatch(s,h,!0),h._touchCapture&&(h._touchCapture=!1,"touch_begin"==e&&R.addTouchMonitor(h.input.touchId,i)))}if(!h._stopsPropagation){for(let t=0;t<r.length;t++){let i=r[t],s=i._listeners[e];if(s&&s.callbacks.length>0&&(i._dispatch(s,h,!1),h._touchCapture&&(h._touchCapture=!1,"touch_begin"==e&&R.addTouchMonitor(h.input.touchId,i)),h._stopsPropagation))break}if(s)for(let t=0;t<s.length;t++){let i=s[t];if(i&&-1==r.indexOf(i)){let t=i._listeners[e];t&&(t.captures.length>0&&i._dispatch(t,h,!0),t.callbacks.length>0&&i._dispatch(t,h,!1))}}}r.length=0,S.returns(h)}!function(){document.body.appendChild(R.rootObject._node),D="ontouchstart"in window||navigator.maxTouchPoints>0||navigator.msMaxTouchPoints>0,E=[];for(let t=0;t<5;t++)E.push(new tt);D||(E[0].touchId=0),G=0,W=new T,D?(document.addEventListener("touchstart",t=>Q(t,0),{passive:!1}),document.addEventListener("touchend",t=>Q(t,1),{passive:!1}),document.addEventListener("touchmove",t=>Q(t,2),{passive:!1}),document.addEventListener("touchcancel",t=>Q(t,3),{passive:!1})):(document.addEventListener("mousedown",t=>q(t,0),{passive:!1}),document.addEventListener("mouseup",t=>q(t,1),{passive:!1}),document.addEventListener("mousemove",t=>q(t,2),{passive:!1})),document.addEventListener("wheel",t=>function(t){W.set(t.pageX,t.pageY);let e=E[0];D&&(e.shiftKey=t.shiftKey,e.ctrlKey=t.ctrlKey,e.target=V=$(W.x,W.y,!0));null!=V&&(e.mouseWheelDelta=t.deltaY,J(e),et(V,"mouse_wheel"),e.mouseWheelDelta=0)}(t),{passive:!1}),window.addEventListener("resize",X,!1),X()}(),(H=t.EaseType||(t.EaseType={}))[H.Linear=0]="Linear",H[H.SineIn=1]="SineIn",H[H.SineOut=2]="SineOut",H[H.SineInOut=3]="SineInOut",H[H.QuadIn=4]="QuadIn",H[H.QuadOut=5]="QuadOut",H[H.QuadInOut=6]="QuadInOut",H[H.CubicIn=7]="CubicIn",H[H.CubicOut=8]="CubicOut",H[H.CubicInOut=9]="CubicInOut",H[H.QuartIn=10]="QuartIn",H[H.QuartOut=11]="QuartOut",H[H.QuartInOut=12]="QuartInOut",H[H.QuintIn=13]="QuintIn",H[H.QuintOut=14]="QuintOut",H[H.QuintInOut=15]="QuintInOut",H[H.ExpoIn=16]="ExpoIn",H[H.ExpoOut=17]="ExpoOut",H[H.ExpoInOut=18]="ExpoInOut",H[H.CircIn=19]="CircIn",H[H.CircOut=20]="CircOut",H[H.CircInOut=21]="CircInOut",H[H.ElasticIn=22]="ElasticIn",H[H.ElasticOut=23]="ElasticOut",H[H.ElasticInOut=24]="ElasticInOut",H[H.BackIn=25]="BackIn",H[H.BackOut=26]="BackOut",H[H.BackInOut=27]="BackInOut",H[H.BounceIn=28]="BounceIn",H[H.BounceOut=29]="BounceOut",H[H.BounceInOut=30]="BounceInOut",H[H.Custom=31]="Custom";class it{dispose(){this._tweenConfig&&this._tweenConfig._tweener&&(this._tweenConfig._tweener.kill(),this._tweenConfig._tweener=null)}get controller(){return this._controller}set controller(t){t!=this._controller&&(this._controller=t,this._controller&&this.init())}get tweenConfig(){return this._tweenConfig||(this._tweenConfig=new st),this._tweenConfig}get allowTween(){return this._tweenConfig&&this._tweenConfig.tween&&0==Mt.n&&!it.disableAllTweenEffect}setup(t){var e,i;this._controller=this._owner.parent.getControllerAt(t.readShort()),this.init();var s=t.readShort();if("pages"in this)this.pages=t.readSArray(s);else{for(e=0;e<s;e++)null!=(i=t.readS())&&this.addStatus(i,t);t.readBool()&&this.addStatus(null,t)}if(t.readBool()&&(this._tweenConfig=new st,this._tweenConfig.easeType=t.readByte(),this._tweenConfig.duration=t.readFloat(),this._tweenConfig.delay=t.readFloat()),t.version>=2)if("positionsInPercent"in this){if(t.readBool()){for(this.positionsInPercent=!0,e=0;e<s;e++)null!=(i=t.readS())&&this.addExtStatus(i,t);t.readBool()&&this.addExtStatus(null,t)}}else"condition"in this&&(this.condition=t.readByte())}updateFromRelations(t,e){}addStatus(t,e){}init(){}apply(){}updateState(){}}class st{constructor(){this.tween=!0,this.easeType=t.EaseType.QuadOut,this.duration=.3,this.delay=0}}class ht{constructor(){this.x=this.y=this.z=this.w=0}get color(){return(this.w<<24)+(this.x<<16)+(this.y<<8)+this.z}set color(t){this.x=(16711680&t)>>16,this.y=(65280&t)>>8,this.z=255&t,this.w=(4278190080&t)>>24}getField(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("Index out of bounds: "+t)}}setField(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;case 3:this.w=e;break;default:throw new Error("Index out of bounds: "+t)}}setZero(){this.x=this.y=this.z=this.w=0}}const rt=.5*Math.PI,at=2*Math.PI;function nt(e,i,s,h,r){switch(e){case t.EaseType.Linear:return i/s;case t.EaseType.SineIn:return 1-Math.cos(i/s*rt);case t.EaseType.SineOut:return Math.sin(i/s*rt);case t.EaseType.SineInOut:return-.5*(Math.cos(Math.PI*i/s)-1);case t.EaseType.QuadIn:return(i/=s)*i;case t.EaseType.QuadOut:return-(i/=s)*(i-2);case t.EaseType.QuadInOut:return(i/=.5*s)<1?.5*i*i:-.5*(--i*(i-2)-1);case t.EaseType.CubicIn:return(i/=s)*i*i;case t.EaseType.CubicOut:return(i=i/s-1)*i*i+1;case t.EaseType.CubicInOut:return(i/=.5*s)<1?.5*i*i*i:.5*((i-=2)*i*i+2);case t.EaseType.QuartIn:return(i/=s)*i*i*i;case t.EaseType.QuartOut:return-((i=i/s-1)*i*i*i-1);case t.EaseType.QuartInOut:return(i/=.5*s)<1?.5*i*i*i*i:-.5*((i-=2)*i*i*i-2);case t.EaseType.QuintIn:return(i/=s)*i*i*i*i;case t.EaseType.QuintOut:return(i=i/s-1)*i*i*i*i+1;case t.EaseType.QuintInOut:return(i/=.5*s)<1?.5*i*i*i*i*i:.5*((i-=2)*i*i*i*i+2);case t.EaseType.ExpoIn:return 0==i?0:Math.pow(2,10*(i/s-1));case t.EaseType.ExpoOut:return i==s?1:1-Math.pow(2,-10*i/s);case t.EaseType.ExpoInOut:return 0==i?0:i==s?1:(i/=.5*s)<1?.5*Math.pow(2,10*(i-1)):.5*(2-Math.pow(2,-10*--i));case t.EaseType.CircIn:return-(Math.sqrt(1-(i/=s)*i)-1);case t.EaseType.CircOut:return Math.sqrt(1-(i=i/s-1)*i);case t.EaseType.CircInOut:return(i/=.5*s)<1?-.5*(Math.sqrt(1-i*i)-1):.5*(Math.sqrt(1-(i-=2)*i)+1);case t.EaseType.ElasticIn:var a;return 0==i?0:1==(i/=s)?1:(0==r&&(r=.3*s),h<1?(h=1,a=r/4):a=r/at*Math.asin(1/h),-h*Math.pow(2,10*(i-=1))*Math.sin((i*s-a)*at/r));case t.EaseType.ElasticOut:var n;return 0==i?0:1==(i/=s)?1:(0==r&&(r=.3*s),h<1?(h=1,n=r/4):n=r/at*Math.asin(1/h),h*Math.pow(2,-10*i)*Math.sin((i*s-n)*at/r)+1);case t.EaseType.ElasticInOut:var o;return 0==i?0:2==(i/=.5*s)?1:(0==r&&(r=s*(.3*1.5)),h<1?(h=1,o=r/4):o=r/at*Math.asin(1/h),i<1?h*Math.pow(2,10*(i-=1))*Math.sin((i*s-o)*at/r)*-.5:h*Math.pow(2,-10*(i-=1))*Math.sin((i*s-o)*at/r)*.5+1);case t.EaseType.BackIn:return(i/=s)*i*((h+1)*i-h);case t.EaseType.BackOut:return(i=i/s-1)*i*((h+1)*i+h)+1;case t.EaseType.BackInOut:return(i/=.5*s)<1?i*i*((1+(h*=1.525))*i-h)*.5:.5*((i-=2)*i*((1+(h*=1.525))*i+h)+2);case t.EaseType.BounceIn:return ot(i,s);case t.EaseType.BounceOut:return lt(i,s);case t.EaseType.BounceInOut:return function(t,e){if(t<.5*e)return.5*ot(2*t,e);return.5*lt(2*t-e,e)+.5}(i,s);default:return-(i/=s)*(i-2)}}function ot(t,e){return 1-lt(e-t,e)}function lt(t,e){return(t/=e)<1/2.75?7.5625*t*t:t<2/2.75?7.5625*(t-=1.5/2.75)*t+.75:t<2.5/2.75?7.5625*(t-=2.25/2.75)*t+.9375:7.5625*(t-=2.625/2.75)*t+.984375}var _t=new T;class dt{constructor(){this._startValue=new ht,this._endValue=new ht,this._value=new ht,this._deltaValue=new ht,this._reset()}setDelay(t){return this._delay=t,this}get delay(){return this._delay}setDuration(t){return this._duration=t,this}get duration(){return this._duration}setBreakpoint(t){return this._breakpoint=t,this}setEase(t){return this._easeType=t,this}setEasePeriod(t){return this._easePeriod=t,this}setEaseOvershootOrAmplitude(t){return this._easeOvershootOrAmplitude=t,this}setRepeat(t,e){return this._repeat=t,this._yoyo=e,this}get repeat(){return this._repeat}setTimeScale(t){return this._timeScale=t,this}setSnapping(t){return this._snapping=t,this}setTarget(t,e){return this._target=t,this._propType=e,this}get target(){return this._target}setPath(t){return this._path=t,this}setUserData(t){return this._userData=t,this}get userData(){return this._userData}onUpdate(t,e){return this._onUpdate=t,this._onUpdateCaller=e,this}onStart(t,e){return this._onStart=t,this._onStartCaller=e,this}onComplete(t,e){return this._onComplete=t,this._onCompleteCaller=e,this}get startValue(){return this._startValue}get endValue(){return this._endValue}get value(){return this._value}get deltaValue(){return this._deltaValue}get normalizedTime(){return this._normalizedTime}get completed(){return 0!=this._ended}get allCompleted(){return 1==this._ended}setPaused(t){return this._paused=t,this}seek(t){if(!this._killed){if(this._elapsedTime=t,this._elapsedTime<this._delay){if(!this._started)return;this._elapsedTime=this._delay}this.update()}}kill(t){this._killed||(t&&(0==this._ended&&(this._breakpoint>=0?this._elapsedTime=this._delay+this._breakpoint:this._repeat>=0?this._elapsedTime=this._delay+this._duration*(this._repeat+1):this._elapsedTime=this._delay+2*this._duration,this.update()),this.callCompleteCallback()),this._killed=!0)}_to(t,e,i){return this._valueSize=1,this._startValue.x=t,this._endValue.x=e,this._value.x=t,this._duration=i,this}_to2(t,e,i,s,h){return this._valueSize=2,this._startValue.x=t,this._endValue.x=i,this._startValue.y=e,this._endValue.y=s,this._value.x=t,this._value.y=e,this._duration=h,this}_to3(t,e,i,s,h,r,a){return this._valueSize=3,this._startValue.x=t,this._endValue.x=s,this._startValue.y=e,this._endValue.y=h,this._startValue.z=i,this._endValue.z=r,this._value.x=t,this._value.y=e,this._value.z=i,this._duration=a,this}_to4(t,e,i,s,h,r,a,n,o){return this._valueSize=4,this._startValue.x=t,this._endValue.x=h,this._startValue.y=e,this._endValue.y=r,this._startValue.z=i,this._endValue.z=a,this._startValue.w=s,this._endValue.w=n,this._value.x=t,this._value.y=e,this._value.z=i,this._value.w=s,this._duration=o,this}_toColor(t,e,i){return this._valueSize=4,this._startValue.color=t,this._endValue.color=e,this._value.color=t,this._duration=i,this}_shake(t,e,i,s){return this._valueSize=5,this._startValue.x=t,this._startValue.y=e,this._startValue.w=i,this._duration=s,this}_init(){this._delay=0,this._duration=0,this._breakpoint=-1,this._easeType=t.EaseType.QuadOut,this._timeScale=1,this._easePeriod=0,this._easeOvershootOrAmplitude=1.70158,this._snapping=!1,this._repeat=0,this._yoyo=!1,this._valueSize=0,this._started=!1,this._paused=!1,this._killed=!1,this._elapsedTime=0,this._normalizedTime=0,this._ended=0}_reset(){this._target=null,this._propType=null,this._userData=null,this._path=null,this._onStart=this._onUpdate=this._onComplete=null,this._onStartCaller=this._onUpdateCaller=this._onCompleteCaller=null}_update(t){if(1!=this._timeScale&&(t*=this._timeScale),0!=t){if(0!=this._ended)return this.callCompleteCallback(),void(this._killed=!0);this._elapsedTime+=t,this.update(),0!=this._ended&&(this._killed||(this.callCompleteCallback(),this._killed=!0))}}update(){if(this._ended=0,0!=this._valueSize){if(!this._started){if(this._elapsedTime<this._delay)return;if(this._started=!0,this.callStartCallback(),this._killed)return}var t=!1,e=this._elapsedTime-this._delay;if(this._breakpoint>=0&&e>=this._breakpoint&&(e=this._breakpoint,this._ended=2),0!=this._repeat){var i=Math.floor(e/this._duration);e-=this._duration*i,this._yoyo&&(t=i%2==1),this._repeat>0&&this._repeat-i<0&&(this._yoyo&&(t=this._repeat%2==1),e=this._duration,this._ended=1)}else e>=this._duration&&(e=this._duration,this._ended=1);if(this._normalizedTime=nt(this._easeType,t?this._duration-e:e,this._duration,this._easeOvershootOrAmplitude,this._easePeriod),this._value.setZero(),this._deltaValue.setZero(),5==this._valueSize)if(0==this._ended){var s=this._startValue.w*(1-this._normalizedTime),h=s*(Math.random()>.5?1:-1),r=s*(Math.random()>.5?1:-1);this._deltaValue.x=h,this._deltaValue.y=r,this._value.x=this._startValue.x+h,this._value.y=this._startValue.y+r}else this._value.x=this._startValue.x,this._value.y=this._startValue.y;else if(this._path){let t=this._path.getPointAt(this._normalizedTime,_t);this._snapping&&(t.x=Math.round(t.x),t.y=Math.round(t.y)),this._deltaValue.x=t.x-this._value.x,this._deltaValue.y=t.y-this._value.y,this._value.x=t.x,this._value.y=t.y}else for(var a=0;a<this._valueSize;a++){var n=this._startValue.getField(a),o=n+(this._endValue.getField(a)-n)*this._normalizedTime;this._snapping&&(o=Math.round(o)),this._deltaValue.setField(a,o-this._value.getField(a)),this._value.setField(a,o)}if(this._target&&this._propType)if(this._propType instanceof Function)switch(this._valueSize){case 1:this._propType.call(this._target,this._value.x);break;case 2:this._propType.call(this._target,this._value.x,this._value.y);break;case 3:this._propType.call(this._target,this._value.x,this._value.y,this._value.z);break;case 4:this._propType.call(this._target,this._value.x,this._value.y,this._value.z,this._value.w);break;case 5:this._propType.call(this._target,this._value.color);break;case 6:this._propType.call(this._target,this._value.x,this._value.y)}else 5==this._valueSize?this._target[this._propType]=this._value.color:this._target[this._propType]=this._value.x;this.callUpdateCallback()}else this._elapsedTime>=this._delay+this._duration&&(this._ended=1)}callStartCallback(){if(this._onStart)try{this._onStart.call(this._onStartCaller,this)}catch(t){console.log("error in start callback > "+t)}}callUpdateCallback(){if(this._onUpdate)try{this._onUpdate.call(this._onUpdateCaller,this)}catch(t){console.log("error in update callback > "+t)}}callCompleteCallback(){if(this._onComplete)try{this._onComplete.call(this._onCompleteCaller,this)}catch(t){console.log("error in complete callback > "+t)}}}class ct{static createTween(){ft||(z.addUpdate(ct.update),ft=!0);var t=pt.borrow();return ut[gt++]=t,t}static isTweening(t,e){if(null==t)return!1;for(var i=!e,s=0;s<gt;s++){var h=ut[s];if(h&&h.target==t&&!h._killed&&(i||h._propType==e))return!0}return!1}static killTweens(t,e,i){if(null==t)return!1;for(var s=!1,h=gt,r=!i,a=0;a<h;a++){var n=ut[a];!n||n.target!=t||n._killed||!r&&n._propType!=i||(n.kill(e),s=!0)}return s}static getTween(t,e){if(null==t)return null;for(var i=gt,s=!e,h=0;h<i;h++){var r=ut[h];if(r&&r.target==t&&!r._killed&&(s||r._propType==e))return r}return null}static update(){for(var t=z.deltaTime/1e3,e=gt,i=-1,s=0;s<e;s++){var h=ut[s];null==h?-1==i&&(i=s):h._killed?(pt.returns(h),ut[s]=null,-1==i&&(i=s)):(h._target&&"isDisposed"in h._target&&h._target.isDisposed?h._killed=!0:h._paused||h._update(t),-1!=i&&(ut[i]=h,ut[s]=null,i++))}if(i>=0){if(gt!=e){var r=e;for(e=gt-e,s=0;s<e;s++)ut[i++]=ut[r++]}gt=i}}}var ut=new Array,pt=new x(dt,t=>t._init(),t=>t._reset()),gt=0,ft=!1;class mt{static to(t,e,i){return ct.createTween()._to(t,e,i)}static to2(t,e,i,s,h){return ct.createTween()._to2(t,e,i,s,h)}static to3(t,e,i,s,h,r,a){return ct.createTween()._to3(t,e,i,s,h,r,a)}static to4(t,e,i,s,h,r,a,n,o){return ct.createTween()._to4(t,e,i,s,h,r,a,n,o)}static toColor(t,e,i){return ct.createTween()._toColor(t,e,i)}static delayedCall(t){return ct.createTween().setDelay(t)}static shake(t,e,i,s){return ct.createTween()._shake(t,e,i,s)}static isTweening(t,e){return ct.isTweening(t,e)}static kill(t,e,i){ct.killTweens(t,e,i)}static getTween(t,e){return ct.getTween(t,e)}}mt.catchCallbackExceptions=!0;class yt{constructor(t){this._owner=t,this._defs=new Array}get owner(){return this._owner}set target(t){this._target!=t&&(this._target&&this.releaseRefTarget(),this._target=t,this._target&&this.addRefTarget())}get target(){return this._target}add(e,i){if(e==t.RelationType.Size)return this.add(t.RelationType.Width,i),void this.add(t.RelationType.Height,i);for(var s=this._defs.length,h=0;h<s;h++)if(this._defs[h].type==e)return;this.internalAdd(e,i)}internalAdd(e,i){if(e==t.RelationType.Size)return this.internalAdd(t.RelationType.Width,i),void this.internalAdd(t.RelationType.Height,i);var s=new wt;s.percent=i,s.type=e,s.axis=e<=t.RelationType.Right_Right||e==t.RelationType.Width||e>=t.RelationType.LeftExt_Left&&e<=t.RelationType.RightExt_Right?0:1,this._defs.push(s)}remove(e){if(e==t.RelationType.Size)return this.remove(t.RelationType.Width),void this.remove(t.RelationType.Height);for(var i=this._defs.length,s=0;s<i;s++)if(this._defs[s].type==e){this._defs.splice(s,1);break}}copy(t){this._target=t.target,this._defs.length=0;for(var e=t._defs.length,i=0;i<e;i++){var s=t._defs[i],h=new wt;h.copy(s),this._defs.push(h)}}dispose(){this._target&&(this.releaseRefTarget(),this._target=null)}get isEmpty(){return 0==this._defs.length}applyOnSelfResized(e,i,s){var h=this._defs.length;if(0!=h){for(var r=this._owner.x,a=this._owner.y,n=0;n<h;n++){switch(this._defs[n].type){case t.RelationType.Center_Center:this._owner.x-=(.5-(s?this._owner.pivotX:0))*e;break;case t.RelationType.Right_Center:case t.RelationType.Right_Left:case t.RelationType.Right_Right:this._owner.x-=(1-(s?this._owner.pivotX:0))*e;break;case t.RelationType.Middle_Middle:this._owner.y-=(.5-(s?this._owner.pivotY:0))*i;break;case t.RelationType.Bottom_Middle:case t.RelationType.Bottom_Top:case t.RelationType.Bottom_Bottom:this._owner.y-=(1-(s?this._owner.pivotY:0))*i}}if((r!=this._owner.x||a!=this._owner.y)&&(r=this._owner.x-r,a=this._owner.y-a,this._owner.updateGearFromRelations(1,r,a),this._owner.parent&&this._owner.parent._transitions.length>0)){h=this._owner.parent._transitions.length;for(var o=0;o<h;o++){this._owner.parent._transitions[o].updateFromRelations(this._owner.id,r,a)}}}}applyOnXYChanged(e,i,s){var h;switch(e.type){case t.RelationType.Left_Left:case t.RelationType.Left_Center:case t.RelationType.Left_Right:case t.RelationType.Center_Center:case t.RelationType.Right_Left:case t.RelationType.Right_Center:case t.RelationType.Right_Right:this._owner.x+=i;break;case t.RelationType.Top_Top:case t.RelationType.Top_Middle:case t.RelationType.Top_Bottom:case t.RelationType.Middle_Middle:case t.RelationType.Bottom_Top:case t.RelationType.Bottom_Middle:case t.RelationType.Bottom_Bottom:this._owner.y+=s;break;case t.RelationType.Width:case t.RelationType.Height:break;case t.RelationType.LeftExt_Left:case t.RelationType.LeftExt_Right:this._owner!=this._target.parent?(h=this._owner.xMin,this._owner.width=this._owner._rawWidth-i,this._owner.xMin=h+i):this._owner.width=this._owner._rawWidth-i;break;case t.RelationType.RightExt_Left:case t.RelationType.RightExt_Right:this._owner!=this._target.parent?(h=this._owner.xMin,this._owner.width=this._owner._rawWidth+i,this._owner.xMin=h):this._owner.width=this._owner._rawWidth+i;break;case t.RelationType.TopExt_Top:case t.RelationType.TopExt_Bottom:this._owner!=this._target.parent?(h=this._owner.yMin,this._owner.height=this._owner._rawHeight-s,this._owner.yMin=h+s):this._owner.height=this._owner._rawHeight-s;break;case t.RelationType.BottomExt_Top:case t.RelationType.BottomExt_Bottom:this._owner!=this._target.parent?(h=this._owner.yMin,this._owner.height=this._owner._rawHeight+s,this._owner.yMin=h):this._owner.height=this._owner._rawHeight+s}}applyOnSizeChanged(e){var i,s,h=0,r=0,a=0;switch(0==e.axis?(this._target!=this._owner.parent&&(h=this._target.x,this._target.pivotAsAnchor&&(r=this._target.pivotX)),e.percent?0!=this._targetWidth&&(a=this._target._width/this._targetWidth):a=this._target._width-this._targetWidth):(this._target!=this._owner.parent&&(h=this._target.y,this._target.pivotAsAnchor&&(r=this._target.pivotY)),e.percent?0!=this._targetHeight&&(a=this._target._height/this._targetHeight):a=this._target._height-this._targetHeight),e.type){case t.RelationType.Left_Left:e.percent?this._owner.xMin=h+(this._owner.xMin-h)*a:0!=r&&(this._owner.x+=a*-r);break;case t.RelationType.Left_Center:e.percent?this._owner.xMin=h+(this._owner.xMin-h)*a:this._owner.x+=a*(.5-r);break;case t.RelationType.Left_Right:e.percent?this._owner.xMin=h+(this._owner.xMin-h)*a:this._owner.x+=a*(1-r);break;case t.RelationType.Center_Center:e.percent?this._owner.xMin=h+(this._owner.xMin+.5*this._owner._rawWidth-h)*a-.5*this._owner._rawWidth:this._owner.x+=a*(.5-r);break;case t.RelationType.Right_Left:e.percent?this._owner.xMin=h+(this._owner.xMin+this._owner._rawWidth-h)*a-this._owner._rawWidth:0!=r&&(this._owner.x+=a*-r);break;case t.RelationType.Right_Center:e.percent?this._owner.xMin=h+(this._owner.xMin+this._owner._rawWidth-h)*a-this._owner._rawWidth:this._owner.x+=a*(.5-r);break;case t.RelationType.Right_Right:e.percent?this._owner.xMin=h+(this._owner.xMin+this._owner._rawWidth-h)*a-this._owner._rawWidth:this._owner.x+=a*(1-r);break;case t.RelationType.Top_Top:e.percent?this._owner.yMin=h+(this._owner.yMin-h)*a:0!=r&&(this._owner.y+=a*-r);break;case t.RelationType.Top_Middle:e.percent?this._owner.yMin=h+(this._owner.yMin-h)*a:this._owner.y+=a*(.5-r);break;case t.RelationType.Top_Bottom:e.percent?this._owner.yMin=h+(this._owner.yMin-h)*a:this._owner.y+=a*(1-r);break;case t.RelationType.Middle_Middle:e.percent?this._owner.yMin=h+(this._owner.yMin+.5*this._owner._rawHeight-h)*a-.5*this._owner._rawHeight:this._owner.y+=a*(.5-r);break;case t.RelationType.Bottom_Top:e.percent?this._owner.yMin=h+(this._owner.yMin+this._owner._rawHeight-h)*a-this._owner._rawHeight:0!=r&&(this._owner.y+=a*-r);break;case t.RelationType.Bottom_Middle:e.percent?this._owner.yMin=h+(this._owner.yMin+this._owner._rawHeight-h)*a-this._owner._rawHeight:this._owner.y+=a*(.5-r);break;case t.RelationType.Bottom_Bottom:e.percent?this._owner.yMin=h+(this._owner.yMin+this._owner._rawHeight-h)*a-this._owner._rawHeight:this._owner.y+=a*(1-r);break;case t.RelationType.Width:i=this._owner._underConstruct&&this._owner==this._target.parent?this._owner.sourceWidth-this._target.initWidth:this._owner._rawWidth-this._targetWidth,e.percent&&(i*=a),this._target==this._owner.parent?this._owner.pivotAsAnchor?(s=this._owner.xMin,this._owner.setSize(this._target._width+i,this._owner._rawHeight,!0),this._owner.xMin=s):this._owner.setSize(this._target._width+i,this._owner._rawHeight,!0):this._owner.width=this._target._width+i;break;case t.RelationType.Height:i=this._owner._underConstruct&&this._owner==this._target.parent?this._owner.sourceHeight-this._target.initHeight:this._owner._rawHeight-this._targetHeight,e.percent&&(i*=a),this._target==this._owner.parent?this._owner.pivotAsAnchor?(s=this._owner.yMin,this._owner.setSize(this._owner._rawWidth,this._target._height+i,!0),this._owner.yMin=s):this._owner.setSize(this._owner._rawWidth,this._target._height+i,!0):this._owner.height=this._target._height+i;break;case t.RelationType.LeftExt_Left:s=this._owner.xMin,i=e.percent?h+(s-h)*a-s:a*-r,this._owner.width=this._owner._rawWidth-i,this._owner.xMin=s+i;break;case t.RelationType.LeftExt_Right:s=this._owner.xMin,i=e.percent?h+(s-h)*a-s:a*(1-r),this._owner.width=this._owner._rawWidth-i,this._owner.xMin=s+i;break;case t.RelationType.RightExt_Left:s=this._owner.xMin,i=e.percent?h+(s+this._owner._rawWidth-h)*a-(s+this._owner._rawWidth):a*-r,this._owner.width=this._owner._rawWidth+i,this._owner.xMin=s;break;case t.RelationType.RightExt_Right:s=this._owner.xMin,e.percent?this._owner==this._target.parent?this._owner._underConstruct?this._owner.width=h+this._target._width-this._target._width*r+(this._owner.sourceWidth-h-this._target.initWidth+this._target.initWidth*r)*a:this._owner.width=h+(this._owner._rawWidth-h)*a:(i=h+(s+this._owner._rawWidth-h)*a-(s+this._owner._rawWidth),this._owner.width=this._owner._rawWidth+i,this._owner.xMin=s):this._owner==this._target.parent?this._owner._underConstruct?this._owner.width=this._owner.sourceWidth+(this._target._width-this._target.initWidth)*(1-r):this._owner.width=this._owner._rawWidth+a*(1-r):(i=a*(1-r),this._owner.width=this._owner._rawWidth+i,this._owner.xMin=s);break;case t.RelationType.TopExt_Top:s=this._owner.yMin,i=e.percent?h+(s-h)*a-s:a*-r,this._owner.height=this._owner._rawHeight-i,this._owner.yMin=s+i;break;case t.RelationType.TopExt_Bottom:s=this._owner.yMin,i=e.percent?h+(s-h)*a-s:a*(1-r),this._owner.height=this._owner._rawHeight-i,this._owner.yMin=s+i;break;case t.RelationType.BottomExt_Top:s=this._owner.yMin,i=e.percent?h+(s+this._owner._rawHeight-h)*a-(s+this._owner._rawHeight):a*-r,this._owner.height=this._owner._rawHeight+i,this._owner.yMin=s;break;case t.RelationType.BottomExt_Bottom:s=this._owner.yMin,e.percent?this._owner==this._target.parent?this._owner._underConstruct?this._owner.height=h+this._target._height-this._target._height*r+(this._owner.sourceHeight-h-this._target.initHeight+this._target.initHeight*r)*a:this._owner.height=h+(this._owner._rawHeight-h)*a:(i=h+(s+this._owner._rawHeight-h)*a-(s+this._owner._rawHeight),this._owner.height=this._owner._rawHeight+i,this._owner.yMin=s):this._owner==this._target.parent?this._owner._underConstruct?this._owner.height=this._owner.sourceHeight+(this._target._height-this._target.initHeight)*(1-r):this._owner.height=this._owner._rawHeight+a*(1-r):(i=a*(1-r),this._owner.height=this._owner._rawHeight+i,this._owner.yMin=s)}}addRefTarget(){this._target!=this._owner.parent&&this._target.on("pos_changed",this.__targetXYChanged,this),this._target.on("size_changed",this.__targetSizeChanged,this),this._targetX=this._target.x,this._targetY=this._target.y,this._targetWidth=this._target._width,this._targetHeight=this._target._height}releaseRefTarget(){null!=this._target.displayObject&&(this._target.off("pos_changed",this.__targetXYChanged,this),this._target.off("size_changed",this.__targetSizeChanged,this))}__targetXYChanged(){if(this._owner.relations.handling||this._owner.group&&this._owner.group._updating)return this._targetX=this._target.x,void(this._targetY=this._target.y);this._owner.relations.handling=this._target;for(var t=this._owner.x,e=this._owner.y,i=this._target.x-this._targetX,s=this._target.y-this._targetY,h=this._defs.length,r=0;r<h;r++)this.applyOnXYChanged(this._defs[r],i,s);if(this._targetX=this._target.x,this._targetY=this._target.y,(t!=this._owner.x||e!=this._owner.y)&&(t=this._owner.x-t,e=this._owner.y-e,this._owner.updateGearFromRelations(1,t,e),this._owner.parent&&this._owner.parent._transitions.length>0)){h=this._owner.parent._transitions.length;for(var a=0;a<h;a++){this._owner.parent._transitions[a].updateFromRelations(this._owner.id,t,e)}}this._owner.relations.handling=null}__targetSizeChanged(){if(this._owner.relations.handling)return this._targetWidth=this._target._width,void(this._targetHeight=this._target._height);this._owner.relations.handling=this._target;for(var t=this._owner.x,e=this._owner.y,i=this._owner._rawWidth,s=this._owner._rawHeight,h=this._defs.length,r=0;r<h;r++)this.applyOnSizeChanged(this._defs[r]);if(this._targetWidth=this._target._width,this._targetHeight=this._target._height,(t!=this._owner.x||e!=this._owner.y)&&(t=this._owner.x-t,e=this._owner.y-e,this._owner.updateGearFromRelations(1,t,e),this._owner.parent&&this._owner.parent._transitions.length>0)){h=this._owner.parent._transitions.length;for(var a=0;a<h;a++){this._owner.parent._transitions[a].updateFromRelations(this._owner.id,t,e)}}i==this._owner._rawWidth&&s==this._owner._rawHeight||(i=this._owner._rawWidth-i,s=this._owner._rawHeight-s,this._owner.updateGearFromRelations(2,i,s)),this._owner.relations.handling=null}}class wt{constructor(){}copy(t){this.percent=t.percent,this.type=t.type,this.axis=t.axis}}class vt{constructor(t){this._owner=t,this._items=[]}add(t,e,i){for(var s=this._items.length,h=0;h<s;h++){var r=this._items[h];if(r.target==t)return void r.add(e,i)}var a=new yt(this._owner);a.target=t,a.add(e,i),this._items.push(a)}remove(t,e){e=e||0;for(var i=this._items.length,s=0;s<i;){var h=this._items[s];h.target==t?(h.remove(e),h.isEmpty?(h.dispose(),this._items.splice(s,1),i--):s++):s++}}contains(t){for(var e=this._items.length,i=0;i<e;i++){if(this._items[i].target==t)return!0}return!1}clearFor(t){for(var e=this._items.length,i=0;i<e;){var s=this._items[i];s.target==t?(s.dispose(),this._items.splice(i,1),e--):i++}}clearAll(){for(var t=this._items.length,e=0;e<t;e++){this._items[e].dispose()}this._items.length=0}copyFrom(t){this.clearAll();for(var e=t._items,i=e.length,s=0;s<i;s++){var h=e[s],r=new yt(this._owner);r.copy(h),this._items.push(r)}}dispose(){this.clearAll()}onOwnerSizeChanged(t,e,i){if(0!=this._items.length)for(var s=this._items.length,h=0;h<s;h++){this._items[h].applyOnSelfResized(t,e,i)}}get empty(){return 0==this._items.length}setup(t,e){for(var i,s=t.readByte(),h=0;h<s;h++){var r=t.readShort();i=-1==r?this._owner.parent:e?this._owner.getChildAt(r):this._owner.parent.getChildAt(r);var a=new yt(this._owner);a.target=i,this._items.push(a);for(var n=t.readByte(),o=0;o<n;o++){var l=t.readByte(),_=t.readBool();a.internalAdd(l,_)}}}}class xt{constructor(t=1,e=1,i=1,s=1){this.r=t,this.g=e,this.b=i,this.a=s}static gammaToLinearSpace(t){return t<=.04045?t/12.92:t<1?Math.pow((t+.055)/1.055,2.4):Math.pow(t,2.4)}static linearToGammaSpace(t){return t<=0?0:t<=.0031308?12.92*t:t<=1?1.055*Math.pow(t,.41666)-.055:Math.pow(t,.41666)}toLinear(t){t.r=xt.gammaToLinearSpace(this.r),t.g=xt.gammaToLinearSpace(this.g),t.b=xt.gammaToLinearSpace(this.b)}toGamma(t){t.r=xt.linearToGammaSpace(this.r),t.g=xt.linearToGammaSpace(this.g),t.b=xt.linearToGammaSpace(this.b)}cloneTo(t){var e=t;e.r=this.r,e.g=this.g,e.b=this.b,e.a=this.a}clone(){var t=new xt;return this.cloneTo(t),t}forNativeElement(){}getHex(){return 255*this.r<<16^255*this.g<<8^255*this.b<<0}getHexString(){return("000000"+this.getHex().toString(16)).slice(-6)}}xt.CLEAR=new xt(0,0,0,0),xt.RED=new xt(1,0,0,1),xt.GREEN=new xt(0,1,0,1),xt.BLUE=new xt(0,0,1,1),xt.CYAN=new xt(0,1,1,1),xt.YELLOW=new xt(1,.92,.016,1),xt.MAGENTA=new xt(1,0,1,1),xt.GRAY=new xt(.5,.5,.5,1),xt.WHITE=new xt(1,1,1,1),xt.BLACK=new xt(0,0,0,1);class bt{}bt.defaultFont="Arial",bt.modalLayerColor=new xt(3355443,.2),bt.buttonSound=null,bt.buttonSoundVolumeScale=1,bt.horizontalScrollBar=null,bt.verticalScrollBar=null,bt.defaultScrollStep=25,bt.defaultScrollDecelerationRate=.967,bt.defaultScrollBarDisplay=t.ScrollBarDisplayType.Visible,bt.defaultScrollTouchEffect=!0,bt.defaultScrollBounceEffect=!0,bt.defaultScrollSnappingThreshold=.1,bt.defaultScrollPagingThreshold=.3,bt.popupMenu=null,bt.popupMenu_seperator=null,bt.loaderErrorSign=null,bt.tooltipsWin=null,bt.defaultComboBoxVisibleItemCount=10,bt.touchScrollSensitivity=20,bt.touchDragSensitivity=10,bt.clickDragSensitivity=2,bt.bringWindowToFrontOnClick=!0,bt.frameTimeForAsyncUIConstruction=2,bt.packageFileExtension="fui";class Ct{constructor(){this._x=0,this._y=0,this._z=0,this._alpha=1,this._visible=!0,this._touchable=!0,this._scaleX=1,this._scaleY=1,this._skewX=0,this._skewY=0,this._pivotX=0,this._pivotY=0,this._sortingOrder=0,this._internalVisible=!0,this.minWidth=0,this.minHeight=0,this.maxWidth=0,this.maxHeight=0,this.sourceWidth=0,this.sourceHeight=0,this.initWidth=0,this.initHeight=0,this._width=0,this._height=0,this._rawWidth=0,this._rawHeight=0,this._sizePercentInGroup=0,this._dragStartPos=new T,this._dragTesting=!1,this._id=""+jt++,this._name="",this.createDisplayObject(),this._displayObject.gOwner=this,this._relations=new vt(this),this._gears=new Array(10)}get id(){return this._id}get name(){return this._name}set name(t){this._name=t}get x(){return this._x}set x(t){this.setPosition(t,this._y)}get y(){return this._y}set y(t){this.setPosition(this._x,t)}get z(){return this._z}set z(t){this.setPosition(this._x,this._y,t)}setPosition(t,e,i){if(this._x!=t||this._y!=e){var s=t-this._x,h=e-this._y;this._x=t,this._y=e,null!=i&&(this._z=i),this.handlePositionChanged(),this instanceof Ft&&this.moveChildren(s,h),this.updateGear(1),this._parent&&!("setVirtual"in this._parent)&&(this._parent.setBoundsChangedFlag(),this._group&&this._group.setBoundsChangedFlag(!0),this.dispatchEvent("pos_changed")),Ct.draggingObject!=this||It||this.localToGlobalRect(0,0,this.width,this.height,Bt)}}get xMin(){return this._pivotAsAnchor?this._x-this._width*this._pivotX:this._x}set xMin(t){this._pivotAsAnchor?this.setPosition(t+this._width*this._pivotX,this._y):this.setPosition(t,this._y)}get yMin(){return this._pivotAsAnchor?this._y-this._height*this._pivotY:this._y}set yMin(t){this._pivotAsAnchor?this.setPosition(this._x,t+this._height*this._pivotY):this.setPosition(this._x,t)}center(e){var i;i=this._parent?this.parent:Lt.GRoot.inst,this.setPosition(Math.floor((i.width-this.width)/2),Math.floor((i.height-this.height)/2)),e&&(this.addRelation(i,t.RelationType.Center_Center),this.addRelation(i,t.RelationType.Middle_Middle))}get width(){return this._width}set width(t){this.setSize(t,this._rawHeight)}get height(){return this._height}set height(t){this.setSize(this._rawWidth,t)}setSize(t,e,i){if(this._rawWidth!=t||this._rawHeight!=e){this._rawWidth=t,this._rawHeight=e,t<this.minWidth&&(t=this.minWidth),e<this.minHeight&&(e=this.minHeight),this.maxWidth>0&&t>this.maxWidth&&(t=this.maxWidth),this.maxHeight>0&&e>this.maxHeight&&(e=this.maxHeight);var s=t-this._width,h=e-this._height;this._width=t,this._height=e,this.handleSizeChanged(),0==this._pivotX&&0==this._pivotY||(this._pivotAsAnchor||i?this.handlePositionChanged():this.setPosition(this.x-this._pivotX*s,this.y-this._pivotY*h)),this instanceof Ft&&this.resizeChildren(s,h),this.updateGear(2),this._parent&&(this._relations.onOwnerSizeChanged(s,h,this._pivotAsAnchor||!i),this._parent.setBoundsChangedFlag(),this._group&&this._group.setBoundsChangedFlag()),this.dispatchEvent("size_changed")}}setSizeDirectly(t,e){this._rawWidth=t,this._rawHeight=e,t<0&&(t=0),e<0&&(e=0),this._width=t,this._height=e}makeFullScreen(){this.setSize(Lt.GRoot.inst.width,Lt.GRoot.inst.height)}get actualWidth(){return this.width*Math.abs(this._scaleX)}get actualHeight(){return this.height*Math.abs(this._scaleY)}get scaleX(){return this._scaleX}set scaleX(t){this.setScale(t,this._scaleY)}get scaleY(){return this._scaleY}set scaleY(t){this.setScale(this._scaleX,t)}setScale(t,e){this._scaleX==t&&this._scaleY==e||(this._scaleX=t,this._scaleY=e,this.handleScaleChanged(),this.updateGear(2))}get skewX(){return this._skewX}set skewX(t){this.setSkew(t,this._skewY)}get skewY(){return this._skewY}set skewY(t){this.setSkew(this._skewX,t)}setSkew(t,e){this._skewX==t&&this._skewY==e||(this._skewX=t,this._skewY=e)}get pivotX(){return this._pivotX}set pivotX(t){this.setPivot(t,this._pivotY)}get pivotY(){return this._pivotY}set pivotY(t){this.setPivot(this._pivotX,t)}setPivot(t,e,i){i=i||!1,this._pivotX==t&&this._pivotY==e&&this._pivotAsAnchor==i||(this._pivotX=t,this._pivotY=e,this._pivotAsAnchor=i,this._displayObject.setPivot(t,e),this.handlePositionChanged())}get pivotAsAnchor(){return this._pivotAsAnchor}get touchable(){return this._touchable}set touchable(t){this._touchable!=t&&(this._touchable=t,this.updateGear(3),this._displayObject.touchable=this._touchable)}get grayed(){return this._grayed}set grayed(t){this._grayed!=t&&(this._grayed=t,this.handleGrayedChanged(),this.updateGear(3))}get enabled(){return!this._grayed&&this._touchable}set enabled(t){this.grayed=!t,this.touchable=t}get rotation(){return this._displayObject.rotation}set rotation(t){this._displayObject.rotation!=t&&(this._displayObject.rotation=t,this.updateGear(3))}get alpha(){return this._alpha}set alpha(t){this._alpha!=t&&(this._alpha=t,this.handleAlphaChanged(),this.updateGear(3))}get visible(){return this._visible}set visible(t){this._visible!=t&&(this._visible=t,this.handleVisibleChanged(),this._parent&&this._parent.setBoundsChangedFlag(),this._group&&this._group.excludeInvisibles&&this._group.setBoundsChangedFlag())}get internalVisible(){return this._internalVisible&&(!this._group||this._group.internalVisible)}get internalVisible2(){return this._visible&&(!this._group||this._group.internalVisible2)}get internalVisible3(){return this._internalVisible&&this._visible}get sortingOrder(){return this._sortingOrder}set sortingOrder(t){if(t<0&&(t=0),this._sortingOrder!=t){var e=this._sortingOrder;this._sortingOrder=t,this._parent&&this._parent.childSortingOrderChanged(this,e,this._sortingOrder)}}get tooltips(){return this._tooltips}set tooltips(t){this._tooltips&&(this.off("roll_over",this.__rollOver,this),this.off("roll_out",this.__rollOut,this)),this._tooltips=t,this._tooltips&&(this.on("roll_over",this.__rollOver,this),this.on("roll_out",this.__rollOut,this))}__rollOver(){z.callDelay(100,this.__doShowTooltips,this)}__doShowTooltips(){Lt.GRoot.inst.showTooltips(this._tooltips)}__rollOut(){z.remove(this.__doShowTooltips,this),Lt.GRoot.inst.hideTooltips()}get onStage(){return this._displayObject.onStage}get resourceURL(){return this.packageItem?"ui://"+this.packageItem.owner.id+this.packageItem.id:null}set group(t){this._group!=t&&(this._group&&this._group.setBoundsChangedFlag(),this._group=t,this._group&&this._group.setBoundsChangedFlag())}get group(){return this._group}getGear(t){var e=this._gears[t];return null==e&&(this._gears[t]=e=function(t,e){let i=new St[e];return i._owner=t,i}(this,t)),e}updateGear(t){if(!this._underConstruct&&!this._gearLocked){var e=this._gears[t];e&&e.controller&&e.updateState()}}checkGearController(t,e){return this._gears[t]&&this._gears[t].controller==e}updateGearFromRelations(t,e,i){this._gears[t]&&this._gears[t].updateFromRelations(e,i)}addDisplayLock(){var t=this._gears[0];if(t&&t.controller){var e=t.addLock();return this.checkGearDisplay(),e}return 0}releaseDisplayLock(t){var e=this._gears[0];e&&e.controller&&(e.releaseLock(t),this.checkGearDisplay())}checkGearDisplay(){if(!this._handlingController){var t=null==this._gears[0]||this._gears[0].connected;this._gears[8]&&(t=this._gears[8].evaluate(t)),t!=this._internalVisible&&(this._internalVisible=t,this._parent&&(this._parent.childStateChanged(this),this._group&&this._group.excludeInvisibles&&this._group.setBoundsChangedFlag()))}}get relations(){return this._relations}addRelation(t,e,i){this._relations.add(t,e,i)}removeRelation(t,e){this._relations.remove(t,e)}get displayObject(){return this._displayObject}get parent(){return this._parent}set parent(t){this._parent=t}removeFromParent(){this._parent&&this._parent.removeChild(this)}get asCom(){return this}get text(){return null}set text(t){}get icon(){return null}set icon(t){}get treeNode(){return this._treeNode}get isDisposed(){return null==this._displayObject}dispose(){this.removeFromParent(),this._relations.dispose(),this._displayObject.dispose(),this._displayObject=null;for(var t=0;t<10;t++){var e=this._gears[t];e&&e.dispose()}}on(t,e,i,s){this._displayObject.on(t,e,i,s)}off(t,e,i,s){this._displayObject.off(t,e,i,s)}offAll(t){this._displayObject.offAll(t)}hasListener(t,e,i,s){return this._displayObject.hasListener(t,e,i,s)}dispatchEvent(t,e){return this._displayObject.dispatchEvent(t,e)}onClick(t,e){this.on("click",t,e)}offClick(t,e){this.off("click",t,e)}hasClickListener(){return this.hasListener("click")}get draggable(){return this._draggable}set draggable(t){this._draggable!=t&&(this._draggable=t,this.initDrag())}get dragBounds(){return this._dragBounds}set dragBounds(t){this._dragBounds=t}startDrag(t){this._displayObject.onStage&&(null==t&&(t=-1),this.dragBegin(t))}stopDrag(){this.dragEnd()}get dragging(){return Ct.draggingObject==this}localToGlobal(t,e,i){return t=t||0,e=e||0,this._pivotAsAnchor&&(t+=this._pivotX*this._width,e+=this._pivotY*this._height),this._displayObject.localToGlobal(t,e,i)}globalToLocal(t,e,i){return t=t||0,e=e||0,i=this._displayObject.globalToLocal(t,e,i),this._pivotAsAnchor&&(i.x-=this._pivotX*this._width,i.y-=this._pivotY*this._height),i}localToRoot(t,e,i){let s=Lt.GRoot.inst,h=this.localToGlobal(t,e,i);return s.globalToLocal(h.x,h.y,h)}rootToLocal(t,e,i){let s=Lt.GRoot.inst.localToGlobal(t,e,i);return this.globalToLocal(s.x,s.y,s)}localToGlobalRect(t,e,i,s,h){h||(h=new P);var r=this.localToGlobal(t,e,kt);return h.x=r.x,h.y=r.y,r=this.localToGlobal(t+i,e+s,kt),h.width=r.x-h.x,h.height=r.y-h.y,h}globalToLocalRect(t,e,i,s,h){h||(h=new P);var r=this.globalToLocal(t,e,kt);return h.x=r.x,h.y=r.y,r=this.globalToLocal(t+i,e+s,kt),h.width=r.x-h.x,h.height=r.y-h.y,h}handleControllerChanged(t){this._handlingController=!0;for(var e=0;e<10;e++){var i=this._gears[e];i&&i.controller==t&&i.apply()}this._handlingController=!1,this.checkGearDisplay()}createDisplayObject(){this._displayObject=new O}handlePositionChanged(){var t=this._x,e=this._y;this._pivotAsAnchor||(t+=this._pivotX*this._width,e+=this._pivotY*this._height),this._displayObject.setPosition(t,e,!0)}handleSizeChanged(){this._displayObject.setSize(this._width,this._height)}handleScaleChanged(){this._displayObject.setScale(this._scaleX,this._scaleY)}handleGrayedChanged(){this._displayObject.grayed=this._grayed}handleAlphaChanged(){this._displayObject.alpha=this._alpha}handleVisibleChanged(){this._displayObject.visible=this.internalVisible2}getProp(e){switch(e){case t.ObjectPropID.Text:return this.text;case t.ObjectPropID.Icon:return this.icon;case t.ObjectPropID.Color:case t.ObjectPropID.OutlineColor:return null;case t.ObjectPropID.Playing:return!1;case t.ObjectPropID.Frame:case t.ObjectPropID.DeltaTime:return 0;case t.ObjectPropID.TimeScale:return 1;case t.ObjectPropID.FontSize:return 0;case t.ObjectPropID.Selected:return!1;default:return}}setProp(e,i){switch(e){case t.ObjectPropID.Text:this.text=i;break;case t.ObjectPropID.Icon:this.icon=i}}constructFromResource(){}setup_beforeAdd(t,e){var i,s;t.seek(e,0),t.skip(5),this._id=t.readS(),this._name=t.readS(),i=t.readInt(),s=t.readInt(),this.setPosition(i,s),t.readBool()&&(this.initWidth=t.readInt(),this.initHeight=t.readInt(),this.setSize(this.initWidth,this.initHeight,!0)),t.readBool()&&(this.minWidth=t.readInt(),this.maxWidth=t.readInt(),this.minHeight=t.readInt(),this.maxHeight=t.readInt()),t.readBool()&&(i=t.readFloat(),s=t.readFloat(),this.setScale(i,s)),t.readBool()&&(i=t.readFloat(),s=t.readFloat(),this.setSkew(i,s)),t.readBool()&&(i=t.readFloat(),s=t.readFloat(),this.setPivot(i,s,t.readBool())),1!=(i=t.readFloat())&&(this.alpha=i),0!=(i=t.readFloat())&&(this.rotation=i),t.readBool()||(this.visible=!1),t.readBool()||(this.touchable=!1),t.readBool()&&(this.grayed=!0);t.readByte(),t.readByte();var h=t.readS();null!=h&&(this.data=h)}setup_afterAdd(t,e){t.seek(e,1);var i=t.readS();i&&(this.tooltips=i);var s=t.readShort();s>=0&&(this.group=this.parent.getChildAt(s)),t.seek(e,2);for(var h=t.readShort(),r=0;r<h;r++){var a=t.readShort();a+=t.pos,this.getGear(t.readByte()).setup(t),t.pos=a}}initDrag(){this._draggable?(this.on("touch_begin",this.__touchBegin,this),this.on("touch_move",this.__touchMove,this),this.on("touch_end",this.__touchEnd,this)):(this.off("touch_begin",this.__touchBegin,this),this.off("touch_move",this.__touchMove,this),this.off("touch_end",this.__touchEnd,this))}dragBegin(t){if(Ct.draggingObject){let t=Ct.draggingObject;Ct.draggingObject.stopDrag(),Ct.draggingObject=null,t.dispatchEvent("drag_end")}this.on("touch_move",this.__touchMove,this),this.on("touch_end",this.__touchEnd,this),R.getTouchPos(t,zt),this.localToGlobalRect(0,0,this.width,this.height,Bt),this._dragTesting=!1,Ct.draggingObject=this,R.addTouchMonitor(t,this._displayObject)}dragEnd(){Ct.draggingObject==this&&(this._dragTesting=!1,Ct.draggingObject=null)}__touchBegin(t){null==this._dragStartPos&&(this._dragStartPos=new T),this._dragStartPos.set(t.input.x,t.input.y),this._dragTesting=!0,t.captureTouch()}__touchMove(t){if(this._dragTesting&&Ct.draggingObject!=this){let e;if(e=R.touchScreen?bt.touchDragSensitivity:bt.clickDragSensitivity,this._dragStartPos&&Math.abs(this._dragStartPos.x-t.input.x)<e&&Math.abs(this._dragStartPos.y-t.input.y)<e)return;this._dragTesting=!1,this.dispatchEvent("drag_start",t.input.touchId)||this.dragBegin(t.input.touchId)}if(Ct.draggingObject==this){let e=t.input.x-zt.x+Bt.x,i=t.input.y-zt.y+Bt.y;if(this._dragBounds){let t=Lt.GRoot.inst.localToGlobalRect(this._dragBounds.x,this._dragBounds.y,this._dragBounds.width,this._dragBounds.height,Ot);e<t.x?e=t.x:e+Bt.width>t.xMax&&(e=t.xMax-Bt.width,e<t.x&&(e=t.x)),i<t.y?i=t.y:i+Bt.height>t.yMax&&(i=t.yMax-Bt.height,i<t.y&&(i=t.y))}let s=this.parent.globalToLocal(e,i,kt);It=!0,this.setPosition(Math.round(s.x),Math.round(s.y)),It=!1,this.dispatchEvent("drag_move")}}__touchEnd(){Ct.draggingObject==this&&(Ct.draggingObject=null,this.dispatchEvent("drag_end"))}static cast(t){return t.$owner}}let St=[class extends it{constructor(){super(...arguments),this.pages=null,this._visible=0,this._displayLockToken=1}init(){this.pages=null}addLock(){return this._visible++,this._displayLockToken}releaseLock(t){t==this._displayLockToken&&this._visible--}get connected(){return null==this._controller||this._visible>0}apply(){this._displayLockToken++,this._displayLockToken<=0&&(this._displayLockToken=1),null==this.pages||0==this.pages.length||-1!=this.pages.indexOf(this._controller.selectedPageId)?this._visible=1:this._visible=0}},class extends it{init(){this._default={x:this._owner.x,y:this._owner.y,px:this._owner.x/this._owner.parent.width,py:this._owner.y/this._owner.parent.height},this._storage={}}addStatus(t,e){var i;t?(i={},this._storage[t]=i):i=this._default,i.x=e.readInt(),i.y=e.readInt()}addExtStatus(t,e){var i;(i=t?this._storage[t]:this._default).px=e.readFloat(),i.py=e.readFloat()}apply(){var t,e,i=this._storage[this._controller.selectedPageId]||this._default;if(this.positionsInPercent&&this._owner.parent?(t=i.px*this._owner.parent.width,e=i.py*this._owner.parent.height):(t=i.x,e=i.y),this.allowTween){if(this._tweenConfig._tweener){if(this._tweenConfig._tweener.endValue.x==t&&this._tweenConfig._tweener.endValue.y==e)return;this._tweenConfig._tweener.kill(!0),this._tweenConfig._tweener=null}var s=this._owner.x,h=this._owner.y;s==t&&h==e||(this._owner.checkGearController(0,this._controller)&&(this._tweenConfig._displayLockToken=this._owner.addDisplayLock()),this._tweenConfig._tweener=mt.to2(s,h,t,e,this._tweenConfig.duration).setDelay(this._tweenConfig.delay).setEase(this._tweenConfig.easeType).setTarget(this).onUpdate(this.__tweenUpdate,this).onComplete(this.__tweenComplete,this))}else this._owner._gearLocked=!0,this._owner.setPosition(t,e),this._owner._gearLocked=!1}__tweenUpdate(t){this._owner._gearLocked=!0,this._owner.setPosition(t.value.x,t.value.y),this._owner._gearLocked=!1}__tweenComplete(){0!=this._tweenConfig._displayLockToken&&(this._owner.releaseDisplayLock(this._tweenConfig._displayLockToken),this._tweenConfig._displayLockToken=0),this._tweenConfig._tweener=null}updateState(){var t=this._storage[this._controller.selectedPageId];t||(t={},this._storage[this._controller.selectedPageId]=t),t.x=this._owner.x,t.y=this._owner.y,t.px=this._owner.x/this._owner.parent.width,t.py=this._owner.y/this._owner.parent.height}updateFromRelations(t,e){if(null!=this._controller&&null!=this._storage&&!this.positionsInPercent){for(var i in this._storage){var s=this._storage[i];s.x+=t,s.y+=e}this._default.x+=t,this._default.y+=e,this.updateState()}}},class extends it{init(){this._default={width:this._owner.width,height:this._owner.height,scaleX:this._owner.scaleX,scaleY:this._owner.scaleY},this._storage={}}addStatus(t,e){var i;t?(i={},this._storage[t]=i):i=this._default,i.width=e.readInt(),i.height=e.readInt(),i.scaleX=e.readFloat(),i.scaleY=e.readFloat()}apply(){var t=this._storage[this._controller.selectedPageId]||this._default;if(this.allowTween){if(this._tweenConfig._tweener){if(this._tweenConfig._tweener.endValue.x==t.width&&this._tweenConfig._tweener.endValue.y==t.height&&this._tweenConfig._tweener.endValue.z==t.scaleX&&this._tweenConfig._tweener.endValue.w==t.scaleY)return;this._tweenConfig._tweener.kill(!0),this._tweenConfig._tweener=null}var e=t.width!=this._owner.width||t.height!=this._owner.height,i=t.scaleX!=this._owner.scaleX||t.scaleY!=this._owner.scaleY;(e||i)&&(this._owner.checkGearController(0,this._controller)&&(this._tweenConfig._displayLockToken=this._owner.addDisplayLock()),this._tweenConfig._tweener=mt.to4(this._owner.width,this._owner.height,this._owner.scaleX,this._owner.scaleY,t.width,t.height,t.scaleX,t.scaleY,this._tweenConfig.duration).setDelay(this._tweenConfig.delay).setEase(this._tweenConfig.easeType).setUserData((e?1:0)+(i?2:0)).setTarget(this).onUpdate(this.__tweenUpdate,this).onComplete(this.__tweenComplete,this))}else this._owner._gearLocked=!0,this._owner.setSize(t.width,t.height,this._owner.checkGearController(1,this._controller)),this._owner.setScale(t.scaleX,t.scaleY),this._owner._gearLocked=!1}__tweenUpdate(t){var e=t.userData;this._owner._gearLocked=!0,0!=(1&e)&&this._owner.setSize(t.value.x,t.value.y,this._owner.checkGearController(1,this._controller)),0!=(2&e)&&this._owner.setScale(t.value.z,t.value.w),this._owner._gearLocked=!1}__tweenComplete(){0!=this._tweenConfig._displayLockToken&&(this._owner.releaseDisplayLock(this._tweenConfig._displayLockToken),this._tweenConfig._displayLockToken=0),this._tweenConfig._tweener=null}updateState(){var t=this._storage[this._controller.selectedPageId];t||(t={},this._storage[this._controller.selectedPageId]=t),t.width=this._owner.width,t.height=this._owner.height,t.scaleX=this._owner.scaleX,t.scaleY=this._owner.scaleY}updateFromRelations(t,e){if(null!=this._controller&&null!=this._storage){for(var i in this._storage){var s=this._storage[i];s.width+=t,s.height+=e}this._default.width+=t,this._default.height+=e,this.updateState()}}},class extends it{init(){this._default={alpha:this._owner.alpha,rotation:this._owner.rotation,grayed:this._owner.grayed,touchable:this._owner.touchable},this._storage={}}addStatus(t,e){var i;t?(i={},this._storage[t]=i):i=this._default,i.alpha=e.readFloat(),i.rotation=e.readFloat(),i.grayed=e.readBool(),i.touchable=e.readBool()}apply(){var t=this._storage[this._controller.selectedPageId]||this._default;if(this.allowTween){if(this._owner._gearLocked=!0,this._owner.grayed=t.grayed,this._owner.touchable=t.touchable,this._owner._gearLocked=!1,this._tweenConfig._tweener){if(this._tweenConfig._tweener.endValue.x==t.alpha&&this._tweenConfig._tweener.endValue.y==t.rotation)return;this._tweenConfig._tweener.kill(!0),this._tweenConfig._tweener=null}var e=t.alpha!=this._owner.alpha,i=t.rotation!=this._owner.rotation;(e||i)&&(this._owner.checkGearController(0,this._controller)&&(this._tweenConfig._displayLockToken=this._owner.addDisplayLock()),this._tweenConfig._tweener=mt.to2(this._owner.alpha,this._owner.rotation,t.alpha,t.rotation,this._tweenConfig.duration).setDelay(this._tweenConfig.delay).setEase(this._tweenConfig.easeType).setUserData((e?1:0)+(i?2:0)).setTarget(this).onUpdate(this.__tweenUpdate,this).onComplete(this.__tweenComplete,this))}else this._owner._gearLocked=!0,this._owner.grayed=t.grayed,this._owner.alpha=t.alpha,this._owner.rotation=t.rotation,this._owner.touchable=t.touchable,this._owner._gearLocked=!1}__tweenUpdate(t){var e=t.userData;this._owner._gearLocked=!0,0!=(1&e)&&(this._owner.alpha=t.value.x),0!=(2&e)&&(this._owner.rotation=t.value.y),this._owner._gearLocked=!1}__tweenComplete(){0!=this._tweenConfig._displayLockToken&&(this._owner.releaseDisplayLock(this._tweenConfig._displayLockToken),this._tweenConfig._displayLockToken=0),this._tweenConfig._tweener=null}updateState(){var t=this._storage[this._controller.selectedPageId];t||(t={},this._storage[this._controller.selectedPageId]=t),t.alpha=this._owner.alpha,t.rotation=this._owner.rotation,t.grayed=this._owner.grayed,t.touchable=this._owner.touchable}},class extends it{init(){this._default={color:this._owner.getProp(t.ObjectPropID.Color),strokeColor:this._owner.getProp(t.ObjectPropID.OutlineColor)},this._storage={}}addStatus(t,e){var i;t?(i={},this._storage[t]=i):i=this._default,i.color=e.readColor(),i.strokeColor=e.readColor()}apply(){this._owner._gearLocked=!0;var e=this._storage[this._controller.selectedPageId]||this._default;this._owner.setProp(t.ObjectPropID.Color,e.color),this._owner.setProp(t.ObjectPropID.OutlineColor,e.strokeColor),this._owner._gearLocked=!1}updateState(){var e=this._storage[this._controller.selectedPageId];e||(e={},this._storage[this._controller.selectedPageId]=e),e.color=this._owner.getProp(t.ObjectPropID.Color),e.strokeColor=this._owner.getProp(t.ObjectPropID.OutlineColor)}},class extends it{init(){this._default={playing:this._owner.getProp(t.ObjectPropID.Playing),frame:this._owner.getProp(t.ObjectPropID.Frame)},this._storage={}}addStatus(t,e){var i;t?(i={},this._storage[t]=i):i=this._default,i.playing=e.readBool(),i.frame=e.readInt()}apply(){this._owner._gearLocked=!0;var e=this._storage[this._controller.selectedPageId]||this._default;this._owner.setProp(t.ObjectPropID.Playing,e.playing),this._owner.setProp(t.ObjectPropID.Frame,e.frame),this._owner._gearLocked=!1}updateState(){var e=this._storage[this._controller.selectedPageId];e||(e={},this._storage[this._controller.selectedPageId]=e),e.playing=this._owner.getProp(t.ObjectPropID.Playing),e.frame=this._owner.getProp(t.ObjectPropID.Frame)}},class extends it{init(){this._default=this._owner.text,this._storage={}}addStatus(t,e){null==t?this._default=e.readS():this._storage[t]=e.readS()}apply(){this._owner._gearLocked=!0;var t=this._storage[this._controller.selectedPageId];this._owner.text=void 0!==t?t:this._default,this._owner._gearLocked=!1}updateState(){this._storage[this._controller.selectedPageId]=this._owner.text}},class extends it{init(){this._default=this._owner.icon,this._storage={}}addStatus(t,e){t?this._storage[t]=e.readS():this._default=e.readS()}apply(){this._owner._gearLocked=!0;var t=this._storage[this._controller.selectedPageId];this._owner.icon=void 0!==t?t:this._default,this._owner._gearLocked=!1}updateState(){this._storage[this._controller.selectedPageId]=this._owner.icon}},class extends it{constructor(){super(...arguments),this.pages=null,this.condition=0,this._visible=0}init(){this.pages=null}apply(){null==this.pages||0==this.pages.length||-1!=this.pages.indexOf(this._controller.selectedPageId)?this._visible=1:this._visible=0}evaluate(t){var e=null==this._controller||this._visible>0;return e=0==this.condition?e&&t:e||t}},class extends it{constructor(){super(...arguments),this._default=0}init(){this._default=this._owner.getProp(t.ObjectPropID.FontSize),this._storage={}}addStatus(t,e){t?this._storage[t]=e.readInt():this._default=e.readInt()}apply(){this._owner._gearLocked=!0;var e=this._storage[this._controller.selectedPageId];void 0!==e?this._owner.setProp(t.ObjectPropID.FontSize,e):this._owner.setProp(t.ObjectPropID.FontSize,this._default),this._owner._gearLocked=!1}updateState(){this._storage[this._controller.selectedPageId]=this._owner.getProp(t.ObjectPropID.FontSize)}}];var It,Tt,Pt,kt=new T,Ot=new P,zt=new T,Bt=new P,Lt={},jt=0,Mt={n:0};class Ft extends Ct{constructor(){super(),this._layout=0,this._lineGap=0,this._columnGap=0,this._mainGridIndex=-1,this._mainGridMinSize=50,this._mainChildIndex=-1,this._totalSize=0,this._numChildren=0,this._updating=0}dispose(){this._boundsChanged=!1,super.dispose()}get layout(){return this._layout}set layout(t){this._layout!=t&&(this._layout=t,this.setBoundsChangedFlag())}get lineGap(){return this._lineGap}set lineGap(t){this._lineGap!=t&&(this._lineGap=t,this.setBoundsChangedFlag(!0))}get columnGap(){return this._columnGap}set columnGap(t){this._columnGap!=t&&(this._columnGap=t,this.setBoundsChangedFlag(!0))}get excludeInvisibles(){return this._excludeInvisibles}set excludeInvisibles(t){this._excludeInvisibles!=t&&(this._excludeInvisibles=t,this.setBoundsChangedFlag())}get autoSizeDisabled(){return this._autoSizeDisabled}set autoSizeDisabled(t){this._autoSizeDisabled=t}get mainGridMinSize(){return this._mainGridMinSize}set mainGridMinSize(t){this._mainGridMinSize!=t&&(this._mainGridMinSize=t,this.setBoundsChangedFlag())}get mainGridIndex(){return this._mainGridIndex}set mainGridIndex(t){this._mainGridIndex!=t&&(this._mainGridIndex=t,this.setBoundsChangedFlag())}setBoundsChangedFlag(e){0==this._updating&&this._parent&&(e||(this._percentReady=!1),this._boundsChanged||(this._boundsChanged=!0,this._layout!=t.GroupLayoutType.None&&z.callLater(this.ensureBoundsCorrect,this)))}ensureBoundsCorrect(){null!=this._parent&&this._boundsChanged&&(this._boundsChanged=!1,0==this._layout?this.updateBounds():this._autoSizeDisabled?this.resizeChildren(0,0):(this.handleLayout(),this.updateBounds()))}updateBounds(){z.remove(this.ensureBoundsCorrect,this);var t,e,i,s=this._parent.numChildren,h=Number.POSITIVE_INFINITY,r=Number.POSITIVE_INFINITY,a=Number.NEGATIVE_INFINITY,n=Number.NEGATIVE_INFINITY,o=!0;for(t=0;t<s;t++)(e=this._parent.getChildAt(t)).group!=this||this._excludeInvisibles&&!e.internalVisible3||((i=e.xMin)<h&&(h=i),(i=e.yMin)<r&&(r=i),(i=e.xMin+e.width)>a&&(a=i),(i=e.yMin+e.height)>n&&(n=i),o=!1);var l=0,_=0;o||(this._updating|=1,this.setPosition(h,r),this._updating&=2,l=a-h,_=n-r),0==(2&this._updating)?(this._updating|=2,this.setSize(l,_),this._updating&=1):(this._updating&=1,this.resizeChildren(this._width-l,this._height-_))}handleLayout(){var e,i,s;if(this._updating|=1,this._layout==t.GroupLayoutType.Horizontal){var h=this.x;for(s=this._parent.numChildren,i=0;i<s;i++)(e=this._parent.getChildAt(i)).group==this&&(this._excludeInvisibles&&!e.internalVisible3||(e.xMin=h,0!=e.width&&(h+=e.width+this._columnGap)))}else if(this._layout==t.GroupLayoutType.Vertical){var r=this.y;for(s=this._parent.numChildren,i=0;i<s;i++)(e=this._parent.getChildAt(i)).group==this&&(this._excludeInvisibles&&!e.internalVisible3||(e.yMin=r,0!=e.height&&(r+=e.height+this._lineGap)))}this._updating&=2}moveChildren(t,e){if(0==(1&this._updating)&&null!=this._parent){this._updating|=1;var i,s,h=this._parent.numChildren;for(i=0;i<h;i++)(s=this._parent.getChildAt(i)).group==this&&s.setPosition(s.x+t,s.y+e);this._updating&=2}}resizeChildren(e,i){if(this._layout!=t.GroupLayoutType.None&&0==(2&this._updating)&&null!=this._parent)if(this._updating|=2,!this._boundsChanged||(this._boundsChanged=!1,this._autoSizeDisabled)){var s,h,r=this._parent.numChildren;if(!this._percentReady){this._percentReady=!0,this._numChildren=0,this._totalSize=0,this._mainChildIndex=-1;var a=0;for(s=0;s<r;s++)(h=this._parent.getChildAt(s)).group==this&&(this._excludeInvisibles&&!h.internalVisible3||(a==this._mainGridIndex&&(this._mainChildIndex=s),this._numChildren++,1==this._layout?this._totalSize+=h.width:this._totalSize+=h.height),a++);for(-1!=this._mainChildIndex&&(1==this._layout?(h=this._parent.getChildAt(this._mainChildIndex),this._totalSize+=this._mainGridMinSize-h.width,h._sizePercentInGroup=this._mainGridMinSize/this._totalSize):(h=this._parent.getChildAt(this._mainChildIndex),this._totalSize+=this._mainGridMinSize-h.height,h._sizePercentInGroup=this._mainGridMinSize/this._totalSize)),s=0;s<r;s++)(h=this._parent.getChildAt(s)).group==this&&s!=this._mainChildIndex&&(this._totalSize>0?h._sizePercentInGroup=(1==this._layout?h.width:h.height)/this._totalSize:h._sizePercentInGroup=0)}var n=0,o=1,l=!1;if(1==this._layout){n=this.width-(this._numChildren-1)*this._columnGap,-1!=this._mainChildIndex&&n>=this._totalSize&&((h=this._parent.getChildAt(this._mainChildIndex)).setSize(n-(this._totalSize-this._mainGridMinSize),h._rawHeight+i,!0),n-=h.width,o-=h._sizePercentInGroup,l=!0);var _=this.x;for(s=0;s<r;s++)(h=this._parent.getChildAt(s)).group==this&&(!this._excludeInvisibles||h.internalVisible3?(l&&s==this._mainChildIndex||(h.setSize(Math.round(h._sizePercentInGroup/o*n),h._rawHeight+i,!0),o-=h._sizePercentInGroup,n-=h.width),h.xMin=_,0!=h.width&&(_+=h.width+this._columnGap)):h.setSize(h._rawWidth,h._rawHeight+i,!0))}else{n=this.height-(this._numChildren-1)*this._lineGap,-1!=this._mainChildIndex&&n>=this._totalSize&&((h=this._parent.getChildAt(this._mainChildIndex)).setSize(h._rawWidth+e,n-(this._totalSize-this._mainGridMinSize),!0),n-=h.height,o-=h._sizePercentInGroup,l=!0);var d=this.y;for(s=0;s<r;s++)(h=this._parent.getChildAt(s)).group==this&&(!this._excludeInvisibles||h.internalVisible3?(l&&s==this._mainChildIndex||(h.setSize(h._rawWidth+e,Math.round(h._sizePercentInGroup/o*n),!0),o-=h._sizePercentInGroup,n-=h.height),h.yMin=d,0!=h.height&&(d+=h.height+this._lineGap)):h.setSize(h._rawWidth+e,h._rawHeight,!0))}this._updating&=1}else this.updateBounds()}handleAlphaChanged(){if(!this._underConstruct)for(var t=this._parent.numChildren,e=0;e<t;e++){var i=this._parent.getChildAt(e);i.group==this&&(i.alpha=this.alpha)}}handleVisibleChanged(){if(this._parent)for(var t=this._parent.numChildren,e=0;e<t;e++){var i=this._parent.getChildAt(e);i.group==this&&i.handleVisibleChanged()}}setup_beforeAdd(t,e){super.setup_beforeAdd(t,e),t.seek(e,5),this._layout=t.readByte(),this._lineGap=t.readInt(),this._columnGap=t.readInt(),t.version>=2&&(this._excludeInvisibles=t.readBool(),this._autoSizeDisabled=t.readBool(),this._mainGridIndex=t.readShort())}setup_afterAdd(t,e){super.setup_afterAdd(t,e),this.visible||this.handleVisibleChanged()}}function At(t,e){var i;i=e?(t>>24&255).toString(16):"";var s=(t>>16&255).toString(16),h=(t>>8&255).toString(16),r=(255&t).toString(16);return 1==i.length&&(i="0"+i),1==s.length&&(s="0"+s),1==h.length&&(h="0"+h),1==r.length&&(r="0"+r),"#"+i+s+h+r}function Rt(t,e,i){return t<e?t=e:t>i&&(t=i),t}function Dt(t){return isNaN(t)?t=0:t>1?t=1:t<0&&(t=0),t}function Et(t,e,i){return t+i*(e-t)}function Vt(t,e,i,s){return Math.sqrt(Math.pow(t-i,2)+Math.pow(e-s,2))}class Wt extends O{constructor(){super()}get color(){return this._color}set color(t){this._color!=t&&(this._color=t,"transparent"!=this._node.style.backgroundColor&&(this._node.style.backgroundColor=At(t)))}drawRect(t,e,i){this._node.style.border=t+"px solid "+e.getHexString(),this.color=i.getHex()}drawRoundRect(t,e,i,s,h,r,a){this._node.style.border=t+"px solid "+e.getHexString(),this._node.style.borderRadius=s+"px "+h+"px "+a+"px "+r+"px",this._node.style.backgroundColor=i.getHexString()}drawEllipse(t,e,i,s,h){this._node.style.border=t+"px solid "+e.getHexString(),this._node.style.borderRadius=this._contentRect.width+"px / "+this._contentRect.height+"px",this._node.style.backgroundColor=i.getHexString()}drawPolygon(t,e,i,s){}drawRegularPolygon(t,e,i,s,h,r,a){}clear(){this._node.style.backgroundColor="transparent",this._node.style.border="0px solid"}}class Gt extends Ct{constructor(){super()}get shape(){return this._shape}get color(){return this._shape.color}set color(t){this._shape.color!=t&&(this._shape.color=t,this.updateGear(4))}createDisplayObject(){this._displayObject=this._shape=new Wt}getProp(e){return e==t.ObjectPropID.Color?this.color:super.getProp(e)}setProp(e,i){e==t.ObjectPropID.Color?this.color=i:super.setProp(e,i)}setup_beforeAdd(t,e){super.setup_beforeAdd(t,e),t.seek(e,5);let i=t.readByte();if(0!=i){let e,s,h,r=t.readInt(),a=t.readFullColor(),n=t.readFullColor(),o=t.readBool();if(o)for(h=[],e=0;e<4;e++)h[e]=t.readFloat();if(1==i)o?this._shape.drawRoundRect(r,a,n,h[0],h[1],h[2],h[3]):this._shape.drawRect(r,a,n);else if(2==i)this._shape.drawEllipse(r,a,n,0,360);else if(3==i){s=t.readShort();let i=[];for(i.length=s,e=0;e<s;e++)i[e]=t.readFloat();this._shape.drawPolygon(i,n,r,a)}else if(4==i){let i,h=t.readShort(),o=t.readFloat();if(s=t.readShort(),s>0)for(i=[],e=0;e<s;e++)i[e]=t.readFloat();this._shape.drawRegularPolygon(h,r,n,a,n,o,i)}}}}class Ht extends O{constructor(){super(),this._tileGridIndice=0,this._timerID_1=0,this._textureSize=new T}get src(){return this._src}set src(t){this._src=t,this.refresh()}get color(){return this._color}set color(t){this._color!=t&&(this._color=t,this.updateFilters())}get textureSize(){return this._textureSize}set textureSize(t){this._textureSize.copy(t),this.refresh()}get scale9Grid(){return this._scale9Grid}set scale9Grid(t){this._scale9Grid=t,this.refresh()}get scaleByTile(){return this._scaleByTile}set scaleByTile(t){this._scaleByTile!=t&&(this._scaleByTile=t,this.refresh())}get tileGridIndice(){return this._tileGridIndice}set tileGridIndice(t){this._tileGridIndice!=t&&(this._tileGridIndice=t,this.refresh())}get fillMethod(){return t.FillMethod.None}set fillMethod(t){}get fillOrigin(){return 0}set fillOrigin(t){}get fillClockwise(){return!0}set fillClockwise(t){}get fillAmount(){return 0}set fillAmount(t){}updateFilters(){let t="";if(this._grayed&&(t+="grayscale(100%)"),16777215!=this._color){t+=' url(\'data:image/svg+xml,            <svg xmlns="http://www.w3.org/2000/svg">              <filter id="color">              <feColorMatrix type="matrix" values="                '+((16711680&this._color)>>16)/255+" 0 0 0 0                0 "+((65280&this._color)>>8)/255+" 0 0 0                0 0 "+(255&this._color)/255+" 0 0                 0 0 0 1 0\" />              </filter>            </svg>#color')"}this._node.style.filter=t}refresh(){0==this._timerID_1&&(this._timerID_1=window.requestAnimationFrame(()=>{this._timerID_1=0,this._src?this._scaleByTile?(this._node.style.backgroundImage="url('"+this._src+"')",0!=this._textureSize.x||0!=this._textureSize.y?this._node.style.backgroundSize=this._textureSize.x+"px "+this._textureSize.y+"px":this._node.style.backgroundSize="auto",this._node.style.backgroundRepeat="repeat"):this._scale9Grid?(this._node.style.boxSizing="border-box",this._node.style.backgroundImage="none",this._node.style.borderImage="url('"+this._src+"')",this._node.style.borderImageWidth="auto",this._node.style.borderImageSlice=this._scale9Grid.top+" "+this._scale9Grid.right+" "+this._scale9Grid.bottom+" "+this._scale9Grid.left+" fill"):(this._node.style.backgroundImage="url('"+this._src+"')",this._node.style.backgroundSize="100% 100%",this._node.style.backgroundRepeat="no-repeat"):this._node.style.backgroundImage="none"}))}}class Nt extends Ct{constructor(){super()}get color(){return this._image.color}set color(t){this._image.color!=t&&(this._image.color=t,this.updateGear(4))}get flip(){return this._image.flip}set flip(t){this._image.flip=t}get fillMethod(){return this._image.fillMethod}set fillMethod(t){this._image.fillMethod=t}get fillOrigin(){return this._image.fillOrigin}set fillOrigin(t){this._image.fillOrigin=t}get fillClockwise(){return this._image.fillClockwise}set fillClockwise(t){this._image.fillClockwise=t}get fillAmount(){return this._image.fillAmount}set fillAmount(t){this._image.fillAmount=t}createDisplayObject(){this._displayObject=this._image=new Ht}handleSizeChanged(){this._image.width=this._width,this._image.height=this._height}constructFromResource(){this._contentItem=this.packageItem.getBranch(),this.sourceWidth=this._contentItem.width,this.sourceHeight=this._contentItem.height,this.initWidth=this.sourceWidth,this.initHeight=this.sourceHeight,this._contentItem=this._contentItem.getHighResolution(),this._image.scale9Grid=this._contentItem.scale9Grid,this._image.scaleByTile=this._contentItem.scaleByTile,this._image.tileGridIndice=this._contentItem.tileGridIndice,this._image.src=this._contentItem.file,this.setSize(this.sourceWidth,this.sourceHeight)}getProp(e){return e==t.ObjectPropID.Color?this.color:super.getProp(e)}setProp(e,i){e==t.ObjectPropID.Color?this.color=i:super.setProp(e,i)}setup_beforeAdd(t,e){super.setup_beforeAdd(t,e),t.seek(e,5),t.readBool()&&(this.color=t.readColor()),this.flip=t.readByte(),this._image.fillMethod=t.readByte(),0!=this._image.fillMethod&&(this._image.fillOrigin=t.readByte(),this._image.fillClockwise=t.readBool(),this._image.fillAmount=t.readFloat())}}class Yt extends Ht{constructor(){super(),this.interval=0,this.swing=!1,this.repeatDelay=0,this.timeScale=1,this._playing=!0,this._frameCount=0,this._frame=0,this._start=0,this._end=0,this._times=0,this._endAt=0,this._status=0,this._frameElapsed=0,this._reversed=!1,this._repeatedCount=0,this.setPlaySettings(),this.on("added_to_stage",this.__addToStage,this),this.on("removed_from_stage",this.__removeFromStage,this)}get frames(){return this._frames}set frames(t){this._frames=t,this._scaleByTile=!1,this._scale9Grid=null,this._frames?(this._frameCount=this._frames.length,(-1==this._end||this._end>this._frameCount-1)&&(this._end=this._frameCount-1),(-1==this._endAt||this._endAt>this._frameCount-1)&&(this._endAt=this._frameCount-1),(this._frame<0||this._frame>this._frameCount-1)&&(this._frame=this._frameCount-1),this._frameElapsed=0,this._repeatedCount=0,this._reversed=!1):this._frameCount=0,this.drawFrame(),this.checkTimer()}get frameCount(){return this._frameCount}get frame(){return this._frame}set frame(t){this._frame!=t&&(this._frames&&t>=this._frameCount&&(t=this._frameCount-1),this._frame=t,this._frameElapsed=0,this.drawFrame())}get playing(){return this._playing}set playing(t){this._playing!=t&&(this._playing=t,this.checkTimer())}rewind(){this._frame=0,this._frameElapsed=0,this._reversed=!1,this._repeatedCount=0,this.drawFrame()}syncStatus(t){this._frame=t._frame,this._frameElapsed=t._frameElapsed,this._reversed=t._reversed,this._repeatedCount=t._repeatedCount,this.drawFrame()}advance(t){for(var e=this._frame,i=this._reversed,s=t;;){var h=this.interval+(this._frames[this._frame].addDelay||0);if(0==this._frame&&this._repeatedCount>0&&(h+=this.repeatDelay),t<h){this._frameElapsed=0;break}if(t-=h,this.swing?this._reversed?(this._frame--,this._frame<=0&&(this._frame=0,this._repeatedCount++,this._reversed=!this._reversed)):(this._frame++,this._frame>this._frameCount-1&&(this._frame=Math.max(0,this._frameCount-2),this._repeatedCount++,this._reversed=!this._reversed)):(this._frame++,this._frame>this._frameCount-1&&(this._frame=0,this._repeatedCount++)),this._frame==e&&this._reversed==i){var r=s-t;t-=Math.floor(t/r)*r}}this.drawFrame()}setPlaySettings(t,e,i,s){this._start=t||0,this._end=e||-1,(-1==this._end||this._end>this._frameCount-1)&&(this._end=this._frameCount-1),this._times=i||0,this._endAt=s||-1,-1==this._endAt&&(this._endAt=this._end),this._status=0,this.frame=this._start}onTimer(){if(this._playing&&0!=this._frameCount&&3!=this._status){var t=z.deltaTime;t>100&&(t=100),1!=this.timeScale&&(t*=this.timeScale),this._frameElapsed+=t;var e=this.interval+(this._frames[this._frame].addDelay||0);0==this._frame&&this._repeatedCount>0&&(e+=this.repeatDelay),this._frameElapsed<e||(this._frameElapsed-=e,this._frameElapsed>this.interval&&(this._frameElapsed=this.interval),this.swing?this._reversed?(this._frame--,this._frame<=0&&(this._frame=0,this._repeatedCount++,this._reversed=!this._reversed)):(this._frame++,this._frame>this._frameCount-1&&(this._frame=Math.max(0,this._frameCount-2),this._repeatedCount++,this._reversed=!this._reversed)):(this._frame++,this._frame>this._frameCount-1&&(this._frame=0,this._repeatedCount++)),1==this._status?(this._frame=this._start,this._frameElapsed=0,this._status=0):2==this._status?(this._frame=this._endAt,this._frameElapsed=0,this._status=3,this.dispatchEvent("play_end")):this._frame==this._end&&(this._times>0?(this._times--,0==this._times?this._status=2:this._status=1):this._status=1),this.drawFrame())}}drawFrame(){}checkTimer(){this._playing&&this._frameCount>0&&this.onStage?z.addUpdate(this.onTimer,this):z.remove(this.onTimer,this)}__addToStage(){this._playing&&this._frameCount>0&&z.addUpdate(this.onTimer,this)}__removeFromStage(){z.remove(this.onTimer,this)}}class Ut extends Ct{constructor(){super()}get color(){return this._movieClip.color}set color(t){this._movieClip.color=t}createDisplayObject(){this._displayObject=this._movieClip=new Yt}get playing(){return this._movieClip.playing}set playing(t){this._movieClip.playing!=t&&(this._movieClip.playing=t,this.updateGear(5))}get frame(){return this._movieClip.frame}set frame(t){this._movieClip.frame!=t&&(this._movieClip.frame=t,this.updateGear(5))}get timeScale(){return this._movieClip.timeScale}set timeScale(t){this._movieClip.timeScale=t}rewind(){this._movieClip.rewind()}syncStatus(t){this._movieClip.syncStatus(t._movieClip)}advance(t){this._movieClip.advance(t)}setPlaySettings(t,e,i,s){this._movieClip.setPlaySettings(t,e,i,s)}getProp(e){switch(e){case t.ObjectPropID.Color:return this.color;case t.ObjectPropID.Playing:return this.playing;case t.ObjectPropID.Frame:return this.frame;case t.ObjectPropID.TimeScale:return this.timeScale;default:return super.getProp(e)}}setProp(e,i){switch(e){case t.ObjectPropID.Color:this.color=i;break;case t.ObjectPropID.Playing:this.playing=i;break;case t.ObjectPropID.Frame:this.frame=i;break;case t.ObjectPropID.TimeScale:this.timeScale=i;break;case t.ObjectPropID.DeltaTime:this.advance(i);break;default:super.setProp(e,i)}}constructFromResource(){var t=this.packageItem.getBranch();this.sourceWidth=t.width,this.sourceHeight=t.height,this.initWidth=this.sourceWidth,this.initHeight=this.sourceHeight,this.setSize(this.sourceWidth,this.sourceHeight),(t=t.getHighResolution()).load(),this._movieClip.interval=t.interval,this._movieClip.swing=t.swing,this._movieClip.repeatDelay=t.repeatDelay,this._movieClip.frames=t.frames}setup_beforeAdd(t,e){super.setup_beforeAdd(t,e),t.seek(e,5),t.readBool()&&(this.color=t.readColor()),this._movieClip.flip=t.readByte(),this._movieClip.frame=t.readInt(),this._movieClip.playing=t.readBool()}}!function(t){t[t.ConstantPixelSize=0]="ConstantPixelSize",t[t.ScaleWithScreenSize=1]="ScaleWithScreenSize",t[t.ConstantPhysicalSize=2]="ConstantPhysicalSize"}(Tt||(Tt={})),function(t){t[t.MatchWidthOrHeight=0]="MatchWidthOrHeight",t[t.MatchWidth=1]="MatchWidth",t[t.MatchHeight=2]="MatchHeight"}(Pt||(Pt={}));class Xt{static get scaleFactor(){return Jt}static get scaleLevel(){return te}static scaleWithScreenSize(t,e,i){Qt=t,Zt=e,Kt=Tt.ScaleWithScreenSize,qt=i||Pt.MatchWidthOrHeight,ee()}static setConstant(t){Kt=Tt.ConstantPixelSize,$t=t||1,ee()}}var qt,Kt=Tt.ConstantPixelSize,Qt=1136,Zt=640,$t=1,Jt=1,te=0;function ee(){let t=R.rootObject.width,e=R.rootObject.height;if(Kt==Tt.ScaleWithScreenSize){if(0==Qt||0==Zt)return;let i=Qt,s=Zt;if(t>e&&i<s||t<e&&i>s){let t=i;i=s,s=t}if(qt==Pt.MatchWidthOrHeight){let h=t/i,r=e/s;Jt=Math.min(h,r)}else Jt=qt==Pt.MatchWidth?t/i:e/s}else Kt==Tt.ConstantPhysicalSize||(Jt=$t);Jt>10&&(Jt=10),te=Jt>3?3:Jt>2?2:Jt>1?1:0,R.rootObject.broadcastEvent("content_scale_factor_changed")}R.rootObject.on("size_changed",ee);class ie{constructor(){this.width=0,this.height=0}load(){}getBranch(){if(this.branches&&-1!=this.owner._branchIndex){var t=this.branches[this.owner._branchIndex];if(t)return this.owner.getItemById(t)}return this}getHighResolution(){if(this.highResolution&&Xt.scaleLevel>0){var t=this.highResolution[Xt.scaleLevel-1];if(t)return this.owner.getItemById(t)}return this}toString(){return this.name}}class se{constructor(t,e,i){this.version=0,e=e||0,null!=i&&-1!=i||(i=t.byteLength-e),this._buffer=t,this._view=new DataView(this._buffer,e,i),this._pos=0,this._length=i}get data(){return this._buffer}get pos(){return this._pos}set pos(t){if(t>this._length)throw"Out of bounds";this._pos=t}get length(){return this._length}skip(t){this._pos+=t}validate(t){if(this._pos+t>this._length)throw"Out of bounds"}readByte(){this.validate(1);let t=this._view.getUint8(this._pos);return this._pos++,t}readBool(){return 1==this.readByte()}readShort(){this.validate(2);let t=this._view.getInt16(this._pos,this.littleEndian);return this._pos+=2,t}readUshort(){this.validate(2);let t=this._view.getUint16(this._pos,this.littleEndian);return this._pos+=2,t}readInt(){this.validate(4);let t=this._view.getInt32(this._pos,this.littleEndian);return this._pos+=4,t}readUint(){this.validate(4);let t=this._view.getUint32(this._pos,this.littleEndian);return this._pos+=4,t}readFloat(){this.validate(4);let t=this._view.getFloat32(this._pos,this.littleEndian);return this._pos+=4,t}readString(t){null==t&&(t=this.readUshort()),this.validate(t);let e=(new TextDecoder).decode(new DataView(this._buffer,this._view.byteOffset+this._pos,t));return this._pos+=t,e}readS(){var t=this.readUshort();return 65534==t?null:65533==t?"":this.stringTable[t]}readSArray(t){for(var e=new Array(t),i=0;i<t;i++)e[i]=this.readS();return e}writeS(t){var e=this.readUshort();65534!=e&&65533!=e&&(this.stringTable[e]=t)}readColor(){var t=this.readByte(),e=this.readByte(),i=this.readByte();return this.readByte(),(t<<16)+(e<<8)+i}readFullColor(){var t=this.readByte(),e=this.readByte(),i=this.readByte(),s=this.readByte();return new xt(t/255,e/255,i/255,s/255)}readChar(){var t=this.readUshort();return String.fromCharCode(t)}readBuffer(){var t=this.readUint();this.validate(t);var e=new se(this._buffer,this._view.byteOffset+this._pos,t);return e.stringTable=this.stringTable,e.version=this.version,this._pos+=t,e}seek(t,e){var i,s=this._pos;return this._pos=t,e<this.readByte()?(1==this.readByte()?(this._pos+=2*e,i=this.readUshort()):(this._pos+=4*e,i=this.readUint()),i>0?(this._pos=t+i,!0):(this._pos=s,!1)):(this._pos=s,!1)}}class he extends I{constructor(){super(...arguments),this._http=new XMLHttpRequest}send(t,e=null,i="get",s="text",h=null){this._responseType=s,this._data=null,this._url=t;var r=this,a=this._http;a.open(i,t,!0);let n=!1;if(h)for(var o=0;o<h.length;o++)a.setRequestHeader(h[o++],h[o]);else window.conch||(e&&"string"!=typeof e?(a.setRequestHeader("Content-Type","application/json"),e instanceof ArrayBuffer||"string"==typeof e||(n=!0)):a.setRequestHeader("Content-Type","application/x-www-form-urlencoded"));let l="arraybuffer"!==s?"text":"arraybuffer";a.responseType=l,a.dataType&&(a.dataType=l),a.onerror=function(t){r._onError(t)},a.onabort=function(t){r._onAbort(t)},a.onprogress=function(t){r._onProgress(t)},a.onload=function(t){r._onLoad(t)},a.send(n?JSON.stringify(e):e)}_onProgress(t){t&&t.lengthComputable&&this.dispatchEvent("progress",t.loaded/t.total)}_onAbort(t){this.error("Request was aborted by user")}_onError(t){this.error("Request failed Status:"+this._http.status+" text:"+this._http.statusText)}_onLoad(t){var e=this._http,i=void 0!==e.status?e.status:200;200===i||204===i||0===i?this.complete():this.error("["+e.status+"]"+e.statusText+":"+e.responseURL)}error(t){this.clear(),console.warn(this.url,t),this.dispatchEvent("error",t)}complete(){this.clear(),this._data=this._http.response||this._http.responseText,this.dispatchEvent("complete",this._data)}clear(){var t=this._http;t.onerror=t.onabort=t.onprogress=t.onload=null}get url(){return this._url}get data(){return this._data}get http(){return this._http}}class re{constructor(t){t.readInt(),this.pixelWidth=t.readInt(),this.scale=1/t.readByte();let e=t.readInt();this.pixels=new Uint8Array(t.data,t.pos,e),t.skip(e)}}class ae{constructor(t,e,i,s,h){this._data=t,this.offsetX=e,this.offsetY=i,this.sourceWidth=s,this.sourceHeight=h}hitTest(t,e,i){if(!t.contains(e,i))return!1;let s=this._data;if(e=Math.floor((e*this.sourceWidth/t.width-this.offsetX)*s.scale),i=Math.floor((i*this.sourceHeight/t.height-this.offsetY)*s.scale),e<0||i<0||e>=s.pixelWidth)return!1;let h=i*s.pixelWidth+e,r=Math.floor(h/8),a=h%8;return r>=0&&r<s.pixels.length&&(s.pixels[r]>>a&1)>0}}class ne{constructor(){this.left=0,this.right=0,this.top=0,this.bottom=0}copy(t){this.top=t.top,this.bottom=t.bottom,this.left=t.left,this.right=t.right}}class oe{constructor(){this._items=[],this._itemsById={},this._itemsByName={},this._dependencies=[],this._branches=[],this._branchIndex=-1}static get branch(){return de}static set branch(t){for(var e in de=t,le){var i=le[e];i._branches&&(i._branchIndex=i._branches.indexOf(t))}}static getVar(t){return ce[t]}static setVar(t,e){ce[t]=e}static getById(t){return le[t]}static getByName(t){return _e[t]}static loadPackage(t){return t.endsWith("/")||(t+="/"),new Promise(e=>{let i=le[t];if(i)return void e(i);let s=new he;s.send(t+"package.xml",null,"get","arraybuffer"),s.on("complete",i=>{let s=new oe;s.loadPackage(new se(i.data),t),le[s.id]=s,_e[s.name]=s,le[s.path]=s,e(s)})})}static removePackage(t){var e=le[t];if(e||(e=_e[t]),!e)throw"No package found: "+t;e.dispose(),delete le[e.id],delete _e[e.name],e._path&&delete le[e._path]}static createObject(t,e,i){var s=oe.getByName(t);return s?s.createObject(e,i):null}static createObjectFromURL(t,e){var i=oe.getItemByURL(t);return i?i.owner.internalCreateObject(i,e):null}static getItemURL(t,e){var i=oe.getByName(t);if(!i)return null;var s=i._itemsByName[e];return s?"ui://"+i.id+s.id:null}static getItemByURL(t){var e=t.indexOf("//");if(-1==e)return null;var i=t.indexOf("/",e+2);if(-1==i){if(t.length>13){var s=t.substr(5,8),h=oe.getById(s);if(null!=h){var r=t.substr(13);return h.getItemById(r)}}}else{var a=t.substr(e+2,i-e-2);if(null!=(h=oe.getByName(a))){var n=t.substr(i+1);return h.getItemByName(n)}}return null}static normalizeURL(t){if(null==t)return null;var e=t.indexOf("//");if(-1==e)return null;var i=t.indexOf("/",e+2);if(-1==i)return t;var s=t.substr(e+2,i-e-2),h=t.substr(i+1);return oe.getItemURL(s,h)}loadPackage(e,i){if(1179080009!=e.readUint())throw"FairyGUI: old package format found in '"+i+"'";this._path=i,e.version=e.readInt();var s=e.version>=2;e.readBool(),this._id=e.readString(),this._name=e.readString(),e.skip(20);var h,r,a,n,o,l=e.pos;e.seek(l,4),h=e.readInt();var _,d=new Array(h);for(e.stringTable=d,r=0;r<h;r++)d[r]=e.readString();if(e.seek(l,5))for(h=e.readInt(),r=0;r<h;r++){let t=e.readUshort(),i=e.readInt();d[t]=e.readString(i)}for(e.seek(l,0),h=e.readShort(),r=0;r<h;r++)this._dependencies.push({id:e.readS(),name:e.readS()});for(s&&((h=e.readShort())>0&&(this._branches=e.readSArray(h),de&&(this._branchIndex=this._branches.indexOf(de))),o=h>0),e.seek(l,1),h=e.readShort(),r=0;r<h;r++){switch(a=e.readInt(),a+=e.pos,(_=new ie).owner=this,_.type=e.readByte(),_.id=e.readS(),_.name=e.readS(),e.readS(),_.file=i+e.readS(),e.readBool(),_.width=e.readInt(),_.height=e.readInt(),_.type){case t.PackageItemType.Image:_.objectType=t.ObjectType.Image;var c=e.readByte();if(1==c){let t=e.readInt(),i=e.readInt(),s=e.readInt(),h=e.readInt();_.scale9Grid=new ne,_.scale9Grid.left=t,_.scale9Grid.top=i,_.scale9Grid.right=_.width-t-s,_.scale9Grid.bottom=_.height-i-h,_.tileGridIndice=e.readInt()}else 2==c&&(_.scaleByTile=!0);_.smoothing=e.readBool();break;case t.PackageItemType.MovieClip:_.smoothing=e.readBool(),_.objectType=t.ObjectType.MovieClip,_.rawData=e.readBuffer();break;case t.PackageItemType.Font:_.rawData=e.readBuffer();break;case t.PackageItemType.Component:var u=e.readByte();_.objectType=u>0?u:t.ObjectType.Component,_.rawData=e.readBuffer(),ue.UIObjectFactory.resolveExtension(_);break;case t.PackageItemType.Spine:case t.PackageItemType.DragonBones:e.readFloat(),e.readFloat()}if(s){(n=e.readS())&&(_.name=n+"/"+_.name);var p=e.readByte();p>0&&(o?_.branches=e.readSArray(p):this._itemsById[e.readS()]=_);var g=e.readByte();g>0&&(_.highResolution=e.readSArray(g))}this._items.push(_),this._itemsById[_.id]=_,null!=_.name&&(this._itemsByName[_.name]=_),e.pos=a}if(e.seek(l,3))for(h=e.readShort(),r=0;r<h;r++)a=e.readInt(),a+=e.pos,(_=this._itemsById[e.readS()])&&_.type==t.PackageItemType.Image&&(_.pixelHitTestData=new re(e)),e.pos=a}dispose(){}get id(){return this._id}get name(){return this._name}get path(){return this._path}get dependencies(){return this._dependencies}createObject(t,e){var i=this._itemsByName[t];return i?this.internalCreateObject(i,e):null}internalCreateObject(t,e){var i=ue.UIObjectFactory.newObject(t,e);return null==i?null:(Mt.n++,i.constructFromResource(),Mt.n--,i)}getItemById(t){return this._itemsById[t]}getItemByName(t){return this._itemsByName[t]}getItemAssetURL(t){return t.file}}var le={},_e={},de="",ce={},ue={};class pe{constructor(){}run(t,e,i){this.fromPage&&0!=this.fromPage.length&&-1==this.fromPage.indexOf(e)||this.toPage&&0!=this.toPage.length&&-1==this.toPage.indexOf(i)?this.leave(t):this.enter(t)}enter(t){}leave(t){}setup(t){var e,i;for(e=t.readShort(),this.fromPage=[],i=0;i<e;i++)this.fromPage[i]=t.readS();for(e=t.readShort(),this.toPage=[],i=0;i<e;i++)this.toPage[i]=t.readS()}}class ge extends pe{constructor(){super(),this.playTimes=1,this.delay=0}enter(t){var e=t.parent.getTransition(this.transitionName);e&&(this._currentTransition&&this._currentTransition.playing?e.changePlayTimes(this.playTimes):e.play(null,this.playTimes,this.delay),this._currentTransition=e)}leave(t){this.stopOnExit&&this._currentTransition&&(this._currentTransition.stop(),this._currentTransition=null)}setup(t){super.setup(t),this.transitionName=t.readS(),this.playTimes=t.readInt(),this.delay=t.readFloat(),this.stopOnExit=t.readBool()}}class fe extends pe{constructor(){super()}enter(t){var e;if(this.controllerName&&(e=this.objectId?t.parent.getChildById(this.objectId):t.parent)){var i=e.getController(this.controllerName);i&&i!=t&&!i.changing&&("~1"==this.targetPage?t.selectedIndex<i.pageCount&&(i.selectedIndex=t.selectedIndex):"~2"==this.targetPage?i.selectedPage=t.selectedPage:i.selectedPageId=this.targetPage)}}setup(t){super.setup(t),this.objectId=t.readS(),this.controllerName=t.readS(),this.targetPage=t.readS()}}var me=0;class ye extends I{constructor(){super(),this.changing=!1,this._pageIds=[],this._pageNames=[],this._selectedIndex=-1,this._previousIndex=-1}dispose(){this.offAll()}get selectedIndex(){return this._selectedIndex}set selectedIndex(t){if(this._selectedIndex!=t){if(t>this._pageIds.length-1)throw"index out of bounds: "+t;this.changing=!0,this._previousIndex=this._selectedIndex,this._selectedIndex=t,this.parent.applyController(this),this.dispatchEvent("status_changed"),this.changing=!1}}setSelectedIndex(t){if(this._selectedIndex!=t){if(t>this._pageIds.length-1)throw"index out of bounds: "+t;this.changing=!0,this._previousIndex=this._selectedIndex,this._selectedIndex=t,this.parent.applyController(this),this.changing=!1}}get previsousIndex(){return this._previousIndex}get selectedPage(){return-1==this._selectedIndex?null:this._pageNames[this._selectedIndex]}set selectedPage(t){var e=this._pageNames.indexOf(t);-1==e&&(e=0),this.selectedIndex=e}setSelectedPage(t){var e=this._pageNames.indexOf(t);-1==e&&(e=0),this.setSelectedIndex(e)}get previousPage(){return-1==this._previousIndex?null:this._pageNames[this._previousIndex]}get pageCount(){return this._pageIds.length}getPageName(t){return this._pageNames[t]}addPage(t){t=t||"",this.addPageAt(t,this._pageIds.length)}addPageAt(t,e){t=t||"";var i=""+me++;null==e||e==this._pageIds.length?(this._pageIds.push(i),this._pageNames.push(t)):(this._pageIds.splice(e,0,i),this._pageNames.splice(e,0,t))}removePage(t){var e=this._pageNames.indexOf(t);-1!=e&&(this._pageIds.splice(e,1),this._pageNames.splice(e,1),this._selectedIndex>=this._pageIds.length?this.selectedIndex=this._selectedIndex-1:this.parent.applyController(this))}removePageAt(t){this._pageIds.splice(t,1),this._pageNames.splice(t,1),this._selectedIndex>=this._pageIds.length?this.selectedIndex=this._selectedIndex-1:this.parent.applyController(this)}clearPages(){this._pageIds.length=0,this._pageNames.length=0,-1!=this._selectedIndex?this.selectedIndex=-1:this.parent.applyController(this)}hasPage(t){return-1!=this._pageNames.indexOf(t)}getPageIndexById(t){return this._pageIds.indexOf(t)}getPageIdByName(t){var e=this._pageNames.indexOf(t);return-1!=e?this._pageIds[e]:null}getPageNameById(t){var e=this._pageIds.indexOf(t);return-1!=e?this._pageNames[e]:null}getPageId(t){return this._pageIds[t]}get selectedPageId(){return-1==this._selectedIndex?null:this._pageIds[this._selectedIndex]}set selectedPageId(t){var e=this._pageIds.indexOf(t);this.selectedIndex=e}set oppositePageId(t){this._pageIds.indexOf(t)>0?this.selectedIndex=0:this._pageIds.length>1&&(this.selectedIndex=1)}get previousPageId(){return-1==this._previousIndex?null:this._pageIds[this._previousIndex]}runActions(){if(this._actions)for(var t=this._actions.length,e=0;e<t;e++)this._actions[e].run(this,this.previousPageId,this.selectedPageId)}setup(t){var e,i,s=t.pos;t.seek(s,0),this.name=t.readS(),t.readBool()&&(this.autoRadioGroupDepth=!0),t.seek(s,1);var h=t.readShort();for(e=0;e<h;e++)this._pageIds.push(t.readS()),this._pageNames.push(t.readS());var r=0;if(t.version>=2)switch(t.readByte()){case 1:r=t.readShort();break;case 2:-1==(r=this._pageNames.indexOf(oe.branch))&&(r=0);break;case 3:-1==(r=this._pageNames.indexOf(oe.getVar(t.readS())))&&(r=0)}if(t.seek(s,2),(h=t.readShort())>0)for(null==this._actions&&(this._actions=[]),e=0;e<h;e++){i=t.readShort(),i+=t.pos;var a=we(t.readByte());a.setup(t),this._actions.push(a),t.pos=i}this.parent&&this._pageIds.length>0?this._selectedIndex=r:this._selectedIndex=-1}}function we(t){switch(t){case 0:return new ge;case 1:return new fe}return null}var ve=new T,xe=new P,be=new T,Ce=new T,Se=0;class Ie{constructor(t){this._owner=t,this._maskContainer=new O,this._owner.displayObject.addChild(this._maskContainer),this._container=this._owner._container,this._container.setPosition(0,0),this._maskContainer.addChild(this._container),this._mouseWheelEnabled=!0,this._xPos=0,this._yPos=0,this._aniFlag=0,this._tweening=0,this._loop=0,this._footerLockedSize=0,this._headerLockedSize=0,this._scrollBarMargin=new ne,this._viewSize=new T,this._contentSize=new T,this._pageSize=new T(1,1),this._overlapSize=new T,this._tweenTime=new T,this._tweenStart=new T,this._tweenDuration=new T,this._tweenChange=new T,this._velocity=new T,this._containerPos=new T,this._beginTouchPos=new T,this._lastTouchPos=new T,this._lastTouchGlobalPos=new T,this._scrollStep=bt.defaultScrollStep,this._decelerationRate=bt.defaultScrollDecelerationRate,this._owner.on("touch_begin",this.__touchBegin,this),this._owner.on("touch_move",this.__touchMove,this),this._owner.on("touch_end",this.__touchEnd,this),this._owner.on("mouse_wheel",this.__mouseWheel,this)}setup(e){this._scrollType=e.readByte();var i=e.readByte(),s=e.readInt();e.readBool()&&(this._scrollBarMargin.top=e.readInt(),this._scrollBarMargin.bottom=e.readInt(),this._scrollBarMargin.left=e.readInt(),this._scrollBarMargin.right=e.readInt());var h=e.readS(),r=e.readS(),a=e.readS(),n=e.readS();if(0!=(1&s)&&(this._displayOnLeft=!0),0!=(2&s)&&(this._snapToItem=!0),0!=(4&s)&&(this._displayInDemand=!0),0!=(8&s)&&(this._pageMode=!0),this._touchEffect=!!(16&s)||!(32&s)&&bt.defaultScrollTouchEffect,this._bouncebackEffect=!!(64&s)||!(128&s)&&bt.defaultScrollBounceEffect,0!=(256&s)&&(this._inertiaDisabled=!0),0==(512&s)&&(this._owner.displayObject.clipping=!0),0!=(1024&s)&&(this._floating=!0),0==(2048&s)&&(this._maskContainer.clipping=!0),i==t.ScrollBarDisplayType.Default&&(i=bt.defaultScrollBarDisplay),i!=t.ScrollBarDisplayType.Hidden){if(this._scrollType==t.ScrollType.Both||this._scrollType==t.ScrollType.Vertical){var o=h||bt.verticalScrollBar;if(o){if(this._vtScrollBar=oe.createObjectFromURL(o),!this._vtScrollBar)throw"cannot create scrollbar} from "+o;this._vtScrollBar.setScrollPane(this,!0),this._owner.displayObject.addChild(this._vtScrollBar.displayObject)}}if((this._scrollType==t.ScrollType.Both||this._scrollType==t.ScrollType.Horizontal)&&(o=r||bt.horizontalScrollBar)){if(this._hzScrollBar=oe.createObjectFromURL(o),!this._hzScrollBar)throw"cannot create scrollbar} from "+o;this._hzScrollBar.setScrollPane(this,!1),this._owner.displayObject.addChild(this._hzScrollBar.displayObject)}i==t.ScrollBarDisplayType.Auto&&(this._scrollBarDisplayAuto=!0),this._scrollBarDisplayAuto&&(this._vtScrollBar&&(this._vtScrollBar.displayObject.visible=!1),this._hzScrollBar&&(this._hzScrollBar.displayObject.visible=!1))}else this._mouseWheelEnabled=!1;if(a&&(this._header=oe.createObjectFromURL(a),!this._header))throw new Error("cannot create scrollPane header from "+a);if(n&&(this._footer=oe.createObjectFromURL(n),!this._footer))throw new Error("cannot create scrollPane footer from "+n);(this._header||this._footer)&&(this._refreshBarAxis=this._scrollType==t.ScrollType.Both||this._scrollType==t.ScrollType.Vertical?"y":"x"),this.setSize(this.owner.width,this.owner.height)}dispose(){0!=this._tweening&&z.remove(this.tweenUpdate,this),delete this._pageController,this._hzScrollBar&&this._hzScrollBar.dispose(),this._vtScrollBar&&this._vtScrollBar.dispose(),this._header&&this._header.dispose(),this._footer&&this._footer.dispose()}get owner(){return this._owner}get hzScrollBar(){return this._hzScrollBar}get vtScrollBar(){return this._vtScrollBar}get header(){return this._header}get footer(){return this._footer}get bouncebackEffect(){return this._bouncebackEffect}set bouncebackEffect(t){this._bouncebackEffect=t}get touchEffect(){return this._touchEffect}set touchEffect(t){this._touchEffect=t}set scrollStep(t){this._scrollStep=t,0==this._scrollStep&&(this._scrollStep=bt.defaultScrollStep)}get scrollStep(){return this._scrollStep}get snapToItem(){return this._snapToItem}set snapToItem(t){this._snapToItem=t}get mouseWheelEnabled(){return this._mouseWheelEnabled}set mouseWheelEnabled(t){this._mouseWheelEnabled=t}get decelerationRate(){return this._decelerationRate}set decelerationRate(t){this._decelerationRate=t}get isDragged(){return this._dragged}get percX(){return 0==this._overlapSize.x?0:this._xPos/this._overlapSize.x}set percX(t){this.setPercX(t,!1)}setPercX(t,e){this._owner.ensureBoundsCorrect(),this.setPosX(this._overlapSize.x*Dt(t),e)}get percY(){return 0==this._overlapSize.y?0:this._yPos/this._overlapSize.y}set percY(t){this.setPercY(t,!1)}setPercY(t,e){this._owner.ensureBoundsCorrect(),this.setPosY(this._overlapSize.y*Dt(t),e)}get posX(){return this._xPos}set posX(t){this.setPosX(t,!1)}setPosX(t,e){this._owner.ensureBoundsCorrect(),1==this._loop&&(t=this.loopCheckingNewPos(t,"x")),(t=Rt(t,0,this._overlapSize.x))!=this._xPos&&(this._xPos=t,this.posChanged(e))}get posY(){return this._yPos}set posY(t){this.setPosY(t,!1)}setPosY(t,e){this._owner.ensureBoundsCorrect(),1==this._loop&&(t=this.loopCheckingNewPos(t,"y")),(t=Rt(t,0,this._overlapSize.y))!=this._yPos&&(this._yPos=t,this.posChanged(e))}get contentWidth(){return this._contentSize.x}get contentHeight(){return this._contentSize.y}get viewWidth(){return this._viewSize.x}set viewWidth(t){t=t+this._owner.margin.left+this._owner.margin.right,this._vtScrollBar&&!this._floating&&(t+=this._vtScrollBar.width),this._owner.width=t}get viewHeight(){return this._viewSize.y}set viewHeight(t){t=t+this._owner.margin.top+this._owner.margin.bottom,this._hzScrollBar&&!this._floating&&(t+=this._hzScrollBar.height),this._owner.height=t}get currentPageX(){if(!this._pageMode)return 0;var t=Math.floor(this._xPos/this._pageSize.x);return this._xPos-t*this._pageSize.x>.5*this._pageSize.x&&t++,t}set currentPageX(t){this.setCurrentPageX(t,!1)}get currentPageY(){if(!this._pageMode)return 0;var t=Math.floor(this._yPos/this._pageSize.y);return this._yPos-t*this._pageSize.y>.5*this._pageSize.y&&t++,t}set currentPageY(t){this.setCurrentPageY(t,!1)}setCurrentPageX(t,e){this._pageMode&&(this._owner.ensureBoundsCorrect(),this._overlapSize.x>0&&this.setPosX(t*this._pageSize.x,e))}setCurrentPageY(t,e){this._pageMode&&(this._owner.ensureBoundsCorrect(),this._overlapSize.y>0&&this.setPosY(t*this._pageSize.y,e))}get isBottomMost(){return this._yPos==this._overlapSize.y||0==this._overlapSize.y}get isRightMost(){return this._xPos==this._overlapSize.x||0==this._overlapSize.x}get pageController(){return this._pageController}set pageController(t){this._pageController=t}get scrollingPosX(){return Rt(-this._container.x,0,this._overlapSize.x)}get scrollingPosY(){return Rt(-this._container.y,0,this._overlapSize.y)}scrollTop(t){this.setPercY(0,t)}scrollBottom(t){this.setPercY(1,t)}scrollUp(t,e){t=t||1,this._pageMode?this.setPosY(this._yPos-this._pageSize.y*t,e):this.setPosY(this._yPos-this._scrollStep*t,e)}scrollDown(t,e){t=t||1,this._pageMode?this.setPosY(this._yPos+this._pageSize.y*t,e):this.setPosY(this._yPos+this._scrollStep*t,e)}scrollLeft(t,e){t=t||1,this._pageMode?this.setPosX(this._xPos-this._pageSize.x*t,e):this.setPosX(this._xPos-this._scrollStep*t,e)}scrollRight(t,e){t=t||1,this._pageMode?this.setPosX(this._xPos+this._pageSize.x*t,e):this.setPosX(this._xPos+this._scrollStep*t,e)}scrollToView(t,e,i){var s;if(this._owner.ensureBoundsCorrect(),this._needRefresh&&this.refresh(),t instanceof Ct?t.parent!=this._owner?(t.parent.localToGlobalRect(t.x,t.y,t.width,t.height,xe),s=this._owner.globalToLocalRect(xe.x,xe.y,xe.width,xe.height,xe)):(s=xe).set(t.x,t.y,t.width,t.height):s=t,this._overlapSize.y>0){var h=this._yPos+this._viewSize.y;i||s.y<=this._yPos||s.height>=this._viewSize.y?this._pageMode?this.setPosY(Math.floor(s.y/this._pageSize.y)*this._pageSize.y,e):this.setPosY(s.y,e):s.y+s.height>h&&(this._pageMode?this.setPosY(Math.floor(s.y/this._pageSize.y)*this._pageSize.y,e):s.height<=this._viewSize.y/2?this.setPosY(s.y+2*s.height-this._viewSize.y,e):this.setPosY(s.y+s.height-this._viewSize.y,e))}if(this._overlapSize.x>0){var r=this._xPos+this._viewSize.x;i||s.x<=this._xPos||s.width>=this._viewSize.x?this._pageMode?this.setPosX(Math.floor(s.x/this._pageSize.x)*this._pageSize.x,e):this.setPosX(s.x,e):s.x+s.width>r&&(this._pageMode?this.setPosX(Math.floor(s.x/this._pageSize.x)*this._pageSize.x,e):s.width<=this._viewSize.x/2?this.setPosX(s.x+2*s.width-this._viewSize.x,e):this.setPosX(s.x+s.width-this._viewSize.x,e))}!e&&this._needRefresh&&this.refresh()}isChildInView(t){if(this._overlapSize.y>0){var e=t.y+this._container.y;if(e<-t.height||e>this._viewSize.y)return!1}return!(this._overlapSize.x>0&&((e=t.x+this._container.x)<-t.width||e>this._viewSize.x))}cancelDragging(){R.removeTouchMonitor(this._owner.displayObject),Ie.draggingPane==this&&(Ie.draggingPane=null),Se=0,this._dragged=!1}lockHeader(t){this._headerLockedSize!=t&&(this._headerLockedSize=t,!this._refreshEventDispatching&&this._container[this._refreshBarAxis]>=0&&(this._tweenStart.set(this._container.x,this._container.y),this._tweenChange.set(0,0),this._tweenChange[this._refreshBarAxis]=this._headerLockedSize-this._tweenStart[this._refreshBarAxis],this._tweenDuration.set(.3,.3),this.startTween(2)))}lockFooter(t){if(this._footerLockedSize!=t&&(this._footerLockedSize=t,!this._refreshEventDispatching&&this._container[this._refreshBarAxis]<=-this._overlapSize[this._refreshBarAxis])){this._tweenStart.set(this._container.x,this._container.y),this._tweenChange.set(0,0);var e=this._overlapSize[this._refreshBarAxis];0==e?e=Math.max(this._contentSize[this._refreshBarAxis]+this._footerLockedSize-this._viewSize[this._refreshBarAxis],0):e+=this._footerLockedSize,this._tweenChange[this._refreshBarAxis]=-e-this._tweenStart[this._refreshBarAxis],this._tweenDuration.set(.3,.3),this.startTween(2)}}onOwnerSizeChanged(){this.setSize(this._owner.width,this._owner.height),this.posChanged(!1)}handleControllerChanged(e){this._pageController==e&&(this._scrollType==t.ScrollType.Horizontal?this.setCurrentPageX(e.selectedIndex,!0):this.setCurrentPageY(e.selectedIndex,!0))}updatePageController(){var e;if(this._pageController&&!this._pageController.changing&&(e=this._scrollType==t.ScrollType.Horizontal?this.currentPageX:this.currentPageY)<this._pageController.pageCount){var i=this._pageController;this._pageController=null,i.selectedIndex=e,this._pageController=i}}adjustMaskContainer(){var t,e;t=this._displayOnLeft&&this._vtScrollBar&&!this._floating?Math.floor(this._owner.margin.left+this._vtScrollBar.width):Math.floor(this._owner.margin.left),e=Math.floor(this._owner.margin.top),t+=this._owner._alignOffset.x,e+=this._owner._alignOffset.y,this._maskContainer.setPosition(t,e)}setSize(t,e){this.adjustMaskContainer(),this._hzScrollBar&&(this._hzScrollBar.y=e-this._hzScrollBar.height,this._vtScrollBar?(this._hzScrollBar.width=t-this._vtScrollBar.width-this._scrollBarMargin.left-this._scrollBarMargin.right,this._displayOnLeft?this._hzScrollBar.x=this._scrollBarMargin.left+this._vtScrollBar.width:this._hzScrollBar.x=this._scrollBarMargin.left):(this._hzScrollBar.width=t-this._scrollBarMargin.left-this._scrollBarMargin.right,this._hzScrollBar.x=this._scrollBarMargin.left)),this._vtScrollBar&&(this._displayOnLeft||(this._vtScrollBar.x=t-this._vtScrollBar.width),this._hzScrollBar?this._vtScrollBar.height=e-this._hzScrollBar.height-this._scrollBarMargin.top-this._scrollBarMargin.bottom:this._vtScrollBar.height=e-this._scrollBarMargin.top-this._scrollBarMargin.bottom,this._vtScrollBar.y=this._scrollBarMargin.top),this._viewSize.x=t,this._viewSize.y=e,this._hzScrollBar&&!this._floating&&(this._viewSize.y-=this._hzScrollBar.height),this._vtScrollBar&&!this._floating&&(this._viewSize.x-=this._vtScrollBar.width),this._viewSize.x-=this._owner.margin.left+this._owner.margin.right,this._viewSize.y-=this._owner.margin.top+this._owner.margin.bottom,this._viewSize.x=Math.max(1,this._viewSize.x),this._viewSize.y=Math.max(1,this._viewSize.y),this._pageSize.x=this._viewSize.x,this._pageSize.y=this._viewSize.y,this.handleSizeChanged()}setContentSize(t,e){this._contentSize.x==t&&this._contentSize.y==e||(this._contentSize.x=t,this._contentSize.y=e,this.handleSizeChanged())}changeContentSizeOnScrolling(t,e,i,s){var h=this._xPos==this._overlapSize.x,r=this._yPos==this._overlapSize.y;this._contentSize.x+=t,this._contentSize.y+=e,this.handleSizeChanged(),1==this._tweening?(0!=t&&h&&this._tweenChange.x<0&&(this._xPos=this._overlapSize.x,this._tweenChange.x=-this._xPos-this._tweenStart.x),0!=e&&r&&this._tweenChange.y<0&&(this._yPos=this._overlapSize.y,this._tweenChange.y=-this._yPos-this._tweenStart.y)):2==this._tweening?(0!=i&&(this._container.x-=i,this._tweenStart.x-=i,this._xPos=-this._container.x),0!=s&&(this._container.y-=s,this._tweenStart.y-=s,this._yPos=-this._container.y)):this._dragged?(0!=i&&(this._container.x-=i,this._containerPos.x-=i,this._xPos=-this._container.x),0!=s&&(this._container.y-=s,this._containerPos.y-=s,this._yPos=-this._container.y)):(0!=t&&h&&(this._xPos=this._overlapSize.x,this._container.x=-this._xPos),0!=e&&r&&(this._yPos=this._overlapSize.y,this._container.y=-this._yPos)),this._pageMode&&this.updatePageController()}handleSizeChanged(){if(this._displayInDemand&&(this._vScrollNone=this._contentSize.y<=this._viewSize.y,this._hScrollNone=this._contentSize.x<=this._viewSize.x),this._vtScrollBar&&(0==this._contentSize.y?this._vtScrollBar.setDisplayPerc(0):this._vtScrollBar.setDisplayPerc(Math.min(1,this._viewSize.y/this._contentSize.y))),this._hzScrollBar&&(0==this._contentSize.x?this._hzScrollBar.setDisplayPerc(0):this._hzScrollBar.setDisplayPerc(Math.min(1,this._viewSize.x/this._contentSize.x))),this.updateScrollBarVisible(),this._scrollType==t.ScrollType.Horizontal||this._scrollType==t.ScrollType.Both?this._overlapSize.x=Math.ceil(Math.max(0,this._contentSize.x-this._viewSize.x)):this._overlapSize.x=0,this._scrollType==t.ScrollType.Vertical||this._scrollType==t.ScrollType.Both?this._overlapSize.y=Math.ceil(Math.max(0,this._contentSize.y-this._viewSize.y)):this._overlapSize.y=0,this._xPos=Rt(this._xPos,0,this._overlapSize.x),this._yPos=Rt(this._yPos,0,this._overlapSize.y),this._refreshBarAxis){var e=this._overlapSize[this._refreshBarAxis];0==e?e=Math.max(this._contentSize[this._refreshBarAxis]+this._footerLockedSize-this._viewSize[this._refreshBarAxis],0):e+=this._footerLockedSize,"x"==this._refreshBarAxis?this._container.setPosition(Rt(this._container.x,-e,this._headerLockedSize),Rt(this._container.y,-this._overlapSize.y,0)):this._container.setPosition(Rt(this._container.x,-this._overlapSize.x,0),Rt(this._container.y,-e,this._headerLockedSize)),this._header&&("x"==this._refreshBarAxis?this._header.height=this._viewSize.y:this._header.width=this._viewSize.x),this._footer&&("y"==this._refreshBarAxis?this._footer.height=this._viewSize.y:this._footer.width=this._viewSize.x)}else this._container.setPosition(Rt(this._container.x,-this._overlapSize.x,0),Rt(this._container.y,-this._overlapSize.y,0));this.updateScrollBarPos(),this._pageMode&&this.updatePageController()}posChanged(t){0==this._aniFlag?this._aniFlag=t?1:-1:1!=this._aniFlag||t||(this._aniFlag=-1),this._needRefresh=!0,z.callLater(this.refresh,this)}refresh(){null!=this._owner.displayObject&&(this._needRefresh=!1,z.remove(this.refresh,this),(this._pageMode||this._snapToItem)&&(be.set(-this._xPos,-this._yPos),this.alignPosition(be,!1),this._xPos=-be.x,this._yPos=-be.y),this.refresh2(),this._owner.dispatchEvent("scroll"),this._needRefresh&&(this._needRefresh=!1,z.remove(this.refresh,this),this.refresh2()),this.updateScrollBarPos(),this._aniFlag=0)}refresh2(){var t,e;1!=this._aniFlag||this._dragged?(0!=this._tweening&&this.killTween(),this._container.setPosition(Math.floor(-this._xPos),Math.floor(-this._yPos)),this.loopCheckingCurrent()):(this._overlapSize.x>0?t=-Math.floor(this._xPos):(0!=this._container.x&&(this._container.x=0),t=0),this._overlapSize.y>0?e=-Math.floor(this._yPos):(0!=this._container.y&&(this._container.y=0),e=0),t!=this._container.x||e!=this._container.y?(this._tweenDuration.set(.5,.5),this._tweenStart.set(this._container.x,this._container.y),this._tweenChange.set(t-this._tweenStart.x,e-this._tweenStart.y),this.startTween(1)):0!=this._tweening&&this.killTween());this._pageMode&&this.updatePageController()}__touchBegin(t){if(this._touchEffect&&0==t.input.button){t.captureTouch(),0!=this._tweening?(this.killTween(),R.cancelClick(t.input.touchId),this._dragged=!0):this._dragged=!1;var e=this._owner.globalToLocal(t.input.x,t.input.y,ve);this._containerPos.set(this._container.x,this._container.y),this._beginTouchPos.set(e.x,e.y),this._lastTouchPos.set(e.x,e.y),this._lastTouchGlobalPos.set(t.input.x,t.input.y),this._isHoldAreaDone=!1,this._velocity.set(0,0),this._velocityScale=1,this._lastMoveTime=performance.now()/1e3}}__touchMove(e){if(this._touchEffect&&!this.owner.isDisposed&&!(Ie.draggingPane&&Ie.draggingPane!=this||Ct.draggingObject)){var i,s,h,r=bt.touchScrollSensitivity,a=this._owner.globalToLocal(e.input.x,e.input.y);if(this._scrollType==t.ScrollType.Vertical){if(!this._isHoldAreaDone){if(Se|=1,(i=Math.abs(this._beginTouchPos.y-a.y))<r)return;if(0!=(2&Se)){if(i<Math.abs(this._beginTouchPos.x-a.x))return}}s=!0}else if(this._scrollType==t.ScrollType.Horizontal){if(!this._isHoldAreaDone){if(Se|=2,(i=Math.abs(this._beginTouchPos.x-a.x))<r)return;if(0!=(1&Se)){if(i<Math.abs(this._beginTouchPos.y-a.y))return}}h=!0}else{if(Se=3,!this._isHoldAreaDone&&(i=Math.abs(this._beginTouchPos.y-a.y))<r&&(i=Math.abs(this._beginTouchPos.x-a.x))<r)return;s=h=!0}var n=Math.floor(this._containerPos.x+a.x-this._beginTouchPos.x),o=Math.floor(this._containerPos.y+a.y-this._beginTouchPos.y);s&&(o>0?this._bouncebackEffect?this._header&&0!=this._header.maxHeight?this._container.y=Math.floor(Math.min(.5*o,this._header.maxHeight)):this._container.y=Math.floor(Math.min(.5*o,.5*this._viewSize.y)):this._container.y=0:o<-this._overlapSize.y?this._bouncebackEffect?this._footer&&this._footer.maxHeight>0?this._container.y=Math.floor(Math.max(.5*(o+this._overlapSize.y),-this._footer.maxHeight)-this._overlapSize.y):this._container.y=Math.floor(Math.max(.5*(o+this._overlapSize.y),.5*-this._viewSize.y)-this._overlapSize.y):this._container.y=-this._overlapSize.y:this._container.y=o),h&&(n>0?this._bouncebackEffect?this._header&&0!=this._header.maxWidth?this._container.x=Math.floor(Math.min(.5*n,this._header.maxWidth)):this._container.x=Math.floor(Math.min(.5*n,.5*this._viewSize.x)):this._container.x=0:n<0-this._overlapSize.x?this._bouncebackEffect?this._footer&&this._footer.maxWidth>0?this._container.x=Math.floor(Math.max(.5*(n+this._overlapSize.x),-this._footer.maxWidth)-this._overlapSize.x):this._container.x=Math.floor(Math.max(.5*(n+this._overlapSize.x),.5*-this._viewSize.x)-this._overlapSize.x):this._container.x=-this._overlapSize.x:this._container.x=n);var l=performance.now()/1e3,_=Math.max(l-this._lastMoveTime,1/60),d=a.x-this._lastTouchPos.x,c=a.y-this._lastTouchPos.y;if(h||(d=0),s||(c=0),0!=_){var u=60*_-1;if(u>1){var p=Math.pow(.833,u);this._velocity.x=this._velocity.x*p,this._velocity.y=this._velocity.y*p}this._velocity.x=Et(this._velocity.x,60*d/60/_,10*_),this._velocity.y=Et(this._velocity.y,60*c/60/_,10*_)}var g=this._lastTouchGlobalPos.x-e.input.x,f=this._lastTouchGlobalPos.y-e.input.y;0!=d?this._velocityScale=Math.abs(g/d):0!=c&&(this._velocityScale=Math.abs(f/c)),this._lastTouchPos.set(a.x,a.y),this._lastTouchGlobalPos.set(e.input.x,e.input.y),this._lastMoveTime=l,this._overlapSize.x>0&&(this._xPos=Rt(-this._container.x,0,this._overlapSize.x)),this._overlapSize.y>0&&(this._yPos=Rt(-this._container.y,0,this._overlapSize.y)),0!=this._loop&&(n=this._container.x,o=this._container.y,this.loopCheckingCurrent()&&(this._containerPos.x+=this._container.x-n,this._containerPos.y+=this._container.y-o)),Ie.draggingPane=this,this._isHoldAreaDone=!0,this._dragged=!0,this.updateScrollBarPos(),this.updateScrollBarVisible(),this._pageMode&&this.updatePageController(),this._owner.dispatchEvent("scroll")}}__touchEnd(){if(Ie.draggingPane==this&&(Ie.draggingPane=null),Se=0,this._dragged&&this._touchEffect){this._dragged=!1,this._tweenStart.set(this._container.x,this._container.y),be.set(this._tweenStart.x,this._tweenStart.y);var t=!1;if(this._container.x>0?(be.x=0,t=!0):this._container.x<-this._overlapSize.x&&(be.x=-this._overlapSize.x,t=!0),this._container.y>0?(be.y=0,t=!0):this._container.y<-this._overlapSize.y&&(be.y=-this._overlapSize.y,t=!0),t){if(this._tweenChange.set(be.x-this._tweenStart.x,be.y-this._tweenStart.y),this._tweenChange.x<-bt.touchDragSensitivity||this._tweenChange.y<-bt.touchDragSensitivity?(this._refreshEventDispatching=!0,this._owner.dispatchEvent("pull_down_release"),this._refreshEventDispatching=!1):(this._tweenChange.x>bt.touchDragSensitivity||this._tweenChange.y>bt.touchDragSensitivity)&&(this._refreshEventDispatching=!0,this._owner.dispatchEvent("pull_up_release"),this._refreshEventDispatching=!1),this._headerLockedSize>0&&0==be[this._refreshBarAxis])be[this._refreshBarAxis]=this._headerLockedSize,this._tweenChange.x=be.x-this._tweenStart.x,this._tweenChange.y=be.y-this._tweenStart.y;else if(this._footerLockedSize>0&&be[this._refreshBarAxis]==-this._overlapSize[this._refreshBarAxis]){var e=this._overlapSize[this._refreshBarAxis];0==e?e=Math.max(this._contentSize[this._refreshBarAxis]+this._footerLockedSize-this._viewSize[this._refreshBarAxis],0):e+=this._footerLockedSize,be[this._refreshBarAxis]=-e,this._tweenChange.x=be.x-this._tweenStart.x,this._tweenChange.y=be.y-this._tweenStart.y}this._tweenDuration.set(.3,.3)}else{if(this._inertiaDisabled)this._tweenDuration.set(.3,.3);else{var i=60*(performance.now()/1e3-this._lastMoveTime)-1;if(i>1){var s=Math.pow(.833,i);this._velocity.x=this._velocity.x*s,this._velocity.y=this._velocity.y*s}this.updateTargetAndDuration(this._tweenStart,be)}if(Ce.set(be.x-this._tweenStart.x,be.y-this._tweenStart.y),this.loopCheckingTarget(be),(this._pageMode||this._snapToItem)&&this.alignPosition(be,!0),this._tweenChange.x=be.x-this._tweenStart.x,this._tweenChange.y=be.y-this._tweenStart.y,0==this._tweenChange.x&&0==this._tweenChange.y)return void this.updateScrollBarVisible();(this._pageMode||this._snapToItem)&&(this.fixDuration("x",Ce.x),this.fixDuration("y",Ce.y))}this.startTween(2)}else this._dragged=!1}__mouseWheel(t){if(this._mouseWheelEnabled){var e=t.input.mouseWheelDelta/window.devicePixelRatio;if(this._snapToItem&&Math.abs(e)<1&&(e=Math.sign(e)),this._overlapSize.x>0&&0==this._overlapSize.y){let t=this._pageMode?this._pageSize.x:this._scrollStep;this.setPosX(this._xPos+t*e,!1)}else{let t=this._pageMode?this._pageSize.y:this._scrollStep;this.setPosY(this._yPos+t*e,!1)}}}updateScrollBarPos(){this._vtScrollBar&&this._vtScrollBar.setScrollPerc(0==this._overlapSize.y?0:Rt(-this._container.y,0,this._overlapSize.y)/this._overlapSize.y),this._hzScrollBar&&this._hzScrollBar.setScrollPerc(0==this._overlapSize.x?0:Rt(-this._container.x,0,this._overlapSize.x)/this._overlapSize.x),this.checkRefreshBar()}updateScrollBarVisible(){this._vtScrollBar&&(this._viewSize.y<=this._vtScrollBar.minSize||this._vScrollNone?this._vtScrollBar.displayObject.visible=!1:this.updateScrollBarVisible2(this._vtScrollBar)),this._hzScrollBar&&(this._viewSize.x<=this._hzScrollBar.minSize||this._hScrollNone?this._hzScrollBar.displayObject.visible=!1:this.updateScrollBarVisible2(this._hzScrollBar))}updateScrollBarVisible2(t){this._scrollBarDisplayAuto&&mt.kill(t,!1,"alpha"),!this._scrollBarDisplayAuto||0!=this._tweening||this._dragged||t.gripDragging?(t.alpha=1,t.displayObject.visible=!0):t.displayObject.visible&&mt.to(1,0,.5).setDelay(.5).onComplete(this.__barTweenComplete,this).setTarget(t,"alpha")}__barTweenComplete(t){var e=t.target;e.alpha=1,e.displayObject.visible=!1}getLoopPartSize(t,e){return(this._contentSize[e]+("x"==e?this._owner.columnGap:this._owner.lineGap))/t}loopCheckingCurrent(){var t=!1;return 1==this._loop&&this._overlapSize.x>0?this._xPos<.001?(this._xPos+=this.getLoopPartSize(2,"x"),t=!0):this._xPos>=this._overlapSize.x&&(this._xPos-=this.getLoopPartSize(2,"x"),t=!0):2==this._loop&&this._overlapSize.y>0&&(this._yPos<.001?(this._yPos+=this.getLoopPartSize(2,"y"),t=!0):this._yPos>=this._overlapSize.y&&(this._yPos-=this.getLoopPartSize(2,"y"),t=!0)),t&&this._container.setPosition(Math.floor(-this._xPos),Math.floor(-this._yPos)),t}loopCheckingTarget(t){1==this._loop&&this.loopCheckingTarget2(t,"x"),2==this._loop&&this.loopCheckingTarget2(t,"y")}loopCheckingTarget2(t,e){var i,s;t[e]>0?(i=this.getLoopPartSize(2,e),(s=this._tweenStart[e]-i)<=0&&s>=-this._overlapSize[e]&&(t[e]-=i,this._tweenStart[e]=s)):t[e]<-this._overlapSize[e]&&(i=this.getLoopPartSize(2,e),(s=this._tweenStart[e]+i)<=0&&s>=-this._overlapSize[e]&&(t[e]+=i,this._tweenStart[e]=s))}loopCheckingNewPos(t,e){if(0==this._overlapSize[e])return t;var i,s="x"==e?this._xPos:this._yPos,h=!1;return t<.001?(t+=this.getLoopPartSize(2,e))>s&&(i=this.getLoopPartSize(6,e),s=Rt(s+(i=Math.ceil((t-s)/i)*i),0,this._overlapSize[e]),h=!0):t>=this._overlapSize[e]&&(t-=this.getLoopPartSize(2,e))<s&&(i=this.getLoopPartSize(6,e),s=Rt(s-(i=Math.ceil((s-t)/i)*i),0,this._overlapSize[e]),h=!0),h&&("x"==e?this._container.x=-Math.floor(s):this._container.y=-Math.floor(s)),t}alignPosition(t,e){if(this._pageMode)t.x=this.alignByPage(t.x,"x",e),t.y=this.alignByPage(t.y,"y",e);else if(this._snapToItem){var i=0,s=0;e&&(i=t.x-this._containerPos.x,s=t.y-this._containerPos.y);var h=this._owner.getSnappingPositionWithDir(-t.x,-t.y,i,s,ve);t.x<0&&t.x>-this._overlapSize.x&&(t.x=-h.x),t.y<0&&t.y>-this._overlapSize.y&&(t.y=-h.y)}}alignByPage(t,e,i){var s;if(t>0)s=0;else if(t<-this._overlapSize[e])s=Math.ceil(this._contentSize[e]/this._pageSize[e])-1;else{s=Math.floor(-t/this._pageSize[e]);var h=i?t-this._containerPos[e]:t-this._container[e],r=Math.min(this._pageSize[e],this._contentSize[e]-(s+1)*this._pageSize[e]),a=-t-s*this._pageSize[e];Math.abs(h)>this._pageSize[e]?a>.5*r&&s++:a>r*(h<0?bt.defaultScrollPagingThreshold:1-bt.defaultScrollPagingThreshold)&&s++,(t=-s*this._pageSize[e])<-this._overlapSize[e]&&(t=-this._overlapSize[e])}if(i){var n,o=this._tweenStart[e];n=o>0?0:o<-this._overlapSize[e]?Math.ceil(this._contentSize[e]/this._pageSize[e])-1:Math.floor(-o/this._pageSize[e]);var l=Math.floor(-this._containerPos[e]/this._pageSize[e]);Math.abs(s-l)>1&&Math.abs(n-l)<=1&&(t=-(s=s>l?l+1:l-1)*this._pageSize[e])}return t}updateTargetAndDuration(t,e){e.x=this.updateTargetAndDuration2(t.x,"x"),e.y=this.updateTargetAndDuration2(t.y,"y")}updateTargetAndDuration2(t,e){var i=this._velocity[e],s=0;if(t>0)t=0;else if(t<-this._overlapSize[e])t=-this._overlapSize[e];else{var h=Math.abs(i)*this._velocityScale;R.touchScreen&&(h*=1136/Math.max(window.screen.width,window.screen.height));var r=0;if(this._pageMode||!R.touchScreen?h>500&&(r=Math.pow((h-500)/500,2)):h>1e3&&(r=Math.pow((h-1e3)/1e3,2)),0!=r)r>1&&(r=1),h*=r,i*=r,this._velocity[e]=i,s=Math.log(60/h)/Math.log(this._decelerationRate)/60,t+=Math.floor(i*s*.4)}return s<.3&&(s=.3),this._tweenDuration[e]=s,t}fixDuration(t,e){if(!(0==this._tweenChange[t]||Math.abs(this._tweenChange[t])>=Math.abs(e))){var i=Math.abs(this._tweenChange[t]/e)*this._tweenDuration[t];i<.3&&(i=.3),this._tweenDuration[t]=i}}startTween(t){this._tweenTime.set(0,0),this._tweening=t,z.addUpdate(this.tweenUpdate,this),this.updateScrollBarVisible()}killTween(){1==this._tweening&&(this._container.setPosition(this._tweenStart.x+this._tweenChange.x,this._tweenStart.y+this._tweenChange.y),this._owner.dispatchEvent("scroll")),this._tweening=0,z.remove(this.tweenUpdate,this),this.updateScrollBarVisible(),this._owner.dispatchEvent("scroll_end")}checkRefreshBar(){if(null!=this._header||null!=this._footer){var t=this._container[this._refreshBarAxis];if(this._header)if(t>0){null==this._header.displayObject.parent&&this._maskContainer.addChildAt(this._header.displayObject,0);var e=ve;e.set(this._header.width,this._header.height),e[this._refreshBarAxis]=t,this._header.setSize(e.x,e.y)}else this._header.displayObject.parent&&this._maskContainer.removeChild(this._header.displayObject);if(this._footer){var i=this._overlapSize[this._refreshBarAxis];t<-i||0==i&&this._footerLockedSize>0?(null==this._footer.displayObject.parent&&this._maskContainer.addChildAt(this._footer.displayObject,0),(e=ve).set(this._footer.x,this._footer.y),e[this._refreshBarAxis]=i>0?t+this._contentSize[this._refreshBarAxis]:Math.max(Math.min(t+this._viewSize[this._refreshBarAxis],this._viewSize[this._refreshBarAxis]-this._footerLockedSize),this._viewSize[this._refreshBarAxis]-this._contentSize[this._refreshBarAxis]),this._footer.setPosition(e.x,e.y),e.set(this._footer.width,this._footer.height),e[this._refreshBarAxis]=i>0?-i-t:this._viewSize[this._refreshBarAxis]-this._footer[this._refreshBarAxis],this._footer.setSize(e.x,e.y)):this._footer.displayObject.parent&&this._maskContainer.removeChild(this._footer.displayObject)}}}tweenUpdate(){var t=this.runTween("x"),e=this.runTween("y");this._container.setPosition(t,e),2==this._tweening&&(this._overlapSize.x>0&&(this._xPos=Rt(-t,0,this._overlapSize.x)),this._overlapSize.y>0&&(this._yPos=Rt(-e,0,this._overlapSize.y)),this._pageMode&&this.updatePageController()),0==this._tweenChange.x&&0==this._tweenChange.y?(this._tweening=0,z.remove(this.tweenUpdate,this),this.loopCheckingCurrent(),this.updateScrollBarPos(),this.updateScrollBarVisible(),this._owner.dispatchEvent("scroll"),this._owner.dispatchEvent("scroll_end")):(this.updateScrollBarPos(),this._owner.dispatchEvent("scroll"))}runTween(t){var e,i,s;if(0!=this._tweenChange[t]){if(this._tweenTime[t]+=z.deltaTime/1e3,this._tweenTime[t]>=this._tweenDuration[t])e=this._tweenStart[t]+this._tweenChange[t],this._tweenChange[t]=0;else{var h=(i=this._tweenTime[t],s=this._tweenDuration[t],(i=i/s-1)*i*i+1);e=this._tweenStart[t]+Math.floor(this._tweenChange[t]*h)}var r=0,a=-this._overlapSize[t];if(this._headerLockedSize>0&&this._refreshBarAxis==t&&(r=this._headerLockedSize),this._footerLockedSize>0&&this._refreshBarAxis==t){var n=this._overlapSize[this._refreshBarAxis];0==n?n=Math.max(this._contentSize[this._refreshBarAxis]+this._footerLockedSize-this._viewSize[this._refreshBarAxis],0):n+=this._footerLockedSize,a=-n}2==this._tweening&&this._bouncebackEffect?e>20+r&&this._tweenChange[t]>0||e>r&&0==this._tweenChange[t]?(this._tweenTime[t]=0,this._tweenDuration[t]=.3,this._tweenChange[t]=-e+r,this._tweenStart[t]=e):(e<a-20&&this._tweenChange[t]<0||e<a&&0==this._tweenChange[t])&&(this._tweenTime[t]=0,this._tweenDuration[t]=.3,this._tweenChange[t]=a-e,this._tweenStart[t]=e):e>r?(e=r,this._tweenChange[t]=0):e<a&&(e=a,this._tweenChange[t]=0)}else e=this._container[t];return e}}var Te;!function(t){t[t.CRSpline=0]="CRSpline",t[t.Bezier=1]="Bezier",t[t.CubicBezier=2]="CubicBezier",t[t.Straight=3]="Straight"}(Te||(Te={}));class Pe{constructor(){this.x=0,this.y=0,this.control1_x=0,this.control1_y=0,this.control2_x=0,this.control2_y=0,this.curveType=0}static newPoint(t,e,i){var s=new Pe;return s.x=t||0,s.y=e||0,s.control1_x=0,s.control1_y=0,s.control2_x=0,s.control2_y=0,s.curveType=i||Te.CRSpline,s}static newBezierPoint(t,e,i,s){var h=new Pe;return h.x=t||0,h.y=e||0,h.control1_x=i||0,h.control1_y=s||0,h.control2_x=0,h.control2_y=0,h.curveType=Te.Bezier,h}static newCubicBezierPoint(t,e,i,s,h,r){var a=new Pe;return a.x=t||0,a.y=e||0,a.control1_x=i||0,a.control1_y=s||0,a.control2_x=h||0,a.control2_y=r||0,a.curveType=Te.CubicBezier,a}clone(){var t=new Pe;return t.x=this.x,t.y=this.y,t.control1_x=this.control1_x,t.control1_y=this.control1_y,t.control2_x=this.control2_x,t.control2_y=this.control2_y,t.curveType=this.curveType,t}}class ke{constructor(){this._segments=new Array,this._points=new Array}get length(){return this._fullLength}create2(t,e,i,s){var h=new Array;h.push(t),h.push(e),i&&h.push(i),s&&h.push(s),this.create(h)}create(t){this._segments.length=0,this._points.length=0,this._fullLength=0;var e=t.length;if(0!=e){var i=[],s=t[0];s.curveType==Te.CRSpline&&i.push(new T(s.x,s.y));for(var h=1;h<e;h++){var r=t[h];if(s.curveType!=Te.CRSpline){var a={};a.type=s.curveType,a.ptStart=this._points.length,s.curveType==Te.Straight?(a.ptCount=2,this._points.push(new T(s.x,s.y)),this._points.push(new T(r.x,r.y))):s.curveType==Te.Bezier?(a.ptCount=3,this._points.push(new T(s.x,s.y)),this._points.push(new T(r.x,r.y)),this._points.push(new T(s.control1_x,s.control1_y))):s.curveType==Te.CubicBezier&&(a.ptCount=4,this._points.push(new T(s.x,s.y)),this._points.push(new T(r.x,r.y)),this._points.push(new T(s.control1_x,s.control1_y)),this._points.push(new T(s.control2_x,s.control2_y))),a.length=Vt(s.x,s.y,r.x,r.y),this._fullLength+=a.length,this._segments.push(a)}r.curveType!=Te.CRSpline?i.length>0&&(i.push(new T(r.x,r.y)),this.createSplineSegment(i)):i.push(new T(r.x,r.y)),s=r}i.length>1&&this.createSplineSegment(i)}}createSplineSegment(t){var e=t.length;t.splice(0,0,t[0]),t.push(t[e]),t.push(t[e]),e+=3;var i={};i.type=Te.CRSpline,i.ptStart=this._points.length,i.ptCount=e,this._points=this._points.concat(t),i.length=0;for(var s=1;s<e;s++)i.length+=Vt(t[s-1].x,t[s-1].y,t[s].x,t[s].y);this._fullLength+=i.length,this._segments.push(i),t.length=0}clear(){this._segments.length=0,this._points.length=0}getPointAt(t,e){e?e.set(0,0):e=new T,t=Dt(t);var i,s=this._segments.length;if(0==s)return e;if(1==t)return(i=this._segments[s-1]).type==Te.Straight?(e.x=Et(this._points[i.ptStart].x,this._points[i.ptStart+1].x,t),e.y=Et(this._points[i.ptStart].y,this._points[i.ptStart+1].y,t),e):i.type==Te.Bezier||i.type==Te.CubicBezier?this.onBezierCurve(i.ptStart,i.ptCount,t,e):this.onCRSplineCurve(i.ptStart,i.ptCount,t,e);for(var h=t*this._fullLength,r=0;r<s;r++)if((h-=(i=this._segments[r]).length)<0){t=1+h/i.length,i.type==Te.Straight?(e.x=Et(this._points[i.ptStart].x,this._points[i.ptStart+1].x,t),e.y=Et(this._points[i.ptStart].y,this._points[i.ptStart+1].y,t)):e=i.type==Te.Bezier||i.type==Te.CubicBezier?this.onBezierCurve(i.ptStart,i.ptCount,t,e):this.onCRSplineCurve(i.ptStart,i.ptCount,t,e);break}return e}get segmentCount(){return this._segments.length}getAnchorsInSegment(t,e){null==e&&(e=new Array);for(var i=this._segments[t],s=0;s<i.ptCount;s++)e.push(new T(this._points[i.ptStart+s].x,this._points[i.ptStart+s].y));return e}getPointsInSegment(t,e,i,s,h,r){null==s&&(s=new Array),r&&!isNaN(r)||(r=.1),h&&h.push(e);var a=this._segments[t];if(a.type==Te.Straight)s.push(new T(Et(this._points[a.ptStart].x,this._points[a.ptStart+1].x,e),Et(this._points[a.ptStart].y,this._points[a.ptStart+1].y,e))),s.push(new T(Et(this._points[a.ptStart].x,this._points[a.ptStart+1].x,i),Et(this._points[a.ptStart].y,this._points[a.ptStart+1].y,i)));else{var n;n=a.type==Te.Bezier||a.type==Te.CubicBezier?this.onBezierCurve:this.onCRSplineCurve,s.push(n.call(this,a.ptStart,a.ptCount,e,new T));for(var o=Math.min(a.length*r,50),l=0;l<=o;l++){var _=l/o;_>e&&_<i&&(s.push(n.call(this,a.ptStart,a.ptCount,_,new T)),h&&h.push(_))}s.push(n.call(this,a.ptStart,a.ptCount,i,new T))}return h&&h.push(i),s}getAllPoints(t,e,i){null==t&&(t=new Array),i&&!isNaN(i)||(i=.1);for(var s=this._segments.length,h=0;h<s;h++)this.getPointsInSegment(h,0,1,t,e,i);return t}onCRSplineCurve(t,e,i,s){var h=Math.floor(i*(e-4))+t,r=this._points[h].x,a=this._points[h].y,n=this._points[h+1].x,o=this._points[h+1].y,l=this._points[h+2].x,_=this._points[h+2].y,d=this._points[h+3].x,c=this._points[h+3].y,u=1==i?1:function(t,e){return t-Math.floor(t/e)*e}(i*(e-4),1),p=((2-u)*u-1)*u*.5,g=.5*((3*u-5)*u*u+2),f=((-3*u+4)*u+1)*u*.5,m=(u-1)*u*u*.5;return s.x=r*p+n*g+l*f+d*m,s.y=a*p+o*g+_*f+c*m,s}onBezierCurve(t,e,i,s){var h=1-i,r=this._points[t].x,a=this._points[t].y,n=this._points[t+1].x,o=this._points[t+1].y,l=this._points[t+2].x,_=this._points[t+2].y;if(4==e){var d=this._points[t+3].x,c=this._points[t+3].y;s.x=h*h*h*r+3*h*h*i*l+3*h*i*i*d+i*i*i*n,s.y=h*h*h*a+3*h*h*i*_+3*h*i*i*c+i*i*i*o}else s.x=h*h*r+2*h*i*l+i*i*n,s.y=h*h*a+2*h*i*_+i*i*o;return s}}class Oe{constructor(t){this._owner=t,this._items=new Array,this._totalDuration=0,this._autoPlayTimes=1,this._autoPlayDelay=0,this._timeScale=1,this._startTime=0,this._endTime=0}play(t,e,i,s,h){this._play(t,e,i,s,h,!1)}playReverse(t,e,i,s,h){this._play(t,e,i,s,h,!0)}changePlayTimes(t){this._totalTimes=t}setAutoPlay(t,e,i){this._autoPlay!=t&&(this._autoPlay=t,this._autoPlayTimes=e||1,this._autoPlayDelay=i||0,this._autoPlay?this._owner.onStage&&this.play(null,null,this._autoPlayTimes,this._autoPlayDelay):this._owner.onStage||this.stop(!1,!0))}_play(t,e,i,s,h,r){this.stop(!0,!0),i=i||0,this._totalTimes=e||1,this._reversed=r,this._startTime=s||0,this._endTime=h||-1,this._playing=!0,this._paused=!1,this._onComplete=t;for(var a=this._items.length,n=0;n<a;n++){var o=this._items[n];if(null==o.target?o.targetId?o.target=this._owner.getChildById(o.targetId):o.target=this._owner:o.target!=this._owner&&o.target.parent!=this._owner&&(o.target=null),o.target&&o.type==ze.Transition){var l=o.target.getTransition(o.value.transName);if(l==this&&(l=null),l)if(0==o.value.playTimes){var _;for(_=n-1;_>=0;_--){var d=this._items[_];if(d.type==ze.Transition&&d.value.trans==l){d.value.stopTime=o.time-d.time;break}}_<0?o.value.stopTime=0:l=null}else o.value.stopTime=-1;o.value.trans=l}}0==i?this.onDelayedPlay():mt.delayedCall(i).setTarget(this).onComplete(this.onDelayedPlay,this)}stop(t,e){if(this._playing){null==t&&(t=!0),this._playing=!1,this._totalTasks=0,this._totalTimes=0;var i=this._onComplete;this._onComplete=null,mt.kill(this);var s=this._items.length;if(this._reversed)for(var h=s-1;h>=0;h--){var r=this._items[h];null!=r.target&&this.stopItem(r,t)}else for(h=0;h<s;h++)null!=(r=this._items[h]).target&&this.stopItem(r,t);e&&i&&i()}}stopItem(t,e){if(0!=t.displayLockToken&&(t.target.releaseDisplayLock(t.displayLockToken),t.displayLockToken=0),t.tweener&&(t.tweener.kill(e),t.tweener=null,t.type!=ze.Shake||e||(t.target._gearLocked=!0,t.target.setPosition(t.target.x-t.value.lastOffsetX,t.target.y-t.value.lastOffsetY),t.target._gearLocked=!1)),t.type==ze.Transition){var i=t.value.trans;i&&i.stop(e,!1)}}setPaused(e){if(this._playing&&this._paused!=e){this._paused=e;var i=mt.getTween(this);i&&i.setPaused(e);for(var s=this._items.length,h=0;h<s;h++){var r=this._items[h];null!=r.target&&(r.type==ze.Transition?r.value.trans&&r.value.trans.setPaused(e):r.type==ze.Animation&&(e?(r.value.flag=r.target.getProp(t.ObjectPropID.Playing),r.target.setProp(t.ObjectPropID.Playing,!1)):r.target.setProp(t.ObjectPropID.Playing,r.value.flag)),r.tweener&&r.tweener.setPaused(e))}}}dispose(){this._playing&&mt.kill(this);for(var t=this._items.length,e=0;e<t;e++){var i=this._items[e];i.tweener&&(i.tweener.kill(),i.tweener=null),i.target=null,i.hook=null,i.tweenConfig&&(i.tweenConfig.endHook=null)}this._items.length=0,this._playing=!1,this._onComplete=null}get playing(){return this._playing}setValue(t,...e){for(var i,s=this._items.length,h=!1,r=0;r<s;r++){var a=this._items[r];if(a.label==t)i=a.tweenConfig?a.tweenConfig.startValue:a.value,h=!0;else{if(!a.tweenConfig||a.tweenConfig.endLabel!=t)continue;i=a.tweenConfig.endValue,h=!0}switch(a.type){case ze.XY:case ze.Size:case ze.Pivot:case ze.Scale:case ze.Skew:i.b1=!0,i.b2=!0,i.f1=parseFloat(e[0]),i.f2=parseFloat(e[1]);break;case ze.Alpha:case ze.Rotation:case ze.Color:i.f1=parseFloat(e[0]);break;case ze.Animation:i.frame=parseInt(e[0]),e.length>1&&(i.playing=e[1]);break;case ze.Visible:i.visible=e[0];break;case ze.Sound:i.sound=e[0],e.length>1&&(i.volume=parseFloat(e[1]));break;case ze.Transition:i.transName=e[0],e.length>1&&(i.playTimes=parseInt(e[1]));break;case ze.Shake:i.amplitude=parseFloat(e[0]),e.length>1&&(i.duration=parseFloat(e[1]));break;case ze.ColorFilter:i.f1=parseFloat(e[0]),i.f2=parseFloat(e[1]),i.f3=parseFloat(e[2]),i.f4=parseFloat(e[3]);break;case ze.Text:case ze.Icon:i.text=e[0]}}if(!h)throw new Error("this.label not exists")}setHook(t,e){for(var i=this._items.length,s=!1,h=0;h<i;h++){var r=this._items[h];if(r.label==t){r.hook=e,s=!0;break}if(r.tweenConfig&&r.tweenConfig.endLabel==t){r.tweenConfig.endHook=e,s=!0;break}}if(!s)throw new Error("this.label not exists")}clearHooks(){for(var t=this._items.length,e=0;e<t;e++){var i=this._items[e];i.hook=null,i.tweenConfig&&(i.tweenConfig.endHook=null)}}setTarget(t,e){for(var i=this._items.length,s=!1,h=0;h<i;h++){var r=this._items[h];r.label==t&&(r.targetId=e==this._owner||null==e?"":e.id,this._playing?r.targetId.length>0?r.target=this._owner.getChildById(r.targetId):r.target=this._owner:r.target=null,s=!0)}if(!s)throw new Error("this.label not exists")}setDuration(t,e){for(var i=this._items.length,s=!1,h=0;h<i;h++){var r=this._items[h];r.tweenConfig&&r.label==t&&(r.tweenConfig.duration=e,s=!0)}if(!s)throw new Error("this.label not exists")}getLabelTime(t){for(var e=this._items.length,i=0;i<e;i++){var s=this._items[i];if(s.label==t)return s.time;if(s.tweenConfig&&s.tweenConfig.endLabel==t)return s.time+s.tweenConfig.duration}return NaN}get timeScale(){return this._timeScale}set timeScale(e){if(this._timeScale!=e&&(this._timeScale=e,this._playing))for(var i=this._items.length,s=0;s<i;s++){var h=this._items[s];h.tweener?h.tweener.setTimeScale(e):h.type==ze.Transition?h.value.trans&&(h.value.trans.timeScale=e):h.type==ze.Animation&&h.target&&h.target.setProp(t.ObjectPropID.TimeScale,e)}}updateFromRelations(t,e,i){var s=this._items.length;if(0!=s)for(var h=0;h<s;h++){var r=this._items[h];r.type==ze.XY&&r.targetId==t&&(r.tweenConfig?(r.tweenConfig.startValue.b3||(r.tweenConfig.startValue.f1+=e,r.tweenConfig.startValue.f2+=i),r.tweenConfig.endValue.b3||(r.tweenConfig.endValue.f1+=e,r.tweenConfig.endValue.f2+=i)):r.value.b3||(r.value.f1+=e,r.value.f2+=i))}}onOwnerAddedToStage(){this._autoPlay&&!this._playing&&this.play(null,this._autoPlayTimes,this._autoPlayDelay)}onOwnerRemovedFromStage(){0==(2&this._options)&&this.stop(0!=(4&this._options),!1)}onDelayedPlay(){if(this.internalPlay(),this._playing=this._totalTasks>0,this._playing){if(0!=(1&this._options))for(var t=this._items.length,e=0;e<t;e++){var i=this._items[e];i.target&&i.target!=this._owner&&(i.displayLockToken=i.target.addDisplayLock())}}else if(this._onComplete){var s=this._onComplete;this._onComplete=null,s()}}internalPlay(){this._ownerBaseX=this._owner.x,this._ownerBaseY=this._owner.y,this._totalTasks=1;var t,e=this._items.length,i=!1;if(this._reversed)for(s=e-1;s>=0;s--)null!=(t=this._items[s]).target&&this.playItem(t);else for(var s=0;s<e;s++)null!=(t=this._items[s]).target&&(t.type==ze.Animation&&0!=this._startTime&&t.time<=this._startTime?(i=!0,t.value.flag=!1):this.playItem(t));i&&this.skipAnimations(),this._totalTasks--}playItem(t){var e;if(t.tweenConfig){if(e=this._reversed?this._totalDuration-t.time-t.tweenConfig.duration:t.time,-1==this._endTime||e<=this._endTime){var i,s;switch(this._reversed?(i=t.tweenConfig.endValue,s=t.tweenConfig.startValue):(i=t.tweenConfig.startValue,s=t.tweenConfig.endValue),t.value.b1=i.b1||s.b1,t.value.b2=i.b2||s.b2,t.type){case ze.XY:case ze.Size:case ze.Scale:case ze.Skew:t.tweener=mt.to2(i.f1,i.f2,s.f1,s.f2,t.tweenConfig.duration);break;case ze.Alpha:case ze.Rotation:t.tweener=mt.to(i.f1,s.f1,t.tweenConfig.duration);break;case ze.Color:t.tweener=mt.toColor(i.f1,s.f1,t.tweenConfig.duration);break;case ze.ColorFilter:t.tweener=mt.to4(i.f1,i.f2,i.f3,i.f4,s.f1,s.f2,s.f3,s.f4,t.tweenConfig.duration)}t.tweener.setDelay(e).setEase(t.tweenConfig.easeType).setRepeat(t.tweenConfig.repeat,t.tweenConfig.yoyo).setTimeScale(this._timeScale).setTarget(t).onStart(this.onTweenStart,this).onUpdate(this.onTweenUpdate,this).onComplete(this.onTweenComplete,this),this._endTime>=0&&t.tweener.setBreakpoint(this._endTime-e),this._totalTasks++}}else t.type==ze.Shake?(e=this._reversed?this._totalDuration-t.time-t.value.duration:t.time,t.value.offsetX=t.value.offsetY=0,t.value.lastOffsetX=t.value.lastOffsetY=0,t.tweener=mt.shake(0,0,t.value.amplitude,t.value.duration).setDelay(e).setTimeScale(this._timeScale).setTarget(t).onUpdate(this.onTweenUpdate,this).onComplete(this.onTweenComplete,this),this._endTime>=0&&t.tweener.setBreakpoint(this._endTime-t.time),this._totalTasks++):(e=this._reversed?this._totalDuration-t.time:t.time)<=this._startTime?(this.applyValue(t),this.callHook(t,!1)):(-1==this._endTime||e<=this._endTime)&&(this._totalTasks++,t.tweener=mt.delayedCall(e).setTimeScale(this._timeScale).setTarget(t).onComplete(this.onDelayedPlayItem,this));t.tweener&&t.tweener.seek(this._startTime)}skipAnimations(){for(var e,i,s,h,r,a,n=this._items.length,o=0;o<n;o++)if(!((a=this._items[o]).type!=ze.Animation||a.time>this._startTime||(h=a.value).flag)){e=(r=a.target).getProp(t.ObjectPropID.Frame),i=r.getProp(t.ObjectPropID.Playing)?0:-1,s=0;for(var l=o;l<n;l++)(a=this._items[l]).type!=ze.Animation||a.target!=r||a.time>this._startTime||((h=a.value).flag=!0,-1!=h.frame?(e=h.frame,i=h.playing?a.time:-1,s=0):h.playing?i<0&&(i=a.time):(i>=0&&(s+=a.time-i),i=-1),this.callHook(a,!1));i>=0&&(s+=this._startTime-i),r.setProp(t.ObjectPropID.Playing,i>=0),r.setProp(t.ObjectPropID.Frame,e),s>0&&r.setProp(t.ObjectPropID.DeltaTime,1e3*s)}}onDelayedPlayItem(t){var e=t.target;e.tweener=null,this._totalTasks--,this.applyValue(e),this.callHook(e,!1),this.checkAllComplete()}onTweenStart(t){var e,i,s=t.target;s.type!=ze.XY&&s.type!=ze.Size||(this._reversed?(e=s.tweenConfig.endValue,i=s.tweenConfig.startValue):(e=s.tweenConfig.startValue,i=s.tweenConfig.endValue),s.type==ze.XY?s.target!=this._owner?(e.b1?e.b3&&(t.startValue.x=e.f1*this._owner.width):t.startValue.x=s.target.x,e.b2?e.b3&&(t.startValue.y=e.f2*this._owner.height):t.startValue.y=s.target.y,i.b1?i.b3&&(t.endValue.x=i.f1*this._owner.width):t.endValue.x=t.startValue.x,i.b2?i.b3&&(t.endValue.y=i.f2*this._owner.height):t.endValue.y=t.startValue.y):(e.b1||(t.startValue.x=s.target.x-this._ownerBaseX),e.b2||(t.startValue.y=s.target.y-this._ownerBaseY),i.b1||(t.endValue.x=t.startValue.x),i.b2||(t.endValue.y=t.startValue.y)):(e.b1||(t.startValue.x=s.target.width),e.b2||(t.startValue.y=s.target.height),i.b1||(t.endValue.x=t.startValue.x),i.b2||(t.endValue.y=t.startValue.y)),s.tweenConfig.path&&(s.value.b1=s.value.b2=!0,t.setPath(s.tweenConfig.path)));this.callHook(s,!1)}onTweenUpdate(t){var e=t.target;switch(e.type){case ze.XY:case ze.Size:case ze.Scale:case ze.Skew:e.value.f1=t.value.x,e.value.f2=t.value.y,e.tweenConfig.path&&(e.value.f1+=t.startValue.x,e.value.f2+=t.startValue.y);break;case ze.Alpha:case ze.Rotation:e.value.f1=t.value.x;break;case ze.Color:e.value.f1=t.value.color;break;case ze.ColorFilter:e.value.f1=t.value.x,e.value.f2=t.value.y,e.value.f3=t.value.z,e.value.f4=t.value.w;break;case ze.Shake:e.value.offsetX=t.deltaValue.x,e.value.offsetY=t.deltaValue.y}this.applyValue(e)}onTweenComplete(t){var e=t.target;e.tweener=null,this._totalTasks--,t.allCompleted&&this.callHook(e,!0),this.checkAllComplete()}onPlayTransCompleted(t){this._totalTasks--,this.checkAllComplete()}callHook(t,e){e?t.tweenConfig&&t.tweenConfig.endHook&&t.tweenConfig.endHook():t.time>=this._startTime&&t.hook&&t.hook()}checkAllComplete(){if(this._playing&&0==this._totalTasks)if(this._totalTimes<0)this.internalPlay(),0==this._totalTasks&&mt.delayedCall(0).setTarget(this).onComplete(this.checkAllComplete,this);else if(this._totalTimes--,this._totalTimes>0)this.internalPlay(),0==this._totalTasks&&mt.delayedCall(0).setTarget(this).onComplete(this.checkAllComplete,this);else{this._playing=!1;for(var t=this._items.length,e=0;e<t;e++){var i=this._items[e];i.target&&0!=i.displayLockToken&&(i.target.releaseDisplayLock(i.displayLockToken),i.displayLockToken=0)}if(this._onComplete){var s=this._onComplete;this._onComplete=null,s()}}}applyValue(e){e.target._gearLocked=!0;var i=e.value;switch(e.type){case ze.XY:e.target==this._owner?i.b1&&i.b2?e.target.setPosition(i.f1+this._ownerBaseX,i.f2+this._ownerBaseY):i.b1?e.target.x=i.f1+this._ownerBaseX:e.target.y=i.f2+this._ownerBaseY:i.b3?i.b1&&i.b2?e.target.setPosition(i.f1*this._owner.width,i.f2*this._owner.height):i.b1?e.target.x=i.f1*this._owner.width:i.b2&&(e.target.y=i.f2*this._owner.height):i.b1&&i.b2?e.target.setPosition(i.f1,i.f2):i.b1?e.target.x=i.f1:i.b2&&(e.target.y=i.f2);break;case ze.Size:i.b1||(i.f1=e.target.width),i.b2||(i.f2=e.target.height),e.target.setSize(i.f1,i.f2);break;case ze.Pivot:e.target.setPivot(i.f1,i.f2,e.target.pivotAsAnchor);break;case ze.Alpha:e.target.alpha=i.f1;break;case ze.Rotation:e.target.rotation=i.f1;break;case ze.Scale:e.target.setScale(i.f1,i.f2);break;case ze.Skew:e.target.setSkew(i.f1,i.f2);break;case ze.Color:e.target.setProp(t.ObjectPropID.Color,i.f1);break;case ze.Animation:i.frame>=0&&e.target.setProp(t.ObjectPropID.Frame,i.frame),e.target.setProp(t.ObjectPropID.Playing,i.playing),e.target.setProp(t.ObjectPropID.TimeScale,this._timeScale);break;case ze.Visible:e.target.visible=i.visible;break;case ze.Transition:if(this._playing){var s=i.trans;if(s){this._totalTasks++;var h=this._startTime>e.time?this._startTime-e.time:0,r=this._endTime>=0?this._endTime-e.time:-1;i.stopTime>=0&&(r<0||r>i.stopTime)&&(r=i.stopTime),s.timeScale=this._timeScale,s._play(this.onPlayTransCompleted.bind(this,e),i.playTimes,0,h,r,this._reversed)}}break;case ze.Sound:if(this._playing&&e.time>=this._startTime){if(null==i.audioClip){var a=oe.getItemByURL(i.sound);i.audioClip=a?a.file:i.sound}i.audioClip&&Lt.GRoot.inst.playOneShotSound(i.audioClip,i.volume)}break;case ze.Shake:e.target.setPosition(e.target.x-i.lastOffsetX+i.offsetX,e.target.y-i.lastOffsetY+i.offsetY),i.lastOffsetX=i.offsetX,i.lastOffsetY=i.offsetY;break;case ze.ColorFilter:break;case ze.Text:e.target.text=i.text;break;case ze.Icon:e.target.icon=i.text}e.target._gearLocked=!1}setup(t){this.name=t.readS(),this._options=t.readInt(),this._autoPlay=t.readBool(),this._autoPlayTimes=t.readInt(),this._autoPlayDelay=t.readFloat();for(var e=t.readShort(),i=0;i<e;i++){var s=t.readShort(),h=t.pos;t.seek(h,0);var r=new Le(t.readByte());this._items[i]=r,r.time=t.readFloat();var a=t.readShort();if(r.targetId=a<0?"":this._owner.getChildAt(a).id,r.label=t.readS(),t.readBool()){if(t.seek(h,1),r.tweenConfig=new je,r.tweenConfig.duration=t.readFloat(),r.time+r.tweenConfig.duration>this._totalDuration&&(this._totalDuration=r.time+r.tweenConfig.duration),r.tweenConfig.easeType=t.readByte(),r.tweenConfig.repeat=t.readInt(),r.tweenConfig.yoyo=t.readBool(),r.tweenConfig.endLabel=t.readS(),t.seek(h,2),this.decodeValue(r,t,r.tweenConfig.startValue),t.seek(h,3),this.decodeValue(r,t,r.tweenConfig.endValue),t.version>=2){var n=t.readInt();if(n>0){r.tweenConfig.path=new ke;for(var o=new Array,l=0;l<n;l++){var _=t.readByte();switch(_){case Te.Bezier:o.push(Pe.newBezierPoint(t.readFloat(),t.readFloat(),t.readFloat(),t.readFloat()));break;case Te.CubicBezier:o.push(Pe.newCubicBezierPoint(t.readFloat(),t.readFloat(),t.readFloat(),t.readFloat(),t.readFloat(),t.readFloat()));break;default:o.push(Pe.newPoint(t.readFloat(),t.readFloat(),_))}}r.tweenConfig.path.create(o)}}}else r.time>this._totalDuration&&(this._totalDuration=r.time),t.seek(h,2),this.decodeValue(r,t,r.value);t.pos=h+s}}decodeValue(t,e,i){switch(t.type){case ze.XY:case ze.Size:case ze.Pivot:case ze.Skew:i.b1=e.readBool(),i.b2=e.readBool(),i.f1=e.readFloat(),i.f2=e.readFloat(),e.version>=2&&t.type==ze.XY&&(i.b3=e.readBool());break;case ze.Alpha:case ze.Rotation:i.b1=i.b2=!0,i.f1=e.readFloat();break;case ze.Scale:i.b1=i.b2=!0,i.f1=e.readFloat(),i.f2=e.readFloat();break;case ze.Color:i.b1=i.b2=!0,i.f1=e.readColor();break;case ze.Animation:i.playing=e.readBool(),i.frame=e.readInt();break;case ze.Visible:i.visible=e.readBool();break;case ze.Sound:i.sound=e.readS(),i.volume=e.readFloat();break;case ze.Transition:i.transName=e.readS(),i.playTimes=e.readInt();break;case ze.Shake:i.amplitude=e.readFloat(),i.duration=e.readFloat();break;case ze.ColorFilter:i.b1=i.b2=!0,i.f1=e.readFloat(),i.f2=e.readFloat(),i.f3=e.readFloat(),i.f4=e.readFloat();break;case ze.Text:case ze.Icon:i.text=e.readS()}}}var ze,Be;!function(t){t[t.XY=0]="XY",t[t.Size=1]="Size",t[t.Scale=2]="Scale",t[t.Pivot=3]="Pivot",t[t.Alpha=4]="Alpha",t[t.Rotation=5]="Rotation",t[t.Color=6]="Color",t[t.Animation=7]="Animation",t[t.Visible=8]="Visible",t[t.Sound=9]="Sound",t[t.Transition=10]="Transition",t[t.Shake=11]="Shake",t[t.ColorFilter=12]="ColorFilter",t[t.Skew=13]="Skew",t[t.Text=14]="Text",t[t.Icon=15]="Icon",t[t.Unknown=16]="Unknown"}(ze||(ze={}));class Le{constructor(t){this.type=t,this.value={},this.displayLockToken=0}}class je{constructor(){this.easeType=t.EaseType.QuadOut,this.startValue={b1:!0,b2:!0},this.endValue={b1:!0,b2:!0}}}class Me{constructor(){}static loadFromXML(t){let e={};Me.strings=e,t.elements("string").forEach(t=>{let i=t.getAttrString("name"),s=t.text,h=i.indexOf("-");if(-1==h)return;let r=i.substr(0,h),a=i.substr(h+1),n=e[r];n||(n={},e[r]=n),n[a]=s})}static translateComponent(e){if(null!=Me.strings){var i=Me.strings[e.owner.id+e.id];if(i){var s,h,r,a,n,o,l,_,d,c=e.rawData;c.seek(0,2);var u=c.readShort();for(n=0;n<u;n++){l=c.readShort(),_=c.pos,c.seek(_,0);var p=c.readByte(),g=p;c.skip(4),s=c.readS(),g==t.ObjectType.Component&&c.seek(_,6)&&(g=c.readByte()),c.seek(_,1),null!=(h=i[s+"-tips"])&&c.writeS(h),c.seek(_,2);var f=c.readShort();for(o=0;o<f;o++){if(r=c.readShort(),r+=c.pos,6==c.readByte()){for(c.skip(2),d=c.readShort(),y=0;y<d;y++)null!=c.readS()&&(null!=(h=i[s+"-texts_"+y])?c.writeS(h):c.skip(2));c.readBool()&&null!=(h=i[s+"-texts_def"])&&c.writeS(h)}c.pos=r}if(p==t.ObjectType.Component&&c.version>=2){c.seek(_,4),c.skip(2),c.skip(4*c.readUshort());for(var m=c.readUshort(),y=0;y<m;y++){var w=c.readS();0==c.readUshort()&&null!=(h=i[s+"-cp-"+w])?c.writeS(h):c.skip(2)}}switch(g){case t.ObjectType.Text:case t.ObjectType.RichText:case t.ObjectType.InputText:null!=(h=i[s])&&(c.seek(_,6),c.writeS(h)),null!=(h=i[s+"-prompt"])&&(c.seek(_,4),c.writeS(h));break;case t.ObjectType.List:case t.ObjectType.Tree:for(c.seek(_,8),c.skip(2),a=c.readUshort(),o=0;o<a;o++){if(r=c.readUshort(),r+=c.pos,c.skip(2),g==t.ObjectType.Tree&&c.skip(2),null!=(h=i[s+"-"+o])?c.writeS(h):c.skip(2),null!=(h=i[s+"-"+o+"-0"])?c.writeS(h):c.skip(2),c.version>=2){c.skip(6),c.skip(4*c.readUshort());for(m=c.readUshort(),y=0;y<m;y++){w=c.readS();0==c.readUshort()&&null!=(h=i[s+"-"+o+"-"+w])?c.writeS(h):c.skip(2)}}c.pos=r}break;case t.ObjectType.Label:c.seek(_,6)&&c.readByte()==g&&(null!=(h=i[s])?c.writeS(h):c.skip(2),c.skip(2),c.readBool()&&c.skip(4),c.skip(4),c.readBool()&&null!=(h=i[s+"-prompt"])&&c.writeS(h));break;case t.ObjectType.Button:c.seek(_,6)&&c.readByte()==g&&(null!=(h=i[s])?c.writeS(h):c.skip(2),null!=(h=i[s+"-0"])&&c.writeS(h));break;case t.ObjectType.ComboBox:if(c.seek(_,6)&&c.readByte()==g){for(a=c.readShort(),o=0;o<a;o++)r=c.readShort(),r+=c.pos,null!=(h=i[s+"-"+o])&&c.writeS(h),c.pos=r;null!=(h=i[s])&&c.writeS(h)}}c.pos=_+l}}}}}class Fe{constructor(t){this.shape=t}hitTest(t,e,i){return!1}}class Ae extends Ct{constructor(){super(),this._sortingChildCount=0,this._children=[],this._controllers=[],this._transitions=[],this._margin=new ne,this._alignOffset=new T,this._childrenRenderOrder=0,this._apexIndex=0}createDisplayObject(){super.createDisplayObject(),this._container=new O,this._displayObject=this._container}dispose(){var t,e;for(e=this._transitions.length,t=0;t<e;++t){this._transitions[t].dispose()}for(e=this._controllers.length,t=0;t<e;++t){this._controllers[t].dispose()}for(this.scrollPane&&this.scrollPane.dispose(),t=(e=this._children.length)-1;t>=0;--t){var i=this._children[t];i.parent=null,i.dispose()}this._boundsChanged=!1,super.dispose()}get displayListContainer(){return this._container}addChild(t){return this.addChildAt(t,this._children.length),t}addChildAt(t,e){if(!t)throw"child is null";if(e>=0&&e<=this._children.length){if(t.parent==this)this.setChildIndex(t,e);else{t.removeFromParent(),t.parent=this;var i=this._children.length;0!=t.sortingOrder?(this._sortingChildCount++,e=this.getInsertPosForSortingChild(t)):this._sortingChildCount>0&&e>i-this._sortingChildCount&&(e=i-this._sortingChildCount),e==i?this._children.push(t):this._children.splice(e,0,t),this.childStateChanged(t),this.setBoundsChangedFlag()}return t}throw"Invalid child index"}getInsertPosForSortingChild(t){for(var e=this._children.length,i=0;i<e;i++){var s=this._children[i];if(s!=t&&t.sortingOrder<s.sortingOrder)break}return i}removeChild(t,e){var i=this._children.indexOf(t);return-1!=i&&this.removeChildAt(i,e),t}removeChildAt(e,i){if(e>=0&&e<this._children.length){var s=this._children[e];return s.parent=null,0!=s.sortingOrder&&this._sortingChildCount--,this._children.splice(e,1),s.group=null,s.displayObject.parent&&(this._container.removeChild(s.displayObject),this._childrenRenderOrder==t.ChildrenRenderOrder.Arch&&z.callLater(this.buildNativeDisplayList,this)),i&&s.dispose(),this.setBoundsChangedFlag(),s}throw"Invalid child index"}removeChildren(t,e,i){t=t||0,null==e&&(e=-1),(e<0||e>=this._children.length)&&(e=this._children.length-1);for(var s=t;s<=e;++s)this.removeChildAt(t,i)}getChildAt(t){if(t>=0&&t<this._children.length)return this._children[t];throw"Invalid child index"}getChild(t){for(var e=this._children.length,i=0;i<e;++i)if(this._children[i].name==t)return this._children[i];return null}getChildByPath(t){for(var e,i=t.split("."),s=i.length,h=this,r=0;r<s&&(e=h.getChild(i[r]));++r)if(r!=s-1){if(!(e instanceof Ae)){e=null;break}h=e}return e}getVisibleChild(t){for(var e=this._children.length,i=0;i<e;++i){var s=this._children[i];if(s.internalVisible&&s.internalVisible2&&s.name==t)return s}return null}getChildInGroup(t,e){for(var i=this._children.length,s=0;s<i;++s){var h=this._children[s];if(h.group==e&&h.name==t)return h}return null}getChildById(t){for(var e=this._children.length,i=0;i<e;++i)if(this._children[i]._id==t)return this._children[i];return null}getChildIndex(t){return this._children.indexOf(t)}setChildIndex(t,e){var i=this._children.indexOf(t);if(-1==i)throw"Not a child of this container";if(0==t.sortingOrder){var s=this._children.length;this._sortingChildCount>0&&e>s-this._sortingChildCount-1&&(e=s-this._sortingChildCount-1),this._setChildIndex(t,i,e)}}setChildIndexBefore(t,e){var i=this._children.indexOf(t);if(-1==i)throw"Not a child of this container";if(0!=t.sortingOrder)return i;var s=this._children.length;return this._sortingChildCount>0&&e>s-this._sortingChildCount-1&&(e=s-this._sortingChildCount-1),i<e?this._setChildIndex(t,i,e-1):this._setChildIndex(t,i,e)}_setChildIndex(e,i,s){var h=this._children.length;if(s>h&&(s=h),i==s)return i;if(this._children.splice(i,1),this._children.splice(s,0,e),e.displayObject.parent){var r,a=0;if(this._childrenRenderOrder==t.ChildrenRenderOrder.Ascent){for(r=0;r<s;r++)this._children[r].displayObject.parent&&a++;a==this._container.numChildren&&a--,this._container.setChildIndex(e.displayObject,a)}else if(this._childrenRenderOrder==t.ChildrenRenderOrder.Descent){for(r=h-1;r>s;r--)this._children[r].displayObject.parent&&a++;a==this._container.numChildren&&a--,this._container.setChildIndex(e.displayObject,a)}else z.callLater(this.buildNativeDisplayList,this);this.setBoundsChangedFlag()}return s}swapChildren(t,e){var i=this._children.indexOf(t),s=this._children.indexOf(e);if(-1==i||-1==s)throw"Not a child of this container";this.swapChildrenAt(i,s)}swapChildrenAt(t,e){var i=this._children[t],s=this._children[e];this.setChildIndex(i,e),this.setChildIndex(s,t)}get numChildren(){return this._children.length}isAncestorOf(t){if(null==t)return!1;for(var e=t.parent;e;){if(e==this)return!0;e=e.parent}return!1}addController(t){this._controllers.push(t),t.parent=this,this.applyController(t)}getControllerAt(t){return this._controllers[t]}getController(t){for(var e=this._controllers.length,i=0;i<e;++i){var s=this._controllers[i];if(s.name==t)return s}return null}removeController(t){var e=this._controllers.indexOf(t);if(-1==e)throw new Error("controller not exists");t.parent=null,this._controllers.splice(e,1);for(var i=this._children.length,s=0;s<i;s++){this._children[s].handleControllerChanged(t)}}get controllers(){return this._controllers}childStateChanged(e){if(!this._buildingDisplayList){var i=this._children.length;if(e instanceof Ft)for(let t=0;t<i;t++){let i=this._children[t];i.group==e&&this.childStateChanged(i)}else if(e.internalVisible){if(!e.displayObject.parent){var s=0;if(this._childrenRenderOrder==t.ChildrenRenderOrder.Ascent){for(let t=0;t<i;t++){let i=this._children[t];if(i==e)break;i.displayObject.parent&&s++}this._container.addChildAt(e.displayObject,s)}else if(this._childrenRenderOrder==t.ChildrenRenderOrder.Descent){for(let t=i-1;t>=0;t--){let i=this._children[t];if(i==e)break;i.displayObject.parent&&s++}this._container.addChildAt(e.displayObject,s)}else this._container.addChild(e.displayObject),z.callLater(this.buildNativeDisplayList,this)}}else e.displayObject.parent&&(this._container.removeChild(e.displayObject),this._childrenRenderOrder==t.ChildrenRenderOrder.Arch&&z.callLater(this.buildNativeDisplayList,this))}}buildNativeDisplayList(){if(this._displayObject){var e=this._children.length;if(0!=e)switch(this._childrenRenderOrder){case t.ChildrenRenderOrder.Ascent:for(let t=0;t<e;t++){let e=this._children[t];e.internalVisible&&this._container.addChild(e.displayObject)}break;case t.ChildrenRenderOrder.Descent:for(let t=e-1;t>=0;t--){let e=this._children[t];e.internalVisible&&this._container.addChild(e.displayObject)}break;case t.ChildrenRenderOrder.Arch:var i=Rt(this._apexIndex,0,e);for(let t=0;t<i;t++){let e=this._children[t];e.internalVisible&&this._container.addChild(e.displayObject)}for(let t=e-1;t>=i;t--){let e=this._children[t];e.internalVisible&&this._container.addChild(e.displayObject)}}}}applyController(t){this._applyingController=t;for(var e=this._children.length,i=0;i<e;i++)this._children[i].handleControllerChanged(t);this._applyingController=null,t.runActions()}applyAllControllers(){for(var t=this._controllers.length,e=0;e<t;++e)this.applyController(this._controllers[e])}adjustRadioGroupDepth(t,e){var i=this._children.length,s=-1,h=-1;for(let r=0;r<i;r++){let i=this._children[r];i==t?s=r:"relatedController"in i&&i.relatedController==e&&r>h&&(h=r)}s<h&&(this._applyingController&&this._children[h].handleControllerChanged(this._applyingController),this.swapChildrenAt(s,h))}getTransitionAt(t){return this._transitions[t]}getTransition(t){for(var e=this._transitions.length,i=0;i<e;++i){var s=this._transitions[i];if(s.name==t)return s}return null}isChildInView(t){return this._displayObject.clipping?t.x+t._width>=0&&t.x<=this._width&&t.y+t._height>=0&&t.y<=this._height:!this._scrollPane||this._scrollPane.isChildInView(t)}getFirstChildInView(){for(var t=this._children.length,e=0;e<t;++e){var i=this._children[e];if(this.isChildInView(i))return e}return-1}get scrollPane(){return this._scrollPane}get opaque(){return this._displayObject.opaque}set opaque(t){this._displayObject.opaque=t}get margin(){return this._margin}set margin(t){this._margin.copy(t),this._displayObject.clipping&&this._container.setPosition(this._margin.left+this._alignOffset.x,this._margin.top+this._alignOffset.y),this.handleSizeChanged()}get childrenRenderOrder(){return this._childrenRenderOrder}set childrenRenderOrder(t){this._childrenRenderOrder!=t&&(this._childrenRenderOrder=t,this.buildNativeDisplayList())}get apexIndex(){return this._apexIndex}set apexIndex(e){this._apexIndex!=e&&(this._apexIndex=e,this._childrenRenderOrder==t.ChildrenRenderOrder.Arch&&this.buildNativeDisplayList())}get baseUserData(){var t=this.packageItem.rawData;return t.seek(0,4),t.readS()}setupScroll(t){this._displayObject==this._container&&(this._container=new O,this._displayObject.addChild(this._container)),this._scrollPane=new Ie(this),this._scrollPane.setup(t)}setupOverflow(e){e==t.OverflowType.Hidden?(this._displayObject==this._container&&(this._container=new O,this._displayObject.addChild(this._container)),this._displayObject.clipping=!0,this._container.setPosition(this._margin.left,this._margin.top)):0==this._margin.left&&0==this._margin.top||(this._displayObject==this._container&&(this._container=new O,this._displayObject.addChild(this._container)),this._container.setPosition(this._margin.left,this._margin.top))}handleSizeChanged(){super.handleSizeChanged(),this._scrollPane&&this._scrollPane.onOwnerSizeChanged()}handleGrayedChanged(){var t=this.getController("grayed");if(t)t.selectedIndex=this.grayed?1:0;else for(var e=this.grayed,i=this._children.length,s=0;s<i;++s)this._children[s].grayed=e}handleControllerChanged(t){super.handleControllerChanged(t),this._scrollPane&&this._scrollPane.handleControllerChanged(t)}setBoundsChangedFlag(){(this._scrollPane||this._trackBounds)&&(this._boundsChanged||(this._boundsChanged=!0,z.callLater(this.__render,this)))}__render(){this._boundsChanged&&this.updateBounds()}ensureBoundsCorrect(){this._boundsChanged&&this.updateBounds()}updateBounds(){var t=0,e=0,i=0,s=0,h=this._children.length;if(h>0){t=Number.POSITIVE_INFINITY,e=Number.POSITIVE_INFINITY;var r=Number.NEGATIVE_INFINITY,a=Number.NEGATIVE_INFINITY,n=0,o=0;for(o=0;o<h;o++){var l=this._children[o];(n=l.x)<t&&(t=n),(n=l.y)<e&&(e=n),(n=l.x+l.actualWidth)>r&&(r=n),(n=l.y+l.actualHeight)>a&&(a=n)}i=r-t,s=a-e}this.setBounds(t,e,i,s)}setBounds(t,e,i,s){this._boundsChanged=!1,this._scrollPane&&this._scrollPane.setContentSize(Math.round(t+i),Math.round(e+s))}get viewWidth(){return this._scrollPane?this._scrollPane.viewWidth:this.width-this._margin.left-this._margin.right}set viewWidth(t){this._scrollPane?this._scrollPane.viewWidth=t:this.width=t+this._margin.left+this._margin.right}get viewHeight(){return this._scrollPane?this._scrollPane.viewHeight:this.height-this._margin.top-this._margin.bottom}set viewHeight(t){this._scrollPane?this._scrollPane.viewHeight=t:this.height=t+this._margin.top+this._margin.bottom}getSnappingPosition(t,e,i){return this.getSnappingPositionWithDir(t,e,0,0,i)}getSnappingPositionWithDir(t,e,i,s,h){h||(h=new T);var r=this._children.length;if(0==r)return h.x=0,h.y=0,h;this.ensureBoundsCorrect();var a=null,n=null,o=0;if(0!=e){for(;o<r;o++)if(e<(a=this._children[o]).y){if(0==o){e=0;break}e=e<(n=this._children[o-1]).y+n.actualHeight/2?n.y:a.y;break}o==r&&(e=a.y)}if(0!=t){for(o>0&&o--;o<r;o++)if(t<(a=this._children[o]).x){if(0==o){t=0;break}t=t<(n=this._children[o-1]).x+n.actualWidth/2?n.x:a.x;break}o==r&&(t=a.x)}return h.x=t,h.y=e,h}childSortingOrderChanged(t,e,i){if(0==i)this._sortingChildCount--,this.setChildIndex(t,this._children.length);else{0==e&&this._sortingChildCount++;var s=this._children.indexOf(t),h=this.getInsertPosForSortingChild(t);s<h?this._setChildIndex(t,s,h-1):this._setChildIndex(t,s,h)}}constructFromResource(){this.constructFromResource2(null,0)}constructFromResource2(e,i){var s,h,r,a,n,o,l,_,d=this.packageItem.getBranch();d.decoded||(d.decoded=!0,Me.translateComponent(d));var c=d.rawData;c.seek(0,0),this._underConstruct=!0,this.sourceWidth=c.readInt(),this.sourceHeight=c.readInt(),this.initWidth=this.sourceWidth,this.initHeight=this.sourceHeight,this.setSize(this.sourceWidth,this.sourceHeight),c.readBool()&&(this.minWidth=c.readInt(),this.maxWidth=c.readInt(),this.minHeight=c.readInt(),this.maxHeight=c.readInt()),c.readBool()&&(n=c.readFloat(),o=c.readFloat(),this.setPivot(n,o,c.readBool())),c.readBool()&&(this._margin.top=c.readInt(),this._margin.bottom=c.readInt(),this._margin.left=c.readInt(),this._margin.right=c.readInt());var u=c.readByte();if(u==t.OverflowType.Scroll){var p=c.pos;c.seek(0,7),this.setupScroll(c),c.pos=p}else this.setupOverflow(u);c.readBool()&&c.skip(8),this._buildingDisplayList=!0,c.seek(0,1);var g,f=c.readShort();for(s=0;s<f;s++){a=c.readShort(),a+=c.pos;var m=new ye;this._controllers.push(m),m.parent=this,m.setup(c),c.pos=a}c.seek(0,2);var y=c.readShort();for(s=0;s<y;s++){if(h=c.readShort(),r=c.pos,e)g=e[i+s];else{c.seek(r,0);var w,v,x=c.readByte(),b=c.readS(),C=c.readS();if(b)w=(v=C?oe.getById(C):d.owner)?v.getItemById(b):null;else w=null;w?(g=ue.UIObjectFactory.newObject(w)).constructFromResource():g=ue.UIObjectFactory.newObject(x)}g._underConstruct=!0,g.setup_beforeAdd(c,r),g.parent=this,this._children.push(g),c.pos=r+h}for(c.seek(0,3),this.relations.setup(c,!0),c.seek(0,2),c.skip(2),s=0;s<y;s++)a=c.readShort(),a+=c.pos,c.seek(c.pos,3),this._children[s].relations.setup(c,!1),c.pos=a;for(c.seek(0,2),c.skip(2),s=0;s<y;s++)a=c.readShort(),a+=c.pos,(g=this._children[s]).setup_afterAdd(c,c.pos),g._underConstruct=!1,c.pos=a;c.seek(0,4),c.skip(2),this.opaque=c.readBool(),-1!=c.readShort()&&c.readBool();var S=c.readS();l=c.readInt(),_=c.readInt(),S?(w=d.owner.getItemById(S))&&w.pixelHitTestData&&(this._displayObject.hitArea=new ae(w.pixelHitTestData,l,_,this.sourceWidth,this.sourceHeight)):0!=l&&-1!=_&&(this._displayObject.hitArea=new Fe(this.getChildAt(_).displayObject)),c.seek(0,5);var I=c.readShort();for(s=0;s<I;s++){a=c.readShort(),a+=c.pos;var T=new Oe(this);T.setup(c),this._transitions.push(T),c.pos=a}this._transitions.length>0&&(this.on("added_to_stage",()=>{this._transitions.forEach(t=>t.onOwnerAddedToStage())}),this.on("removed_from_stage",()=>{this._transitions.forEach(t=>t.onOwnerRemovedFromStage())})),this.applyAllControllers(),this._buildingDisplayList=!1,this._underConstruct=!1,this.buildNativeDisplayList(),this.setBoundsChangedFlag(),d.objectType!=t.ObjectType.Component&&this.constructExtension(c),this.onConstruct()}constructExtension(t){}onConstruct(){}setup_afterAdd(t,e){super.setup_afterAdd(t,e),t.seek(e,4);var i,s,h=t.readShort();for(-1!=h&&this._scrollPane&&(this._scrollPane.pageController=this._parent.getControllerAt(h)),i=t.readShort(),s=0;s<i;s++){var r=this.getController(t.readS()),a=t.readS();r&&(r.selectedPageId=a)}if(t.version>=2)for(i=t.readShort(),s=0;s<i;s++){var n=t.readS(),o=t.readShort(),l=t.readS(),_=this.getChildByPath(n);_&&_.setProp(o,l)}}}class Re extends Ae{constructor(){super(),this._requestingCmd=0,this._uiSources=[],this.bringToFontOnClick=bt.bringWindowToFrontOnClick,this.on("added_to_stage",this.__onShown,this),this.on("removed_from_stage",this.__onHidden,this),this.on("touch_begin",this.__winTouchBegin,this)}addUISource(t){this._uiSources.push(t)}set contentPane(e){this._contentPane!=e&&(this._contentPane&&this.removeChild(this._contentPane),this._contentPane=e,this._contentPane&&(this.addChild(this._contentPane),this.setSize(this._contentPane.width,this._contentPane.height),this._contentPane.addRelation(this,t.RelationType.Size),this._frame=this._contentPane.getChild("frame"),this._frame&&(this.closeButton=this._frame.getChild("closeButton"),this.dragArea=this._frame.getChild("dragArea"),this.contentArea=this._frame.getChild("contentArea"))))}get contentPane(){return this._contentPane}get frame(){return this._frame}get closeButton(){return this._closeButton}set closeButton(t){this._closeButton&&this._closeButton.offClick(this.closeEventHandler,this),this._closeButton=t,this._closeButton&&this._closeButton.onClick(this.closeEventHandler,this)}get dragArea(){return this._dragArea}set dragArea(t){this._dragArea!=t&&(this._dragArea&&(this._dragArea.draggable=!1,this._dragArea.off("drag_start",this.__dragStart,this)),this._dragArea=t,this._dragArea&&(this._dragArea instanceof Gt&&this._dragArea.shape.drawRect(0,xt.CLEAR,xt.CLEAR),this._dragArea.draggable=!0,this._dragArea.on("drag_start",this.__dragStart,this)))}get contentArea(){return this._contentArea}set contentArea(t){this._contentArea=t}show(){De.inst.showWindow(this)}showOn(t){t.showWindow(this)}hide(){this.isShowing&&this.doHideAnimation()}hideImmediately(){De.inst.hideWindowImmediately(this)}centerOn(e,i){this.setPosition(Math.round((e.width-this.width)/2),Math.round((e.height-this.height)/2)),i&&(this.addRelation(e,t.RelationType.Center_Center),this.addRelation(e,t.RelationType.Middle_Middle))}toggleStatus(){this.isTop?this.hide():this.show()}get isShowing(){return null!=this.parent}get isTop(){return this.parent&&this.parent.getChildIndex(this)==this.parent.numChildren-1}get modal(){return this._modal}set modal(t){this._modal=t}bringToFront(){De.inst.bringToFront(this)}showModalWait(t){null!=t&&(this._requestingCmd=t),bt.windowModalWaiting&&(this._modalWaitPane||(this._modalWaitPane=oe.createObjectFromURL(bt.windowModalWaiting)),this.layoutModalWaitPane(),this.addChild(this._modalWaitPane))}layoutModalWaitPane(){if(this._contentArea){var t=this._frame.localToGlobal();t=this.globalToLocal(t.x,t.y,t),this._modalWaitPane.setPosition(t.x+this._contentArea.x,t.y+this._contentArea.y),this._modalWaitPane.setSize(this._contentArea.width,this._contentArea.height)}else this._modalWaitPane.setSize(this.width,this.height)}closeModalWait(t){return(null==t||this._requestingCmd==t)&&(this._requestingCmd=0,this.modalWaiting&&this.removeChild(this._modalWaitPane),!0)}get modalWaiting(){return null!=this._modalWaitPane&&null!=this._modalWaitPane.parent}init(){if(!this._inited&&!this._loading)if(this._uiSources.length>0){this._loading=!1;for(var t=this._uiSources.length,e=0;e<t;e++){var i=this._uiSources[e];i.loaded||(i.load(this.__uiLoadComplete,this),this._loading=!0)}this._loading||this._init()}else this._init()}onInit(){}onShown(){}onHide(){}doShowAnimation(){this.onShown()}doHideAnimation(){this.hideImmediately()}__uiLoadComplete(){for(var t=this._uiSources.length,e=0;e<t;e++){if(!this._uiSources[e].loaded)return}this._loading=!1,this._init()}_init(){this._inited=!0,this.onInit(),this.isShowing&&this.doShowAnimation()}dispose(){this.parent&&this.hideImmediately(),super.dispose()}closeEventHandler(){this.hide()}__onShown(){this._inited?this.doShowAnimation():this.init()}__onHidden(){this.closeModalWait(),this.onHide()}__winTouchBegin(){this.isShowing&&this.bringToFontOnClick&&this.bringToFront()}__dragStart(t){t.preventDefault(),this.startDrag()}}class De extends Ae{constructor(){super(),Be||(Be=this),this.opaque=!1,this._popupStack=[],this._justClosedPopups=[],this.on("touch_begin",this.__stageTouchBegin,this,!0),this._modalLayer=new Gt,this._modalLayer.setSize(this.width,this.height),this._modalLayer.shape.drawRect(0,xt.CLEAR,bt.modalLayerColor),this._modalLayer.addRelation(this,t.RelationType.Size),this.applyScaleFactor(),this.on("content_scale_factor_changed",this.applyScaleFactor,this)}static get inst(){return Be||(Be=new De,R.rootObject.addChild(Be.displayObject)),Be}applyScaleFactor(){this.setSize(Math.ceil(R.rootObject.width/Xt.scaleFactor),Math.ceil(R.rootObject.height/Xt.scaleFactor)),this.setScale(Xt.scaleFactor,Xt.scaleFactor)}showWindow(t){this.addChild(t),t.x>this.width?t.x=this.width-t.width:t.x+t.width<0&&(t.x=0),t.y>this.height?t.y=this.height-t.height:t.y+t.height<0&&(t.y=0),this.adjustModalLayer()}hideWindow(t){t.hide()}hideWindowImmediately(t){t.parent==this&&this.removeChild(t),this.adjustModalLayer()}bringToFront(t){var e,i=this.numChildren;for(e=this._modalLayer.parent&&!t.modal?this.getChildIndex(this._modalLayer)-1:i-1;e>=0;e--){var s=this.getChildAt(e);if(s==t)return;if(s instanceof Re)break}e>=0&&this.setChildIndex(t,e)}showModalWait(e){bt.globalModalWaiting&&(null==this._modalWaitPane&&(this._modalWaitPane=oe.createObjectFromURL(bt.globalModalWaiting)),this._modalWaitPane.setSize(this.width,this.height),this._modalWaitPane.addRelation(this,t.RelationType.Size),this.addChild(this._modalWaitPane),this._modalWaitPane.text=e||"")}closeModalWait(){this._modalWaitPane&&this._modalWaitPane.parent&&this.removeChild(this._modalWaitPane)}closeAllExceptModals(){for(var t=this._children.slice(),e=t.length,i=0;i<e;i++){var s=t[i];s instanceof Re&&!s.modal&&s.hide()}}closeAllWindows(){for(var t=this._children.slice(),e=t.length,i=0;i<e;i++){var s=t[i];s instanceof Re&&s.hide()}}getTopWindow(){for(var t=this.numChildren-1;t>=0;t--){var e=this.getChildAt(t);if(e instanceof Re)return e}return null}get modalLayer(){return this._modalLayer}get hasModalWindow(){return null!=this._modalLayer.parent}get modalWaiting(){return this._modalWaitPane&&this._modalWaitPane.onStage}showPopup(e,i,s){if(this._popupStack.length>0){var h=this._popupStack.indexOf(e);if(-1!=h)for(var r=this._popupStack.length-1;r>=h;r--)this.removeChild(this._popupStack.pop())}if(this._popupStack.push(e),i)for(var a=i;a;){if(a.parent==this){e.sortingOrder<a.sortingOrder&&(e.sortingOrder=a.sortingOrder);break}a=a.parent}var n;this.addChild(e),this.adjustModalLayer();var o,l,_=0,d=0;if(i){n=i.localToRoot(0,0);let t=i.localToRoot(i.width,i.height);_=t.x-n.x,d=t.y-n.y}else n=R.getTouchPos(),n=this.globalToLocal(n.x,n.y);(o=n.x)+e.width>this.width&&(o=o+_-e.width),l=n.y+d,((void 0===s||s===t.PopupDirection.Auto)&&l+e.height>this.height||s===t.PopupDirection.Up)&&(l=n.y-e.height-1)<0&&(l=0,o+=_/2),e.setPosition(o,l)}togglePopup(t,e,i){-1==this._justClosedPopups.indexOf(t)&&this.showPopup(t,e,i)}hidePopup(t){if(t){var e=this._popupStack.indexOf(t);if(-1!=e)for(var i=this._popupStack.length-1;i>=e;i--)this.closePopup(this._popupStack.pop())}else{for(i=this._popupStack.length-1;i>=0;i--)this.closePopup(this._popupStack[i]);this._popupStack.length=0}}get hasAnyPopup(){return 0!=this._popupStack.length}closePopup(t){t.parent&&(t instanceof Re?t.hide():this.removeChild(t))}showTooltips(t){if(null==this._defaultTooltipWin){var e=bt.tooltipsWin;if(!e)return void console.warn("UIConfig.tooltipsWin not defined");this._defaultTooltipWin=oe.createObjectFromURL(e)}this._defaultTooltipWin.text=t,this.showTooltipsWin(this._defaultTooltipWin)}showTooltipsWin(t,e,i){this.hideTooltips(),this._tooltipWin=t,null!=e&&null!=i||(e=R.touchPos.x+10,i=R.touchPos.y+20);var s=this.globalToLocal(e,i);e=s.x,i=s.y,e+this._tooltipWin.width>this.width&&(e=e-this._tooltipWin.width-1)<0&&(e=10),i+this._tooltipWin.height>this.height&&(i=i-this._tooltipWin.height-1,e-this._tooltipWin.width-1>0&&(e=e-this._tooltipWin.width-1),i<0&&(i=10)),this._tooltipWin.x=e,this._tooltipWin.y=i,this.addChild(this._tooltipWin)}hideTooltips(){this._tooltipWin&&(this._tooltipWin.parent&&this.removeChild(this._tooltipWin),this._tooltipWin=null)}playOneShotSound(t,e){}adjustModalLayer(){var t=this.numChildren;this._modalWaitPane&&this._modalWaitPane.parent&&this.setChildIndex(this._modalWaitPane,t-1);for(var e=t-1;e>=0;e--){var i=this.getChildAt(e);if(i instanceof Re&&i.modal)return void(null==this._modalLayer.parent?this.addChildAt(this._modalLayer,e):this.setChildIndexBefore(this._modalLayer,e))}this._modalLayer.parent&&this.removeChild(this._modalLayer)}checkPopups(){if(this._justClosedPopups.length=0,this._popupStack.length>0){let t=R.touchTarget,e=!1;for(;t;){let i=Ct.cast(t);if(i){let t=this._popupStack.indexOf(i);if(-1!=t){for(let e=this._popupStack.length-1;e>t;e--){let t=this._popupStack.length-1,e=this._popupStack[t];this.closePopup(e),this._justClosedPopups.push(e),this._popupStack.splice(t,1)}e=!0;break}}t=t.parent}if(!e)for(let t=this._popupStack.length-1;t>=0;t--){let e=this._popupStack[t];this.closePopup(e),this._justClosedPopups.push(e),this._popupStack.splice(t,1)}}}__stageTouchBegin(){this._tooltipWin&&this.hideTooltips(),this.checkPopups()}}Lt.GRoot=De;class Ee{constructor(){this.size=0,this.color=0,this.lineSpacing=0,this.letterSpacing=0,this.outline=0,this.outlineColor=0,this.shadowOffset=new T,this.shadowColor=0}copy(t){this.size=t.size,this.font=t.font,this.color=t.color,this.lineSpacing=t.lineSpacing,this.letterSpacing=t.letterSpacing,this.bold=t.bold,this.underline=t.underline,this.italic=t.italic,this.strikethrough=t.strikethrough,this.align=t.align,this.outline=t.outline,this.outlineColor=t.outlineColor,this.shadowOffset.copy(t.shadowOffset),this.shadowColor=t.shadowColor}}class Ve extends O{constructor(){super(),this._touchDisabled=!0,this._textFormat=new Ee,this._node.style.display="table-cell",this._text=""}get textFormat(){return this._textFormat}applyFormat(){let t=this._textFormat.font;t||(t=bt.defaultFont),this._node.style.textAlign=this._textFormat.align,this._node.style.verticalAlign=this._textFormat.verticalAlign,this._node.style.fontSize=this._textFormat.size+"px",this._node.style.fontFamily=t,this._node.style.color=At(this._textFormat.color)}get text(){return this._text}set text(t){this._text.length<20&&this._text==t&&!this._html||(this._text=t,this._html=!1,this.applyText())}get htmlText(){return this._text}set htmlText(t){this._text.length<20&&this._text==t&&this._html||(this._text=t,this._html=!0,this.applyText())}applyText(){this._html?this._node.innerHTML=this._text.replace(/\r\n|\n/g,"\n"):this._node.innerText=this._text,this._updatingSize=!0,this._autoSize==t.AutoSizeType.Both?(this._contentRect.width=this._node.clientWidth,this._contentRect.height=this._node.clientHeight,this.gOwner&&this.gOwner.setSize(this._contentRect.width,this._contentRect.height)):this._autoSize==t.AutoSizeType.Height&&(this._contentRect.height=this._node.clientHeight,this.gOwner&&(this.gOwner.height=this._contentRect.height)),this._updatingSize=!1}get autoSize(){return this._autoSize}set autoSize(e){this._autoSize!=e&&(this._autoSize=e,this._autoSize==t.AutoSizeType.Both?this._maxWidth>0?this._node.style.maxWidth=this._maxWidth+"px":this._node.style.maxWidth="none":this._node.style.maxWidth=this._contentRect.width+"px")}get singleLine(){return this._singleLine}set singleLine(t){this._singleLine!=t&&(this._singleLine=t)}get maxWidth(){return this._maxWidth}set maxWidth(e){this._maxWidth!=e&&(this._maxWidth=e,this._autoSize==t.AutoSizeType.Both&&(this._maxWidth>0?this._node.style.maxWidth=this._maxWidth+"px":this._node.style.maxWidth="none"))}onSizeChanged(){this._updatingSize||this._autoSize!=t.AutoSizeType.Both&&(this._node.style.maxWidth=this._contentRect.width+"px")}}class We{constructor(){this._readPos=0,this.defaultImgWidth=0,this.defaultImgHeight=0,this._handlers={},this._handlers.url=this.onTag_URL,this._handlers.img=this.onTag_IMG,this._handlers.b=this.onTag_B,this._handlers.i=this.onTag_I,this._handlers.u=this.onTag_U,this._handlers.sup=this.onTag_Simple,this._handlers.sub=this.onTag_Simple,this._handlers.color=this.onTag_COLOR,this._handlers.font=this.onTag_FONT,this._handlers.size=this.onTag_SIZE}onTag_URL(t,e,i){return e?"</a>":null!=i?'<a href="'+i+'">':'<a href="'+this.getTagText()+'">'}onTag_IMG(t,e,i){if(e)return null;var s=this.getTagText(!0);return s?this.defaultImgWidth?'<img src="'+s+'" width="'+this.defaultImgWidth+'" height="'+this.defaultImgHeight+'"/>':'<img src="'+s+'"/>':null}onTag_B(t,e,i){return e?"</b>":"<b>"}onTag_I(t,e,i){return e?"</i>":"<i>"}onTag_U(t,e,i){return e?"</u>":"<u>"}onTag_Simple(t,e,i){return e?"</"+t+">":"<"+t+">"}onTag_COLOR(t,e,i){return e?"</font>":(this.lastColor=i,'<font color="'+i+'">')}onTag_FONT(t,e,i){return e?"</font>":'<font face="'+i+'">'}onTag_SIZE(t,e,i){return e?"</font>":(this.lastSize=i,'<font size="'+i+'">')}getTagText(t){for(var e,i=this._readPos,s="";-1!=(e=this._text.indexOf("[",i));){if(92!=this._text.charCodeAt(e-1)){s+=this._text.substring(i,e);break}s+=this._text.substring(i,e-1),s+="[",i=e+1}return-1==e?null:(t&&(this._readPos=e),s)}parse(t,e){this._text=t,this.lastColor=null,this.lastSize=null;for(var i,s,h,r,a,n,o,l=0,_="";-1!=(i=this._text.indexOf("[",l));)if(i>0&&92==this._text.charCodeAt(i-1))_+=this._text.substring(l,i-1),_+="[",l=i+1;else{if(_+=this._text.substring(l,i),l=i,-1==(i=this._text.indexOf("]",l)))break;h="/"==this._text.charAt(l+1),r=this._text.substring(h?l+2:l+1,i),this._readPos=i+1,a=null,n=null,-1!=(s=r.indexOf("="))&&(a=r.substring(s+1),r=r.substring(0,s)),r=r.toLowerCase(),null!=(o=this._handlers[r])?e||null!=(n=o.call(this,r,h,a))&&(_+=n):_+=this._text.substring(l,this._readPos),l=this._readPos}return l<this._text.length&&(_+=this._text.substr(l)),this._text=null,_}}var Ge=new We;class He extends Ct{constructor(){super();let e=this._textField.textFormat;e.font=bt.defaultFont,e.size=12,e.lineSpacing=3,this._textField.applyFormat(),this._text="",this._textField.autoSize=t.AutoSizeType.Both}createDisplayObject(){this._displayObject=this._textField=new Ve}get text(){return this._text}set text(t){null==t&&(t=""),this._text=t,this.setText(),this.updateSize(),this.updateGear(6)}setText(){let t=this._text;this._template&&(t=this.parseTemplate(t)),this._textField.maxWidth=this.maxWidth,this._ubbEnabled?this._textField.htmlText=Ge.parse(class{static decodeString(t){let e=t.length,i="",s=0,h=0;for(;;){if(h=t.indexOf("&",s),-1==h){i+=t.substr(s);break}i+=t.substr(s,h-s),s=h+1,h=s;let r=Math.min(e,h+10);for(;h<r&&";"!=t[h];h++);if(h<r&&h>s){let e=t.substr(s,h-s),r=0;if("#"==e[0])e.length>1?(r="x"==e[1]?parseInt(e.substr(2),16):parseInt(e.substr(1)),i+=String.fromCharCode(r),s=h+1):i+="&";else{switch(e){case"amp":r=38;break;case"apos":r=39;break;case"gt":r=62;break;case"lt":r=60;break;case"nbsp":r=32;break;case"quot":r=34}r>0?(i+=String.fromCharCode(r),s=h+1):i+="&"}}else i+="&"}return i}static encodeString(t){return t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/'/g,"&apos;").replace(/"/g,"&quot;")}static getString(t,e,i){if(null==t)return null==i?null:i;let s=t[e];return null!=s?""+s:null==i?null:i}static getInt(t,e,i){let s=this.getString(t,e);if(null==s||0==s.length)return null==i?0:i;if("%"==s[s.length-1]){let t=parseInt(s.substring(0,s.length-1));return Math.ceil(t/100*i)}return parseInt(s)}static getFloat(t,e,i){let s=this.getString(t,e);if(null==s||0==s.length)return null==i?0:i;let h=parseFloat(s);return isNaN(h)?null==i?0:i:h}static getBool(t,e,i){let s=this.getString(t,e);return null==s||0==s.length?null!=i&&i:"true"==s||"1"==s||"false"!=s&&"0"!=s&&(null!=i&&i)}static getColor(t,e,i){let s=this.getString(t,e);return null==s||0==s.length?null==i?0:i:(h=s).length<1?0:("#"==h.charAt(0)&&(h=h.substr(1)),8==h.length?(parseInt(h.substr(0,2),16)<<24)+parseInt(h.substr(2),16):r?4278190080+parseInt(h,16):parseInt(h,16));var h,r}}.encodeString(t)):this._textField.text=t}get textTemplate(){return this._template}set textTemplate(t){(this._template||t)&&(this._template=t,this.flushVars())}setVar(t,e){return this._template||(this._template={}),this._template[t]=e,this}flushVars(){this.setText(),this.updateSize()}get textFormat(){return this._textField.textFormat}applyFormat(){this._textField.applyFormat(),this._underConstruct||this.updateSize()}get singleLine(){return this._textField.singleLine}set singleLine(t){this._textField.singleLine=t}set ubbEnabled(t){this._ubbEnabled=t}get ubbEnabled(){return this._ubbEnabled}get autoSize(){return this._textField.autoSize}set autoSize(t){this._textField.autoSize=t}get color(){return this._textField.textFormat.color}set color(t){this._textField.textFormat.color!=t&&(this._textField.textFormat.color=t,this._textField.applyFormat(),this.updateGear(4))}getProp(e){switch(e){case t.ObjectPropID.Color:return this.color;case t.ObjectPropID.OutlineColor:return this._textField.textFormat.outlineColor;case t.ObjectPropID.FontSize:return this._textField.textFormat.size;default:return super.getProp(e)}}setProp(e,i){switch(e){case t.ObjectPropID.Color:this.color=i;break;case t.ObjectPropID.OutlineColor:this._textField.textFormat.outlineColor=i,this._textField.applyFormat();break;case t.ObjectPropID.FontSize:this._textField.textFormat.size=i,this._textField.applyFormat();break;default:super.setProp(e,i)}}updateSize(){this._updatingSize||(this._updatingSize=!0,this._textField.autoSize==t.AutoSizeType.Both?this.setSize(this._textField.width,this._textField.height):this._textField.autoSize==t.AutoSizeType.Height&&(this.height=this._textField.height),this._updatingSize=!1)}handleSizeChanged(){this._updatingSize||(this._underConstruct?this._textField.setSize(this.width,this.height):this._textField.autoSize!=t.AutoSizeType.Both&&(this._textField.autoSize==t.AutoSizeType.Height?(this._textField.width=this.width,""!=this._text&&this.setSizeDirectly(this.width,this._textField.height)):this._textField.setSize(this.width,this.height)))}setup_beforeAdd(t,e){super.setup_beforeAdd(t,e),t.seek(e,5);let i=this._textField.textFormat;i.font=t.readS(),i.size=t.readShort(),i.color=t.readColor();let s=t.readByte();if(i.align=0==s?"left":1==s?"center":"right",s=t.readByte(),i.verticalAlign=0==s?"top":1==s?"middle":"bottom",i.lineSpacing=t.readShort(),i.letterSpacing=t.readShort(),this.ubbEnabled=t.readBool(),this.autoSize=t.readByte(),i.underline=t.readBool(),i.italic=t.readBool(),i.bold=t.readBool(),this.singleLine=t.readBool(),t.readBool()&&(i.outlineColor=t.readColor(),i.outline=t.readFloat()+1),t.readBool()){i.shadowColor=t.readColor();let e=t.readFloat(),s=t.readFloat();i.shadowOffset.set(e,s)}t.readBool()&&(this._template={}),t.version>=3&&(i.strikethrough=t.readBool()),this._textField.applyFormat()}setup_afterAdd(t,e){super.setup_afterAdd(t,e),t.seek(e,6);var i=t.readS();null!=i&&(this.text=i)}parseTemplate(t){for(var e,i,s,h,r=0,a="";-1!=(e=t.indexOf("{",r));)if(e>0&&92==t.charCodeAt(e-1))a+=t.substring(r,e-1),a+="{",r=e+1;else{if(a+=t.substring(r,e),r=e,-1==(e=t.indexOf("}",r)))break;e!=r+1?(-1!=(i=(s=t.substring(r+1,e)).indexOf("="))?a+=null==(h=this._template[s.substring(0,i)])?s.substring(i+1):h:null!=(h=this._template[s])&&(a+=h),r=e+1):(a+=t.substr(r,2),r=e+1)}return r<t.length&&(a+=t.substr(r)),a}}class Ne{constructor(){this.linkUnderline=Ne.defaultLinkUnderline,this.linkColor=Ne.defaultLinkColor}}Ne.defaultLinkUnderline=!0,Ne.defaultLinkColor=3827660;class Ye extends Ve{constructor(){super(),this._touchDisabled=!1,this.opaque=!0,this.htmlParseOptions=new Ne}}class Ue extends He{constructor(){super()}createDisplayObject(){this._displayObject=this._textField=new Ye}setText(){let t=this._text;this._template&&(t=this.parseTemplate(t)),this._textField.maxWidth=this.maxWidth,this._ubbEnabled?this._textField.htmlText=Ge.parse(t):this._textField.htmlText=t}}class Xe extends O{constructor(){super(),this._textFormat=new Ee,this._text="",this._singleLine=!0,this.createElement()}get textFormat(){return this._textFormat}applyFormat(){let t=this._textFormat.font;t||(t=bt.defaultFont),this._input.style.textAlign=this._textFormat.align,this._input.style.verticalAlign=this._textFormat.verticalAlign,this._input.style.fontSize=this._textFormat.size+"px",this._input.style.fontFamily=t,this._input.style.color=At(this._textFormat.color)}get text(){return this._text=this._input.textContent,this._text}set text(t){this._text=t,this._input.textContent=this._text}set singleLine(t){this._singleLine!=t&&(this._singleLine=t,this.createElement())}createElement(){let t,e=this._input;e&&this._node.removeChild(e),this.singleLine?t=this._input=document.createElement("input"):(t=this._input=document.createElement("textarea"),t.style.resize="none",t.style.overflow="scroll"),t.style.outline="none",t.style.borderWidth="0px",t.style.padding="0px",t.style.margin="0px",t.style.position="absolute",t.style.background="transparent",t.style.width="100%",t.style.height="100%",t.textContent=this._text,this._password&&t instanceof HTMLInputElement&&(t.type="password"),t.readOnly=!!e&&e.readOnly,this._node.appendChild(t)}setPromptText(t){this._input.placeholder=Ge.parse(t,!0)}setMaxLength(t){}setKeyboardType(t){}setRestrict(t){}get editable(){return!this._input.readOnly}set editable(t){this._input.readOnly=!t}get password(){return this._password}set password(t){this._password!=t&&(this._password=t,this._input instanceof HTMLInputElement&&(this._input.type=t?"password":"text"))}}class qe extends Ct{constructor(){super()}createDisplayObject(){this._displayObject=this._textField=new Xe}get text(){return this._textField.text}set text(t){null==t&&(t=""),this._textField.text=t,this.updateGear(6)}get textFormat(){return this._textField.textFormat}applyFormat(){this._textField.applyFormat()}get singleLine(){return this._textField.singleLine}set singleLine(t){this._textField.singleLine=t}get color(){return this._textField.textFormat.color}set color(t){this._textField.textFormat.color!=t&&(this._textField.textFormat.color=t,this._textField.applyFormat(),this.updateGear(4))}get password(){return this._textField.password}set password(t){this._textField.password=t}set editable(t){this._textField.editable=t}get editable(){return this._textField.editable}setMaxLength(t){this._textField.setMaxLength(t)}setPromptText(t){return this._textField.setPromptText(t)}setRestrict(t){this._textField.setRestrict(t)}setKeyboardType(t){this._textField.setKeyboardType(t)}requestFocus(){this._textField._node.focus()}getProp(e){switch(e){case t.ObjectPropID.Color:return this.color;case t.ObjectPropID.OutlineColor:return this._textField.textFormat.outlineColor;case t.ObjectPropID.FontSize:return this._textField.textFormat.size;default:return super.getProp(e)}}setProp(e,i){switch(e){case t.ObjectPropID.Color:this.color=i;break;case t.ObjectPropID.OutlineColor:this._textField.textFormat.outlineColor=i,this._textField.applyFormat();break;case t.ObjectPropID.FontSize:this._textField.textFormat.size=i,this._textField.applyFormat();break;default:super.setProp(e,i)}}setup_beforeAdd(t,e){super.setup_beforeAdd(t,e),t.seek(e,5);let i=this._textField.textFormat;i.font=t.readS(),i.size=t.readShort(),i.color=t.readColor();let s=t.readByte();if(i.align=0==s?"left":1==s?"center":"right",s=t.readByte(),i.verticalAlign=0==s?"top":1==s?"middle":"bottom",i.lineSpacing=t.readShort(),i.letterSpacing=t.readShort(),t.readBool(),t.readByte(),i.underline=t.readBool(),i.italic=t.readBool(),i.bold=t.readBool(),this.singleLine=t.readBool(),t.readBool()&&(i.outlineColor=t.readColor(),i.outline=t.readFloat()+1),t.readBool()){i.shadowColor=t.readColor();let e=t.readFloat(),s=t.readFloat();i.shadowOffset.set(e,s)}t.readBool(),t.version>=3&&(i.strikethrough=t.readBool()),this._textField.applyFormat(),t.seek(e,4);var h=t.readS();null!=h&&this.setPromptText(h),null!=(h=t.readS())&&this.setRestrict(h);var r=t.readInt();0!=r&&this.setMaxLength(r),0!=(r=t.readInt())&&(4==r?this.setKeyboardType("number"):3==r&&this.setKeyboardType("url")),t.readBool()&&(this.password=!0)}setup_afterAdd(t,e){super.setup_afterAdd(t,e),t.seek(e,6);var i=t.readS();null!=i&&(this.text=i)}}class Ke extends Ct{constructor(){super(),this._url="",this._fill=t.LoaderFillType.None,this._align="left",this._valign="top"}createDisplayObject(){this._displayObject=new O,this._content=new Yt,this._displayObject.addChild(this._content)}dispose(){this._content2&&this._content2.dispose(),super.dispose()}get url(){return this._url}set url(t){this._url!=t&&(this._url=t,this.loadContent(),this.updateGear(7))}get icon(){return this._url}set icon(t){this.url=t}get align(){return this._align}set align(t){this._align!=t&&(this._align=t,this.updateLayout())}get verticalAlign(){return this._valign}set verticalAlign(t){this._valign!=t&&(this._valign=t,this.updateLayout())}get fill(){return this._fill}set fill(t){this._fill!=t&&(this._fill=t,this.updateLayout())}get shrinkOnly(){return this._shrinkOnly}set shrinkOnly(t){this._shrinkOnly!=t&&(this._shrinkOnly=t,this.updateLayout())}get autoSize(){return this._autoSize}set autoSize(t){this._autoSize!=t&&(this._autoSize=t,this.updateLayout())}get playing(){return this._content.playing}set playing(t){this._content.playing!=t&&(this._content.playing=t,this.updateGear(5))}get frame(){return this._content.frame}set frame(t){this._content.frame!=t&&(this._content.frame=t,this.updateGear(5))}get color(){return this._content.color}set color(t){this._content.color!=t&&(this._content.color=t,this.updateGear(4))}get fillMethod(){return this._content.fillMethod}set fillMethod(t){this._content.fillMethod=t}get fillOrigin(){return this._content.fillOrigin}set fillOrigin(t){this._content.fillOrigin=t}get fillClockwise(){return this._content.fillClockwise}set fillClockwise(t){this._content.fillClockwise=t}get fillAmount(){return this._content.fillAmount}set fillAmount(t){this._content.fillAmount=t}get content(){return this._content}get component(){return this._content2}loadContent(){this.clearContent(),this._url&&this._url.startsWith("ui://")&&this.loadFromPackage(this._url)}loadFromPackage(e){if(this._contentItem=oe.getItemByURL(e),this._contentItem)if(this._contentItem=this._contentItem.getBranch(),this.sourceWidth=this._contentItem.width,this.sourceHeight=this._contentItem.height,this._contentItem=this._contentItem.getHighResolution(),this._contentItem.load(),this._autoSize&&this.setSize(this.sourceWidth,this.sourceHeight),this._contentItem.type==t.PackageItemType.Image)this._content.src=this._contentItem.file,this._content.scale9Grid=this._contentItem.scale9Grid,this._content.scaleByTile=this._contentItem.scaleByTile,this._content.tileGridIndice=this._contentItem.tileGridIndice,this.sourceWidth=this._contentItem.width,this.sourceHeight=this._contentItem.height,this.updateLayout();else if(this._contentItem.type==t.PackageItemType.MovieClip)this.sourceWidth=this._contentItem.width,this.sourceHeight=this._contentItem.height,this._content.interval=this._contentItem.interval,this._content.swing=this._contentItem.swing,this._content.repeatDelay=this._contentItem.repeatDelay,this._content.frames=this._contentItem.frames,this.updateLayout();else if(this._contentItem.type==t.PackageItemType.Component){var i=oe.createObjectFromURL(e);i?i instanceof Ae?(this._content2=i,this._displayObject.addChild(this._content2.displayObject),this.updateLayout()):(i.dispose(),this.setErrorState()):this.setErrorState()}else this.setErrorState();else this.setErrorState()}setErrorState(){}clearErrorState(){}updateLayout(){if(!this._content2&&!this._content.src&&!this._content.frames)return void(this._autoSize&&(this._updatingLayout=!0,this.setSize(50,30),this._updatingLayout=!1));let e=this.sourceWidth,i=this.sourceHeight;if(this._autoSize&&(this._updatingLayout=!0,0==e&&(e=50),0==i&&(i=30),this.setSize(e,i),this._updatingLayout=!1,e==this._width&&i==this._height))this._content2?(this._content2.setPosition(0,0),this._content2.setScale(1,1)):(this._content.setSize(e,i),this._content.setPosition(0,0));else{var s,h,r=1,a=1;this._fill!=t.LoaderFillType.None&&(r=this.width/this.sourceWidth,a=this.height/this.sourceHeight,1==r&&1==a||(this._fill==t.LoaderFillType.ScaleMatchHeight?r=a:this._fill==t.LoaderFillType.ScaleMatchWidth?a=r:this._fill==t.LoaderFillType.Scale?r>a?r=a:a=r:this._fill==t.LoaderFillType.ScaleNoBorder&&(r>a?a=r:r=a),this._shrinkOnly&&(r>1&&(r=1),a>1&&(a=1)),e=this.sourceWidth*r,i=this.sourceHeight*a)),this._content2?this._content2.setScale(r,a):this._content.setSize(e,i),s="center"==this._align?Math.floor((this.width-e)/2):"right"==this._align?this.width-e:0,h="middle"==this._valign?Math.floor((this.height-i)/2):"bottom"==this._valign?this.height-i:0,this._content2?this._content2.setPosition(s,h):this._content.setPosition(s,h)}}clearContent(){this.clearErrorState(),this._content.src=null,this._content.frames=null,this._content2&&(this._content2.dispose(),this._content2=null),this._contentItem=null}handleSizeChanged(){super.handleSizeChanged(),this._updatingLayout||this.updateLayout()}getProp(e){switch(e){case t.ObjectPropID.Color:return this.color;case t.ObjectPropID.Playing:return this.playing;case t.ObjectPropID.Frame:return this.frame;case t.ObjectPropID.TimeScale:return this._content.timeScale;default:return super.getProp(e)}}setProp(e,i){switch(e){case t.ObjectPropID.Color:this.color=i;break;case t.ObjectPropID.Playing:this.playing=i;break;case t.ObjectPropID.Frame:this.frame=i;break;case t.ObjectPropID.TimeScale:this._content.timeScale=i;break;case t.ObjectPropID.DeltaTime:this._content.advance(i);break;default:super.setProp(e,i)}}setup_beforeAdd(t,e){var i;super.setup_beforeAdd(t,e),t.seek(e,5),this._url=t.readS(),i=t.readByte(),this._align=0==i?"left":1==i?"center":"right",i=t.readByte(),this._valign=0==i?"top":1==i?"middle":"bottom",this._fill=t.readByte(),this._shrinkOnly=t.readBool(),this._autoSize=t.readBool(),t.readBool(),this._content.playing=t.readBool(),this._content.frame=t.readInt(),t.readBool()&&(this.color=t.readColor()),this._content.fillMethod=t.readByte(),0!=this._content.fillMethod&&(this._content.fillOrigin=t.readByte(),this._content.fillClockwise=t.readBool(),this._content.fillAmount=t.readFloat()),this._url&&this.loadContent()}}class Qe extends Ct{}class Ze extends Ae{constructor(){super()}get icon(){return this._iconObject?this._iconObject.icon:null}set icon(t){this._iconObject&&(this._iconObject.icon=t),this.updateGear(7)}get title(){return this._titleObject?this._titleObject.text:null}set title(t){this._titleObject&&(this._titleObject.text=t),this.updateGear(6)}get text(){return this.title}set text(t){this.title=t}get titleColor(){var t=this.getTextField();return t?t.color:0}set titleColor(t){var e=this.getTextField();e&&(e.color=t),this.updateGear(4)}get titleFontSize(){var t=this.getTextField();return t?t.textFormat.size:0}set titleFontSize(t){var e=this.getTextField();e&&(e.textFormat.size=t,e.applyFormat())}get color(){return this.titleColor}set color(t){this.titleColor=t}set editable(t){this._titleObject instanceof qe&&(this._titleObject.editable=t)}get editable(){return this._titleObject instanceof qe&&this._titleObject.editable}getTextField(){return this._titleObject instanceof He?this._titleObject:"getTextField"in this._titleObject?this._titleObject.getTextField():null}getProp(e){switch(e){case t.ObjectPropID.Color:return this.titleColor;case t.ObjectPropID.OutlineColor:var i=this.getTextField();return i?i.textFormat.outlineColor:0;case t.ObjectPropID.FontSize:return this.titleFontSize;default:return super.getProp(e)}}setProp(e,i){switch(e){case t.ObjectPropID.Color:this.titleColor=i;break;case t.ObjectPropID.OutlineColor:var s=this.getTextField();s&&(s.textFormat.outlineColor=i,s.applyFormat());break;case t.ObjectPropID.FontSize:this.titleFontSize=i;break;default:super.setProp(e,i)}}constructExtension(t){this._titleObject=this.getChild("title"),this._iconObject=this.getChild("icon")}setup_afterAdd(t,e){if(super.setup_afterAdd(t,e),t.seek(e,6)&&t.readByte()==this.packageItem.objectType){var i;null!=(i=t.readS())&&(this.title=i),null!=(i=t.readS())&&(this.icon=i),t.readBool()&&(this.titleColor=t.readColor());var s=t.readInt();if(0!=s&&(this.titleFontSize=s),t.readBool()){var h=this.getTextField();h instanceof qe?(null!=(i=t.readS())&&h.setPromptText(i),null!=(i=t.readS())&&h.setRestrict(i),0!=(s=t.readInt())&&h.setMaxLength(s),0!=(s=t.readInt())&&(4==s?h.setKeyboardType("number"):3==s&&h.setKeyboardType("url")),t.readBool()&&(h.password=!0)):t.skip(13)}}}}class $e extends Ae{constructor(){super(),this._soundVolumeScale=0,this._downEffect=0,this._downEffectValue=0,this._downScaled=!1,this._mode=t.ButtonMode.Common,this._title="",this._icon="",this._sound=bt.buttonSound,this._soundVolumeScale=bt.buttonSoundVolumeScale,this._changeStateOnClick=!0,this._downEffectValue=.8}get icon(){return this._icon}set icon(t){this._icon=t,t=this._selected&&this._selectedIcon?this._selectedIcon:this._icon,this._iconObject&&(this._iconObject.icon=t),this.updateGear(7)}get selectedIcon(){return this._selectedIcon}set selectedIcon(t){this._selectedIcon=t,t=this._selected&&this._selectedIcon?this._selectedIcon:this._icon,this._iconObject&&(this._iconObject.icon=t)}get title(){return this._title}set title(t){this._title=t,this._titleObject&&(this._titleObject.text=this._selected&&this._selectedTitle?this._selectedTitle:this._title),this.updateGear(6)}get text(){return this.title}set text(t){this.title=t}get selectedTitle(){return this._selectedTitle}set selectedTitle(t){this._selectedTitle=t,this._titleObject&&(this._titleObject.text=this._selected&&this._selectedTitle?this._selectedTitle:this._title)}get titleColor(){var t=this.getTextField();return t?t.color:0}set titleColor(t){var e=this.getTextField();e&&(e.color=t),this.updateGear(4)}get titleFontSize(){var t=this.getTextField();return t?t.textFormat.size:0}set titleFontSize(t){var e=this.getTextField();e&&(e.textFormat.size=t,e.applyFormat())}get sound(){return this._sound}set sound(t){this._sound=t}get soundVolumeScale(){return this._soundVolumeScale}set soundVolumeScale(t){this._soundVolumeScale=t}set selected(e){if(this._mode!=t.ButtonMode.Common&&this._selected!=e){if(this._selected=e,this.setCurrentState(),this._selectedTitle&&this._titleObject&&(this._titleObject.text=this._selected?this._selectedTitle:this._title),this._selectedIcon){var i=this._selected?this._selectedIcon:this._icon;this._iconObject&&(this._iconObject.icon=i)}this._relatedController&&this._parent&&!this._parent._buildingDisplayList&&(this._selected?(this._relatedController.selectedPageId=this._relatedPageId,this._relatedController.autoRadioGroupDepth&&this._parent.adjustRadioGroupDepth(this,this._relatedController)):this._mode==t.ButtonMode.Check&&this._relatedController.selectedPageId==this._relatedPageId&&(this._relatedController.oppositePageId=this._relatedPageId))}}get selected(){return this._selected}get mode(){return this._mode}set mode(e){this._mode!=e&&(e==t.ButtonMode.Common&&(this.selected=!1),this._mode=e)}get relatedController(){return this._relatedController}set relatedController(t){t!=this._relatedController&&(this._relatedController=t,this._relatedPageId=null)}get relatedPageId(){return this._relatedPageId}set relatedPageId(t){this._relatedPageId=t}get changeStateOnClick(){return this._changeStateOnClick}set changeStateOnClick(t){this._changeStateOnClick=t}get linkedPopup(){return this._linkedPopup}set linkedPopup(t){this._linkedPopup=t}getTextField(){return this._titleObject instanceof He?this._titleObject:"getTextField"in this._titleObject?this._titleObject.getTextField():null}fireClick(e,i){(e=e||!1)&&this._mode==t.ButtonMode.Common&&(this.setState("over"),z.add(100,1,this.setState,this,"down"),z.add(200,1,this.setState,this,()=>{this.setState("up"),i&&this.dispatchEvent("click")}))}setState(e){if(this._buttonController&&(this._buttonController.selectedPage=e),1==this._downEffect){var i=this.numChildren;if("down"==e||"selectedOver"==e||"selectedDisabled"==e)for(var s=255*this._downEffectValue,h=(s<<16)+(s<<8)+s,r=0;r<i;r++){var a=this.getChildAt(r);a instanceof He||a.setProp(t.ObjectPropID.Color,h)}else for(r=0;r<i;r++)(a=this.getChildAt(r))instanceof He||a.setProp(t.ObjectPropID.Color,16777215)}else 2==this._downEffect&&("down"==e||"selectedOver"==e||"selectedDisabled"==e?this._downScaled||(this.setScale(this.scaleX*this._downEffectValue,this.scaleY*this._downEffectValue),this._downScaled=!0):this._downScaled&&(this.setScale(this.scaleX/this._downEffectValue,this.scaleY/this._downEffectValue),this._downScaled=!1))}setCurrentState(){this.grayed&&this._buttonController&&this._buttonController.hasPage("disabled")?this._selected?this.setState("selectedDisabled"):this.setState("disabled"):this._selected?this.setState(this._over?"selectedOver":"down"):this.setState(this._over?"over":"up")}handleControllerChanged(t){super.handleControllerChanged(t),this._relatedController==t&&(this.selected=this._relatedPageId==t.selectedPageId)}handleGrayedChanged(){this._buttonController&&this._buttonController.hasPage("disabled")?this.grayed?this._selected&&this._buttonController.hasPage("selectedDisabled")?this.setState("selectedDisabled"):this.setState("disabled"):this._selected?this.setState("down"):this.setState("up"):super.handleGrayedChanged()}getProp(e){switch(e){case t.ObjectPropID.Color:return this.titleColor;case t.ObjectPropID.OutlineColor:var i=this.getTextField();return i?i.textFormat.outlineColor:0;case t.ObjectPropID.FontSize:return this.titleFontSize;case t.ObjectPropID.Selected:return this.selected;default:return super.getProp(e)}}setProp(e,i){switch(e){case t.ObjectPropID.Color:this.titleColor=i;break;case t.ObjectPropID.OutlineColor:var s=this.getTextField();s&&(s.textFormat.outlineColor=i,s.applyFormat());break;case t.ObjectPropID.FontSize:this.titleFontSize=i;break;case t.ObjectPropID.Selected:this.selected=i;break;default:super.setProp(e,i)}}constructExtension(e){e.seek(0,6),this._mode=e.readByte();var i=e.readS();i&&(this._sound=i),this._soundVolumeScale=e.readFloat(),this._downEffect=e.readByte(),this._downEffectValue=e.readFloat(),2==this._downEffect&&this.setPivot(.5,.5,this.pivotAsAnchor),this._buttonController=this.getController("button"),this._titleObject=this.getChild("title"),this._iconObject=this.getChild("icon"),this._titleObject&&(this._title=this._titleObject.text),this._iconObject&&(this._icon=this._iconObject.icon),this._mode==t.ButtonMode.Common&&this.setState("up"),this.on("roll_over",this.__rollover,this),this.on("roll_out",this.__rollout,this),this.on("touch_begin",this.__btnTouchBegin,this),this.on("touch_end",this.__btnTouchEnd,this),this.on("click",this.__click,this),this.on("removed_from_stage",this.__removeFromStage,this)}setup_afterAdd(t,e){var i,s;(super.setup_afterAdd(t,e),t.seek(e,6))&&(t.readByte()==this.packageItem.objectType&&(null!=(i=t.readS())&&(this.title=i),null!=(i=t.readS())&&(this.selectedTitle=i),null!=(i=t.readS())&&(this.icon=i),null!=(i=t.readS())&&(this.selectedIcon=i),t.readBool()&&(this.titleColor=t.readColor()),0!=(s=t.readInt())&&(this.titleFontSize=s),(s=t.readShort())>=0&&(this._relatedController=this.parent.getControllerAt(s)),this._relatedPageId=t.readS(),null!=(i=t.readS())&&(this._sound=i),t.readBool()&&(this._soundVolumeScale=t.readFloat()),this.selected=t.readBool()))}__rollover(){this._buttonController&&this._buttonController.hasPage("over")&&(this._over=!0,this._down||this.grayed&&this._buttonController.hasPage("disabled")||this.setState(this._selected?"selectedOver":"over"))}__rollout(){this._buttonController&&this._buttonController.hasPage("over")&&(this._over=!1,this._down||this.grayed&&this._buttonController.hasPage("disabled")||this.setState(this._selected?"down":"up"))}__btnTouchBegin(e){0==e.input.button&&(this._down=!0,e.captureTouch(),this._mode==t.ButtonMode.Common&&(this.grayed&&this._buttonController&&this._buttonController.hasPage("disabled")?this.setState("selectedDisabled"):this.setState("down")),this._linkedPopup&&(this._linkedPopup instanceof Re?this._linkedPopup.toggleStatus():De.inst.togglePopup(this._linkedPopup,this)))}__btnTouchEnd(e){this._down&&(this._down=!1,this._mode==t.ButtonMode.Common?this.grayed&&this._buttonController&&this._buttonController.hasPage("disabled")?this.setState("disabled"):this._over?this.setState("over"):this.setState("up"):this._over||!this._buttonController||"over"!=this._buttonController.selectedPage&&"selectedOver"!=this._buttonController.selectedPage||this.setCurrentState())}__removeFromStage(){this._over&&this.__rollout()}__click(e){if(this._sound){var i=oe.getItemByURL(this._sound);i?De.inst.playOneShotSound(i.file):De.inst.playOneShotSound(this._sound)}this._mode==t.ButtonMode.Check?this._changeStateOnClick&&(this.selected=!this._selected,this.dispatchEvent("status_changed")):this._mode==t.ButtonMode.Radio?this._changeStateOnClick&&!this._selected&&(this.selected=!0,this.dispatchEvent("status_changed")):this._relatedController&&(this._relatedController.selectedPageId=this._relatedPageId)}}class Je extends Ae{constructor(){super(),this.visibleItemCount=bt.defaultComboBoxVisibleItemCount,this.popupDirection=t.PopupDirection.Auto,this._itemsUpdated=!0,this._selectedIndex=-1,this._items=[],this._values=[]}get text(){return this._titleObject?this._titleObject.text:null}set text(t){this._titleObject&&(this._titleObject.text=t),this.updateGear(6)}get titleColor(){var t=this.getTextField();return t?t.color:0}set titleColor(t){var e=this.getTextField();e&&(e.color=t),this.updateGear(4)}get titleFontSize(){var t=this.getTextField();return t?t.textFormat.size:0}set titleFontSize(t){var e=this.getTextField();e&&(e.textFormat.size=t,e.applyFormat())}get icon(){return this._iconObject?this._iconObject.icon:null}set icon(t){this._iconObject&&(this._iconObject.icon=t),this.updateGear(7)}get items(){return this._items}set items(t){t?this._items=t.concat():this._items.length=0,this._items.length>0?(this._selectedIndex>=this._items.length?this._selectedIndex=this._items.length-1:-1==this._selectedIndex&&(this._selectedIndex=0),this.text=this._items[this._selectedIndex],this._icons&&this._selectedIndex<this._icons.length&&(this.icon=this._icons[this._selectedIndex])):(this.text="",this._icons&&(this.icon=null),this._selectedIndex=-1),this._itemsUpdated=!0}get icons(){return this._icons}set icons(t){this._icons=t,this._icons&&-1!=this._selectedIndex&&this._selectedIndex<this._icons.length&&(this.icon=this._icons[this._selectedIndex])}get values(){return this._values}set values(t){t?this._values=t.concat():this._values.length=0}get selectedIndex(){return this._selectedIndex}set selectedIndex(t){this._selectedIndex!=t&&(this._selectedIndex=t,this._selectedIndex>=0&&this._selectedIndex<this._items.length?(this.text=this._items[this._selectedIndex],this._icons&&this._selectedIndex<this._icons.length&&(this.icon=this._icons[this._selectedIndex])):(this.text="",this._icons&&(this.icon=null)),this.updateSelectionController())}get value(){return this._values[this._selectedIndex]}set value(t){var e=this._values.indexOf(t);-1==e&&null==t&&(e=this._values.indexOf("")),this.selectedIndex=e}getTextField(){return this._titleObject instanceof He?this._titleObject:"getTextField"in this._titleObject?this._titleObject.getTextField():null}setState(t){this._buttonController&&(this._buttonController.selectedPage=t)}setCurrentState(){this.grayed&&this._buttonController&&this._buttonController.hasPage("disabled")?this.setState("disabled"):this.dropdown&&this.dropdown.parent?this.setState("down"):this.setState(this._over?"over":"up")}get selectionController(){return this._selectionController}set selectionController(t){this._selectionController=t}handleControllerChanged(t){super.handleControllerChanged(t),this._selectionController==t&&(this.selectedIndex=t.selectedIndex)}updateSelectionController(){if(this._selectionController&&!this._selectionController.changing&&this._selectedIndex<this._selectionController.pageCount){var t=this._selectionController;this._selectionController=null,t.selectedIndex=this._selectedIndex,this._selectionController=t}}dispose(){this.dropdown&&(this.dropdown.dispose(),this.dropdown=null),this._selectionController=null,super.dispose()}getProp(e){switch(e){case t.ObjectPropID.Color:return this.titleColor;case t.ObjectPropID.OutlineColor:var i=this.getTextField();return i?i.textFormat.outlineColor:0;case t.ObjectPropID.FontSize:return(i=this.getTextField())?i.textFormat.size:0;default:return super.getProp(e)}}setProp(e,i){switch(e){case t.ObjectPropID.Color:this.titleColor=i;break;case t.ObjectPropID.OutlineColor:var s=this.getTextField();s&&(s.textFormat.outlineColor=i,s.applyFormat());break;case t.ObjectPropID.FontSize:(s=this.getTextField())&&(s.textFormat.size=i,s.applyFormat());break;default:super.setProp(e,i)}}constructExtension(e){this._buttonController=this.getController("button"),this._titleObject=this.getChild("title"),this._iconObject=this.getChild("icon");let i=e.readS();if(i){let e=oe.createObjectFromURL(i);if(!(e instanceof Ae))return void console.warn(this.resourceURL+" should be a component.");if(this.dropdown=e,this._list=this.dropdown.getChild("list"),null==this._list)return void console.warn(this.resourceURL+": should container a list component named list.");this._list.on("click_item",this.__clickItem,this),this._list.addRelation(this.dropdown,t.RelationType.Width),this._list.removeRelation(this.dropdown,t.RelationType.Height),this.dropdown.addRelation(this._list,t.RelationType.Height),this.dropdown.removeRelation(this._list,t.RelationType.Width),this.dropdown.on("removed_from_stage",this.__popupWinClosed,this)}this.on("roll_over",this.__rollover,this),this.on("roll_out",this.__rollout,this),this.on("touch_begin",this.__mousedown,this),this.on("touch_end",this.__mouseup,this)}setup_afterAdd(t,e){if(super.setup_afterAdd(t,e),t.seek(e,6)&&t.readByte()==this.packageItem.objectType){var i,s,h,r,a=t.readShort();for(i=0;i<a;i++)h=t.readShort(),h+=t.pos,this._items[i]=t.readS(),this._values[i]=t.readS(),null!=(r=t.readS())&&(null==this._icons&&(this._icons=[]),this._icons[i]=r),t.pos=h;null!=(r=t.readS())?(this.text=r,this._selectedIndex=this._items.indexOf(r)):this._items.length>0?(this._selectedIndex=0,this.text=this._items[0]):this._selectedIndex=-1,null!=(r=t.readS())&&(this.icon=r),t.readBool()&&(this.titleColor=t.readColor()),(s=t.readInt())>0&&(this.visibleItemCount=s),this.popupDirection=t.readByte(),(s=t.readShort())>=0&&(this._selectionController=this.parent.getControllerAt(s))}}showDropdown(){if(this._itemsUpdated){this._itemsUpdated=!1,this._list.removeChildrenToPool();for(var t=this._items.length,e=0;e<t;e++){var i=this._list.addItemFromPool();i.name=e<this._values.length?this._values[e]:"",i.text=this._items[e],i.icon=this._icons&&e<this._icons.length?this._icons[e]:null}this._list.resizeToFit(this.visibleItemCount)}this._list.selectedIndex=-1,this.dropdown.width=this.width,this._list.ensureBoundsCorrect(),De.inst.togglePopup(this.dropdown,this,this.popupDirection),this.dropdown.parent&&this.setState("down")}__popupWinClosed(){this.setCurrentState()}__clickItem(t){this.dropdown.parent instanceof De&&this.dropdown.parent.hidePopup(),this._selectedIndex=-1,this.selectedIndex=this._list.getChildIndex(t.data),this.dispatchEvent("status_changed")}__rollover(){this._over=!0,this._down||this.dropdown&&this.dropdown.parent||this.setCurrentState()}__rollout(){this._over=!1,this._down||this.dropdown&&this.dropdown.parent||this.setCurrentState()}__mousedown(t){t.initiator instanceof Xe||(this._down=!0,this.dropdown&&this.showDropdown(),t.captureTouch())}__mouseup(){this._down&&(this._down=!1,this.setCurrentState())}}let ti=new T;class ei extends Ae{constructor(){super(),this.changeOnClick=!0,this.canDrag=!0,this._min=0,this._max=0,this._value=0,this._barMaxWidth=0,this._barMaxHeight=0,this._barMaxWidthDelta=0,this._barMaxHeightDelta=0,this._clickPercent=0,this._barStartX=0,this._barStartY=0,this._titleType=t.ProgressTitleType.Percent,this._value=50,this._max=100,this._clickPos=new T}get titleType(){return this._titleType}set titleType(t){this._titleType=t}get wholeNumbers(){return this._wholeNumbers}set wholeNumbers(t){this._wholeNumbers!=t&&(this._wholeNumbers=t,this.update())}get min(){return this._min}set min(t){this._min!=t&&(this._min=t,this.update())}get max(){return this._max}set max(t){this._max!=t&&(this._max=t,this.update())}get value(){return this._value}set value(t){this._value!=t&&(this._value=t,this.update())}update(){this.updateWithPercent((this._value-this._min)/(this._max-this._min),!1)}updateWithPercent(e,i){if(e=Dt(e),i){var s=Rt(this._min+(this._max-this._min)*e,this._min,this._max);if(this._wholeNumbers&&(e=Dt(((s=Math.round(s))-this._min)/(this._max-this._min))),s!=this._value&&(this._value=s,this.dispatchEvent("status_changed")))return}if(this._titleObject)switch(this._titleType){case t.ProgressTitleType.Percent:this._titleObject.text=Math.floor(100*e)+"%";break;case t.ProgressTitleType.ValueAndMax:this._titleObject.text=this._value+"/"+this._max;break;case t.ProgressTitleType.Value:this._titleObject.text=""+this._value;break;case t.ProgressTitleType.Max:this._titleObject.text=""+this._max}var h=this.width-this._barMaxWidthDelta,r=this.height-this._barMaxHeightDelta;this._reverse?(this._barObjectH&&(this._barObjectH.width=Math.round(h*e),this._barObjectH.x=this._barStartX+(h-this._barObjectH.width)),this._barObjectV&&(this._barObjectV.height=Math.round(r*e),this._barObjectV.y=this._barStartY+(r-this._barObjectV.height))):(this._barObjectH&&(this._barObjectH.width=Math.round(h*e)),this._barObjectV&&(this._barObjectV.height=Math.round(r*e)))}constructExtension(t){t.seek(0,6),this._titleType=t.readByte(),this._reverse=t.readBool(),t.version>=2&&(this._wholeNumbers=t.readBool(),this.changeOnClick=t.readBool()),this._titleObject=this.getChild("title"),this._barObjectH=this.getChild("bar"),this._barObjectV=this.getChild("bar_v"),this._gripObject=this.getChild("grip"),this._barObjectH&&(this._barMaxWidth=this._barObjectH.width,this._barMaxWidthDelta=this.width-this._barMaxWidth,this._barStartX=this._barObjectH.x),this._barObjectV&&(this._barMaxHeight=this._barObjectV.height,this._barMaxHeightDelta=this.height-this._barMaxHeight,this._barStartY=this._barObjectV.y),this._gripObject&&(this._gripObject.on("touch_begin",this.__gripTouchBegin,this),this._gripObject.on("touch_move",this.__gripTouchMove,this)),this.on("touch_begin",this.__barTouchBegin,this)}handleSizeChanged(){super.handleSizeChanged(),this._barObjectH&&(this._barMaxWidth=this.width-this._barMaxWidthDelta),this._barObjectV&&(this._barMaxHeight=this.height-this._barMaxHeightDelta),this._underConstruct||this.update()}setup_afterAdd(t,e){super.setup_afterAdd(t,e),t.seek(e,6)&&t.readByte()==this.packageItem.objectType?(this._value=t.readInt(),this._max=t.readInt(),t.version>=2&&(this._min=t.readInt()),this.update()):this.update()}__gripTouchBegin(t){0==t.input.button&&(this.canDrag=!0,t.stopPropagation(),t.captureTouch(),this.globalToLocal(t.input.x,t.input.y,this._clickPos),this._clickPercent=Dt((this._value-this._min)/(this._max-this._min)))}__gripTouchMove(t){if(this.canDrag){var e,i=this.globalToLocal(t.input.x,t.input.y,ti),s=i.x-this._clickPos.x,h=i.y-this._clickPos.y;this._reverse&&(s=-s,h=-h),e=this._barObjectH?this._clickPercent+s/this._barMaxWidth:this._clickPercent+h/this._barMaxHeight,this.updateWithPercent(e,!0)}}__barTouchBegin(t){if(this.changeOnClick){var e=this._gripObject.globalToLocal(t.input.x,t.input.y,ti),i=Dt((this._value-this._min)/(this._max-this._min)),s=0;this._barObjectH&&(s=(e.x-this._gripObject.width/2)/this._barMaxWidth),this._barObjectV&&(s=(e.y-this._gripObject.height/2)/this._barMaxHeight),this._reverse?i-=s:i+=s,this.updateWithPercent(i,!0)}}}class ii extends Ae{constructor(){super(),this._min=0,this._max=0,this._value=0,this._barMaxWidth=0,this._barMaxHeight=0,this._barMaxWidthDelta=0,this._barMaxHeightDelta=0,this._barStartX=0,this._barStartY=0,this._titleType=t.ProgressTitleType.Percent,this._value=50,this._max=100}get titleType(){return this._titleType}set titleType(t){this._titleType!=t&&(this._titleType=t,this.update(t))}get min(){return this._min}set min(t){this._min!=t&&(this._min=t,this.update(this._value))}get max(){return this._max}set max(t){this._max!=t&&(this._max=t,this.update(this._value))}get value(){return this._value}set value(t){this._value!=t&&(mt.kill(this,!1,this.update),this._value=t,this.update(t))}tweenValue(e,i){var s,h=mt.getTween(this,this.update);return h?(s=h.value.x,h.kill()):s=this._value,this._value=e,mt.to(s,this._value,i).setTarget(this,this.update).setEase(t.EaseType.Linear)}update(e){var i=Dt((e-this._min)/(this._max-this._min));if(this._titleObject)switch(this._titleType){case t.ProgressTitleType.Percent:this._titleObject.text=Math.floor(100*i)+"%";break;case t.ProgressTitleType.ValueAndMax:this._titleObject.text=Math.floor(e)+"/"+Math.floor(this._max);break;case t.ProgressTitleType.Value:this._titleObject.text=""+Math.floor(e);break;case t.ProgressTitleType.Max:this._titleObject.text=""+Math.floor(this._max)}var s=this.width-this._barMaxWidthDelta,h=this.height-this._barMaxHeightDelta;this._reverse?(this._barObjectH&&(this.setFillAmount(this._barObjectH,1-i)||(this._barObjectH.width=Math.round(s*i),this._barObjectH.x=this._barStartX+(s-this._barObjectH.width))),this._barObjectV&&(this.setFillAmount(this._barObjectV,1-i)||(this._barObjectV.height=Math.round(h*i),this._barObjectV.y=this._barStartY+(h-this._barObjectV.height)))):(this._barObjectH&&(this.setFillAmount(this._barObjectH,i)||(this._barObjectH.width=Math.round(s*i))),this._barObjectV&&(this.setFillAmount(this._barObjectV,i)||(this._barObjectV.height=Math.round(h*i)))),this._aniObject&&this._aniObject.setProp(t.ObjectPropID.Frame,Math.floor(100*i))}setFillAmount(e,i){return(e instanceof Nt||e instanceof Ke)&&e.fillMethod!=t.FillMethod.None&&(e.fillAmount=i,!0)}constructExtension(t){t.seek(0,6),this._titleType=t.readByte(),this._reverse=t.readBool(),this._titleObject=this.getChild("title"),this._barObjectH=this.getChild("bar"),this._barObjectV=this.getChild("bar_v"),this._aniObject=this.getChild("ani"),this._barObjectH&&(this._barMaxWidth=this._barObjectH.width,this._barMaxWidthDelta=this.width-this._barMaxWidth,this._barStartX=this._barObjectH.x),this._barObjectV&&(this._barMaxHeight=this._barObjectV.height,this._barMaxHeightDelta=this.height-this._barMaxHeight,this._barStartY=this._barObjectV.y)}handleSizeChanged(){super.handleSizeChanged(),this._barObjectH&&(this._barMaxWidth=this.width-this._barMaxWidthDelta),this._barObjectV&&(this._barMaxHeight=this.height-this._barMaxHeightDelta),this._underConstruct||this.update(this._value)}setup_afterAdd(t,e){super.setup_afterAdd(t,e),t.seek(e,6)&&t.readByte()==this.packageItem.objectType?(this._value=t.readInt(),this._max=t.readInt(),t.version>=2&&(this._min=t.readInt()),this.update(this._value)):this.update(this._value)}}var si=new T;class hi extends Ae{constructor(){super(),this._dragOffset=new T,this._scrollPerc=0}setScrollPane(t,e){this._target=t,this._vertical=e}setDisplayPerc(t){this._vertical?(this._fixedGripSize||(this._grip.height=Math.floor(t*this._bar.height)),this._grip.y=this._bar.y+(this._bar.height-this._grip.height)*this._scrollPerc):(this._fixedGripSize||(this._grip.width=Math.floor(t*this._bar.width)),this._grip.x=this._bar.x+(this._bar.width-this._grip.width)*this._scrollPerc),this._grip.visible=0!=t&&1!=t}setScrollPerc(t){this._scrollPerc=t,this._vertical?this._grip.y=this._bar.y+(this._bar.height-this._grip.height)*this._scrollPerc:this._grip.x=this._bar.x+(this._bar.width-this._grip.width)*this._scrollPerc}get minSize(){return this._vertical?(this._arrowButton1?this._arrowButton1.height:0)+(this._arrowButton2?this._arrowButton2.height:0):(this._arrowButton1?this._arrowButton1.width:0)+(this._arrowButton2?this._arrowButton2.width:0)}get gripDragging(){return this._gripDragging}constructExtension(t){t.seek(0,6),this._fixedGripSize=t.readBool(),this._grip=this.getChild("grip"),this._grip?(this._bar=this.getChild("bar"),this._bar?(this._arrowButton1=this.getChild("arrow1"),this._arrowButton2=this.getChild("arrow2"),this._grip.on("touch_begin",this.__gripTouchBegin,this),this._grip.on("touch_move",this.__gripTouchMove,this),this._grip.on("touch_end",this.__gripTouchEnd,this),this.on("touch_begin",this.__barTouchBegin,this),this._arrowButton1&&this._arrowButton1.on("touch_begin",this.__arrowButton1Click,this),this._arrowButton2&&this._arrowButton2.on("touch_begin",this.__arrowButton2Click,this)):console.warn("需要定义bar")):console.warn("需要定义grip")}__gripTouchBegin(t){null!=this._bar&&(t.stopPropagation(),this._gripDragging=!0,this._target.updateScrollBarVisible(),this.globalToLocal(t.input.x,t.input.y,this._dragOffset),this._dragOffset.x-=this._grip.x,this._dragOffset.y-=this._grip.y)}__gripTouchMove(t){if(this.onStage){var e=this.globalToLocal(t.input.x,t.input.y,si);if(this._vertical){let t=e.y-this._dragOffset.y,i=this._bar.height-this._grip.height;this._target.percY=0==i?0:(t-this._bar.y)/i}else{let t=e.x-this._dragOffset.x,i=this._bar.width-this._grip.width;this._target.percX=0==i?0:(t-this._bar.x)/(this._bar.width-this._grip.width)}}}__gripTouchEnd(t){this._gripDragging=!1,this._target.updateScrollBarVisible()}__arrowButton1Click(t){t.stopPropagation(),this._vertical?this._target.scrollUp():this._target.scrollLeft()}__arrowButton2Click(t){t.stopPropagation(),this._vertical?this._target.scrollDown():this._target.scrollRight()}__barTouchBegin(t){t.stopPropagation();var e=this._grip.globalToLocal(t.input.x,t.input.y,si);this._vertical?e.y<0?this._target.scrollUp(4):this._target.scrollDown(4):e.x<0?this._target.scrollLeft(4):this._target.scrollRight(4)}}class ri{constructor(){this._count=0,this._pool={}}clear(){for(var t in this._pool){this._pool[t].forEach(t=>t.dispose())}this._pool={},this._count=0}get count(){return this._count}getObject(t){if(null==(t=oe.normalizeURL(t)))return null;var e=this._pool[t];return e&&e.length>0?(this._count--,e.shift()):oe.createObjectFromURL(t)}returnObject(t){var e=t.resourceURL;if(e){var i=this._pool[e];i||(i=[],this._pool[e]=i),this._count++,i.push(t)}}}class ai extends Ae{constructor(){super(),this._lineCount=0,this._columnCount=0,this._lineGap=0,this._columnGap=0,this._lastSelectedIndex=0,this._numItems=0,this._firstIndex=0,this._curLineItemCount=0,this._virtualListChanged=0,this.itemInfoVer=0,this._trackBounds=!0,this._pool=new ri,this._layout=t.ListLayoutType.SingleColumn,this._autoResizeItem=!0,this._lastSelectedIndex=-1,this._selectionMode=t.ListSelectionMode.Single,this.opaque=!0,this.scrollItemToViewOnClick=!0,this._align="left",this._valign="top",this._container=new O,this._displayObject.addChild(this._container)}dispose(){this._pool.clear(),super.dispose()}get layout(){return this._layout}set layout(t){this._layout!=t&&(this._layout=t,this.setBoundsChangedFlag(),this._virtual&&this.setVirtualListChangedFlag(!0))}get lineCount(){return this._lineCount}set lineCount(e){this._lineCount!=e&&(this._lineCount=e,this._layout!=t.ListLayoutType.FlowVertical&&this._layout!=t.ListLayoutType.Pagination||(this.setBoundsChangedFlag(),this._virtual&&this.setVirtualListChangedFlag(!0)))}get columnCount(){return this._columnCount}set columnCount(e){this._columnCount!=e&&(this._columnCount=e,this._layout!=t.ListLayoutType.FlowHorizontal&&this._layout!=t.ListLayoutType.Pagination||(this.setBoundsChangedFlag(),this._virtual&&this.setVirtualListChangedFlag(!0)))}get lineGap(){return this._lineGap}set lineGap(t){this._lineGap!=t&&(this._lineGap=t,this.setBoundsChangedFlag(),this._virtual&&this.setVirtualListChangedFlag(!0))}get columnGap(){return this._columnGap}set columnGap(t){this._columnGap!=t&&(this._columnGap=t,this.setBoundsChangedFlag(),this._virtual&&this.setVirtualListChangedFlag(!0))}get align(){return this._align}set align(t){this._align!=t&&(this._align=t,this.setBoundsChangedFlag(),this._virtual&&this.setVirtualListChangedFlag(!0))}get verticalAlign(){return this._valign}set verticalAlign(t){this._valign!=t&&(this._valign=t,this.setBoundsChangedFlag(),this._virtual&&this.setVirtualListChangedFlag(!0))}get virtualItemSize(){return this._itemSize}set virtualItemSize(t){this._virtual&&(null==this._itemSize&&(this._itemSize=new T),this._itemSize.set(t.x,t.y),this.setVirtualListChangedFlag(!0))}get defaultItem(){return this._defaultItem}set defaultItem(t){this._defaultItem=t}get autoResizeItem(){return this._autoResizeItem}set autoResizeItem(t){this._autoResizeItem!=t&&(this._autoResizeItem=t,this.setBoundsChangedFlag(),this._virtual&&this.setVirtualListChangedFlag(!0))}get selectionMode(){return this._selectionMode}set selectionMode(t){this._selectionMode=t}get selectionController(){return this._selectionController}set selectionController(t){this._selectionController=t}get itemPool(){return this._pool}getFromPool(t){t||(t=this._defaultItem);var e=this._pool.getObject(t);return e&&(e.visible=!0),e}returnToPool(t){this._pool.returnObject(t)}addChildAt(t,e){return super.addChildAt(t,e),t instanceof $e&&(t.selected=!1,t.changeStateOnClick=!1),t.on("click",this.__clickItem,this),t}addItem(t){return t||(t=this._defaultItem),this.addChild(oe.createObjectFromURL(t))}addItemFromPool(t){return this.addChild(this.getFromPool(t))}removeChildAt(t,e){var i=super.removeChildAt(t);return e?i.dispose():i.off("click",this.__clickItem,this),i}removeChildToPoolAt(t){var e=super.removeChildAt(t);this.returnToPool(e)}removeChildToPool(t){super.removeChild(t),this.returnToPool(t)}removeChildrenToPool(t,e){t=t||0,null==e&&(e=-1),(e<0||e>=this._children.length)&&(e=this._children.length-1);for(var i=t;i<=e;++i)this.removeChildToPoolAt(t)}get selectedIndex(){var t;if(this._virtual)for(t=0;t<this._realNumItems;t++){var e=this._virtualItems[t];if(e.obj instanceof $e&&e.obj.selected||null==e.obj&&e.selected)return this._loop?t%this._numItems:t}else{var i=this._children.length;for(t=0;t<i;t++){var s=this._children[t];if(s instanceof $e&&s.selected)return t}}return-1}set selectedIndex(e){e>=0&&e<this.numItems?(this._selectionMode!=t.ListSelectionMode.Single&&this.clearSelection(),this.addSelection(e)):this.clearSelection()}getSelection(t){var e;if(t||(t=new Array),this._virtual)for(e=0;e<this._realNumItems;e++){var i=this._virtualItems[e];if(i.obj instanceof $e&&i.obj.selected||null==i.obj&&i.selected){var s=e;if(this._loop&&(s=e%this._numItems,-1!=t.indexOf(s)))continue;t.push(s)}}else{var h=this._children.length;for(e=0;e<h;e++){var r=this._children[e];r instanceof $e&&r.selected&&t.push(e)}}return t}addSelection(e,i){if(this._selectionMode!=t.ListSelectionMode.None){var s;if(this.checkVirtualList(),this._selectionMode==t.ListSelectionMode.Single&&this.clearSelection(),i&&this.scrollToView(e),this._lastSelectedIndex=e,this._virtual){var h=this._virtualItems[e];h.obj&&(s=h.obj),h.selected=!0}else s=this.getChildAt(e);s instanceof $e&&!s.selected&&(s.selected=!0,this.updateSelectionController(e))}}removeSelection(e){if(this._selectionMode!=t.ListSelectionMode.None){var i;if(this._virtual){var s=this._virtualItems[e];s.obj&&(i=s.obj),s.selected=!1}else i=this.getChildAt(e);i instanceof $e&&(i.selected=!1)}}clearSelection(){var t;if(this._virtual)for(t=0;t<this._realNumItems;t++){var e=this._virtualItems[t];e.obj instanceof $e&&(e.obj.selected=!1),e.selected=!1}else{var i=this._children.length;for(t=0;t<i;t++){var s=this._children[t];s instanceof $e&&(s.selected=!1)}}}clearSelectionExcept(t){var e;if(this._virtual)for(e=0;e<this._realNumItems;e++){var i=this._virtualItems[e];i.obj!=t&&(i.obj instanceof $e&&(i.obj.selected=!1),i.selected=!1)}else{var s=this._children.length;for(e=0;e<s;e++){var h=this._children[e];h instanceof $e&&h!=t&&(h.selected=!1)}}}selectAll(){this.checkVirtualList();var t,e=-1;if(this._virtual)for(t=0;t<this._realNumItems;t++){var i=this._virtualItems[t];i.obj instanceof $e&&!i.obj.selected&&(i.obj.selected=!0,e=t),i.selected=!0}else{var s=this._children.length;for(t=0;t<s;t++){var h=this._children[t];h instanceof $e&&!h.selected&&(h.selected=!0,e=t)}}-1!=e&&this.updateSelectionController(e)}selectNone(){this.clearSelection()}selectReverse(){this.checkVirtualList();var t,e=-1;if(this._virtual)for(t=0;t<this._realNumItems;t++){var i=this._virtualItems[t];i.obj instanceof $e&&(i.obj.selected=!i.obj.selected,i.obj.selected&&(e=t)),i.selected=!i.selected}else{var s=this._children.length;for(t=0;t<s;t++){var h=this._children[t];h instanceof $e&&(h.selected=!h.selected,h.selected&&(e=t))}}-1!=e&&this.updateSelectionController(e)}handleArrowKey(e){var i=this.selectedIndex;if(-1!=i)switch(e){case 1:if(this._layout==t.ListLayoutType.SingleColumn||this._layout==t.ListLayoutType.FlowVertical)--i>=0&&(this.clearSelection(),this.addSelection(i,!0));else if(this._layout==t.ListLayoutType.FlowHorizontal||this._layout==t.ListLayoutType.Pagination){for(var s=this._children[i],h=0,r=i-1;r>=0;r--){var a=this._children[r];if(a.y!=s.y){s=a;break}h++}for(;r>=0;r--)if((a=this._children[r]).y!=s.y){this.clearSelection(),this.addSelection(r+h+1,!0);break}}break;case 3:if(this._layout==t.ListLayoutType.SingleRow||this._layout==t.ListLayoutType.FlowHorizontal||this._layout==t.ListLayoutType.Pagination)++i<this.numItems&&(this.clearSelection(),this.addSelection(i,!0));else if(this._layout==t.ListLayoutType.FlowVertical){s=this._children[i],h=0;var n=this._children.length;for(r=i+1;r<n;r++){if((a=this._children[r]).x!=s.x){s=a;break}h++}for(;r<n;r++)if((a=this._children[r]).x!=s.x){this.clearSelection(),this.addSelection(r-h-1,!0);break}}break;case 5:if(this._layout==t.ListLayoutType.SingleColumn||this._layout==t.ListLayoutType.FlowVertical)++i<this.numItems&&(this.clearSelection(),this.addSelection(i,!0));else if(this._layout==t.ListLayoutType.FlowHorizontal||this._layout==t.ListLayoutType.Pagination){for(s=this._children[i],h=0,n=this._children.length,r=i+1;r<n;r++){if((a=this._children[r]).y!=s.y){s=a;break}h++}for(;r<n;r++)if((a=this._children[r]).y!=s.y){this.clearSelection(),this.addSelection(r-h-1,!0);break}}break;case 7:if(this._layout==t.ListLayoutType.SingleRow||this._layout==t.ListLayoutType.FlowHorizontal||this._layout==t.ListLayoutType.Pagination)--i>=0&&(this.clearSelection(),this.addSelection(i,!0));else if(this._layout==t.ListLayoutType.FlowVertical){for(s=this._children[i],h=0,r=i-1;r>=0;r--){if((a=this._children[r]).x!=s.x){s=a;break}h++}for(;r>=0;r--)if((a=this._children[r]).x!=s.x){this.clearSelection(),this.addSelection(r+h+1,!0);break}}}}__clickItem(t){if(!this._scrollPane||!this._scrollPane.isDragged){var e=Ct.cast(t.sender);this.setSelectionOnEvent(e,t),this._scrollPane&&this.scrollItemToViewOnClick&&this._scrollPane.scrollToView(e,!0),this.dispatchItemEvent(e,t)}}dispatchItemEvent(t,e){this.dispatchEvent("click_item",t)}setSelectionOnEvent(e,i){if(e instanceof $e&&this._selectionMode!=t.ListSelectionMode.None){var s=!1,h=this.childIndexToItemIndex(this.getChildIndex(e));if(this._selectionMode==t.ListSelectionMode.Single)e.selected||(this.clearSelectionExcept(e),e.selected=!0);else if(i.input.shiftKey){if(!e.selected)if(-1!=this._lastSelectedIndex){var r,a=Math.min(this._lastSelectedIndex,h),n=Math.max(this._lastSelectedIndex,h);if(n=Math.min(n,this.numItems-1),this._virtual)for(r=a;r<=n;r++){var o=this._virtualItems[r];o.obj instanceof $e&&(o.obj.selected=!0),o.selected=!0}else for(r=a;r<=n;r++){var l=this.getChildAt(r);l instanceof $e&&(l.selected=!0)}s=!0}else e.selected=!0}else i.input.ctrlKey||i.input.commandKey||this._selectionMode==t.ListSelectionMode.Multiple_SingleClick?e.selected=!e.selected:e.selected?this.clearSelectionExcept(e):(this.clearSelectionExcept(e),e.selected=!0);s||(this._lastSelectedIndex=h),e.selected&&this.updateSelectionController(h)}}resizeToFit(e,i){this.ensureBoundsCorrect();var s=this.numItems;if((null==e||e>s)&&(e=s),i=i||0,this._virtual){var h=Math.ceil(e/this._curLineItemCount);this._layout==t.ListLayoutType.SingleColumn||this._layout==t.ListLayoutType.FlowHorizontal?this.viewHeight=h*this._itemSize.y+Math.max(0,h-1)*this._lineGap:this.viewWidth=h*this._itemSize.x+Math.max(0,h-1)*this._columnGap}else if(0==e)this._layout==t.ListLayoutType.SingleColumn||this._layout==t.ListLayoutType.FlowHorizontal?this.viewHeight=i:this.viewWidth=i;else{for(var r=e-1,a=null;r>=0&&(a=this.getChildAt(r),this.foldInvisibleItems&&!a.visible);)r--;if(r<0)this._layout==t.ListLayoutType.SingleColumn||this._layout==t.ListLayoutType.FlowHorizontal?this.viewHeight=i:this.viewWidth=i;else{var n=0;this._layout==t.ListLayoutType.SingleColumn||this._layout==t.ListLayoutType.FlowHorizontal?((n=a.y+a.height)<i&&(n=i),this.viewHeight=n):((n=a.x+a.width)<i&&(n=i),this.viewWidth=n)}}}getMaxItemWidth(){for(var t=this._children.length,e=0,i=0;i<t;i++){var s=this.getChildAt(i);s.width>e&&(e=s.width)}return e}handleSizeChanged(){super.handleSizeChanged(),this.setBoundsChangedFlag(),this._virtual&&this.setVirtualListChangedFlag(!0)}handleControllerChanged(t){super.handleControllerChanged(t),this._selectionController==t&&(this.selectedIndex=t.selectedIndex)}updateSelectionController(t){if(this._selectionController&&!this._selectionController.changing&&t<this._selectionController.pageCount){var e=this._selectionController;this._selectionController=null,e.selectedIndex=t,this._selectionController=e}}shouldSnapToNext(t,e,i){return t<0&&e>bt.defaultScrollSnappingThreshold*i||t>0&&e>(1-bt.defaultScrollSnappingThreshold)*i||0==t&&e>i/2}getSnappingPositionWithDir(e,i,s,h,r){var a,n,o;return this._virtual?(r||(r=new T),this._layout==t.ListLayoutType.SingleColumn||this._layout==t.ListLayoutType.FlowHorizontal?(a=i,ni=i,n=this.getIndexOnPos1(!1),i=ni,n<this._virtualItems.length&&n<this._realNumItems&&(o=this._virtualItems[n].height,this.shouldSnapToNext(h,a-i,o)&&(i+=o+this._lineGap))):this._layout==t.ListLayoutType.SingleRow||this._layout==t.ListLayoutType.FlowVertical?(a=e,ni=e,n=this.getIndexOnPos2(!1),e=ni,n<this._virtualItems.length&&n<this._realNumItems&&(o=this._virtualItems[n].width,this.shouldSnapToNext(s,a-e,o)&&(e+=o+this._columnGap))):(a=e,ni=e,n=this.getIndexOnPos3(!1),e=ni,n<this._virtualItems.length&&n<this._realNumItems&&(o=this._virtualItems[n].width,this.shouldSnapToNext(s,a-e,o)&&(e+=o+this._columnGap))),r.x=e,r.y=i,r):super.getSnappingPositionWithDir(e,i,s,h,r)}scrollToView(e,i,s){if(this._virtual){if(0==this._numItems)return;if(this.checkVirtualList(),e>=this._virtualItems.length)throw new Error("Invalid child index: "+e+">"+this._virtualItems.length);var h;this._loop&&(e=Math.floor(this._firstIndex/this._numItems)*this._numItems+e);var r,a=this._virtualItems[e],n=0;if(this._layout==t.ListLayoutType.SingleColumn||this._layout==t.ListLayoutType.FlowHorizontal){for(r=this._curLineItemCount-1;r<e;r+=this._curLineItemCount)n+=this._virtualItems[r].height+this._lineGap;h=new P(0,n,this._itemSize.x,a.height)}else if(this._layout==t.ListLayoutType.SingleRow||this._layout==t.ListLayoutType.FlowVertical){for(r=this._curLineItemCount-1;r<e;r+=this._curLineItemCount)n+=this._virtualItems[r].width+this._columnGap;h=new P(n,0,a.width,this._itemSize.y)}else{var o=e/(this._curLineItemCount*this._curLineItemCount2);h=new P(o*this.viewWidth+e%this._curLineItemCount*(a.width+this._columnGap),e/this._curLineItemCount%this._curLineItemCount2*(a.height+this._lineGap),a.width,a.height)}s=!0,this._scrollPane&&this._scrollPane.scrollToView(h,i,s)}else{var l=this.getChildAt(e);this._scrollPane?this._scrollPane.scrollToView(l,i,s):this._parent&&this._parent.scrollPane&&this._parent.scrollPane.scrollToView(l,i,s)}}getFirstChildInView(){return this.childIndexToItemIndex(super.getFirstChildInView())}childIndexToItemIndex(e){if(!this._virtual)return e;if(this._layout==t.ListLayoutType.Pagination){for(var i=this._firstIndex;i<this._realNumItems;i++)if(this._virtualItems[i].obj&&--e<0)return i;return e}return e+=this._firstIndex,this._loop&&this._numItems>0&&(e%=this._numItems),e}itemIndexToChildIndex(e){if(!this._virtual)return e;if(this._layout==t.ListLayoutType.Pagination)return this.getChildIndex(this._virtualItems[e].obj);if(this._loop&&this._numItems>0){var i=this._firstIndex%this._numItems;e>=i?e-=i:e=this._numItems-i+e}else e-=this._firstIndex;return e}setVirtual(){this._setVirtual(!1)}setVirtualAndLoop(){this._setVirtual(!0)}_setVirtual(e){if(!this._virtual){if(null==this._scrollPane)throw new Error("Virtual list must be scrollable!");if(e){if(this._layout==t.ListLayoutType.FlowHorizontal||this._layout==t.ListLayoutType.FlowVertical)throw new Error("Loop list instanceof not supported for FlowHorizontal or FlowVertical this.layout!");this._scrollPane.bouncebackEffect=!1}if(this._virtual=!0,this._loop=e,this._virtualItems=new Array,this.removeChildrenToPool(),null==this._itemSize){this._itemSize=new T;var i=this.getFromPool(null);if(null==i)throw new Error("Virtual List must have a default list item resource.");this._itemSize.x=i.width,this._itemSize.y=i.height,this.returnToPool(i)}this._layout==t.ListLayoutType.SingleColumn||this._layout==t.ListLayoutType.FlowHorizontal?(this._scrollPane.scrollStep=this._itemSize.y,this._loop&&(this._scrollPane._loop=2)):(this._scrollPane.scrollStep=this._itemSize.x,this._loop&&(this._scrollPane._loop=1)),this.on("scroll",this.__scrolled,this),this.setVirtualListChangedFlag(!0)}}get numItems(){return this._virtual?this._numItems:this._children.length}set numItems(t){var e;if(this._virtual){if(null==this.itemRenderer)throw new Error("set itemRenderer first!");this._numItems=t,this._loop?this._realNumItems=6*this._numItems:this._realNumItems=this._numItems;var i=this._virtualItems.length;if(this._realNumItems>i)for(e=i;e<this._realNumItems;e++){var s={width:0,height:0,flag:0};s.width=this._itemSize.x,s.height=this._itemSize.y,this._virtualItems.push(s)}else for(e=this._realNumItems;e<i;e++)this._virtualItems[e].selected=!1;0!=this._virtualListChanged&&z.remove(this._refreshVirtualList,this),this._refreshVirtualList()}else{var h=this._children.length;if(t>h)for(e=h;e<t;e++)null==this.itemProvider?this.addItemFromPool():this.addItemFromPool(this.itemProvider(e));else this.removeChildrenToPool(t,h);if(this.itemRenderer)for(e=0;e<t;e++)this.itemRenderer(e,this.getChildAt(e))}}refreshVirtualList(){this.setVirtualListChangedFlag(!1)}checkVirtualList(){0!=this._virtualListChanged&&(this._refreshVirtualList(),z.remove(this._refreshVirtualList,this))}setVirtualListChangedFlag(t){t?this._virtualListChanged=2:0==this._virtualListChanged&&(this._virtualListChanged=1),z.callLater(this._refreshVirtualList,this)}_refreshVirtualList(){if(this._displayObject){var e=2==this._virtualListChanged;this._virtualListChanged=0,this._eventLocked=!0,e&&(this._layout==t.ListLayoutType.SingleColumn||this._layout==t.ListLayoutType.SingleRow?this._curLineItemCount=1:this._layout==t.ListLayoutType.FlowHorizontal?this._columnCount>0?this._curLineItemCount=this._columnCount:(this._curLineItemCount=Math.floor((this._scrollPane.viewWidth+this._columnGap)/(this._itemSize.x+this._columnGap)),this._curLineItemCount<=0&&(this._curLineItemCount=1)):this._layout==t.ListLayoutType.FlowVertical?this._lineCount>0?this._curLineItemCount=this._lineCount:(this._curLineItemCount=Math.floor((this._scrollPane.viewHeight+this._lineGap)/(this._itemSize.y+this._lineGap)),this._curLineItemCount<=0&&(this._curLineItemCount=1)):(this._columnCount>0?this._curLineItemCount=this._columnCount:(this._curLineItemCount=Math.floor((this._scrollPane.viewWidth+this._columnGap)/(this._itemSize.x+this._columnGap)),this._curLineItemCount<=0&&(this._curLineItemCount=1)),this._lineCount>0?this._curLineItemCount2=this._lineCount:(this._curLineItemCount2=Math.floor((this._scrollPane.viewHeight+this._lineGap)/(this._itemSize.y+this._lineGap)),this._curLineItemCount2<=0&&(this._curLineItemCount2=1))));var i=0,s=0;if(this._realNumItems>0){var h,r=Math.ceil(this._realNumItems/this._curLineItemCount)*this._curLineItemCount,a=Math.min(this._curLineItemCount,this._realNumItems);if(this._layout==t.ListLayoutType.SingleColumn||this._layout==t.ListLayoutType.FlowHorizontal){for(h=0;h<r;h+=this._curLineItemCount)i+=this._virtualItems[h].height+this._lineGap;if(i>0&&(i-=this._lineGap),this._autoResizeItem)s=this._scrollPane.viewWidth;else{for(h=0;h<a;h++)s+=this._virtualItems[h].width+this._columnGap;s>0&&(s-=this._columnGap)}}else if(this._layout==t.ListLayoutType.SingleRow||this._layout==t.ListLayoutType.FlowVertical){for(h=0;h<r;h+=this._curLineItemCount)s+=this._virtualItems[h].width+this._columnGap;if(s>0&&(s-=this._columnGap),this._autoResizeItem)i=this._scrollPane.viewHeight;else{for(h=0;h<a;h++)i+=this._virtualItems[h].height+this._lineGap;i>0&&(i-=this._lineGap)}}else{s=Math.ceil(r/(this._curLineItemCount*this._curLineItemCount2))*this.viewWidth,i=this.viewHeight}}this.handleAlign(s,i),this._scrollPane.setContentSize(s,i),this._eventLocked=!1,this.handleScroll(!0)}}__scrolled(){this.handleScroll(!1)}getIndexOnPos1(t){if(this._realNumItems<this._curLineItemCount)return ni=0,0;var e,i,s;if(this.numChildren>0&&!t){if((i=this.getChildAt(0).y)>ni){for(e=this._firstIndex-this._curLineItemCount;e>=0;e-=this._curLineItemCount)if((i-=this._virtualItems[e].height+this._lineGap)<=ni)return ni=i,e;return ni=0,0}for(e=this._firstIndex;e<this._realNumItems;e+=this._curLineItemCount){if((s=i+this._virtualItems[e].height+this._lineGap)>ni)return ni=i,e;i=s}return ni=i,this._realNumItems-this._curLineItemCount}for(i=0,e=0;e<this._realNumItems;e+=this._curLineItemCount){if((s=i+this._virtualItems[e].height+this._lineGap)>ni)return ni=i,e;i=s}return ni=i,this._realNumItems-this._curLineItemCount}getIndexOnPos2(t){if(this._realNumItems<this._curLineItemCount)return ni=0,0;var e,i,s;if(this.numChildren>0&&!t){if((i=this.getChildAt(0).x)>ni){for(e=this._firstIndex-this._curLineItemCount;e>=0;e-=this._curLineItemCount)if((i-=this._virtualItems[e].width+this._columnGap)<=ni)return ni=i,e;return ni=0,0}for(e=this._firstIndex;e<this._realNumItems;e+=this._curLineItemCount){if((s=i+this._virtualItems[e].width+this._columnGap)>ni)return ni=i,e;i=s}return ni=i,this._realNumItems-this._curLineItemCount}for(i=0,e=0;e<this._realNumItems;e+=this._curLineItemCount){if((s=i+this._virtualItems[e].width+this._columnGap)>ni)return ni=i,e;i=s}return ni=i,this._realNumItems-this._curLineItemCount}getIndexOnPos3(t){if(this._realNumItems<this._curLineItemCount)return ni=0,0;var e,i,s=this.viewWidth,h=Math.floor(ni/s),r=h*(this._curLineItemCount*this._curLineItemCount2),a=h*s;for(e=0;e<this._curLineItemCount;e++){if((i=a+this._virtualItems[r+e].width+this._columnGap)>ni)return ni=a,r+e;a=i}return ni=a,r+this._curLineItemCount-1}handleScroll(e){if(!this._eventLocked){if(this._layout==t.ListLayoutType.SingleColumn||this._layout==t.ListLayoutType.FlowHorizontal){for(var i=0;this.handleScroll1(e);)if(e=!1,++i>20){console.log("list will never be <the> filled item renderer function always returns a different size.");break}this.handleArchOrder1()}else if(this._layout==t.ListLayoutType.SingleRow||this._layout==t.ListLayoutType.FlowVertical){for(i=0;this.handleScroll2(e);)if(e=!1,++i>20){console.log("list will never be <the> filled item renderer function always returns a different size.");break}this.handleArchOrder2()}else this.handleScroll3(e);this._boundsChanged=!1}}handleScroll1(e){var i=this._scrollPane.scrollingPosY,s=i+this._scrollPane.viewHeight,h=s==this._scrollPane.contentHeight;ni=i;var r=this.getIndexOnPos1(e);if(i=ni,r==this._firstIndex&&!e)return!1;var a=this._firstIndex;this._firstIndex=r;var n,o,l,_,d,c=r,u=a>r,p=this.numChildren,g=a+p-1,f=u?g:a,m=0,y=i,w=0,v=0,x=this.defaultItem,b=(this._scrollPane.viewWidth-this._columnGap*(this._curLineItemCount-1))/this._curLineItemCount;for(this.itemInfoVer++;c<this._realNumItems&&(h||y<s);){if((null==(o=this._virtualItems[c]).obj||e)&&(this.itemProvider&&(null==(x=this.itemProvider(c%this._numItems))&&(x=this._defaultItem),x=oe.normalizeURL(x)),o.obj&&o.obj.resourceURL!=x&&(o.obj instanceof $e&&(o.selected=o.obj.selected),this.removeChildToPool(o.obj),o.obj=null)),null==o.obj){if(u){for(d=f;d>=a;d--)if((l=this._virtualItems[d]).obj&&l.flag!=this.itemInfoVer&&l.obj.resourceURL==x){l.obj instanceof $e&&(l.selected=l.obj.selected),o.obj=l.obj,l.obj=null,d==f&&f--;break}}else for(d=f;d<=g;d++)if((l=this._virtualItems[d]).obj&&l.flag!=this.itemInfoVer&&l.obj.resourceURL==x){l.obj instanceof $e&&(l.selected=l.obj.selected),o.obj=l.obj,l.obj=null,d==f&&f++;break}o.obj?this.setChildIndex(o.obj,u?c-r:this.numChildren):(o.obj=this._pool.getObject(x),u?this.addChildAt(o.obj,c-r):this.addChild(o.obj)),o.obj instanceof $e&&(o.obj.selected=o.selected),n=!0}else n=e;n&&(this._autoResizeItem&&(this._layout==t.ListLayoutType.SingleColumn||this._columnCount>0)&&o.obj.setSize(b,o.obj.height,!0),this.itemRenderer(c%this._numItems,o.obj),c%this._curLineItemCount==0&&(w+=Math.ceil(o.obj.height)-o.height,c==r&&a>r&&(v=Math.ceil(o.obj.height)-o.height)),o.width=Math.ceil(o.obj.width),o.height=Math.ceil(o.obj.height)),o.flag=this.itemInfoVer,o.obj.setPosition(m,y),c==r&&(s+=o.height),m+=o.width+this._columnGap,c%this._curLineItemCount==this._curLineItemCount-1&&(m=0,y+=o.height+this._lineGap),c++}for(_=0;_<p;_++)(o=this._virtualItems[a+_]).flag!=this.itemInfoVer&&o.obj&&(o.obj instanceof $e&&(o.selected=o.obj.selected),this.removeChildToPool(o.obj),o.obj=null);for(p=this._children.length,_=0;_<p;_++){var C=this._virtualItems[r+_].obj;this._children[_]!=C&&this.setChildIndex(C,_)}return 0==w&&0==v||this._scrollPane.changeContentSizeOnScrolling(0,w,0,v),c>0&&this.numChildren>0&&this._container.y<=0&&this.getChildAt(0).y>-this._container.y}handleScroll2(e){var i=this._scrollPane.scrollingPosX,s=i+this._scrollPane.viewWidth,h=i==this._scrollPane.contentWidth;ni=i;var r=this.getIndexOnPos2(e);if(i=ni,r==this._firstIndex&&!e)return!1;var a=this._firstIndex;this._firstIndex=r;var n,o,l,_,d,c=r,u=a>r,p=this.numChildren,g=a+p-1,f=u?g:a,m=i,y=0,w=0,v=0,x=this.defaultItem,b=(this._scrollPane.viewHeight-this._lineGap*(this._curLineItemCount-1))/this._curLineItemCount;for(this.itemInfoVer++;c<this._realNumItems&&(h||m<s);){if((null==(o=this._virtualItems[c]).obj||e)&&(this.itemProvider&&(null==(x=this.itemProvider(c%this._numItems))&&(x=this._defaultItem),x=oe.normalizeURL(x)),o.obj&&o.obj.resourceURL!=x&&(o.obj instanceof $e&&(o.selected=o.obj.selected),this.removeChildToPool(o.obj),o.obj=null)),null==o.obj){if(u){for(d=f;d>=a;d--)if((l=this._virtualItems[d]).obj&&l.flag!=this.itemInfoVer&&l.obj.resourceURL==x){l.obj instanceof $e&&(l.selected=l.obj.selected),o.obj=l.obj,l.obj=null,d==f&&f--;break}}else for(d=f;d<=g;d++)if((l=this._virtualItems[d]).obj&&l.flag!=this.itemInfoVer&&l.obj.resourceURL==x){l.obj instanceof $e&&(l.selected=l.obj.selected),o.obj=l.obj,l.obj=null,d==f&&f++;break}o.obj?this.setChildIndex(o.obj,u?c-r:this.numChildren):(o.obj=this._pool.getObject(x),u?this.addChildAt(o.obj,c-r):this.addChild(o.obj)),o.obj instanceof $e&&(o.obj.selected=o.selected),n=!0}else n=e;n&&(this._autoResizeItem&&(this._layout==t.ListLayoutType.SingleRow||this._lineCount>0)&&o.obj.setSize(o.obj.width,b,!0),this.itemRenderer(c%this._numItems,o.obj),c%this._curLineItemCount==0&&(w+=Math.ceil(o.obj.width)-o.width,c==r&&a>r&&(v=Math.ceil(o.obj.width)-o.width)),o.width=Math.ceil(o.obj.width),o.height=Math.ceil(o.obj.height)),o.flag=this.itemInfoVer,o.obj.setPosition(m,y),c==r&&(s+=o.width),y+=o.height+this._lineGap,c%this._curLineItemCount==this._curLineItemCount-1&&(y=0,m+=o.width+this._columnGap),c++}for(_=0;_<p;_++)(o=this._virtualItems[a+_]).flag!=this.itemInfoVer&&o.obj&&(o.obj instanceof $e&&(o.selected=o.obj.selected),this.removeChildToPool(o.obj),o.obj=null);for(p=this._children.length,_=0;_<p;_++){var C=this._virtualItems[r+_].obj;this._children[_]!=C&&this.setChildIndex(C,_)}return 0==w&&0==v||this._scrollPane.changeContentSizeOnScrolling(w,0,v,0),c>0&&this.numChildren>0&&this._container.x<=0&&this.getChildAt(0).x>-this._container.x}handleScroll3(t){var e=this._scrollPane.scrollingPosX;ni=e;var i=this.getIndexOnPos3(t);if(e=ni,i!=this._firstIndex||t){var s=this._firstIndex;this._firstIndex=i;var h,r,a,n,o,l=s,_=this._virtualItems.length,d=this._curLineItemCount*this._curLineItemCount2,c=i%this._curLineItemCount,u=this.viewWidth,p=Math.floor(i/d)*d,g=p+2*d,f=this._defaultItem,m=(this._scrollPane.viewWidth-this._columnGap*(this._curLineItemCount-1))/this._curLineItemCount,y=(this._scrollPane.viewHeight-this._lineGap*(this._curLineItemCount2-1))/this._curLineItemCount2;for(this.itemInfoVer++,r=p;r<g;r++)if(!(r>=this._realNumItems)){if(o=r%this._curLineItemCount,r-p<d){if(o<c)continue}else if(o>c)continue;(a=this._virtualItems[r]).flag=this.itemInfoVer}var w=null,v=0;for(r=p;r<g;r++)if(!(r>=this._realNumItems)&&(a=this._virtualItems[r]).flag==this.itemInfoVer){if(null==a.obj){for(;l<_;){if((n=this._virtualItems[l]).obj&&n.flag!=this.itemInfoVer){n.obj instanceof $e&&(n.selected=n.obj.selected),a.obj=n.obj,n.obj=null;break}l++}-1==v&&(v=this.getChildIndex(w)+1),null==a.obj?(this.itemProvider&&(null==(f=this.itemProvider(r%this._numItems))&&(f=this._defaultItem),f=oe.normalizeURL(f)),a.obj=this._pool.getObject(f),this.addChildAt(a.obj,v)):v=this.setChildIndexBefore(a.obj,v),v++,a.obj instanceof $e&&(a.obj.selected=a.selected),h=!0}else h=t,v=-1,w=a.obj;h&&(this._autoResizeItem&&(this._curLineItemCount==this._columnCount&&this._curLineItemCount2==this._lineCount?a.obj.setSize(m,y,!0):this._curLineItemCount==this._columnCount?a.obj.setSize(m,a.obj.height,!0):this._curLineItemCount2==this._lineCount&&a.obj.setSize(a.obj.width,y,!0)),this.itemRenderer(r%this._numItems,a.obj),a.width=Math.ceil(a.obj.width),a.height=Math.ceil(a.obj.height))}var x=p/d*u,b=x,C=0,S=0;for(r=p;r<g;r++)r>=this._realNumItems||((a=this._virtualItems[r]).flag==this.itemInfoVer&&a.obj.setPosition(b,C),a.height>S&&(S=a.height),r%this._curLineItemCount==this._curLineItemCount-1?(b=x,C+=S+this._lineGap,S=0,r==p+d-1&&(b=x+=u,C=0)):b+=a.width+this._columnGap);for(r=l;r<_;r++)(a=this._virtualItems[r]).flag!=this.itemInfoVer&&a.obj&&(a.obj instanceof $e&&(a.selected=a.obj.selected),this.removeChildToPool(a.obj),a.obj=null)}}handleArchOrder1(){if(this.childrenRenderOrder==t.ChildrenRenderOrder.Arch){for(var e=this._scrollPane.posY+this.viewHeight/2,i=Number.POSITIVE_INFINITY,s=0,h=0,r=this.numChildren,a=0;a<r;a++){var n=this.getChildAt(a);this.foldInvisibleItems&&!n.visible||(s=Math.abs(e-n.y-n.height/2))<i&&(i=s,h=a)}this.apexIndex=h}}handleArchOrder2(){if(this.childrenRenderOrder==t.ChildrenRenderOrder.Arch){for(var e=this._scrollPane.posX+this.viewWidth/2,i=Number.POSITIVE_INFINITY,s=0,h=0,r=this.numChildren,a=0;a<r;a++){var n=this.getChildAt(a);this.foldInvisibleItems&&!n.visible||(s=Math.abs(e-n.x-n.width/2))<i&&(i=s,h=a)}this.apexIndex=h}}handleAlign(t,e){var i=0,s=0;e<this.viewHeight&&("middle"==this._valign?s=Math.floor((this.viewHeight-e)/2):"bottom"==this._valign&&(s=this.viewHeight-e)),t<this.viewWidth&&("center"==this._align?i=Math.floor((this.viewWidth-t)/2):"right"==this._align&&(i=this.viewWidth-t)),i==this._alignOffset.x&&s==this._alignOffset.y||(this._alignOffset.set(i,s),this._scrollPane?this._scrollPane.adjustMaskContainer():this._container.setPosition(this._margin.left+this._alignOffset.x,this._margin.top+this._alignOffset.y))}updateBounds(){if(!this._virtual){var e,i,s,h,r,a=0,n=0,o=0,l=0,_=0,d=0,c=0,u=this._children.length,p=this.viewWidth,g=this.viewHeight,f=0,m=0;if(this._layout==t.ListLayoutType.SingleColumn){for(e=0;e<u;e++)i=this.getChildAt(e),this.foldInvisibleItems&&!i.visible||(0!=n&&(n+=this._lineGap),i.y=n,this._autoResizeItem&&i.setSize(p,i.height,!0),n+=Math.ceil(i.height),i.width>o&&(o=i.width));if((h=n)<=g&&this._autoResizeItem&&this._scrollPane&&this._scrollPane._displayInDemand&&this._scrollPane.vtScrollBar)for(p+=this._scrollPane.vtScrollBar.width,e=0;e<u;e++)i=this.getChildAt(e),this.foldInvisibleItems&&!i.visible||(i.setSize(p,i.height,!0),i.width>o&&(o=i.width));s=Math.ceil(o)}else if(this._layout==t.ListLayoutType.SingleRow){for(e=0;e<u;e++)i=this.getChildAt(e),this.foldInvisibleItems&&!i.visible||(0!=a&&(a+=this._columnGap),i.x=a,this._autoResizeItem&&i.setSize(i.width,g,!0),a+=Math.ceil(i.width),i.height>l&&(l=i.height));if((s=a)<=p&&this._autoResizeItem&&this._scrollPane&&this._scrollPane._displayInDemand&&this._scrollPane.hzScrollBar)for(g+=this._scrollPane.hzScrollBar.height,e=0;e<u;e++)i=this.getChildAt(e),this.foldInvisibleItems&&!i.visible||(i.setSize(i.width,g,!0),i.height>l&&(l=i.height));h=Math.ceil(l)}else if(this._layout==t.ListLayoutType.FlowHorizontal)if(this._autoResizeItem&&this._columnCount>0){for(e=0;e<u;e++)if(i=this.getChildAt(e),(!this.foldInvisibleItems||i.visible)&&(f+=i.sourceWidth,++_==this._columnCount||e==u-1)){for(r=(p-f-(_-1)*this._columnGap)/f,a=0,_=m;_<=e;_++)i=this.getChildAt(_),this.foldInvisibleItems&&!i.visible||(i.setPosition(a,n),_<e?(i.setSize(i.sourceWidth+Math.round(i.sourceWidth*r),i.height,!0),a+=Math.ceil(i.width)+this._columnGap):i.setSize(p-a,i.height,!0),i.height>l&&(l=i.height));n+=Math.ceil(l)+this._lineGap,l=0,_=0,m=e+1,f=0}h=n+Math.ceil(l),s=p}else{for(e=0;e<u;e++)i=this.getChildAt(e),this.foldInvisibleItems&&!i.visible||(0!=a&&(a+=this._columnGap),(0!=this._columnCount&&_>=this._columnCount||0==this._columnCount&&a+i.width>p&&0!=l)&&(a=0,n+=Math.ceil(l)+this._lineGap,l=0,_=0),i.setPosition(a,n),(a+=Math.ceil(i.width))>o&&(o=a),i.height>l&&(l=i.height),_++);h=n+Math.ceil(l),s=Math.ceil(o)}else if(this._layout==t.ListLayoutType.FlowVertical)if(this._autoResizeItem&&this._lineCount>0){for(e=0;e<u;e++)if(i=this.getChildAt(e),(!this.foldInvisibleItems||i.visible)&&(f+=i.sourceHeight,++_==this._lineCount||e==u-1)){for(r=(g-f-(_-1)*this._lineGap)/f,n=0,_=m;_<=e;_++)i=this.getChildAt(_),this.foldInvisibleItems&&!i.visible||(i.setPosition(a,n),_<e?(i.setSize(i.width,i.sourceHeight+Math.round(i.sourceHeight*r),!0),n+=Math.ceil(i.height)+this._lineGap):i.setSize(i.width,g-n,!0),i.width>o&&(o=i.width));a+=Math.ceil(o)+this._columnGap,o=0,_=0,m=e+1,f=0}s=a+Math.ceil(o),h=g}else{for(e=0;e<u;e++)i=this.getChildAt(e),this.foldInvisibleItems&&!i.visible||(0!=n&&(n+=this._lineGap),(0!=this._lineCount&&_>=this._lineCount||0==this._lineCount&&n+i.height>g&&0!=o)&&(n=0,a+=Math.ceil(o)+this._columnGap,o=0,_=0),i.setPosition(a,n),(n+=Math.ceil(i.height))>l&&(l=n),i.width>o&&(o=i.width),_++);s=a+Math.ceil(o),h=Math.ceil(l)}else{var y;if(this._autoResizeItem&&this._lineCount>0&&(y=Math.floor((g-(this._lineCount-1)*this._lineGap)/this._lineCount)),this._autoResizeItem&&this._columnCount>0){for(e=0;e<u;e++)if(i=this.getChildAt(e),(!this.foldInvisibleItems||i.visible)&&(0==_&&(0!=this._lineCount&&c>=this._lineCount||0==this._lineCount&&n+i.height>g)&&(d++,n=0,c=0),f+=i.sourceWidth,++_==this._columnCount||e==u-1)){for(r=(p-f-(_-1)*this._columnGap)/f,a=0,_=m;_<=e;_++)i=this.getChildAt(_),this.foldInvisibleItems&&!i.visible||(i.setPosition(d*p+a,n),_<e?(i.setSize(i.sourceWidth+Math.round(i.sourceWidth*r),this._lineCount>0?y:i.height,!0),a+=Math.ceil(i.width)+this._columnGap):i.setSize(p-a,this._lineCount>0?y:i.height,!0),i.height>l&&(l=i.height));n+=Math.ceil(l)+this._lineGap,l=0,_=0,m=e+1,f=0,c++}}else for(e=0;e<u;e++)i=this.getChildAt(e),this.foldInvisibleItems&&!i.visible||(0!=a&&(a+=this._columnGap),this._autoResizeItem&&this._lineCount>0&&i.setSize(i.width,y,!0),(0!=this._columnCount&&_>=this._columnCount||0==this._columnCount&&a+i.width>p&&0!=l)&&(a=0,n+=Math.ceil(l)+this._lineGap,l=0,_=0,c++,(0!=this._lineCount&&c>=this._lineCount||0==this._lineCount&&n+i.height>g&&0!=o)&&(d++,n=0,c=0)),i.setPosition(d*p+a,n),(a+=Math.ceil(i.width))>o&&(o=a),i.height>l&&(l=i.height),_++);h=d>0?g:n+Math.ceil(l),s=(d+1)*p}this.handleAlign(s,h),this.setBounds(0,0,s,h)}}setup_beforeAdd(e,i){var s;super.setup_beforeAdd(e,i),e.seek(i,5),this._layout=e.readByte(),this._selectionMode=e.readByte(),s=e.readByte(),this._align=0==s?"left":1==s?"center":"right",s=e.readByte(),this._valign=0==s?"top":1==s?"middle":"bottom",this._lineGap=e.readShort(),this._columnGap=e.readShort(),this._lineCount=e.readShort(),this._columnCount=e.readShort(),this._autoResizeItem=e.readBool(),this._childrenRenderOrder=e.readByte(),this._apexIndex=e.readShort(),e.readBool()&&(this._margin.top=e.readInt(),this._margin.bottom=e.readInt(),this._margin.left=e.readInt(),this._margin.right=e.readInt());var h=e.readByte();if(h==t.OverflowType.Scroll){var r=e.pos;e.seek(i,7),this.setupScroll(e),e.pos=r}else this.setupOverflow(h);e.readBool()&&e.skip(8),e.version>=2&&(this.scrollItemToViewOnClick=e.readBool(),this.foldInvisibleItems=e.readBool()),e.seek(i,8),this._defaultItem=e.readS(),this.readItems(e)}readItems(t){var e,i,s,h;for(e=t.readShort(),i=0;i<e;i++)if(s=t.readShort(),s+=t.pos,null!=(h=t.readS())||(h=this.defaultItem)){var r=this.getFromPool(h);r&&(this.addChild(r),this.setupItem(t,r)),t.pos=s}else t.pos=s}setupItem(t,e){var i,s,h;if(null!=(i=t.readS())&&(e.text=i),null!=(i=t.readS())&&e instanceof $e&&(e.selectedTitle=i),null!=(i=t.readS())&&(e.icon=i),null!=(i=t.readS())&&e instanceof $e&&(e.selectedIcon=i),null!=(i=t.readS())&&(e.name=i),e instanceof Ae){for(s=t.readShort(),h=0;h<s;h++){var r=e.getController(t.readS());i=t.readS(),r&&(r.selectedPageId=i)}if(t.version>=2)for(s=t.readShort(),h=0;h<s;h++){var a=t.readS(),n=t.readShort(),o=t.readS(),l=e.getChildByPath(a);l&&l.setProp(n,o)}}}setup_afterAdd(t,e){super.setup_afterAdd(t,e),t.seek(e,6);var i=t.readShort();-1!=i&&(this._selectionController=this._parent.getControllerAt(i))}}var ni=0;class oi{constructor(t,e){this._expanded=!1,this._level=0,this._resURL=e,t&&(this._children=new Array)}set expanded(t){null!=this._children&&this._expanded!=t&&(this._expanded=t,this._tree&&(this._expanded?this._tree._afterExpanded(this):this._tree._afterCollapsed(this)))}get expanded(){return this._expanded}get isFolder(){return null!=this._children}get parent(){return this._parent}get text(){return this._cell?this._cell.text:null}set text(t){this._cell&&(this._cell.text=t)}get icon(){return this._cell?this._cell.icon:null}set icon(t){this._cell&&(this._cell.icon=t)}get cell(){return this._cell}get level(){return this._level}_setLevel(t){this._level=t}addChild(t){return this.addChildAt(t,this._children.length),t}addChildAt(t,e){if(!t)throw new Error("child is null");var i=this._children.length;if(e>=0&&e<=i){if(t._parent==this)this.setChildIndex(t,e);else t._parent&&t._parent.removeChild(t),e==this._children.length?this._children.push(t):this._children.splice(e,0,t),t._parent=this,t._level=this._level+1,t._setTree(this._tree),(this._tree&&this==this._tree.rootNode||this._cell&&this._cell.parent&&this._expanded)&&this._tree._afterInserted(t);return t}throw new RangeError("Invalid child index")}removeChild(t){var e=this._children.indexOf(t);return-1!=e&&this.removeChildAt(e),t}removeChildAt(t){if(t>=0&&t<this.numChildren){var e=this._children[t];return this._children.splice(t,1),e._parent=null,this._tree&&(e._setTree(null),this._tree._afterRemoved(e)),e}throw"Invalid child index"}removeChildren(t,e){t=t||0,null==e&&(e=-1),(e<0||e>=this.numChildren)&&(e=this.numChildren-1);for(var i=t;i<=e;++i)this.removeChildAt(t)}getChildAt(t){if(t>=0&&t<this.numChildren)return this._children[t];throw"Invalid child index"}getChildIndex(t){return this._children.indexOf(t)}getPrevSibling(){if(null==this._parent)return null;var t=this._parent._children.indexOf(this);return t<=0?null:this._parent._children[t-1]}getNextSibling(){if(null==this._parent)return null;var t=this._parent._children.indexOf(this);return t<0||t>=this._parent._children.length-1?null:this._parent._children[t+1]}setChildIndex(t,e){var i=this._children.indexOf(t);if(-1==i)throw"Not a child of this container";var s=this._children.length;e<0?e=0:e>s&&(e=s),i!=e&&(this._children.splice(i,1),this._children.splice(e,0,t),(this._tree&&this==this._tree.rootNode||this._cell&&this._cell.parent&&this._expanded)&&this._tree._afterMoved(t))}swapChildren(t,e){var i=this._children.indexOf(t),s=this._children.indexOf(e);if(-1==i||-1==s)throw"Not a child of this container";this.swapChildrenAt(i,s)}swapChildrenAt(t,e){var i=this._children[t],s=this._children[e];this.setChildIndex(i,e),this.setChildIndex(s,t)}get numChildren(){return this._children.length}expandToRoot(){for(var t=this;t;)t.expanded=!0,t=t.parent}get tree(){return this._tree}_setTree(t){if(this._tree=t,this._tree&&this._tree.treeNodeWillExpand&&this._expanded&&this._tree.treeNodeWillExpand(this,!0),this._children)for(var e=this._children.length,i=0;i<e;i++){var s=this._children[i];s._level=this._level+1,s._setTree(t)}}}var li,_i=new Array;class di extends ai{constructor(){super(),this._indent=15,this._rootNode=new oi(!0),this._rootNode._setTree(this),this._rootNode.expanded=!0}get rootNode(){return this._rootNode}get indent(){return this._indent}set indent(t){this._indent=t}get clickToExpand(){return this._clickToExpand}set clickToExpand(t){this._clickToExpand=t}getSelectedNode(){return-1!=this.selectedIndex?this.getChildAt(this.selectedIndex)._treeNode:null}getSelectedNodes(t){t||(t=new Array),_i.length=0,super.getSelection(_i);for(var e=_i.length,i=new Array,s=0;s<e;s++){var h=this.getChildAt(_i[s])._treeNode;i.push(h)}return i}selectNode(t,e){for(var i=t.parent;i&&i!=this._rootNode;)i.expanded=!0,i=i.parent;t._cell&&this.addSelection(this.getChildIndex(t._cell),e)}unselectNode(t){t._cell&&this.removeSelection(this.getChildIndex(t._cell))}expandAll(t){t||(t=this._rootNode),t.expanded=!0;for(var e=t.numChildren,i=0;i<e;i++){var s=t.getChildAt(i);s.isFolder&&this.expandAll(s)}}collapseAll(t){t||(t=this._rootNode),t!=this._rootNode&&(t.expanded=!1);for(var e=t.numChildren,i=0;i<e;i++){var s=t.getChildAt(i);s.isFolder&&this.collapseAll(s)}}createCell(t){var e=this.getFromPool(t._resURL?t._resURL:this.defaultItem);if(!e)throw new Error("cannot create tree node object.");e._treeNode=t,t._cell=e;var i,s=e.getChild("indent");s&&(s.width=(t.level-1)*this._indent),(i=e.getController("expanded"))&&(i.on("status_changed",this.__expandedStateChanged,this),i.selectedIndex=t.expanded?1:0),(i=e.getController("leaf"))&&(i.selectedIndex=t.isFolder?0:1),t.isFolder&&e.on("touch_begin",this.__cellMouseDown,this),this.treeNodeRender&&this.treeNodeRender(t,e)}_afterInserted(t){t._cell||this.createCell(t);var e=this.getInsertIndexForNode(t);this.addChildAt(t._cell,e),this.treeNodeRender&&this.treeNodeRender(t,t._cell),t.isFolder&&t.expanded&&this.checkChildren(t,e)}getInsertIndexForNode(t){var e=t.getPrevSibling();null==e&&(e=t.parent);for(var i=this.getChildIndex(e._cell)+1,s=t.level,h=this.numChildren,r=i;r<h;r++){if(this.getChildAt(r)._treeNode.level<=s)break;i++}return i}_afterRemoved(t){this.removeNode(t)}_afterExpanded(t){if(t!=this._rootNode){if(this.treeNodeWillExpand&&this.treeNodeWillExpand(t,!0),null!=t._cell){this.treeNodeRender&&this.treeNodeRender(t,t._cell);var e=t._cell.getController("expanded");e&&(e.selectedIndex=1),t._cell.parent&&this.checkChildren(t,this.getChildIndex(t._cell))}}else this.checkChildren(this._rootNode,0)}_afterCollapsed(t){if(t!=this._rootNode){if(this.treeNodeWillExpand&&this.treeNodeWillExpand(t,!1),null!=t._cell){this.treeNodeRender&&this.treeNodeRender(t,t._cell);var e=t._cell.getController("expanded");e&&(e.selectedIndex=0),t._cell.parent&&this.hideFolderNode(t)}}else this.checkChildren(this._rootNode,0)}_afterMoved(t){var e,i=this.getChildIndex(t._cell);e=t.isFolder?this.getFolderEndIndex(i,t.level):i+1;var s,h,r=this.getInsertIndexForNode(t),a=e-i;if(r<i)for(s=0;s<a;s++)h=this.getChildAt(i+s),this.setChildIndex(h,r+s);else for(s=0;s<a;s++)h=this.getChildAt(i),this.setChildIndex(h,r)}getFolderEndIndex(t,e){for(var i=this.numChildren,s=t+1;s<i;s++){if(this.getChildAt(s)._treeNode.level<=e)return s}return i}checkChildren(t,e){for(var i=t.numChildren,s=0;s<i;s++){e++;var h=t.getChildAt(s);null==h._cell&&this.createCell(h),h._cell.parent||this.addChildAt(h._cell,e),h.isFolder&&h.expanded&&(e=this.checkChildren(h,e))}return e}hideFolderNode(t){for(var e=t.numChildren,i=0;i<e;i++){var s=t.getChildAt(i);s._cell&&this.removeChild(s._cell),s.isFolder&&s.expanded&&this.hideFolderNode(s)}}removeNode(t){if(t._cell&&(t._cell.parent&&this.removeChild(t._cell),this.returnToPool(t._cell),t._cell._treeNode=null,t._cell=null),t.isFolder)for(var e=t.numChildren,i=0;i<e;i++){var s=t.getChildAt(i);this.removeNode(s)}}__cellMouseDown(t){var e=Ct.cast(t.sender)._treeNode;this._expandedStatusInEvt=e.expanded}__expandedStateChanged(t){let e=t.sender;e.parent._treeNode.expanded=1==e.selectedIndex}dispatchItemEvent(t,e){if(0!=this._clickToExpand){var i=t._treeNode;i&&i.isFolder&&this._expandedStatusInEvt==i.expanded&&(2==this._clickToExpand?2==e.input.clickCount&&(i.expanded=!i.expanded):i.expanded=!i.expanded)}super.dispatchItemEvent(t,e)}setup_beforeAdd(t,e){super.setup_beforeAdd(t,e),t.seek(e,9),this._indent=t.readInt(),this._clickToExpand=t.readByte()}readItems(t){var e,i,s,h,r,a,n,o=0;for(e=t.readShort(),i=0;i<e;i++)if(s=t.readShort(),s+=t.pos,null!=(h=t.readS())||(h=this.defaultItem)){r=t.readBool(),n=t.readByte();var l=new oi(r,h);if(l.expanded=!0,0==i)this._rootNode.addChild(l);else if(n>o)a.addChild(l);else if(n<o){for(var _=n;_<=o;_++)a=a.parent;a.addChild(l)}else a.parent.addChild(l);a=l,o=n,this.setupItem(t,l.cell),t.pos=s}else t.pos=s}}class ci{static setExtension(t,e){if(null==t)throw new Error("Invaild url: "+t);var i=oe.getItemByURL(t);i&&(i.extensionType=e),ci.extensions[t]=e}static setLoaderExtension(t){ci.loaderType=t}static resolveExtension(t){var e=ci.extensions["ui://"+t.owner.id+t.id];e||(e=ci.extensions["ui://"+t.owner.name+"/"+t.name]),e&&(t.extensionType=e)}static newObject(e,i){var s;if("number"==typeof e)switch(e){case t.ObjectType.Image:return new Nt;case t.ObjectType.MovieClip:return new Ut;case t.ObjectType.Component:return new Ae;case t.ObjectType.Text:return new He;case t.ObjectType.RichText:return new Ue;case t.ObjectType.InputText:return new qe;case t.ObjectType.Group:return new Ft;case t.ObjectType.List:return new ai;case t.ObjectType.Graph:return new Gt;case t.ObjectType.Loader:return ci.loaderType?new ci.loaderType:new Ke;case t.ObjectType.Button:return new $e;case t.ObjectType.Label:return new Ze;case t.ObjectType.ProgressBar:return new ii;case t.ObjectType.Slider:return new ei;case t.ObjectType.ScrollBar:return new hi;case t.ObjectType.ComboBox:return new Je;case t.ObjectType.Tree:return new di;case t.ObjectType.Loader3D:return new Qe;default:return null}else(s=e.type==t.PackageItemType.Component?i?new i:e.extensionType?new e.extensionType:ci.newObject(e.objectType):ci.newObject(e.objectType))&&(s.packageItem=e);return s}}ci.extensions={},ue.UIObjectFactory=ci;class ui{constructor(){let t=this._agent=new Ke;t.draggable=!0,t.touchable=!1,t.setSize(100,100),t.setPivot(.5,.5,!0),t.align="center",t.verticalAlign="middle",t.sortingOrder=1e6,t.on("drag_end",this.__dragEnd,this)}static get inst(){return li||(li=new ui),li}get dragAgent(){return this._agent}get dragging(){return null!=this._agent.parent}startDrag(t,e,i){if(!this._agent.parent){this._sourceData=e,this._agent.url=t,De.inst.addChild(this._agent);var s=De.inst.globalToLocal(R.touchPos.x,R.touchPos.y);this._agent.setPosition(s.x,s.y),this._agent.startDrag(null!=i?i:-1)}}cancel(){this._agent.parent&&(this._agent.stopDrag(),De.inst.removeChild(this._agent),this._sourceData=null)}__dragEnd(t){if(null!=this._agent.parent){De.inst.removeChild(this._agent);var e=this._sourceData;this._sourceData=null;for(var i=Ct.cast(R.touchTarget);i;){if(i.hasListener("drop"))return void i.dispatchEvent("drop",e);i=i.parent}}}}class pi{constructor(t,e){this.packageItem=t,this.type=e}}t.AsyncOperation=class{constructor(){this._itemList=new Array,this._objectPool=[]}createObject(t,e){var i=oe.getByName(t);if(!i)throw new Error("package not found: "+t);var s=i.getItemByName(e);if(!s)throw new Error("resource not found: "+e);this.internalCreateObject(s)}createObjectFromURL(t){var e=oe.getItemByURL(t);if(!e)throw new Error("resource not found: "+t);this.internalCreateObject(e)}cancel(){if(z.remove(this.run,this),this._itemList.length=0,this._objectPool.length>0){for(var t=this._objectPool.length,e=0;e<t;e++)this._objectPool[e].dispose();this._objectPool.length=0}}internalCreateObject(e){this._itemList.length=0,this._objectPool.length=0;var i=new pi(e,t.ObjectType.Component);i.childCount=this.collectComponentChildren(e),this._itemList.push(i),this._index=0,z.addUpdate(this.run,this)}collectComponentChildren(e){var i,s,h,r,a,n,o=e.rawData;o.seek(0,2);var l=o.readShort();for(h=0;h<l;h++){r=o.readShort(),a=o.pos,o.seek(a,0);var _=o.readByte(),d=o.readS(),c=o.readS();o.pos=a,null!=d?(s=null!=(n=null!=c?oe.getById(c):e.owner)?n.getItemById(d):null,i=new pi(s,_),null!=s&&s.type==t.PackageItemType.Component&&(i.childCount=this.collectComponentChildren(s))):(i=new pi(null,_),_==t.ObjectType.List&&(i.listItemCount=this.collectListChildren(o))),this._itemList.push(i),o.pos=a+r}return l}collectListChildren(e){e.seek(e.pos,8);var i,s,h,r,a,n=0,o=e.readS(),l=e.readShort();for(i=0;i<l;i++)s=e.readShort(),s+=e.pos,null==(h=e.readS())&&(h=o),h&&null!=(r=oe.getItemByURL(h))&&(a=new pi(r,r.objectType),r.type==t.PackageItemType.Component&&(a.childCount=this.collectComponentChildren(r)),this._itemList.push(a),n++),e.pos=s;return n}run(){for(var e,i,s,h,r=performance.now(),a=bt.frameTimeForAsyncUIConstruction,n=this._itemList.length;this._index<n;){if(null!=(i=this._itemList[this._index]).packageItem)e=ci.newObject(i.packageItem),this._objectPool.push(e),Mt.n++,i.packageItem.type==t.PackageItemType.Component?(s=this._objectPool.length-i.childCount-1,e.constructFromResource2(this._objectPool,s),this._objectPool.splice(s,i.childCount)):e.constructFromResource(),Mt.n--;else if(e=ci.newObject(i.type),this._objectPool.push(e),i.type==t.ObjectType.List&&i.listItemCount>0){for(s=this._objectPool.length-i.listItemCount-1,h=0;h<i.listItemCount;h++)e.itemPool.returnObject(this._objectPool[h+s]);this._objectPool.splice(s,i.listItemCount)}if(this._index++,this._index%5==0&&performance.now()-r>=a)return}z.remove(this.run,this);var o=this._objectPool[0];this._itemList.length=0,this._objectPool.length=0,null!=this.callback&&this.callback(o)}},t.ByteBuffer=se,t.Controller=ye,t.DragDropManager=ui,t.Event=C,t.GButton=$e,t.GComboBox=Je,t.GComponent=Ae,t.GGraph=Gt,t.GGroup=Ft,t.GImage=Nt,t.GLabel=Ze,t.GList=ai,t.GLoader=Ke,t.GLoader3D=Qe,t.GMovieClip=Ut,t.GObject=Ct,t.GObjectPool=ri,t.GProgressBar=ii,t.GRichTextField=Ue,t.GRoot=De,t.GScrollBar=hi,t.GSlider=ei,t.GTextField=He,t.GTextInput=qe,t.GTree=di,t.GTreeNode=oi,t.GTween=mt,t.GTweener=dt,t.Image=Ht,t.MovieClip=Yt,t.PackageItem=ie,t.PopupMenu=class{constructor(e){if(!e&&!(e=bt.popupMenu))throw"UIConfig.popupMenu not defined";this._contentPane=oe.createObjectFromURL(e),this._contentPane.on("added_to_stage",this.__addedToStage,this),this._list=this._contentPane.getChild("list"),this._list.removeChildrenToPool(),this._list.addRelation(this._contentPane,t.RelationType.Width),this._list.removeRelation(this._contentPane,t.RelationType.Height),this._contentPane.addRelation(this._list,t.RelationType.Height),this._list.on("click_item",this.__clickItem,this)}dispose(){this._contentPane.dispose()}addItem(t,e){var i=this._list.addItemFromPool();i.title=t,i.data=e,i.grayed=!1;var s=i.getController("checked");return s&&(s.selectedIndex=0),i}addItemAt(t,e,i){var s=this._list.getFromPool();this._list.addChildAt(s,e),s.title=t,s.data=i,s.grayed=!1;var h=s.getController("checked");return h&&(h.selectedIndex=0),s}addSeperator(){if(null==bt.popupMenu_seperator)throw"UIConfig.popupMenu_seperator not defined";this.list.addItemFromPool(bt.popupMenu_seperator)}getItemName(t){return this._list.getChildAt(t).name}setItemText(t,e){this._list.getChild(t).title=e}setItemVisible(t,e){var i=this._list.getChild(t);i.visible!=e&&(i.visible=e,this._list.setBoundsChangedFlag())}setItemGrayed(t,e){this._list.getChild(t).grayed=e}setItemCheckable(t,e){var i=this._list.getChild(t).getController("checked");i&&(e?0==i.selectedIndex&&(i.selectedIndex=1):i.selectedIndex=0)}setItemChecked(t,e){var i=this._list.getChild(t).getController("checked");i&&(i.selectedIndex=e?2:1)}isItemChecked(t){var e=this._list.getChild(t).getController("checked");return!!e&&2==e.selectedIndex}removeItem(t){var e=this._list.getChild(t);if(e){var i=this._list.getChildIndex(e);return this._list.removeChildToPoolAt(i),!0}return!1}clearItems(){this._list.removeChildrenToPool()}get itemCount(){return this._list.numChildren}get contentPane(){return this._contentPane}get list(){return this._list}show(t,e){De.inst.showPopup(this.contentPane,t instanceof De?null:t,e)}__clickItem(t){let e=t.data;if(e instanceof $e)if(e.grayed)this._list.selectedIndex=-1;else{var i=e.getController("checked");i&&0!=i.selectedIndex&&(1==i.selectedIndex?i.selectedIndex=2:i.selectedIndex=1),this._contentPane.parent.hidePopup(this.contentPane),e.data&&e.data()}}__addedToStage(){this._list.selectedIndex=-1,this._list.resizeToFit(1e5,10)}},t.ScrollPane=Ie,t.Stage=R,t.Transition=Oe,t.TranslationHelper=Me,t.UBBParser=We,t.UIConfig=bt,t.UIObjectFactory=ci,t.UIPackage=oe,t.Window=Re,Object.defineProperty(t,"__esModule",{value:!0})}));