@eva/plugin-ui 2.1.0-beta.1 → 2.1.0-beta.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -4
- package/dist/EVA.plugin.ui.js +1370 -140
- package/dist/EVA.plugin.ui.min.js +1 -1
- package/dist/plugin-ui.cjs.js +1139 -138
- package/dist/plugin-ui.cjs.prod.js +1 -1
- package/dist/plugin-ui.d.ts +318 -66
- package/dist/plugin-ui.esm.js +1139 -140
- package/package.json +4 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
function _extends(){return _extends=Object.assign?Object.assign.bind():function(t){for(var i=1;i<arguments.length;i++){var e=arguments[i];for(var s in e)({}).hasOwnProperty.call(e,s)&&(t[s]=e[s])}return t},_extends.apply(null,arguments)}function ownKeys(t,i){var e=Object.keys(t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);i&&(s=s.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),e.push.apply(e,s)}return e}function _objectSpread(t){for(var i=1;i<arguments.length;i++){var e=null!=arguments[i]?arguments[i]:{};i%2?ownKeys(Object(e),!0).forEach(function(i){_defineProperty(t,i,e[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(e)):ownKeys(Object(e)).forEach(function(i){Object.defineProperty(t,i,Object.getOwnPropertyDescriptor(e,i))})}return t}function _defineProperty(t,i,e){return(i=_toPropertyKey(i))in t?Object.defineProperty(t,i,{value:e,enumerable:!0,configurable:!0,writable:!0}):t[i]=e,t}function _toPropertyKey(t){var i=_toPrimitive(t,"string");return"symbol"==typeof i?i:i+""}function _toPrimitive(t,i){if("object"!=typeof t||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var s=e.call(t,i||"default");if("object"!=typeof s)return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===i?String:Number)(t)}globalThis.EVA=globalThis.EVA||{},globalThis.EVA.plugin=globalThis.EVA.plugin||{};var _EVA_IIFE_ui=function(t,i,e,s){"use strict";var n;t.UIShapeType=void 0,(n=t.UIShapeType||(t.UIShapeType={})).RECT="rect",n.CIRCLE="circle",n.ELLIPSE="ellipse",n.ROUNDED_RECT="roundedRect";class r extends i.Component{constructor(){super(...arguments),this.componentName="UI",this.shapes=[]}static getInspectorMetadata(){const t=[{name:"fill",type:"color",isArray:!1},{name:"stroke",type:"color",isArray:!1},{name:"lineWidth",type:"number",isArray:!1},{name:"alpha",type:"number",isArray:!1},{name:"x",type:"number",isArray:!1},{name:"y",type:"number",isArray:!1},{name:"width",type:"number",isArray:!1},{name:"height",type:"number",isArray:!1},{name:"radius",type:"number",isArray:!1}];return{name:r.componentName,type:"object",isArray:!1,isFolder:!0,children:[{name:"componentName",type:"string",isArray:!1},{name:"shapes",type:"object",isArray:!0,children:[{name:"type",type:"string",isArray:!1},{name:"style",type:"object",isArray:!1,children:t}]},{name:"type",type:"string",isArray:!1},{name:"style",type:"object",isArray:!1,children:t}]}}init(t){var i;t&&(this.componentName=null!==(i=t.componentName)&&void 0!==i?i:this.componentName,t.shapes?this.shapes=t.shapes:t.type&&t.style&&(this.shapes=[{type:t.type,style:t.style}]))}awake(){this.redraw()}start(){this.redraw(),queueMicrotask(()=>this.redraw())}parseLinearGradient(t){const i=t.match(/linear-gradient\s*\(\s*([^,]+),\s*(.+)\)/);if(!i)return null;const e=i[1].trim(),s=parseFloat(e),n=[],r=i[2].split(/,(?![^(]*\))/);for(const t of r){const i=t.trim().match(/(.+?)\s+(\d+)%/);if(i){const t=i[1].trim(),e=parseFloat(i[2])/100;n.push({color:t,position:e})}}return{angle:s,colorStops:n}}createGradient(t,i,e,n,r=0,a=0){let o=0,l=0,h=0,d=0;if(0===t)o=.5,l=1,h=.5,d=0;else if(90===t)o=0,l=.5,h=1,d=.5;else if(180===t)o=.5,l=0,h=.5,d=1;else if(270===t)o=1,l=.5,h=0,d=.5;else{const i=(90-t)*(Math.PI/180),s=.5,r=.5,a=Math.max(e,n),u=Math.sqrt(e*e+n*n)/(2*a);o=s-Math.cos(i)*u,l=r-Math.sin(i)*u,h=s+Math.cos(i)*u,d=r+Math.sin(i)*u}const u=new s.FillGradient(o,l,h,d);return i.forEach(t=>{u.addColorStop(t.position,t.color)}),u}getShapeBounds(i,e){const s=e.x||0,n=e.y||0;switch(i){case t.UIShapeType.RECT:case t.UIShapeType.ROUNDED_RECT:return{width:e.width,height:e.height,x:s,y:n};case t.UIShapeType.CIRCLE:return{width:2*e.radius,height:2*e.radius,x:s,y:n};case t.UIShapeType.ELLIPSE:return{width:e.width,height:e.height,x:s,y:n};default:return{width:100,height:100,x:s,y:n}}}redraw(){if(!this.gameObject)return;let t=this.gameObject.getComponent("Graphics");t||(t=this.gameObject.addComponent(new e.Graphics));const i=t.graphics;i?(i.clear(),this.shapes.forEach(t=>{this.drawShape(i,t.type,t.style)})):console.warn("Graphics component has no graphics instance")}drawShape(i,e,s){switch(void 0!==s.alpha&&(i.alpha=s.alpha),s.stroke&&void 0!==s.lineWidth?i.setStrokeStyle({color:s.stroke,width:s.lineWidth}):s.stroke&&i.setStrokeStyle({color:s.stroke,width:1}),e){case t.UIShapeType.RECT:this.drawRect(i,s);break;case t.UIShapeType.CIRCLE:this.drawCircle(i,s);break;case t.UIShapeType.ELLIPSE:this.drawEllipse(i,s);break;case t.UIShapeType.ROUNDED_RECT:this.drawRoundedRect(i,s);break;default:console.warn(`Unknown shape type: ${e}`)}if(s.fill)if("string"==typeof s.fill&&s.fill.includes("linear-gradient")){const t=this.parseLinearGradient(s.fill);if(t){const n=this.getShapeBounds(e,s),r=this.createGradient(t.angle,t.colorStops,n.width,n.height,n.x,n.y);i.fill(r)}else console.warn(`Failed to parse gradient: ${s.fill}`),i.fill("#000000")}else i.fill(s.fill)}drawRect(t,i){const e=i.x||0,s=i.y||0;t.rect(e,s,i.width,i.height)}drawCircle(t,i){const e=i.x||0,s=i.y||0;t.circle(e,s,i.radius)}drawEllipse(t,i){const e=i.x||0,s=i.y||0;t.ellipse(e,s,i.width/2,i.height/2)}drawRoundedRect(t,i){const e=i.x||0,s=i.y||0,n=i.radius||0;t.roundRect(e,s,i.width,i.height,n)}addShape(t,i){this.shapes.push({type:t,style:i}),this.redraw()}clearShapes(){this.shapes=[],this.redraw()}updateShape(t,i,e){t>=0&&t<this.shapes.length&&(this.shapes[t]={type:i,style:e},this.redraw())}removeShape(t){t>=0&&t<this.shapes.length&&(this.shapes.splice(t,1),this.redraw())}getShapeCount(){return this.shapes.length}getShape(t){return t>=0&&t<this.shapes.length?this.shapes[t]:null}setAlpha(t){this.shapes.forEach(i=>{i.style.alpha=t}),this.redraw()}setFill(t){this.shapes.forEach(i=>{i.style.fill=t}),this.redraw()}setStroke(t,i=1){this.shapes.forEach(e=>{e.style.stroke=t,e.style.lineWidth=i}),this.redraw()}}function a(t){var i={exports:{}};return t(i,i.exports),i.exports}r.componentName="UI";var o=a(function(t,i){Object.defineProperty(i,"__esModule",{value:!0}),i.Collector=void 0;i.Collector=class{constructor(t){this.emit=(...i)=>{t.emitCollecting(this,i)}}}}),l=o,h=a(function(t,i){Object.defineProperty(i,"__esModule",{value:!0}),i.CollectorArray=void 0;class e extends l.Collector{constructor(){super(...arguments),this.result=[]}handleResult(t){return this.result.push(t),!0}getResult(){return this.result}reset(){this.result.length=0}}i.CollectorArray=e}),d=a(function(t,i){Object.defineProperty(i,"__esModule",{value:!0}),i.CollectorLast=void 0;class e extends l.Collector{handleResult(t){return this.result=t,!0}getResult(){return this.result}reset(){delete this.result}}i.CollectorLast=e}),u=a(function(t,i){Object.defineProperty(i,"__esModule",{value:!0}),i.CollectorUntil0=void 0;class e extends l.Collector{constructor(){super(...arguments),this.result=!1}handleResult(t){return this.result=t,this.result}getResult(){return this.result}reset(){this.result=!1}}i.CollectorUntil0=e}),c=a(function(t,i){Object.defineProperty(i,"__esModule",{value:!0}),i.CollectorWhile0=void 0;class e extends l.Collector{constructor(){super(...arguments),this.result=!1}handleResult(t){return this.result=t,!this.result}getResult(){return this.result}reset(){this.result=!1}}i.CollectorWhile0=e}),p=a(function(t,i){Object.defineProperty(i,"__esModule",{value:!0}),i.SignalConnectionImpl=void 0;i.SignalConnectionImpl=class{constructor(t,i){this.link=t,this.parentCleanup=i}disconnect(){return null!==this.link&&(this.link.unlink(),this.link=null,this.parentCleanup(),this.parentCleanup=null,!0)}set enabled(t){this.link&&this.link.setEnabled(t)}get enabled(){return null!==this.link&&this.link.isEnabled()}}}),g=a(function(t,i){Object.defineProperty(i,"__esModule",{value:!0}),i.SignalLink=void 0;class e{constructor(t=null,i=null,e=0){this.enabled=!0,this.newLink=!1,this.callback=null,this.prev=null!=t?t:this,this.next=null!=i?i:this,this.order=e}isEnabled(){return this.enabled&&!this.newLink}setEnabled(t){this.enabled=t}unlink(){this.callback=null,this.next.prev=this.prev,this.prev.next=this.next}insert(t,i){let s=this.prev;for(;s!==this&&!(s.order<=i);)s=s.prev;const n=new e(s,s.next,i);return n.callback=t,s.next=n,n.next.prev=n,n}}i.SignalLink=e}),v=p,f=g,_=a(function(t,i){Object.defineProperty(i,"__esModule",{value:!0}),i.Signal=void 0;i.Signal=class{constructor(){this.head=new f.SignalLink,this.hasNewLinks=!1,this.emitDepth=0,this.connectionsCount=0}getConnectionsCount(){return this.connectionsCount}hasConnections(){return this.connectionsCount>0}connect(t,i=0){this.connectionsCount++;const e=this.head.insert(t,i);return this.emitDepth>0&&(this.hasNewLinks=!0,e.newLink=!0),new v.SignalConnectionImpl(e,()=>this.decrementConnectionCount())}decrementConnectionCount(){this.connectionsCount--}disconnect(t){for(let i=this.head.next;i!==this.head;i=i.next)if(i.callback===t)return this.decrementConnectionCount(),i.unlink(),!0;return!1}disconnectAll(){for(;this.head.next!==this.head;)this.head.next.unlink();this.connectionsCount=0}emit(...t){this.emitDepth++;for(let i=this.head.next;i!==this.head;i=i.next)i.isEnabled()&&i.callback&&i.callback.apply(null,t);this.emitDepth--,this.unsetNewLink()}emitCollecting(t,i){this.emitDepth++;for(let e=this.head.next;e!==this.head;e=e.next)if(e.isEnabled()&&e.callback){const s=e.callback.apply(null,i);if(!t.handleResult(s))break}this.emitDepth--,this.unsetNewLink()}unsetNewLink(){if(this.hasNewLinks&&0===this.emitDepth){for(let t=this.head.next;t!==this.head;t=t.next)t.newLink=!1;this.hasNewLinks=!1}}}}),m=a(function(t,i){Object.defineProperty(i,"__esModule",{value:!0}),i.SignalConnections=void 0;i.SignalConnections=class{constructor(){this.list=[]}add(t){this.list.push(t)}disconnectAll(){for(const t of this.list)t.disconnect();this.list=[]}getCount(){return this.list.length}isEmpty(){return 0===this.list.length}}}),w=h,b=d,y=u,x=c,S=_,k=m,C=a(function(t,i){Object.defineProperty(i,"__esModule",{value:!0}),i.SignalConnections=i.Signal=i.CollectorWhile0=i.CollectorUntil0=i.CollectorLast=i.CollectorArray=i.Collector=void 0,Object.defineProperty(i,"Collector",{enumerable:!0,get:function(){return l.Collector}}),Object.defineProperty(i,"CollectorArray",{enumerable:!0,get:function(){return w.CollectorArray}}),Object.defineProperty(i,"CollectorLast",{enumerable:!0,get:function(){return b.CollectorLast}}),Object.defineProperty(i,"CollectorUntil0",{enumerable:!0,get:function(){return y.CollectorUntil0}}),Object.defineProperty(i,"CollectorWhile0",{enumerable:!0,get:function(){return x.CollectorWhile0}}),Object.defineProperty(i,"Signal",{enumerable:!0,get:function(){return S.Signal}}),Object.defineProperty(i,"SignalConnections",{enumerable:!0,get:function(){return k.SignalConnections}})}),V=Object.defineProperty,P=(t,i,e)=>((t,i,e)=>i in t?V(t,i,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[i]=e)(t,"symbol"!=typeof i?i+"":i,e);class M{constructor(){P(this,"_isMouseIn",!1),P(this,"_isDown",!1),P(this,"onDown"),P(this,"onUp"),P(this,"onUpOut"),P(this,"onOut"),P(this,"onPress"),P(this,"onHover"),this.onPress=new C.Signal,this.onDown=new C.Signal,this.onUp=new C.Signal,this.onHover=new C.Signal,this.onOut=new C.Signal,this.onUpOut=new C.Signal}connectEvents(t){s.isMobile.any?(t.on("pointerdown",this.processDown,this),t.on("pointerup",this.processUp,this),t.on("pointerupoutside",this.processUpOut,this),t.on("pointerout",this.processOut,this),t.on("pointertap",this.processPress,this),t.on("pointerover",this.processOver,this)):(t.on("mousedown",this.processDown,this),t.on("mouseup",this.processUp,this),t.on("mouseupoutside",this.processUpOut,this),t.on("mouseout",this.processOut,this),t.on("click",this.processPress,this),t.on("mouseover",this.processOver,this))}disconnectEvents(t){s.isMobile.any?(t.off("pointerdown",this.processDown,this),t.off("pointerup",this.processUp,this),t.off("pointerupoutside",this.processUpOut,this),t.off("pointerout",this.processOut,this),t.off("pointertap",this.processPress,this),t.off("pointerover",this.processOver,this)):(t.off("mousedown",this.processDown,this),t.off("mouseup",this.processUp,this),t.off("mouseupoutside",this.processUpOut,this),t.off("mouseout",this.processOut,this),t.off("click",this.processPress,this),t.off("mouseover",this.processOver,this))}processDown(t){this._isDown=!0,this.onDown.emit(this,t),this.down(t)}processUp(t){this._isDown&&(this.onUp.emit(this,t),this.up(t)),this._isDown=!1}processUpOut(t){this._isDown&&(this.onUp.emit(this,t),this.onUpOut.emit(this,t),this.up(t),this.upOut(t)),this._isDown=!1}processOut(t){this._isMouseIn&&(this._isMouseIn=!1,this.onOut.emit(this,t),this.out(t))}processPress(t){this._isDown=!1,this.onPress.emit(this,t),this.press(t)}processOver(t){s.isMobile.any||(this._isMouseIn=!0,this.onHover.emit(this,t),this.hover(t))}down(t){}up(t){}upOut(t){}out(t){}press(t){}hover(t){}get isDown(){return this._isDown}}var T=Object.defineProperty,I=(t,i,e)=>((t,i,e)=>i in t?T(t,i,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[i]=e)(t,"symbol"!=typeof i?i+"":i,e);class O extends M{constructor(t){super(),I(this,"_view"),t&&(this.view=t,this.enabled=!0)}set view(t){!!this._view&&this._view&&this.disconnectEvents(this._view),this._view=t,this.connectEvents(this._view)}get view(){return this._view}set enabled(t){this.view?(this.view.eventMode=t?"static":"auto",this.view.cursor=t?"pointer":"default",!t&&this.isDown&&this.processUp()):console.error("Button view is not set. Please set it before enabling the button.")}get enabled(){var t;return"static"===(null===(t=this.view)||void 0===t?void 0:t.eventMode)}}class E extends s.Container{constructor(t){super(),I(this,"button"),I(this,"onDown"),I(this,"onUp"),I(this,"onUpOut"),I(this,"onOut"),I(this,"onPress"),I(this,"onHover"),this.button=new O(this),this.button.enabled=!0,t&&this.addChild(t),this.onPress=this.button.onPress,this.onDown=this.button.onDown,this.onUp=this.button.onUp,this.onHover=this.button.onHover,this.onOut=this.button.onOut,this.onUpOut=this.button.onUpOut}set enabled(t){this.button.enabled=t}get enabled(){return this.button.enabled}}function A(t){return"string"==typeof t?s.Sprite.from(t):t instanceof s.Texture?new s.Sprite(t):t}var B=Object.defineProperty,j=(t,i,e)=>((t,i,e)=>i in t?B(t,i,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[i]=e)(t,"symbol"!=typeof i?i+"":i,e);class R extends s.Container{constructor(t,i,e){super(),j(this,"_triggerEvents",new Set(["onPress"])),j(this,"innerView"),j(this,"_active"),j(this,"onChange"),this.innerView=new s.Container,this.addChild(this.innerView),this.onChange=new C.Signal,t&&(this.views=t),i&&(this.triggerEvents=i),void 0!==e&&this.views.length>0&&(this.active=e),this.setInteractionEvents()}setInteractionEvents(){this.innerView.eventMode="static",this.innerView.on("pointerdown",()=>this.handleEvents("onDown")),this.innerView.on("pointerup",()=>this.handleEvents("onUp")),this.innerView.on("pointerupoutside",()=>this.handleEvents("onUpOut")),this.innerView.on("pointerout",()=>this.handleEvents("onOut")),this.innerView.on("pointertap",()=>this.handleEvents("onPress")),this.innerView.on("pointerover",()=>this.handleEvents("onHover"))}handleEvents(t){this._triggerEvents.has(t)&&this.switch()}get activeView(){if(this.views&&void 0!==this.active&&this.views[this.active])return this.views[this.active]}set views(t){this.innerView.removeChildren(),t.forEach(t=>this.add(t))}get views(){return this.innerView.children}add(t){const i=A(t);this.innerView.addChild(i),i.visible=!1,1===this.views.length&&(this.active=0)}remove(t){this.views[t]&&this.innerView.removeChild(this.views[t])}set triggerEvents(t){this._triggerEvents=new Set(Array.isArray(t)?t:[t])}get triggerEvents(){return Array.from(this._triggerEvents)}switch(t){if(void 0!==t&&t===this.active)return;const i=this.active;if(this.forceSwitch(t),i!==this.active){var e;const t=this.views.length>2?null!=(e=this.active)?e:0:1===this.active;this.onChange.emit(t)}}forceSwitch(t){if(void 0===t||t!==this.active){if(this.activeView&&(this.activeView.visible=!1),void 0!==t&&!this.views[t])throw new Error(`View with id ${t} does not exist.`);this._active=void 0===t?this.nextActive:t,void 0!==this._active&&(this.views[this._active].visible=!0)}}get nextActive(){if(0!==this.views.length)return void 0===this.active?0:this.active<this.views.length-1?this.active+1:0}set active(t){this.switch(t)}get active(){return this._active}}var U=Object.defineProperty,L=(t,i,e)=>((t,i,e)=>i in t?U(t,i,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[i]=e)(t,"symbol"!=typeof i?i+"":i,e);var D=Object.defineProperty,F=(t,i,e)=>((t,i,e)=>i in t?D(t,i,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[i]=e)(t,"symbol"!=typeof i?i+"":i,e);class N extends s.Container{constructor(t){super(),F(this,"_progress",0),F(this,"options",{}),F(this,"bgCircle",new s.Graphics),F(this,"fillCircle",new s.Graphics),F(this,"innerView",new s.Container),this.options=null!=t?t:{},this.addChild(this.innerView),this.innerView.addChild(this.bgCircle,this.fillCircle),this.addBackground(),null!=t&&t.value&&(this.progress=t.value)}addBackground(){const{backgroundColor:t,lineWidth:i=5,radius:e=50,backgroundAlpha:s}=this.options;let n=1;void 0===t?n=1e-6:void 0!==s&&s>0&&(n=s),this.bgCircle.circle(0,0,e).stroke({width:i,color:t,alpha:n})}set progress(t){t>100&&(t=100),t<0&&(t=0),this._progress=t;const{lineWidth:i=5,radius:e=50,fillColor:n=16777215,fillAlpha:r,cap:a}=this.options;if(0===t&&0===r)return void this.fillCircle.clear();const o=3.6*t;this.fillCircle.clear().arc(0,0,e,-90*s.DEG_TO_RAD,(-90+o)*s.DEG_TO_RAD).stroke({width:i,color:n,cap:a,alpha:r})}get progress(){return this._progress}}let H;H="undefined"==typeof self&&"undefined"!=typeof process&&process.hrtime?function(){const t=process.hrtime();return 1e3*t[0]+t[1]/1e6}:"undefined"!=typeof self&&void 0!==self.performance&&void 0!==self.performance.now?self.performance.now.bind(self.performance):void 0!==Date.now?Date.now:function(){return(new Date).getTime()};class W{constructor(){W.prototype.__init.call(this),W.prototype.__init2.call(this),W.prototype.__init3.call(this),W.prototype.__init4.call(this)}__init(){this._tweens={}}static get shared(){return W._shared||(W._shared=new W),W._shared}__init2(){this._paused=!1}isPaused(){return this._paused}pause(){this._paused=!0}resume(){this._paused=!1}__init3(){this._lastUpdateTime=void 0}__init4(){this.now=H}getAll(){return Object.keys(this._tweens).map(t=>this._tweens[t])}removeAll(){this._tweens={}}add(t){this._tweens[t.getId()]=t}remove(t){delete this._tweens[t.getId()]}update(t,i=!1){if(null==t&&(null==this._lastUpdateTime?(this._lastUpdateTime=this.now(),t=0):t=this.now()-this._lastUpdateTime),this._lastUpdateTime=this.now(),this._paused)return!1;const e=Object.keys(this._tweens);if(0==e.length)return!1;for(let s=0;s<e.length;s++){const n=this._tweens[e[s]];n&&0==n.update(t,!0)&&!i&&delete this._tweens[e[s]]}return!0}}const G={Step:{None:t=>t<.5?0:1},Linear:{None:t=>t},Quadratic:{In:t=>t*t,Out:t=>t*(2-t),InOut:t=>(t*=2)<1?.5*t*t:-.5*(--t*(t-2)-1)},Cubic:{In:t=>t*t*t,Out:t=>--t*t*t+1,InOut:t=>(t*=2)<1?.5*t*t*t:.5*((t-=2)*t*t+2)},Quartic:{In:t=>t*t*t*t,Out:t=>1- --t*t*t*t,InOut:t=>(t*=2)<1?.5*t*t*t*t:-.5*((t-=2)*t*t*t-2)},Quintic:{In:t=>t*t*t*t*t,Out:t=>--t*t*t*t*t+1,InOut:t=>(t*=2)<1?.5*t*t*t*t*t:.5*((t-=2)*t*t*t*t+2)},Sinusoidal:{In:t=>1-Math.cos(t*Math.PI/2),Out:t=>Math.sin(t*Math.PI/2),InOut:t=>.5*(1-Math.cos(Math.PI*t))},Exponential:{In:t=>0==t?0:Math.pow(1024,t-1),Out:t=>1==t?1:1-Math.pow(2,-10*t),InOut:t=>0==t?0:1==t?1:(t*=2)<1?.5*Math.pow(1024,t-1):.5*(2-Math.pow(2,-10*(t-1)))},Circular:{In:t=>1-Math.sqrt(1-t*t),Out:t=>Math.sqrt(1- --t*t),InOut:t=>(t*=2)<1?-.5*(Math.sqrt(1-t*t)-1):.5*(Math.sqrt(1-(t-=2)*t)+1)},Elastic:{In:t=>0==t?0:1==t?1:-Math.pow(2,10*(t-1))*Math.sin(5*(t-1.1)*Math.PI),Out:t=>0==t?0:1==t?1:Math.pow(2,-10*t)*Math.sin(5*(t-.1)*Math.PI)+1,InOut:t=>0==t?0:1==t?1:(t*=2)<1?-.5*Math.pow(2,10*(t-1))*Math.sin(5*(t-1.1)*Math.PI):.5*Math.pow(2,-10*(t-1))*Math.sin(5*(t-1.1)*Math.PI)+1},Back:{In(t){const i=1.70158;return t*t*((i+1)*t-i)},Out(t){const i=1.70158;return--t*t*((i+1)*t+i)+1},InOut(t){const i=2.5949095;return(t*=2)<1?t*t*((i+1)*t-i)*.5:.5*((t-=2)*t*((i+1)*t+i)+2)}},Bounce:{In:t=>1-G.Bounce.Out(1-t),Out:t=>t<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,InOut:t=>t<.5?.5*G.Bounce.In(2*t):.5*G.Bounce.Out(2*t-1)+.5}},z={Geom:{Linear(t,i){const e=t.length-1,s=e*i,n=Math.floor(s),r=z.Utils.Linear;return i<0?r(t[0],t[1],s):i>1?r(t[e],t[e-1],e-s):r(t[n],t[n+1>e?e:n+1],s-n)},Bezier(t,i){let e=0;const s=t.length-1,n=Math.pow,r=z.Utils.Bernstein;for(let a=0;a<=s;a++)e+=r(s,a)*n(1-i,s-a)*n(i,a)*t[a];return e},QuadraticBezier(t,i){let e=0;const s=t.length-1;if(1==i)return t[s];const n=Math.pow,r=z.Utils.Bernstein,a=s*i,o=Math.floor(a),l=.5*(a-o)+o%2*.5,h=o-o%2,d=h+1,u=h+2;return e+=r(2,0)*n(1-l,2)*n(l,0)*t[h],e+=r(2,1)*n(1-l,1)*n(l,1)*t[d],e+=r(2,2)*n(1-l,0)*n(l,2)*t[u],e},CubicBezier(t,i){let e=0;const s=t.length-1;if(1==i)return t[s];const n=Math.pow,r=z.Utils.Bernstein,a=s*i,o=Math.floor(a),l=1/3*(a-o)+1/3*(o%3),h=o-o%3,d=h+1,u=h+2,c=h+3;return e+=r(3,0)*n(1-l,3)*n(l,0)*t[h],e+=r(3,1)*n(1-l,2)*n(l,1)*t[d],e+=r(3,2)*n(1-l,1)*n(l,2)*t[u],e+=r(3,3)*n(1-l,0)*n(l,3)*t[c],e},CatmullRom(t,i){const e=t.length-1;let s=e*i,n=Math.floor(s);const r=z.Utils.CatmullRom;return t[0]==t[e]?(i<0&&(n=Math.floor(s=e*(1+i))),r(t[(n-1+e)%e],t[n],t[(n+1)%e],t[(n+2)%e],s-n)):i<0?t[0]-(r(t[0],t[0],t[1],t[1],-s)-t[0]):i>1?t[e]-(r(t[e],t[e],t[e-1],t[e-1],s-e)-t[e]):r(t[n?n-1:0],t[n],t[e<n+1?e:n+1],t[e<n+2?e:n+2],s-n)}},Angle:{Radians(t,i){const e=t.length-1,s=e*i,n=Math.floor(s),r=z.Utils.WrapLinear;return i<0?r(t[0],t[1],s,2*Math.PI):i>1?r(t[e],t[e-1],e-s,2*Math.PI):r(t[n],t[n+1>e?e:n+1],s-n,2*Math.PI)},Degrees(t,i){const e=t.length-1,s=e*i,n=Math.floor(s),r=z.Utils.WrapLinear;return i<0?r(t[0],t[1],s,360):i>1?r(t[e],t[e-1],e-s,360):r(t[n],t[n+1>e?e:n+1],s-n,360)}},Color:{RGB(t,i){const e=t.length-1,s=e*i,n=Math.floor(s),r=z.Utils.RGBLinear;return i<0?r(t[0],t[1],s):i>1?r(t[e],t[e-1],e-s):r(t[n],t[n+1>e?e:n+1],s-n)},HSV(t,i){const e=t.length-1,s=e*i,n=Math.floor(s),r=z.Utils.HSVLinear;return i<0?r(t[0],t[1],s):i>1?r(t[e],t[e-1],e-s):r(t[n],t[n+1>e?e:n+1],s-n)},HCL(t,i){const e=t.length-1,s=e*i,n=Math.floor(s),r=z.Utils.HCLLinear;return i<0?r(t[0],t[1],s):i>1?r(t[e],t[e-1],e-s):r(t[n],t[n+1>e?e:n+1],s-n)}},Utils:{RGBsplit:t=>({a:t>>24&255,r:t>>16&255,g:t>>8&255,b:255&t}),HSVsplit(t){const i=z.Utils.RGBsplit(t);i.r/=255,i.g/=255,i.b/=255;const e=Math.max(i.r,i.g,i.b),s=Math.min(i.r,i.g,i.b);let n;const r=e,a=e-s,o=0==e?0:a/e;if(e==s)n=0;else{switch(e){case i.r:n=(i.g-i.b)/a+(i.g<i.b?6:0);break;case i.g:n=(i.b-i.r)/a+2;break;case i.b:n=(i.r-i.g)/a+4}n/=6}return{a:i.a,h:n,s:o,v:r}},HSVJoin(t){let i,e,s;const n=Math.floor(6*t.h),r=6*t.h-n,a=t.v*(1-t.s),o=t.v*(1-r*t.s),l=t.v*(1-(1-r)*t.s);switch(n%6){case 0:i=t.v,e=l,s=a;break;case 1:i=o,e=t.v,s=a;break;case 2:i=a,e=t.v,s=l;break;case 3:i=a,e=o,s=t.v;break;case 4:i=l,e=a,s=t.v;break;case 5:i=t.v,e=a,s=o}return t.a<<24|i<<16|e<<8|s},HCLSplit(t){const i=z.Utils.RGBsplit(t),e={a:i.a,h:0,c:0,l:0};let s=0;const n=Math.min(i.r,Math.min(i.g,i.b)),r=Math.max(i.r,Math.max(i.g,i.b));let a=.03;return e.c=r-n,0!=e.c&&(s=Math.atan2(i.g-i.b,i.r-i.g)/Math.PI,a*=n/r),a=Math.exp(a),e.h=(s/2-Math.min(s%1,-s%1)/6)%1,e.c*=a,e.l=z.Utils.Linear(-n,r,a)/1.060909067907034,e},HCLJoin(t){const i={a:t.a,r:0,g:0,b:0};if(0!=t.l){let e=t.h;const s=t.c,n=.530454533953517*t.l,r=Math.exp(.03*(1-s/(2*n))),a=(2*n-s)/(2*r-1),o=s/r,l=(e+Math.min(2*e%1/4,-2*e%1/8))*Math.PI*2;let h;e*=6,e<=.999?(h=Math.tan(l),i.r=1,i.g=h/(1+h)):e<=1.001?(i.r=1,i.g=1):e<=2?(h=Math.tan(l),i.r=(1+h)/h,i.g=1):e<=3?(h=Math.tan(l),i.g=1,i.b=1+h):e<=3.999?(h=Math.tan(l),i.g=1/(1+h),i.b=1):e<=4.001?(i.g=0,i.b=1):e<=5?(h=Math.tan(l),i.r=-1/h,i.b=1):(h=Math.tan(l),i.r=1,i.b=-h),i.r=i.r*o+a,i.g=i.g*o+a,i.b=i.b*o+a}return i.a<<24|i.r<<16|i.g<<8|i.b},WrapLinear(t,i,e,s){let n;return t=(t+s*Math.trunc(Math.abs(t/s)))%s,i=(i+s*Math.trunc(Math.abs(i/s)))%s,Math.abs(t-i)<=.5*s?n=z.Utils.Linear(t,i,e):(n=t<i?z.Utils.Linear(t+s,i,e):z.Utils.Linear(t,i+s,e),n%=s),n},RGBLinear(t,i,e){const s=z.Utils.RGBsplit(t),n=z.Utils.RGBsplit(i);return z.Utils.Linear(s.a,n.a,e)<<24|z.Utils.Linear(s.r,n.r,e)<<16|z.Utils.Linear(s.g,n.g,e)<<8|z.Utils.Linear(s.b,n.b,e)},HSVLinear(t,i,e){const s=z.Utils.HSVsplit(t),n=z.Utils.HSVsplit(i);let r;Math.abs(s.h-n.h)<=.5?r=z.Utils.Linear(s.h,n.h,e):(r=s.h<n.h?z.Utils.Linear(s.h+1,n.h,e):z.Utils.Linear(s.h,n.h+1,e),r%=1);const a=z.Utils.Linear(s.s,n.s,e),o=z.Utils.Linear(s.v,n.v,e),l=z.Utils.Linear(s.a,n.a,e);return z.Utils.HSVJoin({a:l,h:r,s:a,v:o})},HCLLinear(t,i,e){const s=z.Utils.HCLSplit(t),n=z.Utils.HCLSplit(i);let r;Math.abs(s.h-n.h)<=.5?r=z.Utils.Linear(s.h,n.h,e):(r=s.h<n.h?z.Utils.Linear(s.h+1,n.h,e):z.Utils.Linear(s.h,n.h+1,e),r%=1);const a=z.Utils.Linear(s.c,n.c,e),o=z.Utils.Linear(s.l,n.l,e),l=z.Utils.Linear(s.a,n.a,e);return z.Utils.HSVJoin({a:l,h:r,s:a,v:o})},Linear:(t,i,e)=>(i-t)*e+t,Bernstein(t,i){const e=z.Utils.Factorial;return e(t)/e(i)/e(t-i)},Factorial:function(){const t=[1];return function(i){let e=1;if(t[i])return t[i];for(let t=i;t>1;t--)e*=t;return t[i]=e,e}}(),CatmullRom(t,i,e,s,n){const r=.5*(e-t),a=.5*(s-i),o=n*n;return(2*i-2*e+r+a)*(n*o)+(-3*i+3*e-2*r-a)*o+r*n+i}}};class q{static __initStatic(){this._nextId=0}static nextId(){return q._nextId++}}q.__initStatic();const Y={safetyCheckFunction:t=>!0,easingFunction:G.Linear.None,yoyoEasingFunction:void 0,interpolationFunction:z.Geom.Linear};class X{__init(){this._isPaused=!1}__init2(){this._valuesStart={}}__init3(){this._valuesEnd={}}__init4(){this._valuesStartRepeat={}}__init5(){this._duration=0}__init6(){this._repeatCount=0}__init7(){this._repeat=0}__init8(){this._yoyo=!1}__init9(){this._isPlaying=!1}get _reversed(){return this.yoyo&&this._repeatCount%2!=0}__init10(){this._delayTime=0}__init11(){this._startTime=0}__init12(){this._elapsedTime=0}__init13(){this._timescale=1}__init14(){this._safetyCheckFunction=Y.safetyCheckFunction}__init15(){this._easingFunction=Y.easingFunction}__init16(){this._yoyoEasingFunction=Y.yoyoEasingFunction}__init17(){this._interpolationFunction=Y.interpolationFunction}__init18(){this._chainedTweens=[]}__init19(){this._onStartCallbackFired=!1}__init20(){this._onAfterDelayCallbackFired=!1}__init21(){this._id=q.nextId()}__init22(){this._isChainStopped=!1}get _group(){return this._groupRef?this._groupRef:W.shared}set _group(t){this._groupRef=t}constructor(t,i){X.prototype.__init.call(this),X.prototype.__init2.call(this),X.prototype.__init3.call(this),X.prototype.__init4.call(this),X.prototype.__init5.call(this),X.prototype.__init6.call(this),X.prototype.__init7.call(this),X.prototype.__init8.call(this),X.prototype.__init9.call(this),X.prototype.__init10.call(this),X.prototype.__init11.call(this),X.prototype.__init12.call(this),X.prototype.__init13.call(this),X.prototype.__init14.call(this),X.prototype.__init15.call(this),X.prototype.__init16.call(this),X.prototype.__init17.call(this),X.prototype.__init18.call(this),X.prototype.__init19.call(this),X.prototype.__init20.call(this),X.prototype.__init21.call(this),X.prototype.__init22.call(this),this._object=t,this._group=i}getId(){return this._id}getGroup(){return this._group}getTimescale(){return this._timescale}isPlaying(){return this._isPlaying}isPaused(){return this._isPaused}from(t){try{JSON.stringify(t)}catch(t){throw new Error("The object you provided to the from() method has a circular reference!")}return this._setupProperties(t,this._valuesStart,t,this._valuesStartRepeat,!0),this}to(t,i){try{this._valuesEnd=JSON.parse(JSON.stringify(t))}catch(e){return console.warn("The object you provided to the to() method has a circular reference!. It can't be cloned. Falling back to dynamic targeting"),this.dynamicTo(t,i)}return void 0!==i&&(this._duration=i),this}dynamicTo(t,i){return this._valuesEnd=t,void 0!==i&&(this._duration=i),this}duration(t){return this._duration=t,this}start(t){return this._isPlaying||(null!=t&&(this._delayTime=t),this._group.add(this),this._reversed&&(this._swapEndStartRepeatValues(this._valuesStartRepeat,this._valuesEnd),this._valuesStart=JSON.parse(JSON.stringify(this._valuesStartRepeat))),this._repeatCount=0,this._isPlaying=!0,this._isPaused=!1,this._onStartCallbackFired=!1,this._onAfterDelayCallbackFired=!1,this._isChainStopped=!1,this._startTime=-this._delayTime,this._elapsedTime=0,this._setupProperties(this._object,this._valuesStart,this._valuesEnd,this._valuesStartRepeat,!1)),this}restart(t){return this.reset(),this.start(t)}reset(){return this._isPlaying&&this.stop(),this._valuesStart={},this._valuesStartRepeat={},this}rewind(){this._isPlaying&&this.stop(),this._reversed&&this._swapEndStartRepeatValues(this._valuesStartRepeat,this._valuesEnd);const t=this._easingFunction(0);return this._updateProperties(this._object,this._valuesStart,this._valuesEnd,t),this}_setupProperties(t,i,e,s,n){for(const r in e){const a=t[r],o=Array.isArray(a),l=!Number.isNaN(Number(a)),h=o?"array":typeof a,d="object"==h,u="object"==typeof e[r],c=!o&&Array.isArray(e[r]);"undefined"!=h&&"function"!=h&&null!=e[r]&&(o||l||d)&&((d||o||u)&&a&&!c?(void 0===i[r]&&(i[r]=o?[]:{}),void 0===s[r]&&(s[r]=o?[]:{}),this._setupProperties(a,i[r],e[r],s[r],n)):((void 0===i[r]||n)&&(i[r]=a),(void 0===s[r]||n)&&(s[r]=c?e[r].slice().reverse()[0]:i[r]||0)))}}stop(){return this._isChainStopped||(this._isChainStopped=!0,this.stopChainedTweens()),this._isPlaying?(this._group.remove(this),this._isPlaying=!1,this._isPaused=!1,this._onStopCallback&&this._onStopCallback(this._object,this),this):this}end(t=!1){let i=[];if(t||(i=this._chainedTweens,this._chainedTweens=[]),this.resume(),this.update(1/0),!t){this._chainedTweens=i;for(let t=0,i=this._chainedTweens.length;t<i;t++)this._chainedTweens[t].start()}return this}skip(t,i=!1){return this.resume(),this.update(t*this._duration-(i?this._elapsedTime:0)),this}pause(){return this._isPaused||!this._isPlaying||(this._isPaused=!0,this._group.remove(this)),this}resume(){return this._isPaused&&this._isPlaying?(this._isPaused=!1,this._group.add(this),this):this}stopChainedTweens(){for(let t=0,i=this._chainedTweens.length;t<i;t++)this._chainedTweens[t].stop();return this}startChainedTweens(t=!1){t&&this.stop();for(let t=0,i=this._chainedTweens.length;t<i;t++)this._chainedTweens[t].start();return this}group(t){return this._group=t,this}delay(t){return this._delayTime=t,this}timescale(t){return this._timescale=t,this}repeat(t=1/0){return this._repeat=t,this}repeatDelay(t){return this._repeatDelayTime=t,this}yoyo(t=!0){return this._yoyo=t,this}easing(t){return this._easingFunction=t,this}safetyCheck(t){return this._safetyCheckFunction=t,this}yoyoEasing(t){return this._yoyoEasingFunction=t,this}interpolation(t){return this._interpolationFunction=t,this}chain(...t){return this._chainedTweens=t,this}onStart(t){return this._onStartCallback=t,this}onAfterDelay(t){return this._onAfterDelayCallback=t,this}onUpdate(t){return this._onUpdateCallback=t,this}onRepeat(t){return this._onRepeatCallback=t,this}onComplete(t){return this._onCompleteCallback=t,this}onStop(t){return this._onStopCallback=t,this}update(t,i=!1){const e=this._internalUpdate(t);return e||i||this._group.remove(this),e}_internalUpdate(t){if(!this._safetyCheckFunction(this._object))return!1;if(this._isPaused)return!1;let i;t*=this._timescale,this._elapsedTime+=t;const e=this._duration,s=this._startTime+this._elapsedTime;if(s>e&&!this._isPlaying)return!1;this.isPlaying||this.start(),0==this._onStartCallbackFired&&(this._onStartCallback&&this._onStartCallback(this._object,this),this._onStartCallbackFired=!0),0==this._onAfterDelayCallbackFired&&s>=0&&(this._onAfterDelayCallback&&this._onAfterDelayCallback(this._object,this),this._onAfterDelayCallbackFired=!0),i=s/this._duration,0==this._duration&&(i=s>=0?1:0),i=Math.min(1,i),i=Math.max(0,i);let n=Number.isFinite(s)?s%this._duration:s;Number.isNaN(n)&&(n=0);const r=Math.floor(s/this._duration);let a;if(a=this._reversed&&this._yoyoEasingFunction?this._yoyoEasingFunction(i):this._easingFunction(i),this._updateProperties(this._object,this._valuesStart,this._valuesEnd,a),this._onUpdateCallback&&(1!=i||this._repeat-this._repeatCount<=0)&&this._onUpdateCallback(this._object,i,this),1==i){if(this._repeat-this._repeatCount>0){const t=this._repeatCount;if(this._repeatCount=Math.min(this._repeat+1,this._repeatCount+r),this._onUpdateCallback&&(this._repeat-this._repeatCount<0||n<=0)&&this._onUpdateCallback(this._object,i,this),this._yoyo?this._swapEndStartRepeatValues(this._valuesStartRepeat,this._valuesEnd):this._moveForwardStartRepeatValues(this._valuesStartRepeat,this._valuesEnd),this._valuesStart=JSON.parse(JSON.stringify(this._valuesStartRepeat)),void 0!==this._repeatDelayTime?this._startTime=-this._repeatDelayTime:this._startTime=0,this._onRepeatCallback){let i=1;Number.isFinite(r)?i=this._repeatCount-t:Number.isFinite(this._repeat)&&(i=this._repeat-t);for(let e=0;e<i;e++)this._onRepeatCallback(this._object,t+1+e,this)}if(this._elapsedTime=0,this._repeat-this._repeatCount>=0)return n>0&&Number.isFinite(this._repeat)&&this._internalUpdate(n),!0}this._onCompleteCallback&&this._onCompleteCallback(this._object,this);for(let t=0,i=this._chainedTweens.length;t<i;t++)this._chainedTweens[t].start(),n>0&&this._chainedTweens[t].update(n);return this._isPlaying=!1,!1}return!0}_updateProperties(t,i,e,s){for(const n in e){if(null==i[n])continue;const r=i[n];let a=e[n];const o=Array.isArray(t[n]),l=Array.isArray(a);!o&&l?this._reversed?t[n]=this._interpolationFunction(a.concat([r]),s):t[n]=this._interpolationFunction([r].concat(a),s):"object"==typeof a&&a?this._updateProperties(t[n],r,a,s):(a=this._handleRelativeValue(r,a),"number"!=typeof a||"number"!=typeof r&&"string"!=typeof r||(t[n]=Number(r)+(a-Number(r))*s,"string"==typeof r&&(t[n]=String(t[n]))))}}_handleRelativeValue(t,i){return"string"!=typeof i?i:"+"==i.charAt(0)||"-"==i.charAt(0)?t+Number(i):Number(i)}_swapEndStartRepeatValues(t,i){for(const e in t){const s=!Array.isArray(t[e])&&Array.isArray(i[e]);if("object"==typeof t[e])this._swapEndStartRepeatValues(t[e],i[e]);else{const n=t[e];if("string"==typeof i[e])t[e]=Number(t[e])+Number(i[e]),i[e]=n;else if(s){const s=i[e].slice().reverse();t[e]=s[0],i[e]=s}else t[e]=i[e],i[e]=n}}}_moveForwardStartRepeatValues(t,i){for(const e in t)"object"==typeof i[e]?this._moveForwardStartRepeatValues(t[e],i[e]):"string"==typeof i[e]&&(t[e]=Number(t[e])+Number(i[e]))}}function $(t,i,e=0,s=!0){let n=i.scale.x,r=i.scale.y;if(!t)throw new Error("Parent is not defined");const a=t.width-2*e,o=t.height-2*e,l=a-Math.round(i.width),h=o-Math.round(i.height);if(l<0&&(n=a/(i.width/n)),h<0&&(r=o/(i.height/r)),n<=0||r<=0)i.scale.set(0);else if(s||i.scale.x===i.scale.y){const t=Math.min(n,r);i.scale.set(t,t)}else{const t=i.scale.x/i.scale.y;l<h?i.scale.set(n,n/t):i.scale.set(r*t,r)}}function K(t){return"string"==typeof t||"number"==typeof t?new s.Text({text:String(t)}):t}var J=Object.defineProperty,Q=(t,i,e)=>((t,i,e)=>i in t?J(t,i,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[i]=e)(t,"symbol"!=typeof i?i+"":i,e);class Z extends E{constructor(t){var i,e;super(),Q(this,"animations"),Q(this,"originalInnerViewState"),Q(this,"defaultDuration",100),Q(this,"options"),Q(this,"_padding",0),Q(this,"_offset",{}),Q(this,"_textOffset",{}),Q(this,"iconOffset",{}),Q(this,"innerView",new s.Container),Q(this,"_views",{}),Q(this,"state","default"),Q(this,"anchor"),Q(this,"_defaultTextScale",{x:1,y:1}),Q(this,"_defaultIconScale",{x:1,y:1}),Q(this,"_defaultTextAnchor",{x:.5,y:.5}),Q(this,"_defaultIconAnchor",{x:.5,y:.5}),this.options=null!=t?t:{};const{defaultView:n,hoverView:r,pressedView:a,disabledView:o,text:l,padding:h,offset:d,textOffset:u,iconOffset:c,defaultTextScale:p,defaultIconScale:g,defaultTextAnchor:v,defaultIconAnchor:f,scale:_,anchor:m,anchorX:w,anchorY:b,icon:y,animations:x}=null!=t?t:{};this.addChild(this.innerView),this.anchor=new s.ObservablePoint({_onUpdate:()=>this.updateAnchor()}),this.anchor.set(null!=(i=null!=w?w:m)?i:0,null!=(e=null!=b?b:m)?e:0),this.padding=null!=h?h:0,this.offset=null!=d?d:{},this.textOffset=null!=u?u:{},this.iconOffset=null!=c?c:{},this.defaultTextScale=null!=p?p:{x:1,y:1},this.defaultIconScale=null!=g?g:{x:1,y:1},this.defaultTextAnchor=null!=v?v:{x:.5,y:.5},this.defaultIconAnchor=null!=f?f:{x:.5,y:.5},this.scale.set(null!=_?_:1),x&&(this.animations=x,this.setOriginalInnerViewState(),s.Ticker.shared.add(()=>W.shared.update())),this.setState("default"),this.defaultView=n,this.hoverView=r,this.pressedView=a,this.disabledView=o,this.text=null!=l?l:"",void 0!==y&&(this.iconView=y),this.initStateControl()}set text(t){t&&0!==t?this._views.textView?this._views.textView.text=t.toString():this.createTextView(t):this.removeView("textView")}get text(){var t;return null===(t=this._views.textView)||void 0===t?void 0:t.text}set enabled(t){this.button.enabled=t,this.setState(t?"default":"disabled")}get enabled(){return this.button.enabled}setState(t,i=!1){if(!i&&this.state===t)return;const e=this.getStateView(this.state);e&&(e.visible=!1),this.state=t;const s=this.getStateView(t);s&&(this.setOffset(s,t,this.offset),s.visible=!0),this.updateAnchor(),this.playAnimations(t)}createTextView(t){var i;if(this._views.textView=K(t),void 0===(null===(i=this.options)||void 0===i?void 0:i.defaultTextScale)){const{x:t,y:i}=this._views.textView.scale;this._defaultTextScale={x:t,y:i}}this.innerView.addChild(this._views.textView),this.adjustTextView(this.state)}setOffset(t,i,e){const s=e?e[i]:{x:0,y:0},n=null==e?void 0:e.default;var r,a;if(s)t.x+=null!=(r=s.x)?r:0,t.y+=null!=(a=s.y)?a:0;else if(n){var o,l;t.x+=null!=(o=n.x)?o:0,t.y+=null!=(l=n.y)?l:0}else if(e.x||e.y){var h,d;t.x+=null!=(h=e.x)?h:0,t.y+=null!=(d=e.y)?d:0}}getStateView(t){var i,e,s,n,r,a,o,l;if(this._views)switch(t){case"hover":return null!=(i=null!=(e=this._views.hoverView)?e:this._views.defaultView)?i:void 0;case"pressed":return null!=(s=null!=(n=null!=(r=this._views.pressedView)?r:this._views.hoverView)?n:this._views.defaultView)?s:void 0;case"disabled":return null!=(a=null!=(o=this._views.disabledView)?o:this._views.defaultView)?a:void 0;case"default":return null!=(l=this._views.defaultView)?l:void 0;default:return}}adjustTextView(t){var i,e;if(!this.text)return;if(!this._views.textView)return;const s=this.getStateView(this.state),n=null!=(i=this._defaultTextAnchor.x)?i:.5,r=null!=(e=this._defaultTextAnchor.y)?e:.5;if(s){var a;if(null!==(a=this.options)&&void 0!==a&&a.ignoreRefitting||this._views.textView.scale.set(this._defaultTextScale.x,this._defaultTextScale.y),"default"===this.contentFittingMode&&$(s,this._views.textView,this.padding,!1),"fill"===this.contentFittingMode){var o,l;this._views.textView.scale.set(1);const t=s.width-2*this.padding,i=s.height-2*this.padding,e=t/this._views.textView.width,n=i/this._views.textView.height,r=Math.min(e,n);this._views.textView.scale.set(r*(null!=(o=this._defaultTextScale.x)?o:1),r*(null!=(l=this._defaultTextScale.y)?l:1))}this._views.textView.x=s.x+s.width/2,this._views.textView.y=s.y+s.height/2}this._views.textView.anchor.set(n,r),this.setOffset(this._views.textView,t,this.textOffset)}adjustIconView(t){var i,e,s;if(!this._views.iconView)return;const n=this.getStateView(t);if(!n)return;if(null!==(i=this.options)&&void 0!==i&&i.ignoreRefitting||this._views.iconView.scale.set(this._defaultIconScale.x,this._defaultIconScale.y),"default"===this.contentFittingMode&&$(n,this._views.iconView,this.padding,!1),"fill"===this.contentFittingMode){var r,a;this._views.iconView.scale.set(1);const t=n.width-2*this.padding,i=n.height-2*this.padding,e=t/this._views.iconView.width,s=i/this._views.iconView.height,o=Math.min(e,s);this._views.iconView.scale.set(o*(null!=(r=this._defaultIconScale.x)?r:1),o*(null!=(a=this._defaultIconScale.y)?a:1))}const o=null!=(e=this._defaultIconAnchor.x)?e:.5,l=null!=(s=this._defaultIconAnchor.y)?s:.5;"anchor"in this._views.iconView?this._views.iconView.anchor.set(o,l):this._views.iconView.pivot.set(o*(this._views.iconView.width/this._views.iconView.scale.x),l*(this._views.iconView.height/this._views.iconView.scale.y)),this._views.iconView.x=n.x+n.width/2,this._views.iconView.y=n.y+n.height/2,this.setOffset(this._views.iconView,t,this.iconOffset)}updateAnchor(){var t,i;if(!this._views)return;const e=null!=(t=this.anchor.x)?t:0,n=null!=(i=this.anchor.y)?i:0;if([this._views.defaultView,this._views.hoverView,this._views.pressedView,this._views.disabledView].forEach(t=>{var i;t&&(null===(i=t.anchor)||void 0===i||i.set(0),t.x=-t.width*e,t.y=-t.height*n)}),this._views.defaultView){const{x:t,y:i,width:e,height:n}=this._views.defaultView;this.hitArea=new s.Rectangle(t,i,e,n)}this.adjustIconView(this.state),this.adjustTextView(this.state)}set contentFittingMode(t){this.options.contentFittingMode=t}get contentFittingMode(){var t;return null!=(t=this.options.contentFittingMode)?t:"default"}set defaultView(t){this.updateView("defaultView",t),this._views.disabledView&&"default"!==this.state&&(this._views.disabledView.visible=!1)}get defaultView(){return this._views.defaultView}set hoverView(t){this.updateView("hoverView",t),this._views.hoverView&&"hover"!==this.state&&(this._views.hoverView.visible=!1)}get hoverView(){return this._views.hoverView}set pressedView(t){this.updateView("pressedView",t),this._views.pressedView&&"pressed"!==this.state&&(this._views.pressedView.visible=!1)}get pressedView(){return this._views.pressedView}set disabledView(t){this.updateView("disabledView",t),this._views.disabledView&&"disabled"!==this.state&&(this._views.disabledView.visible=!1)}get disabledView(){return this._views.disabledView}updateView(t,i){var e;void 0!==i&&(this.removeView(t),null!==(e=this.options)&&void 0!==e&&e.nineSliceSprite&&("string"==typeof i?this._views[t]=new s.NineSliceSprite({texture:s.Texture.from(i),leftWidth:this.options.nineSliceSprite[0],topHeight:this.options.nineSliceSprite[1],rightWidth:this.options.nineSliceSprite[2],bottomHeight:this.options.nineSliceSprite[3]}):i instanceof s.Texture?this._views[t]=new s.NineSliceSprite({texture:i,leftWidth:this.options.nineSliceSprite[0],topHeight:this.options.nineSliceSprite[1],rightWidth:this.options.nineSliceSprite[2],bottomHeight:this.options.nineSliceSprite[3]}):console.warn("NineSliceSprite can not be used with views set as Container. Pass the texture or texture name as instead of the Container extended instance.")),this._views[t]||(this._views[t]=A(i)),this.setOffset(this._views[t],this.state,this.offset),this._views[t].parent||this.innerView.addChild(this._views[t]),this.updateAnchor(),this._views.iconView&&this.innerView.addChild(this._views.iconView),this._views.textView&&this.innerView.addChild(this._views.textView),this.setState(this.state,!0))}removeView(t){this._views[t]&&(this.innerView.removeChild(this._views[t]),this._views[t]=void 0)}set textView(t){void 0!==t&&(this.removeView("textView"),null!==t&&this.createTextView(t))}get textView(){return this._views.textView}set iconView(t){var i;if(void 0!==t&&(this.removeView("iconView"),null!==t)){if(this._views.iconView=A(t),void 0===(null===(i=this.options)||void 0===i?void 0:i.defaultIconScale)){const{x:t,y:i}=this._views.iconView.scale;this._defaultIconScale={x:t,y:i}}this._views.iconView.parent||this.innerView.addChild(this._views.iconView),this.setState(this.state,!0)}}get iconView(){return this._views.iconView}playAnimations(t){var i;if(!this.animations)return;const e=null!=(i=this.animations[t])?i:this.animations.default;if(e){var s;const t=e;return this.defaultDuration=null!=(s=t.duration)?s:this.defaultDuration,void new X(this.innerView).to(t.props,t.duration).start()}new X(this.innerView).to(this.originalInnerViewState,this.defaultDuration).start()}setOriginalInnerViewState(){var t;this.originalInnerViewState={x:this.innerView.x,y:this.innerView.y,width:this.innerView.width,height:this.innerView.height,scale:{x:this.innerView.scale.x,y:this.innerView.scale.y}};const i=null===(t=this.animations)||void 0===t?void 0:t.default;var e,s,n,r,a,o,l,h,d,u,c,p,g,v,f,_;i&&(this.innerView.x=null!=(e=null!=(s=i.props.x)?s:this.originalInnerViewState.x)?e:0,this.innerView.y=null!=(n=null!=(r=i.props.y)?r:this.originalInnerViewState.y)?n:0,this.innerView.width=null!=(a=null!=(o=i.props.width)?o:this.originalInnerViewState.width)?a:0,this.innerView.height=null!=(l=null!=(h=i.props.height)?h:this.originalInnerViewState.height)?l:0,this.innerView.scale.x=null!=(d=null!=(u=null===(c=i.props.scale)||void 0===c?void 0:c.x)?u:null===(p=this.originalInnerViewState.scale)||void 0===p?void 0:p.x)?d:1,this.innerView.scale.y=null!=(g=null!=(v=null===(f=i.props.scale)||void 0===f?void 0:f.y)?v:null===(_=this.originalInnerViewState.scale)||void 0===_?void 0:_.y)?g:1)}initStateControl(){this.onDown.connect(()=>{this.setState("pressed")}),this.onUp.connect(()=>{this.setState(s.isMobile.any?"default":"hover")}),this.onUpOut.connect(()=>{this.setState("default")}),this.onOut.connect(()=>{this.button.isDown||this.setState("default")}),this.onPress.connect(()=>{this.setState(s.isMobile.any?"default":"hover")}),this.onHover.connect(()=>{this.button.isDown||this.setState(s.isMobile.any?"default":"hover")})}set padding(t){this._padding=t,this.adjustTextView(this.state),this.adjustIconView(this.state)}get padding(){return this._padding}set offset(t){this._offset=t,this.updateAnchor()}get offset(){return this._offset}set textOffset(t){this._textOffset=t,this.adjustTextView(this.state)}get textOffset(){return this._textOffset}set defaultTextScale(t){var i,e;if(void 0===t)return;this.options.defaultTextScale=t;const s="number"==typeof t;this._defaultTextScale.x=s?t:null!=(i=t.x)?i:1,this._defaultTextScale.y=s?t:null!=(e=t.y)?e:1,this.adjustTextView(this.state)}get defaultTextScale(){return this.defaultTextScale}set defaultIconScale(t){var i,e;if(void 0===t)return;this.options.defaultIconScale=t;const s="number"==typeof t;this._defaultIconScale.x=s?t:null!=(i=t.x)?i:1,this._defaultIconScale.y=s?t:null!=(e=t.y)?e:1,this.adjustIconView(this.state)}get defaultIconScale(){return this.defaultIconScale}set defaultTextAnchor(t){var i,e;if(void 0===t)return;this.options.defaultTextAnchor=t;const s="number"==typeof t;this._defaultTextAnchor.x=s?t:null!=(i=t.x)?i:1,this._defaultTextAnchor.y=s?t:null!=(e=t.y)?e:1,this.adjustTextView(this.state)}get defaultTextAnchor(){return this.defaultTextAnchor}set defaultIconAnchor(t){var i,e;if(void 0===t)return;this.options.defaultIconAnchor=t;const s="number"==typeof t;this._defaultIconAnchor.x=s?t:null!=(i=t.x)?i:1,this._defaultIconAnchor.y=s?t:null!=(e=t.y)?e:1,this.adjustIconView(this.state)}get defaultIconAnchor(){return this.defaultIconAnchor}set width(t){var i;null!==(i=this.options)&&void 0!==i&&i.nineSliceSprite?(this._views.defaultView&&(this._views.defaultView.width=t),this._views.hoverView&&(this._views.hoverView.width=t),this._views.pressedView&&(this._views.pressedView.width=t),this._views.disabledView&&(this._views.disabledView.width=t),this.adjustTextView(this.state),this.adjustIconView(this.state),this.updateAnchor()):super.width=t}get width(){return super.width}set height(t){var i;null!==(i=this.options)&&void 0!==i&&i.nineSliceSprite?(this._views.defaultView&&(this._views.defaultView.height=t),this._views.hoverView&&(this._views.hoverView.height=t),this._views.pressedView&&(this._views.pressedView.height=t),this._views.disabledView&&(this._views.disabledView.height=t),this.adjustTextView(this.state),this.adjustIconView(this.state),this.updateAnchor()):super.height=t}get height(){return super.height}setSize(t,i){var e;null!==(e=this.options)&&void 0!==e&&e.nineSliceSprite?(this._views.defaultView&&this._views.defaultView.setSize(t,i),this._views.hoverView&&this._views.hoverView.setSize(t,i),this._views.pressedView&&this._views.pressedView.setSize(t,i),this._views.disabledView&&this._views.disabledView.setSize(t,i),this.adjustTextView(this.state),this.adjustIconView(this.state),this.updateAnchor()):super.setSize(t,i)}}var tt=Object.defineProperty,it=(t,i,e)=>((t,i,e)=>i in t?tt(t,i,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[i]=e)(t,"symbol"!=typeof i?i+"":i,e);class et extends s.Container{constructor(t){var i;super(),it(this,"options"),it(this,"_type","bidirectional"),it(this,"_maxWidth",0),it(this,"children",[]),t&&(t.maxWidth&&(this._maxWidth=t.maxWidth),this.init(t)),null==t||null===(i=t.items)||void 0===i||i.forEach(t=>this.addChild(t)),this.on("added",()=>this.arrangeChildren()),this.on("childAdded",()=>this.arrangeChildren())}init(t){this.options=t,null!=t&&t.type&&(this.type=t.type),null!=t&&t.children&&t.children.forEach(t=>this.addChild(t))}set type(t){this._type=t,this.arrangeChildren()}get type(){return this._type}set elementsMargin(t){if(!this.options)throw new Error("List has not been initiated!");this.options.elementsMargin=t,this.arrangeChildren()}get elementsMargin(){var t,i;return null!=(t=null===(i=this.options)||void 0===i?void 0:i.elementsMargin)?t:0}set padding(t){if(!this.options)throw new Error("List has not been initiated!");this.options.padding=t,this.options.vertPadding=t,this.options.horPadding=t,this.options.leftPadding=t,this.options.rightPadding=t,this.options.topPadding=t,this.options.bottomPadding=t,this.arrangeChildren()}get padding(){var t,i;return null!=(t=null===(i=this.options)||void 0===i?void 0:i.padding)?t:0}set vertPadding(t){if(!this.options)throw new Error("List has not been initiated!");this.options.vertPadding=t,this.options.topPadding=t,this.options.bottomPadding=t,this.arrangeChildren()}get vertPadding(){var t,i,e;return null!=(t=null!=(i=null===(e=this.options)||void 0===e?void 0:e.vertPadding)?i:this.padding)?t:0}set horPadding(t){if(!this.options)throw new Error("List has not been initiated!");this.options.horPadding=t,this.options.leftPadding=t,this.options.rightPadding=t,this.arrangeChildren()}get horPadding(){var t,i,e;return null!=(t=null!=(i=null===(e=this.options)||void 0===e?void 0:e.horPadding)?i:this.padding)?t:0}set leftPadding(t){if(!this.options)throw new Error("List has not been initiated!");this.options.leftPadding=t,this.arrangeChildren()}get leftPadding(){var t,i;return null!=(t=null===(i=this.options)||void 0===i?void 0:i.leftPadding)?t:this.horPadding}set rightPadding(t){if(!this.options)throw new Error("List has not been initiated!");this.options.rightPadding=t,this.arrangeChildren()}get rightPadding(){var t,i;return null!=(t=null===(i=this.options)||void 0===i?void 0:i.rightPadding)?t:this.horPadding}set topPadding(t){if(!this.options)throw new Error("List has not been initiated!");this.options.topPadding=t,this.arrangeChildren()}get topPadding(){var t,i;return null!=(t=null===(i=this.options)||void 0===i?void 0:i.topPadding)?t:this.vertPadding}set bottomPadding(t){if(!this.options)throw new Error("List has not been initiated!");this.options.bottomPadding=t,this.arrangeChildren()}get bottomPadding(){var t,i;return null!=(t=null===(i=this.options)||void 0===i?void 0:i.bottomPadding)?t:this.vertPadding}arrangeChildren(){var t,i,e;let s=0,n=this.leftPadding,r=this.topPadding;const a=null!=(t=null===(i=this.options)||void 0===i?void 0:i.elementsMargin)?t:0;let o=this.maxWidth||(null===(e=this.parent)||void 0===e?void 0:e.width);this.rightPadding&&(o-=this.rightPadding),this.children.forEach((t,i)=>{switch(this.type){case"vertical":t.y=r,t.x=n,r+=a+t.height;break;case"horizontal":t.x=n,t.y=r,n+=a+t.width;break;default:t.x=n,t.y=r,t.x+t.width>o&&i>0&&(r+=a+s,n=this.leftPadding,t.x=n,t.y=r,s=0),s=Math.max(s,t.height),n+=a+t.width}})}removeItem(t){const i=this.children[t];i&&(this.removeChild(i),this.arrangeChildren())}set maxWidth(t){this._maxWidth=t,this.arrangeChildren()}get maxWidth(){return this._maxWidth}}var st=Object.defineProperty,nt=(t,i,e)=>((t,i,e)=>i in t?st(t,i,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[i]=e)(t,"symbol"!=typeof i?i+"":i,e);class rt{constructor(t={}){var i,e,s;nt(this,"x"),nt(this,"ax"),nt(this,"dx"),nt(this,"tx"),nt(this,"_options"),this.x=0,this.ax=0,this.dx=0,this.tx=0,this._options={max:null!=(i=t.max)?i:160,damp:null!=(e=t.damp)?e:.8,springiness:null!=(s=t.springiness)?s:.1}}update(){this.ax=(this.tx-this.x)*this._options.springiness,this.dx+=this.ax,this.dx*=this._options.damp,this.dx<-this._options.max?this.dx=-this._options.max:this.dx>this._options.max&&(this.dx=this._options.max),this.x+=this.dx}reset(){this.x=0,this.ax=0,this.dx=0,this.tx=0}get max(){return this._options.max}set max(t){this._options.max=t}get damp(){return this._options.damp}set damp(t){this._options.damp=t}get springiness(){return this._options.springiness}set springiness(t){this._options.springiness=t}}var at=Object.defineProperty,ot=(t,i,e)=>((t,i,e)=>i in t?at(t,i,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[i]=e)(t,"symbol"!=typeof i?i+"":i,e);class lt{constructor(){ot(this,"done",!1),ot(this,"to",0),ot(this,"_spring"),ot(this,"_pos",0),ot(this,"_speed",0),ot(this,"_correctSpeed",!1),this._spring=new rt,this._pos=0,this.to=0}start(t,i,e){this._speed=t,this._pos=i,this.to=e,this.done=!1,this._spring.x=this._pos,this._spring.tx=this.to;const s=this.to-this._pos,n=Math.abs(s)/s,r=Math.abs(this._speed)/this._speed;this._correctSpeed=n!==r}update(){if(this._correctSpeed)this._speed*=.6,Math.abs(this._speed)<2&&(this._correctSpeed=!1),this._pos+=this._speed,this._spring.x=this._pos;else{const t=this.to-this._pos;Math.abs(t)<.05?(this._pos=this.to,this.done=!0):(this._spring.tx=this.to,this._spring.update(),this._pos=this._spring.x)}return this._pos}cancel(){}}var ht=Object.defineProperty,dt=(t,i,e)=>((t,i,e)=>i in t?ht(t,i,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[i]=e)(t,"symbol"!=typeof i?i+"":i,e);class ut{constructor(t={}){var i,e,s;dt(this,"position",0),dt(this,"constrain",!0),dt(this,"min",0),dt(this,"max",0),dt(this,"maxSpeed",400),dt(this,"_ease"),dt(this,"_offset",0),dt(this,"_prev",0),dt(this,"_speed",0),dt(this,"_hasStopped",!1),dt(this,"_targetSpeed",0),dt(this,"_speedChecker",0),dt(this,"_grab",0),dt(this,"_activeEase"),this.constrain=null==(i=t.constrain)||i,this.maxSpeed=null!=(e=t.maxSpeed)?e:400,this._ease=null!=(s=t.ease)?s:new lt}set value(t){this._speed=0,this.position=t}get value(){return this.position}grab(t){this._grab=t,this._offset=this.position-t,this._speedChecker=0,this._targetSpeed=this._speed=0,this._hasStopped=!1}hold(t){this._speedChecker++,this.position=t+this._offset,this._speedChecker>1&&(this._targetSpeed=this.position-this._prev),this._speed+=(this._targetSpeed-this._speed)/2,this._speed>this.maxSpeed?this._speed=this.maxSpeed:this._speed<-this.maxSpeed&&(this._speed=-this.maxSpeed),this._prev=this.position,this.constrain&&(this._activeEase=void 0,this.position>this.min?this.position-=(this.position-this.min)/1.5:this.position<this.max&&(this.position+=(this.max-this.position)/1.5))}slide(t=!1){this._hasStopped||(this.constrain?this._updateConstrain(t):this._updateDefault())}get moveAmount(){return-(this.position-this._offset-this._grab)}_updateDefault(){this._speed*=.9,this.position+=this._speed,(this._speed<0?-1*this._speed:this._speed)<.01&&(this._hasStopped=!0)}_updateConstrain(t=!1){const i=this.max;t?(this.value>0&&(this.value=0),this.value>0&&(this.value=0),this.value<this.max&&(this.value=this.max),this.value<this.max&&(this.value=this.max)):this.position>this.min||this.position<i||this._activeEase?(this._activeEase||(this._activeEase=this._ease,this.position>this.min?this._activeEase.start(this._speed,this.position,this.min):this._activeEase.start(this._speed,this.position,i)),this.position=this._activeEase.update(),this._activeEase.done&&(this.position=this._activeEase.to,this._speed=0,this._activeEase=void 0)):this._updateDefault()}}var ct=Object.defineProperty,pt=(t,i,e)=>((t,i,e)=>i in t?ct(t,i,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[i]=e)(t,"symbol"!=typeof i?i+"":i,e);class gt{constructor(t){var i;pt(this,"xAxis"),pt(this,"yAxis"),pt(this,"_isDown",!1),pt(this,"_globalPosition"),pt(this,"_frame"),pt(this,"_bounds"),pt(this,"_dirty",!1),pt(this,"disableEasing",!1),this.xAxis=new ut({ease:t.xEase,maxSpeed:t.maxSpeed,constrain:t.constrain}),this.yAxis=new ut({ease:t.yEase,maxSpeed:t.maxSpeed,constrain:t.constrain}),this.disableEasing=null!=(i=t.disableEasing)&&i,this._frame=new s.Rectangle,this._bounds=new s.Rectangle,this._globalPosition=new s.Point}pointerDown(t){this._globalPosition=t,this.xAxis.grab(t.x),this.yAxis.grab(t.y),this._isDown=!0}pointerUp(){this._isDown=!1}pointerMove(t){this._globalPosition=t}update(){this._dirty&&this._bounds&&this._frame&&(this._dirty=!1,this.xAxis.min=this._bounds.left,this.xAxis.min=this._bounds.right-this._frame.width,this.xAxis.min=this._bounds.top,this.xAxis.min=this._bounds.bottom-this._frame.height),this._isDown&&this._globalPosition?(this.xAxis.hold(this._globalPosition.x),this.yAxis.hold(this._globalPosition.y)):(this.xAxis.slide(this.disableEasing),this.yAxis.slide(this.disableEasing))}resize(t,i){this._frame&&(this._frame.x=0,this._frame.width=t,this._frame.y=0,this._frame.height=i,this._dirty=!0)}setBounds(t,i,e,s){this._bounds&&(this._bounds.x=t,this._bounds.width=i-t,this._bounds.y=e,this._bounds.height=s-e,this._dirty=!0)}get x(){return this.xAxis.value}get y(){return this.yAxis.value}}var vt=Object.defineProperty,ft=(t,i,e)=>((t,i,e)=>i in t?vt(t,i,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[i]=e)(t,"symbol"!=typeof i?i+"":i,e);class _t extends s.Container{constructor(t){super(),ft(this,"background"),ft(this,"borderMask"),ft(this,"lastWidth",0),ft(this,"lastHeight",0),ft(this,"_width",0),ft(this,"_height",0),ft(this,"_dimensionChanged",!1),ft(this,"list"),ft(this,"_trackpad"),ft(this,"isDragging",0),ft(this,"interactiveStorage",[]),ft(this,"visibleItems",[]),ft(this,"pressedChild"),ft(this,"ticker",s.Ticker.shared),ft(this,"options",{}),ft(this,"stopRenderHiddenItemsTimeout"),ft(this,"onMouseScrollBinding",this.onMouseScroll.bind(this)),ft(this,"dragStarTouchPoint"),ft(this,"isOver",!1),ft(this,"proximityRange",0),ft(this,"proximityStatusCache",[]),ft(this,"lastScrollX"),ft(this,"lastScrollY"),ft(this,"proximityCheckFrameCounter",0),ft(this,"onProximityChange",new C.Signal),ft(this,"onScroll",new C.Signal),t&&this.init(t),this.ticker.add(this.update,this)}init(t){var i,e,s,n,r,a,o,l,h,d;this.options=t,this.setBackground(t.background),this._width=null!=(i=null!=(e=t.width)?e:null===(s=this.background)||void 0===s?void 0:s.width)?i:100,this._height=null!=(n=null!=(r=t.height)?r:null===(a=this.background)||void 0===a?void 0:a.height)?n:100,this.proximityRange=null!=(o=t.proximityRange)?o:0,this.list||(this.list=new et,super.addChild(this.list)),null===(l=this.list)||void 0===l||l.init({type:t.type,elementsMargin:t.elementsMargin,padding:t.padding,vertPadding:t.vertPadding,horPadding:t.horPadding,topPadding:t.topPadding,bottomPadding:t.bottomPadding,leftPadding:t.leftPadding,rightPadding:t.rightPadding,maxWidth:t.maxWidth||("horizontal"!==t.type&&"vertical"!==t.type?this._width:0)}),t.items&&this.addItems(t.items),this.hasBounds&&(this.addMask(),this.makeScrollable()),this._trackpad&&(this._trackpad.xAxis.value=0,this._trackpad.yAxis.value=0),this.options.globalScroll=null==(h=t.globalScroll)||h,this.options.shiftScroll=null!=(d=t.shiftScroll)&&d,this.resize()}get hasBounds(){return!!this._width||!!this._height}addItems(t){null!=t&&t.length&&t.forEach(t=>this.addItem(t))}removeItems(){var t;this.proximityStatusCache.length=0,null===(t=this.list)||void 0===t||t.removeChildren()}addItem(...t){if(t.length>1)t.forEach(t=>this.addItem(t));else{var i;const e=t[0];e.width&&e.height||console.error("ScrollBox item should have size"),e.eventMode="static",null===(i=this.list)||void 0===i||i.addChild(e),this.proximityStatusCache.push(!1),this.options.disableDynamicRendering||(e.renderable=this.isItemVisible(e))}return this.resize(),t[0]}removeItem(t){var i;null===(i=this.list)||void 0===i||i.removeItem(t),this.proximityStatusCache.splice(t,1),this.resize()}isItemVisible(t,i=0){let e=!1;const s=this.list;if(!s)return!1;if(this.isVertical||this.isBidirectional){var n;const r=t.y+s.y;r+t.height>=-i&&r<=(null!=(n=this.options.height)?n:this._height)+i&&(e=!0)}if(this.isHorizontal||this.isBidirectional){var r;const n=t.x+s.x;n+t.width>=-i&&n<=(null!=(r=this.options.width)?r:this._width)+i&&(e=!0)}return e}get items(){var t,i;return null!=(t=null===(i=this.list)||void 0===i?void 0:i.children)?t:[]}setBackground(t){this.background&&this.removeChild(this.background),this.options.background=t,this.background=new s.Graphics,this.addChildAt(this.background,0),this.resize()}addMask(){this.borderMask||(this.borderMask=new s.Graphics,super.addChild(this.borderMask),this.mask=this.borderMask),this.resize()}makeScrollable(){this._trackpad||(this._trackpad=new gt({disableEasing:this.options.disableEasing})),this.on("pointerdown",t=>{var i;this.renderAllItems(),this.isDragging=1,this.dragStarTouchPoint=this.worldTransform.applyInverse(t.global),this._trackpad&&this.dragStarTouchPoint&&this._trackpad.pointerDown(new s.Point(this.dragStarTouchPoint.x,this.dragStarTouchPoint.y));const e=null===(i=this.list)||void 0===i?void 0:i.worldTransform.applyInverse(t.global);e&&this.visibleItems.forEach(t=>{t.x<e.x&&t.x+t.width>e.x&&t.y<e.y&&t.y+t.height>e.y&&(this.pressedChild=t)})}),this.on("pointerup",()=>{var t;this.isDragging=0,null===(t=this._trackpad)||void 0===t||t.pointerUp(),this.restoreItemsInteractivity(),this.pressedChild=void 0,this.stopRenderHiddenItems()}),this.on("pointerover",()=>{this.isOver=!0}),this.on("pointerout",()=>{this.isOver=!1}),this.on("pointerupoutside",()=>{var t;this.isDragging=0,null===(t=this._trackpad)||void 0===t||t.pointerUp(),this.restoreItemsInteractivity(),this.pressedChild=void 0,this.stopRenderHiddenItems()}),this.on("globalpointermove",t=>{var i;if(!this.isDragging)return;const e=this.worldTransform.applyInverse(t.global);if(this.dragStarTouchPoint){var n;const t=null!=(n=this.options.dragTrashHold)?n:10;if(this.isHorizontal||this.isBidirectional){const i=e.x-this.dragStarTouchPoint.x;Math.abs(i)>t&&(this.isDragging=2)}if(this.isVertical||this.isBidirectional){const i=e.y-this.dragStarTouchPoint.y;Math.abs(i)>t&&(this.isDragging=2)}}var r,a;this.dragStarTouchPoint&&2!==this.isDragging||(null===(i=this._trackpad)||void 0===i||i.pointerMove(new s.Point(e.x,e.y)),this.pressedChild&&(this.revertClick(this.pressedChild),this.pressedChild=void 0),this.isBidirectional?null===(r=this.onScroll)||void 0===r||r.emit({x:this.scrollX,y:this.scrollY}):null===(a=this.onScroll)||void 0===a||a.emit(this.isVertical?this.scrollY:this.scrollX))}),document.addEventListener("wheel",this.onMouseScrollBinding,!0)}setInteractive(t){this.eventMode=t?"static":"auto"}get listHeight(){var t,i,e,s,n,r;return(null!=(t=null===(i=this.list)||void 0===i?void 0:i.height)?t:0)+(null!=(e=null===(s=this.list)||void 0===s?void 0:s.topPadding)?e:0)+(null!=(n=null===(r=this.list)||void 0===r?void 0:r.bottomPadding)?n:0)}get listWidth(){var t,i,e,s,n,r;return(null!=(t=null===(i=this.list)||void 0===i?void 0:i.width)?t:0)+(null!=(e=null===(s=this.list)||void 0===s?void 0:s.leftPadding)?e:0)+(null!=(n=null===(r=this.list)||void 0===r?void 0:r.rightPadding)?n:0)}resize(t=!1){if(this.hasBounds){if(this.renderAllItems(),this.borderMask&&(t||this._dimensionChanged||this.lastWidth!==this.listWidth||this.lastHeight!==this.listHeight)){var i,e,s,n;this.options.width||(this._width+=this.listWidth),this.options.height||(this._height+=this.listHeight),null===(i=this.borderMask)||void 0===i||i.clear().roundRect(0,0,this._width,this._height,0|(null!=(e=this.options.radius)?e:0)).fill(16711935).stroke(0),this.borderMask&&(this.borderMask.eventMode="none");const t=this.options.background;null===(s=this.background)||void 0===s||s.clear().roundRect(0,0,this._width,this._height,0|(null!=(n=this.options.radius)?n:0)).fill({color:null!=t?t:0,alpha:t?1:1e-7}),this.isBidirectional?this.setInteractive(this.listWidth>this._width||this.listHeight>this._height):this.isHorizontal?this.setInteractive(this.listWidth>this._width):this.setInteractive(this.listHeight>this._height),this.lastWidth=this.listWidth,this.lastHeight=this.listHeight}if(this._trackpad&&this.borderMask){var r,a,o,l,h,d,u,c,p,g,v,f;const t=this.borderMask.width-(null!=(r=null===(a=this.list)||void 0===a?void 0:a.width)?r:0)-(null!=(o=null===(l=this.list)||void 0===l?void 0:l.leftPadding)?o:0)-(null!=(h=null===(d=this.list)||void 0===d?void 0:d.rightPadding)?h:0),i=this.borderMask.height-(null!=(u=null===(c=this.list)||void 0===c?void 0:c.height)?u:0)-(null!=(p=null===(g=this.list)||void 0===g?void 0:g.topPadding)?p:0)-(null!=(v=null===(f=this.list)||void 0===f?void 0:f.bottomPadding)?v:0);this.isBidirectional?(this._trackpad.yAxis.max=-Math.abs(i),this._trackpad.xAxis.max=-Math.abs(t)):this.isVertical?this._trackpad.yAxis.max=-Math.abs(i):this.isHorizontal&&(this._trackpad.xAxis.max=-Math.abs(t))}var _,m;if(this._dimensionChanged)null===(_=this.list)||void 0===_||_.arrangeChildren(),this.stopRenderHiddenItems(),this._dimensionChanged=!1;else t&&(null===(m=this.list)||void 0===m||m.arrangeChildren()),this.updateVisibleItems();this.lastScrollX=void 0,this.lastScrollY=void 0}}onMouseScroll(t){if(!this.isOver&&!this.options.globalScroll)return;this.renderAllItems();const i=!!this.options.shiftScroll,e=i?void 0!==t.deltaX||void 0!==t.deltaY:void 0!==t.deltaX,s=void 0!==t.deltaY;if((this.isHorizontal||this.isBidirectional)&&e){var n,r;const e=i||this.isBidirectional?t.deltaX:t.deltaY,s=(null!=(n=null===(r=this.list)||void 0===r?void 0:r.x)?n:0)-e;if(this.listWidth<this._width)this._trackpad&&(this._trackpad.xAxis.value=0);else{const t=this._width-this.listWidth,i=0;this._trackpad&&(this._trackpad.xAxis.value=Math.min(i,Math.max(t,s)))}}if((this.isVertical||this.isBidirectional)&&s){var a,o;const i=(null!=(a=null===(o=this.list)||void 0===o?void 0:o.y)?a:0)-t.deltaY;if(this.listHeight<this._height)this._trackpad&&(this._trackpad.yAxis.value=0);else{const t=this._height-this.listHeight,e=0;this._trackpad&&(this._trackpad.yAxis.value=Math.min(e,Math.max(t,i)))}}var l,h,d,u,c;if(this.isBidirectional&&(e||s))null===(l=this.onScroll)||void 0===l||l.emit({x:null!=(h=null===(d=this._trackpad)||void 0===d?void 0:d.xAxis.value)?h:0,y:null!=(u=null===(c=this._trackpad)||void 0===c?void 0:c.yAxis.value)?u:0});else if(this.isHorizontal&&e){var p,g,v;null===(p=this.onScroll)||void 0===p||p.emit(null!=(g=null===(v=this._trackpad)||void 0===v?void 0:v.xAxis.value)?g:0)}else if(this.isVertical&&s){var f,_,m;null===(f=this.onScroll)||void 0===f||f.emit(null!=(_=null===(m=this._trackpad)||void 0===m?void 0:m.yAxis.value)?_:0)}this.stopRenderHiddenItems()}scrollBottom(){var t,i;this.interactive?this.scrollTo((null!=(t=null===(i=this.list)||void 0===i?void 0:i.children.length)?t:1)-1):this.scrollTop()}scrollTop(){this.renderAllItems(),this._trackpad&&(this._trackpad.xAxis.value=0,this._trackpad.yAxis.value=0),this.stopRenderHiddenItems()}renderAllItems(){clearTimeout(this.stopRenderHiddenItemsTimeout),this.stopRenderHiddenItemsTimeout=void 0,this.options.disableDynamicRendering||this.items.forEach(t=>{t.renderable=!0})}stopRenderHiddenItems(){this.options.disableDynamicRendering||(this.stopRenderHiddenItemsTimeout&&(clearTimeout(this.stopRenderHiddenItemsTimeout),this.stopRenderHiddenItemsTimeout=void 0),this.stopRenderHiddenItemsTimeout=setTimeout(()=>this.updateVisibleItems(),2e3))}updateVisibleItems(){this.visibleItems.length=0,this.items.forEach(t=>{t.renderable=this.isItemVisible(t),this.visibleItems.push(t)})}scrollTo(t){if(!this.interactive||!this._trackpad||!this.list)return;const i=this.list.children[t];i&&(this.renderAllItems(),this._trackpad.xAxis.value=this.isHorizontal||this.isBidirectional?this._width-i.x-i.width-this.list.rightPadding:0,this._trackpad.yAxis.value=this.isVertical||this.isBidirectional?this._height-i.y-i.height-this.list.bottomPadding:0,this.stopRenderHiddenItems())}scrollToPosition({x:t,y:i}){void 0===t&&void 0===i||(this.renderAllItems(),void 0!==t&&(this.scrollX=-t),void 0!==i&&(this.scrollY=-i),this.stopRenderHiddenItems())}get height(){return this._height}set height(t){this._height=t,this._dimensionChanged=!0,this.resize(),this.scrollTop()}get width(){return this._width}set width(t){this._width=t,this._dimensionChanged=!0,this.resize(),this.scrollTop()}setSize(t,i){var e;"object"==typeof t?(i=null!=(e=t.height)?e:t.width,t=t.width):i=null!=i?i:t;this._width=t,this._height=i,this._dimensionChanged=!0,this.resize(),this.scrollTop()}getSize(t){return(t=t||{width:0,height:0}).width=this._width,t.height=this._height,t}get scrollX(){var t,i;return null!=(t=null===(i=this._trackpad)||void 0===i?void 0:i.xAxis.value)?t:0}set scrollX(t){this._trackpad&&(this._trackpad.xAxis.value=t)}get scrollY(){var t,i;return null!=(t=null===(i=this._trackpad)||void 0===i?void 0:i.yAxis.value)?t:0}set scrollY(t){this._trackpad&&(this._trackpad.yAxis.value=t)}update(){var t;this.list&&this._trackpad&&(this._trackpad.update(),(this.isHorizontal||this.isBidirectional)&&this.list.x!==this._trackpad.x&&(this.list.x=this._trackpad.x),(this.isVertical||this.isBidirectional)&&this.list.y!==this._trackpad.y&&(this.list.y=this._trackpad.y),this.options.disableProximityCheck||this._trackpad.x===this.lastScrollX&&this._trackpad.y===this.lastScrollY||(this.proximityCheckFrameCounter++,this.proximityCheckFrameCounter>=(null!=(t=this.options.proximityDebounce)?t:10)&&(this.items.forEach((t,i)=>{const e=this.isItemVisible(t,this.proximityRange);e!==this.proximityStatusCache[i]&&(this.proximityStatusCache[i]=e,this.onProximityChange.emit({item:t,index:i,inRange:e}))}),this.lastScrollX=this._trackpad.x,this.lastScrollY=this._trackpad.y,this.proximityCheckFrameCounter=0)))}destroy(t){var i,e;this.ticker.remove(this.update,this),document.removeEventListener("wheel",this.onMouseScrollBinding,!0),null===(i=this.background)||void 0===i||i.destroy(),null===(e=this.list)||void 0===e||e.destroy(),super.destroy(t)}restoreItemsInteractivity(){this.interactiveStorage.forEach(t=>{t.item.eventMode=t.eventMode}),this.interactiveStorage.length=0}revertClick(t){var i;"auto"!==t.eventMode&&(s.isMobile.any?t.emit("pointerupoutside",{target:t}):t.emit("mouseupoutside",{target:t}),this.interactiveStorage.push({item:t,eventMode:null!=(i=t.eventMode)?i:"auto"}),t.eventMode="auto");t instanceof s.Container&&t.children&&t.children.forEach(t=>this.revertClick(t))}get scrollHeight(){var t,i;return null!=(t=null===(i=this.list)||void 0===i?void 0:i.height)?t:0}get scrollWidth(){var t,i;return null!=(t=null===(i=this.list)||void 0===i?void 0:i.width)?t:0}get isVertical(){var t;return"vertical"===(null!=(t=this.options.type)?t:"vertical")}get isHorizontal(){return"horizontal"===this.options.type}get isBidirectional(){return"bidirectional"===this.options.type}}var mt=Object.defineProperty,wt=(t,i,e)=>((t,i,e)=>i in t?mt(t,i,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[i]=e)(t,"symbol"!=typeof i?i+"":i,e);class bt extends s.Container{constructor(t){var i;super(),wt(this,"backdrop"),wt(this,"innerView"),wt(this,"contentView"),wt(this,"titleText"),wt(this,"contentBody"),wt(this,"scrollBox"),wt(this,"buttonContainer"),wt(this,"options"),wt(this,"_isOpen",!1),wt(this,"onSelect"),wt(this,"onClose"),this.options=t,this.onSelect=new C.Signal,this.onClose=new C.Signal,this.backdrop=new s.Container,this.contentView=new s.Container,this.buttonContainer=new et(_objectSpread({type:"horizontal",elementsMargin:10},t.buttonList)),this.initBackdrop(),this.initInnerView(),this.initTitle(),this.initButtons();const e=this.dialogPadding,{width:n}=this.options;let{height:r}=this.options;var a;r&&(r=r-2*e-this.buttonContainer.height,null!==(a=this.titleText)&&void 0!==a&&a.height&&(r-=this.titleText.height));this.scrollBox=new _t(_objectSpread(_objectSpread({background:0,elementsMargin:10,radius:0,type:"bidirectional",padding:10},this.options.scrollBox),{},{width:n?n-2*e:0,height:r})),null===(i=this.innerView)||void 0===i||i.addChild(this.scrollBox),this.visible=!1,this.initContent(),s.Ticker.shared.add(()=>W.shared.update())}get dialogWidth(){var t,i,e;return null!=(t=null!=(i=this.options.width)?i:null===(e=this.innerView)||void 0===e?void 0:e.width)?t:0}get dialogHeight(){var t,i,e;return null!=(t=null!=(i=this.options.height)?i:null===(e=this.innerView)||void 0===e?void 0:e.height)?t:0}get dialogPadding(){var t;return null!=(t=this.options.padding)?t:20}get isOpen(){return this._isOpen}initBackdrop(){if(this.options.backdrop)this.backdrop=A(this.options.backdrop);else{var t,i;const e=new s.Sprite(s.Texture.WHITE);e.tint=null!=(t=this.options.backdropColor)?t:0,e.alpha=null!=(i=this.options.backdropAlpha)?i:.5,e.width=1e4,e.height=1e4,this.backdrop=e}this.backdrop.eventMode="static",this.backdrop.x=-5e3,this.backdrop.y=-5e3,this.options.closeOnBackdropClick&&this.backdrop.on("pointertap",()=>this.close()),this.addChild(this.backdrop)}initInnerView(){const{background:t,nineSliceSprite:i}=this.options;i?"string"==typeof t?this.innerView=new s.NineSliceSprite({texture:s.Texture.from(t),leftWidth:i[0],topHeight:i[1],rightWidth:i[2],bottomHeight:i[3]}):t instanceof s.Texture?this.innerView=new s.NineSliceSprite({texture:t,leftWidth:i[0],topHeight:i[1],rightWidth:i[2],bottomHeight:i[3]}):(console.warn("NineSliceSprite can not be used with views set as Container. Pass the texture or texture name as instead of the Container extended instance."),this.innerView=A(t)):this.innerView=A(t),this.options.width&&this.options.height&&(this.innerView instanceof s.NineSliceSprite||this.innerView instanceof s.Graphics)&&(this.innerView.width=this.options.width,this.innerView.height=this.options.height),"anchor"in this.innerView?this.innerView.anchor.set(.5,.5):this.innerView.pivot.set(this.dialogWidth/2,this.dialogHeight/2),this.innerView.eventMode="static",this.addChild(this.innerView),this.innerView.addChild(this.contentView)}initTitle(){this.options.title&&(this.titleText=K(this.options.title),"anchor"in this.titleText&&this.titleText.anchor.set(.5,0),this.titleText.x=this.dialogWidth/2,this.titleText.y=this.dialogPadding,this.contentView.addChild(this.titleText))}initContent(){if(!this.options.content)return;let t=this.dialogPadding;if(this.titleText&&(t+=this.titleText.height),"string"==typeof this.options.content||"number"==typeof this.options.content){const t=K(this.options.content);this.scrollBox.addItem(t)}else Array.isArray(this.options.content)?this.options.content.forEach(t=>this.scrollBox.addItem(t)):this.scrollBox.addItem(this.options.content);this.scrollBox.x=this.dialogPadding,this.scrollBox.y=t,this.contentView.addChild(this.scrollBox)}initButtons(){if(!this.options.buttons||0===this.options.buttons.length)return;this.options.buttons.forEach((t,i)=>{let e;switch(!0){case t instanceof O:t.onPress.connect(()=>{this.onSelect.emit(i,"")}),t.view&&this.buttonContainer.addChild(t.view);break;case t instanceof Z:t.onPress.connect(()=>{var e;this.onSelect.emit(i,null!=(e=t.text)?e:"")}),this.buttonContainer.addChild(t);break;default:e=new Z(t),e.onPress.connect(()=>{var t;this.onSelect.emit(i,null!=(t=e.text)?t:"")}),this.buttonContainer.addChild(e)}}),this.buttonContainer.x=this.dialogWidth/2-this.buttonContainer.width/2,this.buttonContainer.y=this.dialogHeight-this.dialogPadding-this.buttonContainer.height,this.contentView.addChild(this.buttonContainer)}open(){var t,i,e;if(!this.innerView)return;this.visible=!0,this._isOpen=!0;const s=null===(t=this.options.animations)||void 0===t?void 0:t.open;var n;if(!s)return this.backdrop.alpha=null!=(n=this.options.backdropAlpha)?n:.5,void this.innerView.scale.set(1);this.backdrop.alpha=0,this.innerView.scale.set(.8);const r=null!=(i=s.duration)?i:300;new X(this.backdrop).to({alpha:null!=(e=this.options.backdropAlpha)?e:.5},r).start(),new X(this.innerView.scale).to({x:1,y:1},r).start()}close(){var t,i;if(!this.innerView)return;const e=null===(t=this.options.animations)||void 0===t?void 0:t.close;if(!e)return this.visible=!1,this._isOpen=!1,void this.onClose.emit();const s=null!=(i=e.duration)?i:300;new X(this.backdrop).to({alpha:0},s).start(),new X(this.innerView.scale).to({x:.8,y:.8},s).onComplete(()=>{this.visible=!1,this._isOpen=!1,this.onClose.emit()}).start()}show(){this.open()}hide(){this.close()}}var yt=Object.defineProperty,xt=(t,i,e)=>((t,i,e)=>i in t?yt(t,i,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[i]=e)(t,"symbol"!=typeof i?i+"":i,e);class St extends s.Container{constructor(t){super(),xt(this,"bg"),xt(this,"fill"),xt(this,"fillMask"),xt(this,"progressStart",0),xt(this,"_progress",0),xt(this,"options"),xt(this,"innerView");const i={bg:s.Texture.WHITE,fill:s.Texture.WHITE,fillPaddings:{top:0,right:0,bottom:0,left:0},progress:0};this.options=_objectSpread(_objectSpread({},i),t),this.innerView=new s.Container,this.addChild(this.innerView),this.init(this.options)}init({bg:t,fill:i,fillPaddings:e,progress:s}){this.setBackground(t),this.setFill(i,e),this.progress=null!=s?s:0}setBackground(t){var i;this.bg&&this.bg.destroy(),null!==(i=this.options)&&void 0!==i&&i.nineSliceSprite&&("string"==typeof t?this.bg=new s.NineSliceSprite({texture:s.Texture.from(t),leftWidth:this.options.nineSliceSprite.bg[0],topHeight:this.options.nineSliceSprite.bg[1],rightWidth:this.options.nineSliceSprite.bg[2],bottomHeight:this.options.nineSliceSprite.bg[3]}):t instanceof s.Texture?this.bg=new s.NineSliceSprite({texture:t,leftWidth:this.options.nineSliceSprite.bg[0],topHeight:this.options.nineSliceSprite.bg[1],rightWidth:this.options.nineSliceSprite.bg[2],bottomHeight:this.options.nineSliceSprite.bg[3]}):console.warn("NineSliceSprite can not be used with views set as Container.\n Pass the texture or texture name as instead of the Container extended instance.")),this.bg||(this.bg=A(t)),this.innerView.addChildAt(this.bg,0)}setFill(t,i){var e,n,r;if(this.fill&&this.fill.destroy(),this.bg instanceof s.Sprite&&t===this.bg)return void console.warn("Can not use same Sprite instance for bg and fill.");null!==(e=this.options)&&void 0!==e&&e.nineSliceSprite?"string"==typeof t||t instanceof s.Texture?this.fill=new s.NineSliceSprite({texture:"string"==typeof t?s.Texture.from(t):t,leftWidth:this.options.nineSliceSprite.fill[0],topHeight:this.options.nineSliceSprite.fill[1],rightWidth:this.options.nineSliceSprite.fill[2],bottomHeight:this.options.nineSliceSprite.fill[3]}):(console.warn("NineSliceSprite can not be used with views set as Container.\n Pass the texture or texture name as instead of the Container extended instance."),this.fill=A(t)):this.fill=A(t),this.innerView.addChildAt(this.fill,1);const a=null!=(n=null==i?void 0:i.left)?n:0,o=null!=(r=null==i?void 0:i.top)?r:0;this.fill.x=a,this.fill.y=o,this.fillMask&&(this.fill.mask=null,this.fillMask.destroy());const l=this.fill.width/2,h=this.fill.width/2,d=this.fill.height/2,u=this.fill.height/2;let c=s.Texture.WHITE;this.fill instanceof s.Sprite&&this.fill.texture&&(c=this.fill.texture),this.fillMask=new s.NineSliceSprite({texture:c,leftWidth:l,topHeight:d,rightWidth:h,bottomHeight:u}),this.fillMask.position.copyFrom(this.fill),this.addChild(this.fillMask),this.fill.mask=this.fillMask}validate(t){return(t=Math.round(t))<0?0:t>100?100:t}set progress(t){this._progress=this.validate(t),this.fill&&this.fillMask&&(this.fill.mask=null,this.fillMask.width=this.fill.width/100*(this._progress-this.progressStart),this.fillMask.x=this.progressStart/100*this.fill.width+this.fill.x,this.fillMask.height=this.fill.height,this.fill.mask=this.fillMask)}get progress(){return this._progress}set width(t){var i;if(null!==(i=this.options)&&void 0!==i&&i.nineSliceSprite){if(this.bg&&(this.bg.width=t),this.fill){var e,s,n,r;const i=null!=(e=null===(s=this.options.fillPaddings)||void 0===s?void 0:s.left)?e:0,a=null!=(n=null===(r=this.options.fillPaddings)||void 0===r?void 0:r.right)?n:0;this.fill.width=t-i-a,this.fillMask.width=t-i-a}this.progress=this._progress}else super.width=t}get width(){return super.width}set height(t){var i;if(null!==(i=this.options)&&void 0!==i&&i.nineSliceSprite){if(this.bg&&(this.bg.height=t),this.fill){var e,s,n,r;const i=null!=(e=null===(s=this.options.fillPaddings)||void 0===s?void 0:s.top)?e:0,a=null!=(n=null===(r=this.options.fillPaddings)||void 0===r?void 0:r.bottom)?n:0;this.fill.height=t-i-a,this.fillMask.height=t-i-a}this.progress=this._progress}else super.height=t}get height(){return super.height}setSize(t,i){var e;if(null!==(e=this.options)&&void 0!==e&&e.nineSliceSprite){if(this.bg&&this.bg.setSize(t,i),this.fill){var s,n,r,a,o,l,h,d,u;if("object"==typeof t)i=null!=(u=t.height)?u:t.width,t=t.width;else i=null!=i?i:t;const e=null!=(s=null===(n=this.options.fillPaddings)||void 0===n?void 0:n.top)?s:0,c=null!=(r=null===(a=this.options.fillPaddings)||void 0===a?void 0:a.bottom)?r:0,p=null!=(o=null===(l=this.options.fillPaddings)||void 0===l?void 0:l.left)?o:0,g=null!=(h=null===(d=this.options.fillPaddings)||void 0===d?void 0:d.right)?h:0;this.fill.setSize(t-p-g,i-e-c),this.fillMask.setSize(t-p-g,i-e-c)}this.progress=this._progress}else super.setSize(t,i)}}var kt=Object.defineProperty,Ct=(t,i,e)=>((t,i,e)=>i in t?kt(t,i,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[i]=e)(t,"symbol"!=typeof i?i+"":i,e);class Vt extends St{constructor(t){var i,e;super(t),Ct(this,"_slider1"),Ct(this,"_slider2"),Ct(this,"value1Text"),Ct(this,"value2Text"),Ct(this,"_value1",0),Ct(this,"_value2",0),Ct(this,"dragging",0),Ct(this,"_min",0),Ct(this,"_max",100),Ct(this,"_step",1),Ct(this,"startX"),Ct(this,"startUpdateValue1"),Ct(this,"startUpdateValue2"),Ct(this,"settings"),this.settings=t,t.slider1&&(this.slider1=t.slider1),t.slider2&&(this.slider2=t.slider2),this.min=null!=(i=t.min)?i:0,this.max=null!=(e=t.max)?e:100}init(t){super.init(t),this.fill&&(this.fill.eventMode="none")}set slider1(t){if(t&&(this._slider1&&(this._slider1.removeAllListeners(),this._slider1.destroy()),this._slider1=this.createSlider(t),this.settings.showValue&&!this.value1Text)){var i;const t=null!=(i=this.settings.valueTextClass)?i:s.Text;this.value1Text=new t({text:"",style:this.settings.valueTextStyle||{fill:16777215}}),this.value1Text.anchor.set(.5),this.addChild(this.value1Text)}}get slider1(){return this._slider1}set slider2(t){if(t&&(this._slider2&&(this._slider2.removeAllListeners(),this._slider2.destroy()),this._slider2=this.createSlider(t),this.settings.showValue&&!this.value2Text)){var i;const t=null!=(i=this.settings.valueTextClass)?i:s.Text;this.value2Text=new t({text:"",style:this.settings.valueTextStyle||{fill:16777215}}),this.value2Text.anchor.set(.5),this.addChild(this.value2Text)}}get slider2(){return this._slider2}setBackground(t){this.bg&&this.bg.removeAllListeners(),super.setBackground(t),this.activateBG()}activateBG(){this.bg.eventMode="static",this.bg.on("pointerdown",this.startUpdate,this).on("globalpointermove",this.update,this).on("pointerup",this.endUpdate,this).on("pointerupoutside",this.endUpdate,this)}createSlider(t){var i,e;const n=A(t);n.eventMode="static",n.on("pointerdown",t=>{this.bg&&(t.currentTarget=this.bg),this.startUpdate(t)}).on("pointerup",this.endUpdate,this).on("pointerupoutside",this.endUpdate,this),n.x=n.width/2;const r=new s.Container;return r.addChild(n),n instanceof s.Sprite&&n.anchor.set(.5),r.y=null!==(i=this.bg)&&void 0!==i&&i.height?(null===(e=this.bg)||void 0===e?void 0:e.height)/2:0,this.addChild(r),r}startUpdate(t){this.dragging=1;const i=t.currentTarget;this.startX=i.parent.worldTransform.applyInverse(t.global).x,this.startUpdateValue1=this._value1,this.startUpdateValue2=this._value2,this.update(t)}endUpdate(){this.dragging&&(this.dragging=0,(this.startX||this.startUpdateValue1!==this._value1||this.startUpdateValue2!==this._value2)&&this.change(),this.startUpdateValue1=0,this.startUpdateValue2=0)}onClick(){this.change()}update(t){const i=t.currentTarget,{x:e}=i.parent.worldTransform.applyInverse(t.global);e!==this.startX&&(this.startX=0)}change(){}set max(t){this._max=t}get max(){return this._max}set min(t){this._min=t}get min(){return this._min}set step(t){this._step=t}get step(){return this._step}}var Pt=Object.defineProperty,Mt=(t,i,e)=>((t,i,e)=>i in t?Pt(t,i,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[i]=e)(t,"symbol"!=typeof i?i+"":i,e);var Tt=Object.defineProperty,It=(t,i,e)=>((t,i,e)=>i in t?Tt(t,i,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[i]=e)(t,"symbol"!=typeof i?i+"":i,e);class Ot extends s.Container{constructor(t){super(),It(this,"_bg"),It(this,"inputMask"),It(this,"_cursor"),It(this,"_value",""),It(this,"_secure",!1),It(this,"inputField"),It(this,"placeholder"),It(this,"editing",!1),It(this,"tick",0),It(this,"lastInputData",""),It(this,"activation",!1),It(this,"options"),It(this,"input"),It(this,"handleActivationBinding",this.handleActivation.bind(this)),It(this,"onKeyUpBinding",this.onKeyUp.bind(this)),It(this,"stopEditingBinding",this.stopEditing.bind(this)),It(this,"onInputBinding",this.onInput.bind(this)),It(this,"onPasteBinding",this.onPaste.bind(this)),It(this,"onEnter"),It(this,"onChange"),It(this,"paddingTop",0),It(this,"paddingRight",0),It(this,"paddingBottom",0),It(this,"paddingLeft",0);const i={bg:s.Texture.WHITE,textStyle:{fill:0,align:"center"},TextClass:s.Text,placeholder:"",value:"",maxLength:void 0,secure:!1,align:"left",padding:0,cleanOnFocus:!1,addMask:!1};this.options=_objectSpread(_objectSpread({},i),t);const{padding:e=0,secure:n=!1}=this.options;this.padding=e,this._secure=n,this.cursor="text",this.interactive=!0,this.on("pointertap",()=>{this.activation=!0,s.isMobile.any&&this.handleActivation()}),window.addEventListener(s.isMobile.any?"touchstart":"click",this.handleActivationBinding),this.onEnter=new C.Signal,this.onChange=new C.Signal,s.Ticker.shared.add(t=>this.update(t.deltaTime)),t.bg?this.bg=t.bg:console.error("Input: bg is not defined, please define it.")}onInput(t){var i;this.lastInputData=null!=(i=t.data)?i:""}onKeyUp(t){const i=t.key;["Shift","Control","Alt","Meta","ArrowLeft","ArrowRight","ArrowUp","ArrowDown","CapsLock","AltGraph","Tab","ContextMenu","F1","F2","F3","F4","F5","F6","F7","F8","F9","F10","F11","F12","ScrollLock","Pause","Insert","Delete","Home","End","PageUp","PageDown","NumLock","Dead"].includes(i)||t.metaKey||t.ctrlKey||("Backspace"===i?this._delete():"Escape"===i||"Enter"===i?this.stopEditing():1===i.length?this._add(i):this.lastInputData&&1===this.lastInputData.length&&this._add(this.lastInputData),this.input&&(this.input.value=""))}init(){var t;const{textStyle:i={fill:0,align:"center"},TextClass:e=s.Text,placeholder:n=""}=this.options,r=i.fill&&s.Color.isColorLike(i.fill)?i.fill:0;this.inputField=new e({text:"",style:i}),this._cursor=new s.Sprite(s.Texture.WHITE),this._cursor.tint=r,this._cursor.anchor.set(.5),this._cursor.width=2,this._cursor.height=.8*this.inputField.height,this._cursor.alpha=0,this.placeholder=new e({text:n,style:i}),this.placeholder.visible=!!n,this.addChild(this.inputField,this.placeholder,this._cursor),this.value=null!=(t=this.options.value)?t:"",this.align()}set bg(t){var i;this._bg&&this._bg.destroy();const e=null!=t?t:s.Texture.WHITE;null!==(i=this.options)&&void 0!==i&&i.nineSliceSprite&&("string"==typeof e?this._bg=new s.NineSliceSprite({texture:s.Texture.from(e),leftWidth:this.options.nineSliceSprite[0],topHeight:this.options.nineSliceSprite[1],rightWidth:this.options.nineSliceSprite[2],bottomHeight:this.options.nineSliceSprite[3]}):e instanceof s.Texture?this._bg=new s.NineSliceSprite({texture:e,leftWidth:this.options.nineSliceSprite[0],topHeight:this.options.nineSliceSprite[1],rightWidth:this.options.nineSliceSprite[2],bottomHeight:this.options.nineSliceSprite[3]}):console.warn("NineSliceSprite can not be used with views set as Container.\n Pass the texture or texture name as instead of the Container extended instance.")),this._bg||(this._bg=A(e)),this._bg.cursor="text",this._bg.interactive=!0,this.addChildAt(this._bg,0),this.inputField||this.init(),this.options.addMask&&this.createInputMask(t)}get bg(){return this._bg}_add(t){this.editing&&(this.options.maxLength&&this.value.length>=this.options.maxLength||(this.value=this.value+t,this.onChange.emit(this.value)))}_delete(){const t=this.value.length;this.editing&&0!==t&&(this.value=this.value.substring(0,t-1),this.onChange.emit(this.value))}_startEditing(){this.options.cleanOnFocus&&(this.value=""),this.tick=0,this.editing=!0,this.placeholder&&(this.placeholder.visible=!1),this._cursor&&(this._cursor.alpha=1),this.createInputField(),this.align()}createInputField(){var t,i,e,n,r,a;this.input&&(this.input.removeEventListener("blur",this.stopEditingBinding),this.input.removeEventListener("keydown",this.onKeyUpBinding),this.input.removeEventListener("input",this.onInputBinding),this.input.removeEventListener("paste",this.onPasteBinding),null===(r=this.input)||void 0===r||r.blur(),null===(a=this.input)||void 0===a||a.remove(),this.input=void 0);const o=document.createElement("input");document.body.appendChild(o),o.style.position="fixed",o.style.left=`${this.getGlobalPosition().x}px`,o.style.top=`${this.getGlobalPosition().y}px`,o.style.opacity="0.0000001",o.style.width=`${null!=(t=null===(i=this._bg)||void 0===i?void 0:i.width)?t:100}px`,o.style.height=`${null!=(e=null===(n=this._bg)||void 0===n?void 0:n.height)?e:30}px`,o.style.border="none",o.style.outline="none",o.style.background="white",s.isMobile.android.device?setTimeout(()=>{o.focus(),o.click()},100):(o.focus(),o.click()),o.addEventListener("blur",this.stopEditingBinding),o.addEventListener("keydown",this.onKeyUpBinding),o.addEventListener("input",this.onInputBinding),o.addEventListener("paste",this.onPasteBinding),this.input=o,this.align()}handleActivation(){this.editing||(this.stopEditing(),this.activation&&(this._startEditing(),this.activation=!1))}stopEditing(){var t,i;this.editing&&(this._cursor&&(this._cursor.alpha=0),this.editing=!1,this.placeholder&&0===this.value.length&&(this.placeholder.visible=!0),null===(t=this.input)||void 0===t||t.blur(),null===(i=this.input)||void 0===i||i.remove(),this.input=void 0,this.align(),this.onEnter.emit(this.value))}update(t){this.editing&&(this.tick+=.1*t,this._cursor&&(this._cursor.alpha=Math.round(.5*Math.sin(this.tick)+.5)))}align(){if(!this._bg)return;const t=this.getAlign();this.inputField&&(this.inputField.anchor.set(t,.5),this.inputField.x=this._bg.width*t+(1===t?-this.paddingRight:this.paddingLeft),this.inputField.y=this._bg.height/2+this.paddingTop-this.paddingBottom),this.placeholder&&(this.placeholder.anchor.set(t,.5),this.placeholder.x=this._bg.width*t+(1===t?-this.paddingRight:this.paddingLeft),this.placeholder.y=this._bg.height/2),this._cursor&&this.inputField&&(this._cursor.x=this.getCursorPosX(),this._cursor.y=this.inputField.y)}getAlign(){if(!this._bg||!this.inputField)return 0;const t=.95*this._bg.width,i=this.paddingLeft+this.paddingRight-10;if(this.inputField.width+i>t)return this.editing?1:0;switch(this.options.align){case"left":default:return 0;case"center":return.5;case"right":return 1}}getCursorPosX(){if(!this.inputField)return 0;switch(this.getAlign()){case 0:return this.inputField.x+this.inputField.width;case.5:return this.inputField.x+.5*this.inputField.width;case 1:return this.inputField.x;default:return 0}}set value(t){const i=t.length;this._value=t,this.inputField&&(this.inputField.text=this.secure?"*".repeat(i):t),this.placeholder&&(this.placeholder.visible=0===i&&!this.editing),this.align()}get value(){return this._value}set secure(t){this._secure=t,this.value=this._value}get secure(){return this._secure}set padding(t){var i,e,s,n,r,a,o,l;if("number"==typeof t&&(this.paddingTop=t,this.paddingRight=t,this.paddingBottom=t,this.paddingLeft=t),Array.isArray(t))this.paddingTop=null!=(i=t[0])?i:0,this.paddingRight=null!=(e=null!=(s=t[1])?s:t[0])?e:0,this.paddingBottom=null!=(n=null!=(r=t[2])?r:t[0])?n:0,this.paddingLeft=null!=(a=null!=(o=null!=(l=t[3])?l:t[1])?o:t[0])?a:0;else if("object"==typeof t){var h,d,u,c;this.paddingTop=null!=(h=t.top)?h:0,this.paddingRight=null!=(d=t.right)?d:0,this.paddingBottom=null!=(u=t.bottom)?u:0,this.paddingLeft=null!=(c=t.left)?c:0}}get padding(){return[this.paddingTop,this.paddingRight,this.paddingBottom,this.paddingLeft]}destroy(t){this.off("pointertap"),window.removeEventListener(s.isMobile.any?"touchstart":"click",this.handleActivationBinding),super.destroy(t)}set width(t){var i;null!==(i=this.options)&&void 0!==i&&i.nineSliceSprite?(this._bg&&(this._bg.width=t),this.updateInputMaskSize(),this.align()):super.width=t}get width(){return super.width}set height(t){var i;null!==(i=this.options)&&void 0!==i&&i.nineSliceSprite?(this._bg&&(this._bg.height=t),this.updateInputMaskSize(),this.align()):super.height=t}get height(){return super.height}setSize(t,i){var e;null!==(e=this.options)&&void 0!==e&&e.nineSliceSprite?(this._bg&&this._bg.setSize(t,i),this.updateInputMaskSize(),this.align()):super.setSize(t,i)}createInputMask(t){var i;this.inputMask&&(this.inputField&&(this.inputField.mask=null),this._cursor&&(this._cursor.mask=null),this.inputMask.destroy()),null!==(i=this.options)&&void 0!==i&&i.nineSliceSprite&&"string"==typeof t?this.inputMask=new s.NineSliceSprite({texture:s.Texture.from(t),leftWidth:this.options.nineSliceSprite[0],topHeight:this.options.nineSliceSprite[1],rightWidth:this.options.nineSliceSprite[2],bottomHeight:this.options.nineSliceSprite[3]}):t instanceof s.Sprite?this.inputMask=new s.Sprite(t.texture):t instanceof s.Graphics?this.inputMask=t.clone(!0):this.inputMask=A(t),this.inputField&&(this.inputField.mask=this.inputMask),this._cursor&&(this._cursor.mask=this.inputMask),this.updateInputMaskSize(),this.addChildAt(this.inputMask,0)}updateInputMaskSize(){this.inputMask&&this._bg&&(this.inputMask.setSize(this._bg.width-this.paddingLeft-this.paddingRight,this._bg.height-this.paddingTop-this.paddingBottom),this.inputMask.position.set(this.paddingLeft,this.paddingTop))}onPaste(t){t.preventDefault();const i=(t.clipboardData||window.clipboardData).getData("text");i&&this._add(i)}}var Et=Object.defineProperty,At=(t,i,e)=>((t,i,e)=>i in t?Et(t,i,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[i]=e)(t,"symbol"!=typeof i?i+"":i,e);class Bt extends s.Container{constructor(t){super(),At(this,"target"),At(this,"border",new s.Graphics),At(this,"_targetMask"),At(this,"maskData"),At(this,"borderWidth",0),At(this,"borderColor",0),null!=t&&t.target&&this.init(t)}init({target:t,mask:i,borderWidth:e,borderColor:s}){this.target&&this.removeChild(this.target),t&&(this.target=A(t)),this.addChild(this.border),this.target&&this.addChild(this.target),i&&this.applyMask(i),e&&this.setBorder(e,null!=s?s:0)}applyMask(t){this.maskData=t,this._targetMask=A(t),this.addChild(this._targetMask),this.target&&(this.target.mask=this._targetMask)}setBorder(t,i){if(this.borderWidth=t,this.borderColor=i,this.showBorder(),this.maskData&&this._targetMask){const i="string"==typeof this.maskData?s.Sprite.from(this.maskData):this.maskData.clone(!0);i.width+=2*t,i.height+=2*t,this.mask=i,this.addChild(i),this._targetMask.position.set(t)}}showBorder(){if(!this.target)return;const t=2*this.borderWidth;this.border.clear().rect(0,0,this.target.width+t,this.target.height+t).fill(this.borderColor),this.target.x=this.borderWidth,this.target.y=this.borderWidth}hideBorder(){this.border.clear()}}var jt=Object.defineProperty,Rt=(t,i,e)=>((t,i,e)=>i in t?jt(t,i,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[i]=e)(t,"symbol"!=typeof i?i+"":i,e);class Ut extends s.Container{constructor(t){super(),Rt(this,"items",[]),Rt(this,"innerView"),Rt(this,"value",""),Rt(this,"selected",0),Rt(this,"onChange"),Rt(this,"options");this.options=_objectSpread(_objectSpread({},{items:[],type:"vertical",elementsMargin:0,selectedItem:0}),t),this.onChange=new C.Signal,this.init(this.options)}init(t){var i,e,s,n;this.options=t,this.selected=null!=(i=t.selectedItem)?i:0,this.value=null!=(e=null===(s=t.items[this.selected])||void 0===s||null===(n=s.labelText)||void 0===n?void 0:n.text)?e:"",this.innerView?(this.innerView.type=t.type,this.innerView.elementsMargin=t.elementsMargin):this.innerView=new et({type:t.type,elementsMargin:t.elementsMargin}),this.addItems(t.items),this.addChild(this.innerView),this.selectItem(this.selected)}addItems(t){t.forEach((t,i)=>{var e;t.onChange.connect(()=>this.selectItem(i)),this.items.push(t),null===(e=this.innerView)||void 0===e||e.addChild(t)})}removeItems(t){t.forEach(t=>{var i;const e=this.items[t];e&&(e.onChange.disconnectAll(),null===(i=this.innerView)||void 0===i||i.removeChild(e),this.items.splice(t,1))})}selectItem(t){var i,e,s,n;(this.items.forEach((i,e)=>{i.forceCheck(e===t)}),this.selected!==t)&&this.onChange.emit(t,null!=(s=null===(n=this.items[t].labelText)||void 0===n?void 0:n.text)?s:"");this.value=null!=(i=null===(e=this.options.items[t].labelText)||void 0===e?void 0:e.text)?i:"",this.selected=t}}var Lt=Object.defineProperty,Dt=(t,i,e)=>((t,i,e)=>i in t?Lt(t,i,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[i]=e)(t,"symbol"!=typeof i?i+"":i,e);class Ft extends s.Container{constructor(t){super(),Dt(this,"view",new s.Container),Dt(this,"openButton"),Dt(this,"closeButton"),Dt(this,"openView"),Dt(this,"scrollBox"),Dt(this,"value",-1),Dt(this,"onSelect"),this.addChild(this.view),this.onSelect=new C.Signal,t&&this.init(t)}init({closedBG:t,textStyle:i,TextClass:e,items:n,openBG:r,selected:a,selectedTextOffset:o,scrollBox:l,visibleItems:h}){var d,u;(e=null!=e?e:s.Text,this.openView&&this.openView!==r&&this.view.removeChild(this.openView),this.openButton?(this.openButton.defaultView=A(t),this.openButton.textView=new e({text:null!=n&&n.items?n.items[0]:"",style:i}),this.openButton.textOffset=null!=o?o:{}):(this.openButton=new Z({defaultView:t,text:new e({text:null!=n&&n.items?n.items[0]:"",style:i}),textOffset:o}),this.openButton.onPress.connect(()=>this.toggle()),this.addChild(this.openButton)),this.openView!==r&&(this.openView=A(r),this.view.visible=!1,this.view.addChild(this.openView)),this.closeButton?(this.closeButton.defaultView=(new s.Graphics).rect(0,0,this.openButton.width,this.openButton.height).fill({color:0,alpha:1e-5}),this.closeButton.textView=new e({text:null!=n&&n.items?n.items[0]:"",style:i}),this.openButton.textOffset=null!=o?o:{}):(this.closeButton=new Z({defaultView:(new s.Graphics).rect(0,0,this.openButton.width,this.openButton.height).fill({color:0,alpha:1e-5}),text:new e({text:null!=n&&n.items?n.items[0]:"",style:i}),textOffset:o}),this.closeButton.onPress.connect(()=>this.toggle()),this.view.addChild(this.closeButton)),this.scrollBox?this.scrollBox.removeItems():(this.scrollBox=new _t,this.view.addChild(this.scrollBox)),this.scrollBox.init(_objectSpread({type:"vertical",elementsMargin:0,width:this.openButton.width,height:this.openButton.height*(null!=h?h:5),radius:0,padding:0},l)),this.scrollBox.y=this.openButton.height,null!=l&&l.offset)&&(this.scrollBox.x=null!=(d=l.offset.x)?d:0,this.scrollBox.y+=null!=(u=l.offset.y)?u:0);this.addItems(n,a)}addItems(t,i=0){this.convertItemsToButtons(t).forEach((t,e)=>{var s;const n=t.text;e===i&&(this.openButton.text=null!=n?n:"",this.closeButton.text=null!=n?n:""),t.onPress.connect(()=>{this.value=e,this.onSelect.emit(e,null!=n?n:""),this.openButton.text=null!=n?n:"",this.closeButton.text=null!=n?n:"",this.close()}),null===(s=this.scrollBox)||void 0===s||s.addItem(t)})}removeItem(t){this.scrollBox&&this.scrollBox.removeItem(t)}toggle(){this.view.visible=!this.view.visible,this.openButton.visible=!this.openButton.visible}open(){this.view.visible=!0,this.openButton.visible=!1}close(){this.view.visible=!1,this.openButton.visible=!0}convertItemsToButtons({items:t,backgroundColor:i,hoverColor:e,width:n,height:r,textStyle:a,TextClass:o,radius:l}){o=null!=o?o:s.Text;const h=[];return t.forEach(t=>{const d=(new s.Graphics).roundRect(0,0,n,r,l).fill(i),u=null!=e?e:i,c=(new s.Graphics).roundRect(0,0,n,r,l).fill(u),p=new o({text:t,style:a}),g=new Z({defaultView:d,hoverView:c,text:p});h.push(g)}),h}}var Nt=Object.defineProperty,Ht=(t,i,e)=>((t,i,e)=>i in t?Nt(t,i,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[i]=e)(t,"symbol"!=typeof i?i+"":i,e);function Wt(t,i){var e,s,n;if(!t||!i)return null;const r=function(t){var i,e,s,n,r,a;const o=null===(e=(i=t).getSystem)||void 0===e?void 0:e.call(i,"Renderer");if(o)return o;const l=null!==(s=t.systems)&&void 0!==s?s:[];for(const t of l){const i=null!==(r=null===(n=null==t?void 0:t.constructor)||void 0===n?void 0:n.systemName)&&void 0!==r?r:null===(a=null==t?void 0:t.constructor)||void 0===a?void 0:a.name;if("Renderer"===i||"RendererSystem"===i)return t;if("Renderer"===(null==t?void 0:t.name)||"RendererSystem"===(null==t?void 0:t.name))return t;if(null==t?void 0:t.containerManager)return t}return null}(t),a=null!==(e=null==r?void 0:r.containerManager)&&void 0!==e?e:null===(s=null==r?void 0:r.rendererManager)||void 0===s?void 0:s.containerManager;return(null==a?void 0:a.getContainer)&&null!==(n=a.getContainer(i.id))&&void 0!==n?n:null}function Gt(t,i,e){const s=Wt(t,i);if(!s)return!1;try{return e.parent&&e.parent!==s&&e.parent.removeChild(e),"function"==typeof s.addChildAt?s.addChildAt(e,0):s.addChild(e),!0}catch(t){return!1}}function zt(t,i,e){if(!e)return;const s=Wt(t,i);try{s&&e.parent===s&&s.removeChild(e),"function"==typeof e.destroy&&e.destroy({children:!0})}catch(t){}}function qt(t,i,e,s=4){const n=Wt(t,i);n?e(n):s<=0||queueMicrotask(()=>qt(t,i,e,s-1))}function Yt(t,i,e){var n;if(!e)return null;if("entityName"in e){const s=function(t,i){var e,s,n;if("function"==typeof t.findChildByName)try{const e=t.findChildByName(i);if(e)return e}catch(t){}const r=null!==(s=null===(e=t.transform)||void 0===e?void 0:e.children)&&void 0!==s?s:[];for(const t of r)if((null===(n=null==t?void 0:t.gameObject)||void 0===n?void 0:n.name)===i)return t.gameObject;return null}(i,e.entityName);if(s){const i=Wt(t,s);if(i){try{i.parent&&i.parent.removeChild(i)}catch(t){}return i}}return e.fallback?Yt(t,i,e.fallback):null}if("ui"in e)return null!==(n=function(t){var i,e,n;if(!t||!t.type)return null;const r=new s.Graphics,{style:a}=t,o=null!==(i=a.width)&&void 0!==i?i:0,l=null!==(e=a.height)&&void 0!==e?e:0,h=null!==(n=a.radius)&&void 0!==n?n:0;switch(t.type){case"rect":r.rect(0,0,o,l);break;case"roundedRect":r.roundRect(0,0,o,l,h);break;case"circle":r.circle(h,h,h);break;case"ellipse":r.ellipse(o/2,l/2,o/2,l/2)}void 0!==a.fill&&r.fill(a.fill);void 0!==a.stroke&&void 0!==a.lineWidth&&(r.setStrokeStyle({color:a.stroke,width:a.lineWidth}),r.stroke());void 0!==a.alpha&&(r.alpha=a.alpha);return r}(e.ui))&&void 0!==n?n:e.fallback?Yt(t,i,e.fallback):null;if("texture"in e){const n=function(t,i){var e,n;const r=null!==(e=null==t?void 0:t.resource)&&void 0!==e?e:null;if(null===(n=null==r?void 0:r.instances)||void 0===n?void 0:n[i]){const t=r.instances[i];if(t instanceof s.Texture)return t;if((null==t?void 0:t.image)instanceof s.Texture)return t.image}try{return s.Texture.from(i)}catch(t){return null}}(t,e.texture);return n?new s.Sprite(n):e.fallback?Yt(t,i,e.fallback):null}if("color"in e)try{const t=new s.Graphics;return e.radius&&e.radius>0?t.roundRect(0,0,e.width,e.height,e.radius):t.rect(0,0,e.width,e.height),t.fill(e.color),t}catch(t){return console.error("[view-resolver] color view create failed",t),null}return null}class Xt extends i.Component{constructor(){super(...arguments),this.toggleCount=0,this.pressCount=0,this.hoverCount=0,this.changeCount=0,this.updateCount=0,this.selectCount=0,this.focused=!1}init(t){t&&this.applyParams(t)}applyDeclarativeProps(t,i){this.applyParams(t)}applyParams(t){const i=this.constructor.__def;if(i)for(const[e,s]of Object.entries(i.fields)){if(!(e in t))continue;const i=t[e];if(void 0!==i)switch(s.kind){case"scalar":case"opaque":this[e]=i;break;case"shallowMerge":this[e]=_extends(_extends({},this[e]),i);break;case"arrayCopy":Array.isArray(i)&&(this[e]=i.slice());break;case"tuple":!Array.isArray(i)||s.tupleLength&&i.length!==s.tupleLength||(this[e]=i.slice())}}}}function $t(t){const i=t.name;class e extends Xt{constructor(e){super(e),this.componentName=i;for(const[i,e]of Object.entries(t.fields))void 0!==e.default?this[i]=Kt(e.default):i in this||(this[i]=void 0)}static getInspectorMetadata(){return function(t){const i=[];for(const[e,s]of Object.entries(t.fields))s.inspector&&i.push(_extends(_extends({},s.inspector),{name:s.inspector.name||e}));return{name:t.name,type:"object",isArray:!1,isFolder:!0,children:i}}(t)}}const s=e;s.componentName=i,s.__def=t;try{Object.defineProperty(s,"name",{value:i})}catch(t){}if(t.mixin)for(const[i,s]of Object.entries(t.mixin))e.prototype[i]=s;return s}function Kt(t){return null===t||"object"!=typeof t?t:Array.isArray(t)?t.slice():_extends({},t)}const Jt={kind:"scalar",default:!0,inspector:{name:"enabled",type:"boolean"}},Qt={kind:"scalar",inspector:{name:"bindToStore",type:"string"}};function Zt(){const[t,i]=this.valueRange;if(i<=t)return 0;return(Math.max(t,Math.min(i,this.value))-t)/(i-t)*100}function ti(t){if(void 0!==t)return"string"==typeof t?parseInt(t.replace("#",""),16):t}const ii={name:"Button",signalPrefix:"button",pixiClass:E,fields:{enabled:Jt,view:{kind:"opaque",inspector:{name:"view",type:"object"}}},views:{kind:"single",key:"view",required:!0},positional:!0,optionsBuilder:(t,i)=>[i.single],postCreate:(t,i)=>{t.enabled=i.enabled},signalMap:t=>({press:()=>(t.pressCount+=1,{}),down:!0,up:!0,hover:!0}),syncOnChange:(t,i)=>{t.enabled=i.enabled}},ei={name:"FancyButton",signalPrefix:"fancybutton",pixiClass:Z,fields:{enabled:Jt,state:{kind:"scalar",default:"default",inspector:{name:"state",type:"string"}},selected:{kind:"scalar",default:!1,inspector:{name:"selected",type:"boolean"}},text:{kind:"scalar",inspector:{name:"text",type:"string"}},padding:{kind:"scalar",inspector:{name:"padding",type:"number"}},selectedTint:{kind:"scalar",default:"#FFD680",inspector:{name:"selectedTint",type:"color"}},views:{kind:"shallowMerge",default:{},inspector:{name:"views",type:"object",isFolder:!0,children:[{name:"default",type:"object"},{name:"hover",type:"object"},{name:"pressed",type:"object"},{name:"disabled",type:"object"}]}},offset:{kind:"shallowMerge",default:{}},textOffset:{kind:"shallowMerge",default:{}},nineSliceSprite:{kind:"opaque"}},views:{kind:"object",folder:"views",keys:[{name:"default",required:!1},{name:"hover",required:!1},{name:"pressed",required:!1},{name:"disabled",required:!1}]},optionsBuilder:(t,i)=>{var e,s,n,r;const a={text:t.text,padding:t.padding,offset:t.offset,textOffset:t.textOffset,nineSliceSprite:t.nineSliceSprite};return(null===(e=i.object)||void 0===e?void 0:e.default)&&(a.defaultView=i.object.default),(null===(s=i.object)||void 0===s?void 0:s.hover)&&(a.hoverView=i.object.hover),(null===(n=i.object)||void 0===n?void 0:n.pressed)&&(a.pressedView=i.object.pressed),(null===(r=i.object)||void 0===r?void 0:r.disabled)&&(a.disabledView=i.object.disabled),a},postCreate:(t,i)=>{t.enabled=i.enabled,i.selected&&si(t,i)},signalMap:t=>({press:()=>(t.pressCount+=1,{}),hover:()=>(t.hoverCount+=1,{}),down:!0,up:!0}),syncOnChange:(t,i)=>{t.enabled=i.enabled,void 0!==i.text&&t.text!==i.text&&(t.text=i.text),void 0!==i.padding&&t.padding!==i.padding&&(t.padding=i.padding),si(t,i)}};function si(t,i){try{const e=t.defaultView;e&&"tint"in e&&(e.tint=i.selected?i.selectedTint:16777215)}catch(t){}}const ni={name:"CheckBox",signalPrefix:"checkbox",pixiClass:class extends R{constructor(t){var i,e,n;super(),L(this,"labelText"),L(this,"onCheck"),L(this,"_style"),L(this,"_textClass"),this._textClass=null!=(i=t.TextClass)?i:s.Text,this.text=null!=(e=t.text)?e:"",this.style=t.style,this.checked=null!=(n=t.checked)&&n,this.triggerEvents=["onPress"],this.innerView.cursor="pointer",this.onCheck=new C.Signal,this.onChange.connect(()=>this.onCheck.emit(this.checked))}addLabel(t,i){var e;t&&(this.labelText=new this._textClass({text:null!=t?t:"",style:null!=i?i:null===(e=this._style)||void 0===e?void 0:e.text}),this.addChild(this.labelText),this.labelText.cursor="pointer",this.labelText.eventMode="static",this.labelText.on("pointertap",()=>this.checked=!this.checked),this.alignText())}set text(t){var i;t?(this.labelText?this.labelText.text=t:this.addLabel(t),this.alignText()):this.labelText&&((i=this.labelText)&&(i.parent&&i.parent.removeChild(i),i.destroy()),this.labelText=void 0)}get text(){var t,i;return null!=(t=null===(i=this.labelText)||void 0===i?void 0:i.text)?t:""}set style(t){const i=this.checked;this._style=t;const{unchecked:e,checked:s}=t,n=A(e),r=A(s);this.views=[n,r],i?(r.visible=!0,n.visible=!1,this.active=1):(n.visible=!0,r.visible=!1,this.active=0),this.labelText&&t.text&&(this.labelText.style=t.text,this.alignText())}get style(){return this._style}alignText(){if(!this.style)return;if(!this.labelText)return;if(!this.views)return;const t=this.views[0];var i,e,s,n,r,a;t&&(this.labelText.x=t.width+10+(null!=(i=null===(e=this._style)||void 0===e||null===(s=e.textOffset)||void 0===s?void 0:s.x)?i:0),this.labelText.y=(t.height-this.labelText.height)/2+(null!=(n=null===(r=this._style)||void 0===r||null===(a=r.textOffset)||void 0===a?void 0:a.y)?n:0))}get checked(){return 1===this.active}set checked(t){this.switch(t?1:0)}forceCheck(t){this.forceSwitch(t?1:0)}},fields:{enabled:Jt,checked:{kind:"scalar",default:!1,inspector:{name:"checked",type:"boolean"}},text:{kind:"scalar",inspector:{name:"text",type:"string"}},bindToStore:Qt,views:{kind:"shallowMerge",default:{},inspector:{name:"views",type:"object",isFolder:!0,children:[{name:"checked",type:"object"},{name:"unchecked",type:"object"}]}},disabledStyle:{kind:"shallowMerge",default:{alpha:.4,scale:1}}},views:{kind:"object",folder:"views",keys:[{name:"checked",required:!0},{name:"unchecked",required:!0}]},optionsBuilder:(t,i)=>({style:{checked:i.object.checked,unchecked:i.object.unchecked},text:t.text,checked:t.checked}),signalMap:t=>({check:i=>(t.checked=i,t.toggleCount+=1,{value:i})}),syncOnChange:(t,i)=>{t.checked!==i.checked&&(t.checked=i.checked)}},ri={name:"Switcher",signalPrefix:"switcher",pixiClass:R,fields:{active:{kind:"scalar",default:0,inspector:{name:"active",type:"number"}},views:{kind:"arrayCopy",default:[]},triggerEvent:{kind:"scalar",default:"onPress",inspector:{name:"triggerEvent",type:"string"}},bindToStore:Qt},views:{kind:"array",key:"views",minLength:2},positional:!0,optionsBuilder:(t,i)=>[i.array,t.triggerEvent,t.active],signalMap:t=>({change:i=>(t.active="number"==typeof i?i:i?1:0,t.changeCount+=1,{active:t.active})}),syncOnChange:(t,i)=>{t.active!==i.active&&(t.active=i.active)}},ai={name:"Slider",signalPrefix:"slider",pixiClass:class extends Vt{constructor(t){var i;super(_objectSpread({slider1:t.slider,value1:t.value},t)),Ht(this,"sliderOptions"),Ht(this,"onUpdate",new C.Signal),Ht(this,"onChange",new C.Signal),this.sliderOptions=t,this.step=t.step||1,this.value=null!=(i=t.value)?i:this.min,this.updateSlider()}get value(){return this._value1}set value(t){var i;t!==this._value1&&(t<this.min&&(t=this.min),t>this.max&&(t=this.max),this._value1=t,this.updateSlider(),null===(i=this.onUpdate)||void 0===i||i.emit(this.value))}set max(t){super.max=t,this.updateSlider()}get max(){return super.max}set min(t){super.min=t,this.updateSlider()}get min(){return super.min}set step(t){super.step=t,this.updateSlider()}get step(){return super.step}set slider(t){this.slider1=t,this.updateSlider()}update(t){var i;if(super.update(t),!this.dragging)return;const e=t.currentTarget,{x:s}=e.parent.worldTransform.applyInverse(t.global),n=s/((null===(i=this.bg)||void 0===i?void 0:i.width)||1),r=this.min+n*(this.max-this.min);this.value=Math.round(r/this.step)*this.step}change(){var t;null===(t=this.onChange)||void 0===t||t.emit(this.value)}updateSlider(){var t,i,e,s,n,r;if(this._slider1&&(this.progress=((null!=(t=this.value)?t:this.min)-this.min)/(this.max-this.min)*100,this._slider1.x=(null!=(i=null===(e=this.bg)||void 0===e?void 0:e.width)?i:0)/100*this.progress-this._slider1.width/2,this._slider1.y=(null!=(s=null===(n=this.bg)||void 0===n?void 0:n.height)?s:0)/2,null!==(r=this.sliderOptions)&&void 0!==r&&r.showValue&&this.value1Text)){var a,o,l,h;this.value1Text.text=`${Math.round(this.value)}`;const t=this._slider1.x+this._slider1.width/2,i=this._slider1.y;this.value1Text.x=t+(null!=(a=null===(o=this.sliderOptions.valueTextOffset)||void 0===o?void 0:o.x)?a:0),this.value1Text.y=i+(null!=(l=null===(h=this.sliderOptions.valueTextOffset)||void 0===h?void 0:h.y)?l:0)}}set width(t){super.width=t,this.updateSlider()}get width(){return super.width}set height(t){super.height=t,this.updateSlider()}get height(){return super.height}setSize(t,i){super.setSize(t,i),this.updateSlider()}},fields:{enabled:Jt,value:{kind:"scalar",default:0,inspector:{name:"value",type:"number"}},min:{kind:"scalar",default:0,inspector:{name:"min",type:"number"}},max:{kind:"scalar",default:100,inspector:{name:"max",type:"number"}},step:{kind:"scalar",default:1,inspector:{name:"step",type:"number"}},orientation:{kind:"scalar",default:"horizontal",inspector:{name:"orientation",type:"string"}},showValue:{kind:"scalar",default:!1,inspector:{name:"showValue",type:"boolean"}},views:{kind:"shallowMerge",default:{}},bindToStore:Qt},views:{kind:"object",folder:"views",keys:[{name:"bg",required:!0},{name:"fill",required:!0},{name:"thumb",required:!0}]},optionsBuilder:(t,i)=>(oi(i.object.thumb),{bg:i.object.bg,fill:i.object.fill,slider:i.object.thumb,min:t.min,max:t.max,step:t.step,value:t.value,showValue:t.showValue}),signalMap:t=>({update:i=>(t.value=i,t.updateCount+=1,{value:i}),change:i=>(t.value=i,t.changeCount+=1,{value:i})}),syncOnChange:(t,i)=>{t.value!==i.value&&(t.value=i.value)}};function oi(t){var i,e,s,n;if(!t)return;if(t.anchor)return;let r=0;try{const n=null===(i=t.getBounds)||void 0===i?void 0:i.call(t);r=null!==(s=null!==(e=null==n?void 0:n.height)&&void 0!==e?e:t.height)&&void 0!==s?s:0}catch(i){r=null!==(n=t.height)&&void 0!==n?n:0}r>0&&t.pivot&&t.pivot.set(0,r/2)}const li={name:"DoubleSlider",signalPrefix:"doubleslider",pixiClass:class extends Vt{constructor(t){super(t),Mt(this,"sliderOptions"),Mt(this,"activeValue"),Mt(this,"onChange",new C.Signal),Mt(this,"onUpdate",new C.Signal),this.sliderOptions=t,this.setInitialState()}setInitialState(){this.validateValues();const{value1:t,value2:i}=this.sliderOptions;this.updateProgress(t,i),this.value2=null!=i?i:0,this.value1=null!=t?t:0}updateProgress(t=this.value1,i=this.value2){this.progressStart=(t-this.min)/(this.max-this.min)*100,this.progress=(i-this.min)/(this.max-this.min)*100}validateValues(){var t,i,e,s;const n=null!=(t=this.sliderOptions.min)?t:this.min,r=null!=(i=this.sliderOptions.max)?i:this.max;this.sliderOptions.value1||(this.sliderOptions.value1=n),this.sliderOptions.value2||(this.sliderOptions.value2=r);let a=null!=(e=this.sliderOptions.value1)?e:n,o=null!=(s=this.sliderOptions.value2)?s:r;o<a&&(o=a),a<n&&(a=n),a>r&&(a=r),o>r&&(o=r),this.sliderOptions.value1=a,this.sliderOptions.value2=o}get value1(){return this._value1}set value1(t){var i;t!==this._value1&&(t<this.min&&(t=this.min),t>this._value2&&(t=this._value2),this._value1=t,this.updateSlider1(),null===(i=this.onUpdate)||void 0===i||i.emit(this.value1,this.value2))}get value2(){return this._value2}set value2(t){var i;t!==this._value2&&(t<this._value1&&(t=this._value1),t>this.max&&(t=this.max),this._value2=t,this.updateSlider2(),null===(i=this.onUpdate)||void 0===i||i.emit(this.value1,this.value2))}update(t){var i;if(super.update(t),!this.dragging)return;const e=t.currentTarget,{x:s}=e.parent.worldTransform.applyInverse(t.global),n=this._slider1?Math.abs(s-this._slider1.x-this._slider1.width):1/0,r=this._slider2?Math.abs(s-this._slider2.x):1/0;this.activeValue||(this.slider1&&s<this.slider1.x?this.activeValue="value1":this.slider2&&s>this.slider2.x?this.activeValue="value2":this.activeValue=n<r?"value1":"value2");const a=this.validate(s/(null===(i=this.bg)||void 0===i?void 0:i.width)*100);"value1"===this.activeValue?(this.progressStart=a,this.value1=this.min+(this.max-this.min)/100*a,this.updateProgress(this.value1,this.value2)):(this.progress=a,this.value2=this.min+(this.max-this.min)/100*a,this.updateProgress(this.value1,this.value2))}endUpdate(){super.endUpdate(),this.activeValue=void 0}change(){var t;null===(t=this.onChange)||void 0===t||t.emit(this.value1,this.value2)}set slider1(t){super.slider1=t,this.updateSlider1()}get slider1(){return this._slider1}set slider2(t){super.slider2=t,this.updateSlider2()}get slider2(){return this._slider2}updateSlider1(){var t,i,e,s,n;if(this._slider1&&(this.updateProgress(this.value1,this.value2),this._slider1.x=(null!=(t=null===(i=this.bg)||void 0===i?void 0:i.width)?t:0)/100*this.progressStart-this._slider1.width/2,this._slider1.y=(null!=(e=null===(s=this.bg)||void 0===s?void 0:s.height)?e:0)/2,this._slider2&&this._slider1.x>this._slider2.x&&(this._slider1.x=this._slider2.x),null!==(n=this.sliderOptions)&&void 0!==n&&n.showValue&&this.value1Text&&this._slider1)){var r,a,o,l;this.value1Text.text=`${Math.round(this.value1)}`;const t=this._slider1.x+this._slider1.width/2,i=this._slider1.y;this.value1Text.x=t+(null!=(r=null===(a=this.sliderOptions.valueTextOffset)||void 0===a?void 0:a.x)?r:0),this.value1Text.y=i+(null!=(o=null===(l=this.sliderOptions.valueTextOffset)||void 0===l?void 0:l.y)?o:0)}}updateSlider2(){var t,i,e,s,n;if(this._slider2&&(this.updateProgress(this.value1,this.value2),this._slider2.x=(null!=(t=null===(i=this.bg)||void 0===i?void 0:i.width)?t:0)/100*this.progress-this._slider2.width/2,this._slider2.y=(null!=(e=null===(s=this.bg)||void 0===s?void 0:s.height)?e:0)/2,this._slider1&&this._slider2.x<this._slider1.x&&(this._slider2.x=this._slider1.x),null!==(n=this.sliderOptions)&&void 0!==n&&n.showValue&&this.value2Text&&this._slider2)){var r,a,o,l;this.value2Text.text=`${Math.round(this.value2)}`;const t=this._slider2.x+this._slider2.width/2,i=this._slider2.y;this.value2Text.x=t+(null!=(r=null===(a=this.sliderOptions.valueTextOffset)||void 0===a?void 0:a.x)?r:0),this.value2Text.y=i+(null!=(o=null===(l=this.sliderOptions.valueTextOffset)||void 0===l?void 0:l.y)?o:0)}}set width(t){super.width=t,this.updateSlider1(),this.updateSlider2()}get width(){return super.width}set height(t){super.height=t,this.updateSlider1(),this.updateSlider2()}get height(){return super.height}setSize(t,i){super.setSize(t,i),this.updateSlider1(),this.updateSlider2()}},fields:{enabled:Jt,value1:{kind:"scalar",default:0,inspector:{name:"value1",type:"number"}},value2:{kind:"scalar",default:100,inspector:{name:"value2",type:"number"}},min:{kind:"scalar",default:0,inspector:{name:"min",type:"number"}},max:{kind:"scalar",default:100,inspector:{name:"max",type:"number"}},step:{kind:"scalar",default:1},showValue:{kind:"scalar",default:!1,inspector:{name:"showValue",type:"boolean"}},views:{kind:"shallowMerge",default:{}},bindToStore1:{kind:"scalar"},bindToStore2:{kind:"scalar"}},views:{kind:"object",folder:"views",keys:[{name:"bg",required:!0},{name:"fill",required:!0},{name:"slider1",required:!0},{name:"slider2",required:!0}]},optionsBuilder:(t,i)=>(oi(i.object.slider1),oi(i.object.slider2),{bg:i.object.bg,fill:i.object.fill,slider1:i.object.slider1,slider2:i.object.slider2,min:t.min,max:t.max,value1:t.value1,value2:t.value2,showValue:t.showValue}),signalMap:t=>({update:(i,e)=>(t.value1=i,t.value2=e,t.updateCount+=1,{value1:i,value2:e}),change:(i,e)=>(t.value1=i,t.value2=e,t.changeCount+=1,{value1:i,value2:e})}),syncOnChange:(t,i)=>{t.value1!==i.value1&&(t.value1=i.value1),t.value2!==i.value2&&(t.value2=i.value2)}},hi={name:"ProgressBar",signalPrefix:"progressbar",pixiClass:St,fields:{value:{kind:"scalar",default:0,inspector:{name:"value",type:"number"}},valueRange:{kind:"tuple",tupleLength:2,default:[0,100],inspector:{name:"valueRange",type:"number",isArray:!0}},bgView:{kind:"opaque"},fillView:{kind:"opaque"},nineSliceSprite:{kind:"opaque"},fillPaddings:{kind:"shallowMerge",default:{}},bindToStore:Qt},views:{kind:"object",folder:"__progress_views__",keys:[]},optionsBuilder:(t,i)=>({bg:t.__resolved_bg,fill:t.__resolved_fill,fillPaddings:t.fillPaddings,progress:di(t)}),syncOnChange:(t,i)=>{const e=di(i);t.progress!==e&&(t.progress=e)},mixin:{getProgressPct:Zt}};function di(t){const[i,e]=t.valueRange;if(e<=i)return 0;return(Math.max(i,Math.min(e,t.value))-i)/(e-i)*100}const ui={name:"CircularProgressBar",signalPrefix:"circularprogressbar",pixiClass:N,fields:{value:{kind:"scalar",default:0,inspector:{name:"value",type:"number"}},valueRange:{kind:"tuple",tupleLength:2,default:[0,100],inspector:{name:"valueRange",type:"number",isArray:!0}},radius:{kind:"scalar",default:60,inspector:{name:"radius",type:"number"}},lineWidth:{kind:"scalar",default:12,inspector:{name:"lineWidth",type:"number"}},startAngle:{kind:"scalar",default:-90,inspector:{name:"startAngle",type:"number",step:5}},backgroundColor:{kind:"scalar",default:"#1f2937",inspector:{name:"backgroundColor",type:"color"}},fillColor:{kind:"scalar",default:"#22c55e",inspector:{name:"fillColor",type:"color"}},backgroundAlpha:{kind:"scalar",default:1,inspector:{name:"backgroundAlpha",type:"number",step:.05}},fillAlpha:{kind:"scalar",default:1,inspector:{name:"fillAlpha",type:"number",step:.05}},bindToStore:Qt},optionsBuilder:t=>({radius:t.radius,lineWidth:t.lineWidth,backgroundColor:t.backgroundColor,fillColor:t.fillColor,backgroundAlpha:t.backgroundAlpha,fillAlpha:t.fillAlpha,value:di(t)}),syncOnChange:(t,i)=>{const e=di(i);t.progress!==e&&(t.progress=e)},mixin:{getProgressPct:Zt}},ci={name:"Input",signalPrefix:"input",pixiClass:Ot,fields:{enabled:Jt,value:{kind:"scalar",default:"",inspector:{name:"value",type:"string"}},placeholder:{kind:"scalar",default:"",inspector:{name:"placeholder",type:"string"}},maxLength:{kind:"scalar",default:100,inspector:{name:"maxLength",type:"number"}},secure:{kind:"scalar",default:!1,inspector:{name:"secure",type:"boolean"}},align:{kind:"scalar",default:"left",inspector:{name:"align",type:"string"}},padding:{kind:"tuple",tupleLength:4,default:[8,8,8,8]},textStyle:{kind:"shallowMerge",default:{fontFamily:"Arial",fontSize:16,fill:"#222"}},bgView:{kind:"opaque"},nineSliceSprite:{kind:"opaque"},cleanOnFocus:{kind:"scalar",default:!1,inspector:{name:"cleanOnFocus",type:"boolean"}},addMask:{kind:"scalar",default:!1,inspector:{name:"addMask",type:"boolean"}},bindToStore:Qt},views:{kind:"single",key:"bgView",required:!0},optionsBuilder:(t,i)=>({bg:i.single,textStyle:t.textStyle,placeholder:t.placeholder,value:t.value,maxLength:t.maxLength,secure:t.secure,align:t.align,padding:t.padding,cleanOnFocus:t.cleanOnFocus,nineSliceSprite:t.nineSliceSprite,addMask:t.addMask}),signalMap:t=>({change:i=>(t.value=i,t.changeCount+=1,{value:i}),enter:t=>({value:t})}),syncOnChange:(t,i)=>{t.value!==i.value&&(t.value=i.value)}},pi={name:"List",signalPrefix:"list",pixiClass:et,fields:{type:{kind:"scalar",default:"vertical",inspector:{name:"type",type:"string"}},elementsMargin:{kind:"scalar",default:0,inspector:{name:"elementsMargin",type:"number"}},padding:{kind:"scalar"},vertPadding:{kind:"scalar"},horPadding:{kind:"scalar"},topPadding:{kind:"scalar"},bottomPadding:{kind:"scalar"},leftPadding:{kind:"scalar"},rightPadding:{kind:"scalar"},maxWidth:{kind:"scalar"},maxHeight:{kind:"scalar"},itemsChildName:{kind:"scalar",default:"items"}},optionsBuilder:(t,i)=>{var e;return{type:t.type,elementsMargin:t.elementsMargin,padding:t.padding,vertPadding:t.vertPadding,horPadding:t.horPadding,topPadding:t.topPadding,bottomPadding:t.bottomPadding,leftPadding:t.leftPadding,rightPadding:t.rightPadding,maxWidth:t.maxWidth,maxHeight:t.maxHeight,children:null!==(e=t.__resolved_items)&&void 0!==e?e:[]}},syncOnChange:(t,i)=>{t.type!==i.type&&(t.type=i.type),t.elementsMargin!==i.elementsMargin&&(t.elementsMargin=i.elementsMargin),"function"==typeof t.arrangeChildren&&t.arrangeChildren()}},gi={name:"ScrollBox",signalPrefix:"scrollbox",pixiClass:_t,fields:{width:{kind:"scalar",default:320,inspector:{name:"width",type:"number"}},height:{kind:"scalar",default:240,inspector:{name:"height",type:"number"}},direction:{kind:"scalar",default:"vertical",inspector:{name:"direction",type:"string"}},contentChildName:{kind:"scalar",default:"content"},background:{kind:"scalar",default:1118481,inspector:{name:"background",type:"color"}},radius:{kind:"scalar",default:0,inspector:{name:"radius",type:"number"}},elementsMargin:{kind:"scalar",default:0},disableDynamicRendering:{kind:"scalar",default:!1},disableEasing:{kind:"scalar",default:!1,inspector:{name:"disableEasing",type:"boolean"}},padding:{kind:"scalar",default:0},inertia:{kind:"scalar",default:!0},inertiaDecay:{kind:"scalar",default:.92},bounceFactor:{kind:"scalar",default:.18}},mixin:{applyOffset(){},getBounds:()=>({minX:0,maxX:0,minY:0,maxY:0})},optionsBuilder:(t,i)=>{var e,s;return{width:t.width,height:t.height,type:null!==(e={horizontal:"horizontal",vertical:"vertical",both:"bidirectional"}[t.direction])&&void 0!==e?e:"vertical",background:t.background,radius:t.radius,elementsMargin:t.elementsMargin,padding:t.padding,disableEasing:t.disableEasing,disableDynamicRendering:t.disableDynamicRendering,items:null!==(s=t.__resolved_items)&&void 0!==s?s:[]}},signalMap:()=>({scroll:t=>({value:t})}),syncOnChange:(t,i)=>{if("function"==typeof t.resize)try{t.resize(i.width,i.height)}catch(t){}}},vi={name:"Select",signalPrefix:"select",pixiClass:Ft,fields:{items:{kind:"arrayCopy",default:[]},selectedIndex:{kind:"scalar",default:-1,inspector:{name:"selectedIndex",type:"number"}},placeholder:{kind:"scalar",default:"",inspector:{name:"placeholder",type:"string"}},closedView:{kind:"opaque"},openView:{kind:"opaque"},textStyle:{kind:"shallowMerge",default:{fontFamily:"Arial",fontSize:14,fill:"#222"}},nineSliceSprite:{kind:"opaque"},bindToStore:Qt},views:{kind:"object",folder:"__select_views__",keys:[]},optionsBuilder:t=>{var i;return{closedBG:t.__resolved_closedView,openBG:t.__resolved_openView,textStyle:t.textStyle,items:{items:(null!==(i=t.items)&&void 0!==i?i:[]).map(t=>t.text),backgroundColor:0,hoverColor:6710886,width:200,height:30,textStyle:t.textStyle,radius:4},selected:t.selectedIndex>=0?t.selectedIndex:void 0,nineSliceSprite:t.nineSliceSprite}},signalMap:t=>({select:(i,e)=>(t.selectedIndex=i,t.selectCount+=1,{index:i,text:e})})},fi={name:"Dialog",signalPrefix:"dialog",pixiClass:bt,fields:{open:{kind:"scalar",default:!1,inspector:{name:"open",type:"boolean"}},title:{kind:"scalar",inspector:{name:"title",type:"string"}},width:{kind:"scalar",inspector:{name:"width",type:"number"}},height:{kind:"scalar",inspector:{name:"height",type:"number"}},padding:{kind:"scalar",inspector:{name:"padding",type:"number"}},backdropColor:{kind:"scalar",default:0,inspector:{name:"backdropColor",type:"color"}},backdropAlpha:{kind:"scalar",default:.5,inspector:{name:"backdropAlpha",type:"number",step:.05}},backdropView:{kind:"opaque"},backgroundView:{kind:"opaque"},closeOnBackdropClick:{kind:"scalar",default:!0,inspector:{name:"closeOnBackdropClick",type:"boolean"}},contentChildName:{kind:"scalar",default:"content",inspector:{name:"contentChildName",type:"string"}},nineSliceSprite:{kind:"opaque"},bindToStore:Qt},optionsBuilder:t=>{var i;return{backdrop:t.__resolved_backdropView,backdropColor:ti(t.backdropColor),backdropAlpha:t.backdropAlpha,background:null!==(i=t.__resolved_backgroundView)&&void 0!==i?i:new s.Container,title:t.title,width:t.width,height:t.height,padding:t.padding,closeOnBackdropClick:t.closeOnBackdropClick,nineSliceSprite:t.nineSliceSprite}},postCreate:(t,i)=>{i.open&&"function"==typeof t.open&&t.open()},signalMap:t=>({close:()=>(t.open=!1,{}),select:(t,i)=>({index:t,text:i})}),syncOnChange:(t,i)=>{i.open&&!t.isOpen&&"function"==typeof t.open?t.open():!i.open&&t.isOpen&&"function"==typeof t.close&&t.close()}},_i={name:"MaskedFrame",signalPrefix:"maskedframe",pixiClass:Bt,fields:{targetView:{kind:"opaque"},maskView:{kind:"opaque"},borderView:{kind:"opaque"}},optionsBuilder:t=>({target:t.__resolved_targetView,mask:t.__resolved_maskView,borderWidth:0,borderColor:0})},mi=$t(ii),wi=$t(ei),bi=$t(ni),yi=$t(ri),xi=$t(ai),Si=$t(li),ki=$t(hi),Ci=$t(ui),Vi=$t(ci),Pi=$t(pi),Mi=$t(gi),Ti=$t(vi),Ii=$t(fi),Oi=$t(_i),Ei={Button:ii,FancyButton:ei,CheckBox:ni,Switcher:ri,Slider:ai,DoubleSlider:li,ProgressBar:hi,CircularProgressBar:ui,Input:ci,List:pi,ScrollBox:gi,Select:vi,Dialog:fi,MaskedFrame:_i};class Ai extends i.Component{constructor(){super(...arguments),this.componentName="RadioGroup",this.direction="vertical",this.elementsMargin=4,this.boundCheckBoxes=[]}static getInspectorMetadata(){return{name:Ai.componentName,type:"object",isArray:!1,isFolder:!0,children:[{name:"selectedId",type:"string",isArray:!1},{name:"direction",type:"string",isArray:!1},{name:"elementsMargin",type:"number",isArray:!1},{name:"childNames",type:"string",isArray:!0}]}}init(t){t&&this.applyParams(t)}applyDeclarativeProps(t,i){this.applyParams(t)}applySelection(){for(const{name:t,cb:i}of this.boundCheckBoxes){const e=t===this.selectedId;i.checked!==e&&(i.checked=e)}}applyParams(t){"string"==typeof t.selectedId&&(this.selectedId=t.selectedId),Array.isArray(t.childNames)&&(this.childNames=t.childNames.slice()),t.direction&&(this.direction=t.direction),"number"==typeof t.elementsMargin&&(this.elementsMargin=t.elementsMargin)}}function Bi(t,i,e){const s=[],{go:n,prefix:r,emitToMx:a=!0}=i;for(const[i,o]of Object.entries(e)){const e=ji(t,i);if(!e)continue;const l=e.connect((...t)=>{var e,s,l,h,d;const u=!0===o?t[0]:Ri(o,t),c="object"==typeof u&&null!==u?_extends({entityName:n.name},u):{entityName:n.name,value:u};try{null===(s=(e=n).emit)||void 0===s||s.call(e,i,c)}catch(t){}try{null===(h=(l=n).emit)||void 0===h||h.call(l,`${r}:${i}`,c)}catch(t){}if(a){const t="undefined"!=typeof globalThis?globalThis.mx:void 0;if(null===(d=null==t?void 0:t.event)||void 0===d?void 0:d.emit)try{t.event.emit(`${r}:${i}`,c)}catch(t){}}});s.push(()=>{try{l.disconnect()}catch(t){}})}return s}function ji(t,i){const e=[`on${i.charAt(0).toUpperCase()}${i.slice(1)}`,`on${i.charAt(0).toUpperCase()}${i.slice(1)}Change`];for(const i of e){const e=null==t?void 0:t[i];if(e&&"function"==typeof e.connect)return e}return null}function Ri(t,i){var e;try{return null!==(e=t(...i))&&void 0!==e?e:{}}catch(t){return{}}}Ai.componentName="RadioGroup";let Ui=class extends i.System{constructor(){super(...arguments),this.name="UISystem",this.instances=new Map,this.signalCleanups=new Map,this.radioGroupInstances=new Map}get checkBoxInstances(){let t=this.instances.get("CheckBox");return t||(t=new Map,this.instances.set("CheckBox",t)),t}update(t){var i,e,s;const n=null!==(s=null===(e=null===(i=this.componentObserver)||void 0===i?void 0:i.clear)||void 0===e?void 0:e.call(i))&&void 0!==s?s:[];for(const t of n)this.componentChanged(t)}componentChanged(t){const i=t.componentName;if("UI"===i)return this.handleUI(t);if("RadioGroup"===i)return this.handleRadioGroup(t);const e=Ei[i];return e?this.handleGeneric(e,t):void 0}handleUI(t){if(t.type===i.OBSERVER_TYPE.ADD||t.type===i.OBSERVER_TYPE.CHANGE){const i=t.component;"function"==typeof i.redraw&&i.redraw()}}handleGeneric(t,e){var s;const n=e.component,r=n.gameObject;if(!r)return;const a=this.getInstanceMap(t.name);if(e.type===i.OBSERVER_TYPE.ADD)qt(this.gameRef(r),r,()=>this.attachGeneric(t,n,r,a));else if(e.type===i.OBSERVER_TYPE.CHANGE){const i=a.get(r.id);if(!i)return void qt(this.gameRef(r),r,()=>this.attachGeneric(t,n,r,a));null===(s=t.syncOnChange)||void 0===s||s.call(t,i,n)}else e.type===i.OBSERVER_TYPE.REMOVE&&this.detachGeneric(r.id,a,r)}attachGeneric(t,i,e,s){var n,r,a,o,l,h,d;if(s.has(e.id))return;const u=this.gameRef(e),c=function(t,i,e,s){var n,r;if(!s)return{};switch(s.kind){case"single":{const n=e[s.key],r=Yt(t,i,n);return s.required&&!r?null:{single:r}}case"object":{const r=null!==(n=e[s.folder])&&void 0!==n?n:{},a={};for(const{name:e,required:n}of s.keys){const s=Yt(t,i,r[e]);if(n&&!s)return null;a[e]=s}return{object:a}}case"array":{const n=(null!==(r=e[s.key])&&void 0!==r?r:[]).map(e=>Yt(t,i,e)).filter(Boolean);return n.length<s.minLength?null:{array:n}}}}(u,e,i,t.views);if(t.views&&null===c)return;if(function(t,i,e,s){switch(t){case"ProgressBar":i.__resolved_bg=Yt(e,s,i.bgView),i.__resolved_fill=Yt(e,s,i.fillView);break;case"Select":i.__resolved_closedView=Yt(e,s,i.closedView),i.__resolved_openView=Yt(e,s,i.openView);break;case"Dialog":i.__resolved_backdropView=Yt(e,s,i.backdropView),i.__resolved_backgroundView=Yt(e,s,i.backgroundView);break;case"MaskedFrame":i.__resolved_targetView=Yt(e,s,i.targetView),i.__resolved_maskView=Yt(e,s,i.maskView)}}(t.name,i,u,e),!function(t,i){switch(t){case"ProgressBar":return!(!i.__resolved_bg||!i.__resolved_fill);case"Select":return!(!i.__resolved_closedView||!i.__resolved_openView);case"Dialog":default:return!0;case"MaskedFrame":return!(!i.__resolved_targetView||!i.__resolved_maskView)}}(t.name,i))return;if("List"===t.name||"ScrollBox"===t.name){const s="List"===t.name?i.itemsChildName:i.contentChildName;i.__resolved_items=function(t,i,e){var s,n,r;const a=[],o=Di(i,e);if(!o)return a;const l=(null===(s=o.transform)||void 0===s?void 0:s.children)||[];for(const i of l){const e=null==i?void 0:i.gameObject;if(!e)continue;const s=Wt(t,e);if(s){try{null===(r=null===(n=s.parent)||void 0===n?void 0:n.removeChild)||void 0===r||r.call(n,s)}catch(t){}a.push(s)}}return a}(u,e,s)}const p=t.optionsBuilder(i,null!=c?c:{}),g=t.positional?new t.pixiClass(...p):new t.pixiClass(p);if(null===(n=t.postCreate)||void 0===n||n.call(t,g,i),s.set(e.id,g),Gt(u,e,g),"Dialog"===t.name){const t=Di(e,null!==(r=i.contentChildName)&&void 0!==r?r:"content");if(t){const i=Wt(u,t);if(i)try{null===(o=(a=g).addChild)||void 0===o||o.call(a,i)}catch(t){}}}if("MaskedFrame"===t.name&&i.borderView){const t=Yt(u,e,i.borderView);if(t)try{null===(h=(l=g).addChild)||void 0===h||h.call(l,t)}catch(t){}}if(t.signalMap){const s=Bi(g,{go:e,prefix:t.signalPrefix},t.signalMap(i));this.signalCleanups.set(e.id,s)}null===(d=t.onAttachedExtra)||void 0===d||d.call(t,g,i,e,u)}detachGeneric(t,i,e){const s=i.get(t);zt(this.gameRef(e),e,s),i.delete(t);const n=this.signalCleanups.get(t);n&&(n.forEach(t=>t()),this.signalCleanups.delete(t))}handleRadioGroup(t){const e=t.component,s=e.gameObject;if(s)if(t.type===i.OBSERVER_TYPE.ADD)qt(this.gameRef(s),s,()=>queueMicrotask(()=>this.attachRadioGroup(e)));else if(t.type===i.OBSERVER_TYPE.CHANGE)e.applySelection();else if(t.type===i.OBSERVER_TYPE.REMOVE){const t=this.radioGroupInstances.get(s.id);zt(this.gameRef(s),s,t),this.radioGroupInstances.delete(s.id);const i=this.signalCleanups.get(s.id);i&&(i.forEach(t=>t()),this.signalCleanups.delete(s.id))}}attachRadioGroup(t){var i,e,s,n,r;const a=t.gameObject,o=this.gameRef(a);if(!a||this.radioGroupInstances.has(a.id))return;t.boundCheckBoxes=[];const l=[],h=[],d=(null===(i=a.transform)||void 0===i?void 0:i.children)||[];for(const i of d){const r=null==i?void 0:i.gameObject;if(!r)continue;if(t.childNames&&!t.childNames.includes(r.name))continue;const a=null===(e=r.getComponent)||void 0===e?void 0:e.call(r,"CheckBox");if(!a)continue;const o=this.checkBoxInstances.get(r.id);if(o){try{null===(n=null===(s=o.parent)||void 0===s?void 0:s.removeChild)||void 0===n||n.call(s,o)}catch(t){}l.push(o),h.push(r.name),t.boundCheckBoxes.push({name:r.name,cb:a})}}if(0===l.length)return;const u=t.selectedId?Math.max(0,h.indexOf(t.selectedId)):0,c=new Ut({items:l,type:null!==(r={horizontal:"horizontal",vertical:"vertical",bidirectional:"bidirectional"}[t.direction])&&void 0!==r?r:"vertical",elementsMargin:t.elementsMargin,selectedItem:u});this.radioGroupInstances.set(a.id,c),Gt(o,a,c);const p=Bi(c,{go:a,prefix:"radiogroup"},{change:(i,e)=>{var s;const n=null!==(s=h[i])&&void 0!==s?s:e;return t.selectedId=n,{selectedId:t.selectedId,index:i}}});this.signalCleanups.set(a.id,p)}getInstanceMap(t){let i=this.instances.get(t);return i||(i=new Map,this.instances.set(t,i)),i}gameRef(t){var i,e,s;const n=this.game;return n||(t&&null!==(s=null!==(i=t.game)&&void 0!==i?i:null===(e=t.scene)||void 0===e?void 0:e.game)&&void 0!==s?s:null)}};Ui.systemName="UISystem",Ui=function(t,i,e,s){var n,r=arguments.length,a=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,i,e,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(i,e,a):n(i,e))||a);return r>3&&a&&Object.defineProperty(i,e,a),a}([i.decorators.componentObserver(function(){const t={UI:[{prop:["shapes"],deep:!0}],RadioGroup:[{prop:["selectedId"],deep:!1},{prop:["direction"],deep:!1},{prop:["elementsMargin"],deep:!1}]};for(const[i,e]of Object.entries(Ei)){const s=[];for(const[t,i]of Object.entries(e.fields)){const e="shallowMerge"===i.kind||"tuple"===i.kind||"arrayCopy"===i.kind;s.push({prop:[t],deep:e})}t[i]=s}return t}())],Ui);var Li=Ui;function Di(t,i){var e,s;if(!t)return null;if("function"==typeof t.findChildByName)try{const e=t.findChildByName(i);if(e)return e}catch(t){}const n=(null===(e=t.transform)||void 0===e?void 0:e.children)||[];for(const t of n)if((null===(s=null==t?void 0:t.gameObject)||void 0===s?void 0:s.name)===i)return t.gameObject;return null}return t.Button=mi,t.COMPONENT_DEFINITIONS=Ei,t.CheckBox=bi,t.CircularProgressBar=Ci,t.Dialog=Ii,t.DoubleSlider=Si,t.FancyButton=wi,t.Input=Vi,t.List=Pi,t.MaskedFrame=Oi,t.PixiUiComponent=Xt,t.PluginUiSystem=Li,t.ProgressBar=ki,t.RadioGroup=Ai,t.ScrollBox=Mi,t.Select=Ti,t.Slider=xi,t.Switcher=yi,t.UI=r,t.UISystem=Li,t.defineUiComponent=$t,Object.defineProperty(t,"__esModule",{value:!0}),t}({},EVA,EVA.plugin.renderer.graphics,PIXI);globalThis.EVA.plugin.ui=globalThis.EVA.plugin.ui||_EVA_IIFE_ui;
|
|
1
|
+
function _extends(){return _extends=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var i=arguments[e];for(var s in i)({}).hasOwnProperty.call(i,s)&&(t[s]=i[s])}return t},_extends.apply(null,arguments)}function ownKeys(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);e&&(s=s.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),i.push.apply(i,s)}return i}function _objectSpread(t){for(var e=1;e<arguments.length;e++){var i=null!=arguments[e]?arguments[e]:{};e%2?ownKeys(Object(i),!0).forEach(function(e){_defineProperty(t,e,i[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):ownKeys(Object(i)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))})}return t}function _defineProperty(t,e,i){return(e=_toPropertyKey(e))in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}function _toPropertyKey(t){var e=_toPrimitive(t,"string");return"symbol"==typeof e?e:e+""}function _toPrimitive(t,e){if("object"!=typeof t||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var s=i.call(t,e||"default");if("object"!=typeof s)return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}globalThis.EVA=globalThis.EVA||{},globalThis.EVA.plugin=globalThis.EVA.plugin||{};var _EVA_IIFE_ui=function(t,e,i,s){"use strict";var n;t.ShapeType=void 0,(n=t.ShapeType||(t.ShapeType={})).RECT="rect",n.CIRCLE="circle",n.ELLIPSE="ellipse",n.ROUNDED_RECT="roundedRect";const o=t.ShapeType;class l extends e.Component{constructor(){super(...arguments),this.componentName="Shape",this.shapes=[]}static getInspectorMetadata(){const t=[{name:"fill",type:"color",isArray:!1},{name:"stroke",type:"color",isArray:!1},{name:"lineWidth",type:"number",isArray:!1},{name:"alpha",type:"number",isArray:!1},{name:"x",type:"number",isArray:!1},{name:"y",type:"number",isArray:!1},{name:"width",type:"number",isArray:!1},{name:"height",type:"number",isArray:!1},{name:"radius",type:"number",isArray:!1}];return{name:l.componentName,type:"object",isArray:!1,isFolder:!0,children:[{name:"componentName",type:"string",isArray:!1},{name:"shapes",type:"object",isArray:!0,children:[{name:"type",type:"string",isArray:!1},{name:"style",type:"object",isArray:!1,children:t}]},{name:"type",type:"string",isArray:!1},{name:"style",type:"object",isArray:!1,children:t}]}}init(t){var e;t&&(this.componentName=null!==(e=t.componentName)&&void 0!==e?e:this.componentName,t.shapes?this.shapes=t.shapes:t.type&&t.style&&(this.shapes=[{type:t.type,style:t.style}]))}awake(){this.redraw()}start(){this.redraw(),queueMicrotask(()=>this.redraw())}parseLinearGradient(t){const e=t.match(/linear-gradient\s*\(\s*([^,]+),\s*(.+)\)/);if(!e)return null;const i=e[1].trim(),s=parseFloat(i),n=[],o=e[2].split(/,(?![^(]*\))/);for(const t of o){const e=t.trim().match(/(.+?)\s+(\d+)%/);if(e){const t=e[1].trim(),i=parseFloat(e[2])/100;n.push({color:t,position:i})}}return{angle:s,colorStops:n}}createGradient(t,e,i,n,o=0,l=0){let r=0,a=0,h=0,d=0;if(0===t)r=.5,a=1,h=.5,d=0;else if(90===t)r=0,a=.5,h=1,d=.5;else if(180===t)r=.5,a=0,h=.5,d=1;else if(270===t)r=1,a=.5,h=0,d=.5;else{const e=(90-t)*(Math.PI/180),s=.5,o=.5,l=Math.max(i,n),u=Math.sqrt(i*i+n*n)/(2*l);r=s-Math.cos(e)*u,a=o-Math.sin(e)*u,h=s+Math.cos(e)*u,d=o+Math.sin(e)*u}const u=new s.FillGradient(r,a,h,d);return e.forEach(t=>{u.addColorStop(t.position,t.color)}),u}getShapeBounds(e,i){const s=i.x||0,n=i.y||0;switch(e){case t.ShapeType.RECT:case t.ShapeType.ROUNDED_RECT:return{width:i.width,height:i.height,x:s,y:n};case t.ShapeType.CIRCLE:return{width:2*i.radius,height:2*i.radius,x:s,y:n};case t.ShapeType.ELLIPSE:return{width:i.width,height:i.height,x:s,y:n};default:return{width:100,height:100,x:s,y:n}}}redraw(){if(!this.gameObject)return;let t=this.gameObject.getComponent("Graphics");t||(t=this.gameObject.addComponent(new i.Graphics));const e=t.graphics;e?(e.clear(),this.shapes.forEach(t=>{this.drawShape(e,t.type,t.style)})):console.warn("Graphics component has no graphics instance")}drawShape(e,i,s){var n;switch(void 0!==s.alpha&&(e.alpha=s.alpha),i){case t.ShapeType.RECT:this.drawRect(e,s);break;case t.ShapeType.CIRCLE:this.drawCircle(e,s);break;case t.ShapeType.ELLIPSE:this.drawEllipse(e,s);break;case t.ShapeType.ROUNDED_RECT:this.drawRoundedRect(e,s);break;default:console.warn(`Unknown shape type: ${i}`)}if(void 0!==s.fill)if("string"==typeof s.fill&&s.fill.includes("linear-gradient")){const t=this.parseLinearGradient(s.fill);if(t){const n=this.getShapeBounds(i,s),o=this.createGradient(t.angle,t.colorStops,n.width,n.height,n.x,n.y);e.fill(o)}else console.warn(`Failed to parse gradient: ${s.fill}`),e.fill("#000000")}else e.fill(s.fill);void 0!==s.stroke&&e.stroke({color:s.stroke,width:null!==(n=s.lineWidth)&&void 0!==n?n:1})}drawRect(t,e){const i=e.x||0,s=e.y||0;t.rect(i,s,e.width,e.height)}drawCircle(t,e){const i=e.x||0,s=e.y||0;t.circle(i,s,e.radius)}drawEllipse(t,e){const i=e.x||0,s=e.y||0;t.ellipse(i,s,e.width/2,e.height/2)}drawRoundedRect(t,e){const i=e.x||0,s=e.y||0,n=e.radius||0;t.roundRect(i,s,e.width,e.height,n)}addShape(t,e){this.shapes.push({type:t,style:e}),this.redraw()}clearShapes(){this.shapes=[],this.redraw()}updateShape(t,e,i){t>=0&&t<this.shapes.length&&(this.shapes[t]={type:e,style:i},this.redraw())}removeShape(t){t>=0&&t<this.shapes.length&&(this.shapes.splice(t,1),this.redraw())}getShapeCount(){return this.shapes.length}getShape(t){return t>=0&&t<this.shapes.length?this.shapes[t]:null}setAlpha(t){this.shapes.forEach(e=>{e.style.alpha=t}),this.redraw()}setFill(t){this.shapes.forEach(e=>{e.style.fill=t}),this.redraw()}setStroke(t,e=1){this.shapes.forEach(i=>{i.style.stroke=t,i.style.lineWidth=e}),this.redraw()}}function r(t){var e={exports:{}};return t(e,e.exports),e.exports}l.componentName="Shape";var a=r(function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.Collector=void 0;e.Collector=class{constructor(t){this.emit=(...e)=>{t.emitCollecting(this,e)}}}}),h=a,d=r(function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.CollectorArray=void 0;class i extends h.Collector{constructor(){super(...arguments),this.result=[]}handleResult(t){return this.result.push(t),!0}getResult(){return this.result}reset(){this.result.length=0}}e.CollectorArray=i}),u=r(function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.CollectorLast=void 0;class i extends h.Collector{handleResult(t){return this.result=t,!0}getResult(){return this.result}reset(){delete this.result}}e.CollectorLast=i}),c=r(function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.CollectorUntil0=void 0;class i extends h.Collector{constructor(){super(...arguments),this.result=!1}handleResult(t){return this.result=t,this.result}getResult(){return this.result}reset(){this.result=!1}}e.CollectorUntil0=i}),p=r(function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.CollectorWhile0=void 0;class i extends h.Collector{constructor(){super(...arguments),this.result=!1}handleResult(t){return this.result=t,!this.result}getResult(){return this.result}reset(){this.result=!1}}e.CollectorWhile0=i}),v=r(function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.SignalConnectionImpl=void 0;e.SignalConnectionImpl=class{constructor(t,e){this.link=t,this.parentCleanup=e}disconnect(){return null!==this.link&&(this.link.unlink(),this.link=null,this.parentCleanup(),this.parentCleanup=null,!0)}set enabled(t){this.link&&this.link.setEnabled(t)}get enabled(){return null!==this.link&&this.link.isEnabled()}}}),g=r(function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.SignalLink=void 0;class i{constructor(t=null,e=null,i=0){this.enabled=!0,this.newLink=!1,this.callback=null,this.prev=null!=t?t:this,this.next=null!=e?e:this,this.order=i}isEnabled(){return this.enabled&&!this.newLink}setEnabled(t){this.enabled=t}unlink(){this.callback=null,this.next.prev=this.prev,this.prev.next=this.next}insert(t,e){let s=this.prev;for(;s!==this&&!(s.order<=e);)s=s.prev;const n=new i(s,s.next,e);return n.callback=t,s.next=n,n.next.prev=n,n}}e.SignalLink=i}),f=v,m=g,w=r(function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.Signal=void 0;e.Signal=class{constructor(){this.head=new m.SignalLink,this.hasNewLinks=!1,this.emitDepth=0,this.connectionsCount=0}getConnectionsCount(){return this.connectionsCount}hasConnections(){return this.connectionsCount>0}connect(t,e=0){this.connectionsCount++;const i=this.head.insert(t,e);return this.emitDepth>0&&(this.hasNewLinks=!0,i.newLink=!0),new f.SignalConnectionImpl(i,()=>this.decrementConnectionCount())}decrementConnectionCount(){this.connectionsCount--}disconnect(t){for(let e=this.head.next;e!==this.head;e=e.next)if(e.callback===t)return this.decrementConnectionCount(),e.unlink(),!0;return!1}disconnectAll(){for(;this.head.next!==this.head;)this.head.next.unlink();this.connectionsCount=0}emit(...t){this.emitDepth++;for(let e=this.head.next;e!==this.head;e=e.next)e.isEnabled()&&e.callback&&e.callback.apply(null,t);this.emitDepth--,this.unsetNewLink()}emitCollecting(t,e){this.emitDepth++;for(let i=this.head.next;i!==this.head;i=i.next)if(i.isEnabled()&&i.callback){const s=i.callback.apply(null,e);if(!t.handleResult(s))break}this.emitDepth--,this.unsetNewLink()}unsetNewLink(){if(this.hasNewLinks&&0===this.emitDepth){for(let t=this.head.next;t!==this.head;t=t.next)t.newLink=!1;this.hasNewLinks=!1}}}}),_=r(function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.SignalConnections=void 0;e.SignalConnections=class{constructor(){this.list=[]}add(t){this.list.push(t)}disconnectAll(){for(const t of this.list)t.disconnect();this.list=[]}getCount(){return this.list.length}isEmpty(){return 0===this.list.length}}}),b=d,y=u,x=c,S=p,k=w,C=_,V=r(function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.SignalConnections=e.Signal=e.CollectorWhile0=e.CollectorUntil0=e.CollectorLast=e.CollectorArray=e.Collector=void 0,Object.defineProperty(e,"Collector",{enumerable:!0,get:function(){return h.Collector}}),Object.defineProperty(e,"CollectorArray",{enumerable:!0,get:function(){return b.CollectorArray}}),Object.defineProperty(e,"CollectorLast",{enumerable:!0,get:function(){return y.CollectorLast}}),Object.defineProperty(e,"CollectorUntil0",{enumerable:!0,get:function(){return x.CollectorUntil0}}),Object.defineProperty(e,"CollectorWhile0",{enumerable:!0,get:function(){return S.CollectorWhile0}}),Object.defineProperty(e,"Signal",{enumerable:!0,get:function(){return k.Signal}}),Object.defineProperty(e,"SignalConnections",{enumerable:!0,get:function(){return C.SignalConnections}})}),T=Object.defineProperty,P=(t,e,i)=>((t,e,i)=>e in t?T(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i)(t,"symbol"!=typeof e?e+"":e,i);class M{constructor(){P(this,"_isMouseIn",!1),P(this,"_isDown",!1),P(this,"onDown"),P(this,"onUp"),P(this,"onUpOut"),P(this,"onOut"),P(this,"onPress"),P(this,"onHover"),this.onPress=new V.Signal,this.onDown=new V.Signal,this.onUp=new V.Signal,this.onHover=new V.Signal,this.onOut=new V.Signal,this.onUpOut=new V.Signal}connectEvents(t){s.isMobile.any?(t.on("pointerdown",this.processDown,this),t.on("pointerup",this.processUp,this),t.on("pointerupoutside",this.processUpOut,this),t.on("pointerout",this.processOut,this),t.on("pointertap",this.processPress,this),t.on("pointerover",this.processOver,this)):(t.on("mousedown",this.processDown,this),t.on("mouseup",this.processUp,this),t.on("mouseupoutside",this.processUpOut,this),t.on("mouseout",this.processOut,this),t.on("click",this.processPress,this),t.on("mouseover",this.processOver,this))}disconnectEvents(t){s.isMobile.any?(t.off("pointerdown",this.processDown,this),t.off("pointerup",this.processUp,this),t.off("pointerupoutside",this.processUpOut,this),t.off("pointerout",this.processOut,this),t.off("pointertap",this.processPress,this),t.off("pointerover",this.processOver,this)):(t.off("mousedown",this.processDown,this),t.off("mouseup",this.processUp,this),t.off("mouseupoutside",this.processUpOut,this),t.off("mouseout",this.processOut,this),t.off("click",this.processPress,this),t.off("mouseover",this.processOver,this))}processDown(t){this._isDown=!0,this.onDown.emit(this,t),this.down(t)}processUp(t){this._isDown&&(this.onUp.emit(this,t),this.up(t)),this._isDown=!1}processUpOut(t){this._isDown&&(this.onUp.emit(this,t),this.onUpOut.emit(this,t),this.up(t),this.upOut(t)),this._isDown=!1}processOut(t){this._isMouseIn&&(this._isMouseIn=!1,this.onOut.emit(this,t),this.out(t))}processPress(t){this._isDown=!1,this.onPress.emit(this,t),this.press(t)}processOver(t){s.isMobile.any||(this._isMouseIn=!0,this.onHover.emit(this,t),this.hover(t))}down(t){}up(t){}upOut(t){}out(t){}press(t){}hover(t){}get isDown(){return this._isDown}}var O=Object.defineProperty,I=(t,e,i)=>((t,e,i)=>e in t?O(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i)(t,"symbol"!=typeof e?e+"":e,i);class B extends M{constructor(t){super(),I(this,"_view"),t&&(this.view=t,this.enabled=!0)}set view(t){!!this._view&&this._view&&this.disconnectEvents(this._view),this._view=t,this.connectEvents(this._view)}get view(){return this._view}set enabled(t){this.view?(this.view.eventMode=t?"static":"auto",this.view.cursor=t?"pointer":"default",!t&&this.isDown&&this.processUp()):console.error("Button view is not set. Please set it before enabling the button.")}get enabled(){var t;return"static"===(null===(t=this.view)||void 0===t?void 0:t.eventMode)}}class A extends s.Container{constructor(t){super(),I(this,"button"),I(this,"onDown"),I(this,"onUp"),I(this,"onUpOut"),I(this,"onOut"),I(this,"onPress"),I(this,"onHover"),this.button=new B(this),this.button.enabled=!0,t&&this.addChild(t),this.onPress=this.button.onPress,this.onDown=this.button.onDown,this.onUp=this.button.onUp,this.onHover=this.button.onHover,this.onOut=this.button.onOut,this.onUpOut=this.button.onUpOut}set enabled(t){this.button.enabled=t}get enabled(){return this.button.enabled}}function E(t){return"string"==typeof t?s.Sprite.from(t):t instanceof s.Texture?new s.Sprite(t):t}var j=Object.defineProperty,R=(t,e,i)=>((t,e,i)=>e in t?j(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i)(t,"symbol"!=typeof e?e+"":e,i);class F extends s.Container{constructor(t,e,i){super(),R(this,"_triggerEvents",new Set(["onPress"])),R(this,"innerView"),R(this,"_active"),R(this,"onChange"),this.innerView=new s.Container,this.addChild(this.innerView),this.onChange=new V.Signal,t&&(this.views=t),e&&(this.triggerEvents=e),void 0!==i&&this.views.length>0&&(this.active=i),this.setInteractionEvents()}setInteractionEvents(){this.innerView.eventMode="static",this.innerView.on("pointerdown",()=>this.handleEvents("onDown")),this.innerView.on("pointerup",()=>this.handleEvents("onUp")),this.innerView.on("pointerupoutside",()=>this.handleEvents("onUpOut")),this.innerView.on("pointerout",()=>this.handleEvents("onOut")),this.innerView.on("pointertap",()=>this.handleEvents("onPress")),this.innerView.on("pointerover",()=>this.handleEvents("onHover"))}handleEvents(t){this._triggerEvents.has(t)&&this.switch()}get activeView(){if(this.views&&void 0!==this.active&&this.views[this.active])return this.views[this.active]}set views(t){this.innerView.removeChildren(),t.forEach(t=>this.add(t))}get views(){return this.innerView.children}add(t){const e=E(t);this.innerView.addChild(e),e.visible=!1,1===this.views.length&&(this.active=0)}remove(t){this.views[t]&&this.innerView.removeChild(this.views[t])}set triggerEvents(t){this._triggerEvents=new Set(Array.isArray(t)?t:[t])}get triggerEvents(){return Array.from(this._triggerEvents)}switch(t){if(void 0!==t&&t===this.active)return;const e=this.active;if(this.forceSwitch(t),e!==this.active){var i;const t=this.views.length>2?null!=(i=this.active)?i:0:1===this.active;this.onChange.emit(t)}}forceSwitch(t){if(void 0===t||t!==this.active){if(this.activeView&&(this.activeView.visible=!1),void 0!==t&&!this.views[t])throw new Error(`View with id ${t} does not exist.`);this._active=void 0===t?this.nextActive:t,void 0!==this._active&&(this.views[this._active].visible=!0)}}get nextActive(){if(0!==this.views.length)return void 0===this.active?0:this.active<this.views.length-1?this.active+1:0}set active(t){this.switch(t)}get active(){return this._active}}var L=Object.defineProperty,D=(t,e,i)=>((t,e,i)=>e in t?L(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i)(t,"symbol"!=typeof e?e+"":e,i);class U extends F{constructor(t){var e,i,n;super(),D(this,"labelText"),D(this,"onCheck"),D(this,"_style"),D(this,"_textClass"),this._textClass=null!=(e=t.TextClass)?e:s.Text,this.text=null!=(i=t.text)?i:"",this.style=t.style,this.checked=null!=(n=t.checked)&&n,this.triggerEvents=["onPress"],this.innerView.cursor="pointer",this.onCheck=new V.Signal,this.onChange.connect(()=>this.onCheck.emit(this.checked))}addLabel(t,e){var i;t&&(this.labelText=new this._textClass({text:null!=t?t:"",style:null!=e?e:null===(i=this._style)||void 0===i?void 0:i.text}),this.addChild(this.labelText),this.labelText.cursor="pointer",this.labelText.eventMode="static",this.labelText.on("pointertap",()=>this.checked=!this.checked),this.alignText())}set text(t){var e;t?(this.labelText?this.labelText.text=t:this.addLabel(t),this.alignText()):this.labelText&&((e=this.labelText)&&(e.parent&&e.parent.removeChild(e),e.destroy()),this.labelText=void 0)}get text(){var t,e;return null!=(t=null===(e=this.labelText)||void 0===e?void 0:e.text)?t:""}set style(t){const e=this.checked;this._style=t;const{unchecked:i,checked:s}=t,n=E(i),o=E(s);this.views=[n,o],e?(o.visible=!0,n.visible=!1,this.active=1):(n.visible=!0,o.visible=!1,this.active=0),this.labelText&&t.text&&(this.labelText.style=t.text,this.alignText())}get style(){return this._style}alignText(){if(!this.style)return;if(!this.labelText)return;if(!this.views)return;const t=this.views[0];var e,i,s,n,o,l;t&&(this.labelText.x=t.width+10+(null!=(e=null===(i=this._style)||void 0===i||null===(s=i.textOffset)||void 0===s?void 0:s.x)?e:0),this.labelText.y=(t.height-this.labelText.height)/2+(null!=(n=null===(o=this._style)||void 0===o||null===(l=o.textOffset)||void 0===l?void 0:l.y)?n:0))}get checked(){return 1===this.active}set checked(t){this.switch(t?1:0)}forceCheck(t){this.forceSwitch(t?1:0)}}var N=Object.defineProperty,H=(t,e,i)=>((t,e,i)=>e in t?N(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i)(t,"symbol"!=typeof e?e+"":e,i);class z extends s.Container{constructor(t){super(),H(this,"_progress",0),H(this,"options",{}),H(this,"bgCircle",new s.Graphics),H(this,"fillCircle",new s.Graphics),H(this,"innerView",new s.Container),this.options=null!=t?t:{},this.addChild(this.innerView),this.innerView.addChild(this.bgCircle,this.fillCircle),this.addBackground(),null!=t&&t.value&&(this.progress=t.value)}addBackground(){const{backgroundColor:t,lineWidth:e=5,radius:i=50,backgroundAlpha:s}=this.options;let n=1;void 0===t?n=1e-6:void 0!==s&&s>0&&(n=s),this.bgCircle.circle(0,0,i).stroke({width:e,color:t,alpha:n})}set progress(t){t>100&&(t=100),t<0&&(t=0),this._progress=t;const{lineWidth:e=5,radius:i=50,fillColor:n=16777215,fillAlpha:o,cap:l}=this.options;if(0===t&&0===o)return void this.fillCircle.clear();const r=3.6*t;this.fillCircle.clear().arc(0,0,i,-90*s.DEG_TO_RAD,(-90+r)*s.DEG_TO_RAD).stroke({width:e,color:n,cap:l,alpha:o})}get progress(){return this._progress}}let W;W="undefined"==typeof self&&"undefined"!=typeof process&&process.hrtime?function(){const t=process.hrtime();return 1e3*t[0]+t[1]/1e6}:"undefined"!=typeof self&&void 0!==self.performance&&void 0!==self.performance.now?self.performance.now.bind(self.performance):void 0!==Date.now?Date.now:function(){return(new Date).getTime()};class G{constructor(){G.prototype.__init.call(this),G.prototype.__init2.call(this),G.prototype.__init3.call(this),G.prototype.__init4.call(this)}__init(){this._tweens={}}static get shared(){return G._shared||(G._shared=new G),G._shared}__init2(){this._paused=!1}isPaused(){return this._paused}pause(){this._paused=!0}resume(){this._paused=!1}__init3(){this._lastUpdateTime=void 0}__init4(){this.now=W}getAll(){return Object.keys(this._tweens).map(t=>this._tweens[t])}removeAll(){this._tweens={}}add(t){this._tweens[t.getId()]=t}remove(t){delete this._tweens[t.getId()]}update(t,e=!1){if(null==t&&(null==this._lastUpdateTime?(this._lastUpdateTime=this.now(),t=0):t=this.now()-this._lastUpdateTime),this._lastUpdateTime=this.now(),this._paused)return!1;const i=Object.keys(this._tweens);if(0==i.length)return!1;for(let s=0;s<i.length;s++){const n=this._tweens[i[s]];n&&0==n.update(t,!0)&&!e&&delete this._tweens[i[s]]}return!0}}const q={Step:{None:t=>t<.5?0:1},Linear:{None:t=>t},Quadratic:{In:t=>t*t,Out:t=>t*(2-t),InOut:t=>(t*=2)<1?.5*t*t:-.5*(--t*(t-2)-1)},Cubic:{In:t=>t*t*t,Out:t=>--t*t*t+1,InOut:t=>(t*=2)<1?.5*t*t*t:.5*((t-=2)*t*t+2)},Quartic:{In:t=>t*t*t*t,Out:t=>1- --t*t*t*t,InOut:t=>(t*=2)<1?.5*t*t*t*t:-.5*((t-=2)*t*t*t-2)},Quintic:{In:t=>t*t*t*t*t,Out:t=>--t*t*t*t*t+1,InOut:t=>(t*=2)<1?.5*t*t*t*t*t:.5*((t-=2)*t*t*t*t+2)},Sinusoidal:{In:t=>1-Math.cos(t*Math.PI/2),Out:t=>Math.sin(t*Math.PI/2),InOut:t=>.5*(1-Math.cos(Math.PI*t))},Exponential:{In:t=>0==t?0:Math.pow(1024,t-1),Out:t=>1==t?1:1-Math.pow(2,-10*t),InOut:t=>0==t?0:1==t?1:(t*=2)<1?.5*Math.pow(1024,t-1):.5*(2-Math.pow(2,-10*(t-1)))},Circular:{In:t=>1-Math.sqrt(1-t*t),Out:t=>Math.sqrt(1- --t*t),InOut:t=>(t*=2)<1?-.5*(Math.sqrt(1-t*t)-1):.5*(Math.sqrt(1-(t-=2)*t)+1)},Elastic:{In:t=>0==t?0:1==t?1:-Math.pow(2,10*(t-1))*Math.sin(5*(t-1.1)*Math.PI),Out:t=>0==t?0:1==t?1:Math.pow(2,-10*t)*Math.sin(5*(t-.1)*Math.PI)+1,InOut:t=>0==t?0:1==t?1:(t*=2)<1?-.5*Math.pow(2,10*(t-1))*Math.sin(5*(t-1.1)*Math.PI):.5*Math.pow(2,-10*(t-1))*Math.sin(5*(t-1.1)*Math.PI)+1},Back:{In(t){const e=1.70158;return t*t*((e+1)*t-e)},Out(t){const e=1.70158;return--t*t*((e+1)*t+e)+1},InOut(t){const e=2.5949095;return(t*=2)<1?t*t*((e+1)*t-e)*.5:.5*((t-=2)*t*((e+1)*t+e)+2)}},Bounce:{In:t=>1-q.Bounce.Out(1-t),Out:t=>t<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,InOut:t=>t<.5?.5*q.Bounce.In(2*t):.5*q.Bounce.Out(2*t-1)+.5}},Y={Geom:{Linear(t,e){const i=t.length-1,s=i*e,n=Math.floor(s),o=Y.Utils.Linear;return e<0?o(t[0],t[1],s):e>1?o(t[i],t[i-1],i-s):o(t[n],t[n+1>i?i:n+1],s-n)},Bezier(t,e){let i=0;const s=t.length-1,n=Math.pow,o=Y.Utils.Bernstein;for(let l=0;l<=s;l++)i+=o(s,l)*n(1-e,s-l)*n(e,l)*t[l];return i},QuadraticBezier(t,e){let i=0;const s=t.length-1;if(1==e)return t[s];const n=Math.pow,o=Y.Utils.Bernstein,l=s*e,r=Math.floor(l),a=.5*(l-r)+r%2*.5,h=r-r%2,d=h+1,u=h+2;return i+=o(2,0)*n(1-a,2)*n(a,0)*t[h],i+=o(2,1)*n(1-a,1)*n(a,1)*t[d],i+=o(2,2)*n(1-a,0)*n(a,2)*t[u],i},CubicBezier(t,e){let i=0;const s=t.length-1;if(1==e)return t[s];const n=Math.pow,o=Y.Utils.Bernstein,l=s*e,r=Math.floor(l),a=1/3*(l-r)+1/3*(r%3),h=r-r%3,d=h+1,u=h+2,c=h+3;return i+=o(3,0)*n(1-a,3)*n(a,0)*t[h],i+=o(3,1)*n(1-a,2)*n(a,1)*t[d],i+=o(3,2)*n(1-a,1)*n(a,2)*t[u],i+=o(3,3)*n(1-a,0)*n(a,3)*t[c],i},CatmullRom(t,e){const i=t.length-1;let s=i*e,n=Math.floor(s);const o=Y.Utils.CatmullRom;return t[0]==t[i]?(e<0&&(n=Math.floor(s=i*(1+e))),o(t[(n-1+i)%i],t[n],t[(n+1)%i],t[(n+2)%i],s-n)):e<0?t[0]-(o(t[0],t[0],t[1],t[1],-s)-t[0]):e>1?t[i]-(o(t[i],t[i],t[i-1],t[i-1],s-i)-t[i]):o(t[n?n-1:0],t[n],t[i<n+1?i:n+1],t[i<n+2?i:n+2],s-n)}},Angle:{Radians(t,e){const i=t.length-1,s=i*e,n=Math.floor(s),o=Y.Utils.WrapLinear;return e<0?o(t[0],t[1],s,2*Math.PI):e>1?o(t[i],t[i-1],i-s,2*Math.PI):o(t[n],t[n+1>i?i:n+1],s-n,2*Math.PI)},Degrees(t,e){const i=t.length-1,s=i*e,n=Math.floor(s),o=Y.Utils.WrapLinear;return e<0?o(t[0],t[1],s,360):e>1?o(t[i],t[i-1],i-s,360):o(t[n],t[n+1>i?i:n+1],s-n,360)}},Color:{RGB(t,e){const i=t.length-1,s=i*e,n=Math.floor(s),o=Y.Utils.RGBLinear;return e<0?o(t[0],t[1],s):e>1?o(t[i],t[i-1],i-s):o(t[n],t[n+1>i?i:n+1],s-n)},HSV(t,e){const i=t.length-1,s=i*e,n=Math.floor(s),o=Y.Utils.HSVLinear;return e<0?o(t[0],t[1],s):e>1?o(t[i],t[i-1],i-s):o(t[n],t[n+1>i?i:n+1],s-n)},HCL(t,e){const i=t.length-1,s=i*e,n=Math.floor(s),o=Y.Utils.HCLLinear;return e<0?o(t[0],t[1],s):e>1?o(t[i],t[i-1],i-s):o(t[n],t[n+1>i?i:n+1],s-n)}},Utils:{RGBsplit:t=>({a:t>>24&255,r:t>>16&255,g:t>>8&255,b:255&t}),HSVsplit(t){const e=Y.Utils.RGBsplit(t);e.r/=255,e.g/=255,e.b/=255;const i=Math.max(e.r,e.g,e.b),s=Math.min(e.r,e.g,e.b);let n;const o=i,l=i-s,r=0==i?0:l/i;if(i==s)n=0;else{switch(i){case e.r:n=(e.g-e.b)/l+(e.g<e.b?6:0);break;case e.g:n=(e.b-e.r)/l+2;break;case e.b:n=(e.r-e.g)/l+4}n/=6}return{a:e.a,h:n,s:r,v:o}},HSVJoin(t){let e,i,s;const n=Math.floor(6*t.h),o=6*t.h-n,l=t.v*(1-t.s),r=t.v*(1-o*t.s),a=t.v*(1-(1-o)*t.s);switch(n%6){case 0:e=t.v,i=a,s=l;break;case 1:e=r,i=t.v,s=l;break;case 2:e=l,i=t.v,s=a;break;case 3:e=l,i=r,s=t.v;break;case 4:e=a,i=l,s=t.v;break;case 5:e=t.v,i=l,s=r}return t.a<<24|e<<16|i<<8|s},HCLSplit(t){const e=Y.Utils.RGBsplit(t),i={a:e.a,h:0,c:0,l:0};let s=0;const n=Math.min(e.r,Math.min(e.g,e.b)),o=Math.max(e.r,Math.max(e.g,e.b));let l=.03;return i.c=o-n,0!=i.c&&(s=Math.atan2(e.g-e.b,e.r-e.g)/Math.PI,l*=n/o),l=Math.exp(l),i.h=(s/2-Math.min(s%1,-s%1)/6)%1,i.c*=l,i.l=Y.Utils.Linear(-n,o,l)/1.060909067907034,i},HCLJoin(t){const e={a:t.a,r:0,g:0,b:0};if(0!=t.l){let i=t.h;const s=t.c,n=.530454533953517*t.l,o=Math.exp(.03*(1-s/(2*n))),l=(2*n-s)/(2*o-1),r=s/o,a=(i+Math.min(2*i%1/4,-2*i%1/8))*Math.PI*2;let h;i*=6,i<=.999?(h=Math.tan(a),e.r=1,e.g=h/(1+h)):i<=1.001?(e.r=1,e.g=1):i<=2?(h=Math.tan(a),e.r=(1+h)/h,e.g=1):i<=3?(h=Math.tan(a),e.g=1,e.b=1+h):i<=3.999?(h=Math.tan(a),e.g=1/(1+h),e.b=1):i<=4.001?(e.g=0,e.b=1):i<=5?(h=Math.tan(a),e.r=-1/h,e.b=1):(h=Math.tan(a),e.r=1,e.b=-h),e.r=e.r*r+l,e.g=e.g*r+l,e.b=e.b*r+l}return e.a<<24|e.r<<16|e.g<<8|e.b},WrapLinear(t,e,i,s){let n;return t=(t+s*Math.trunc(Math.abs(t/s)))%s,e=(e+s*Math.trunc(Math.abs(e/s)))%s,Math.abs(t-e)<=.5*s?n=Y.Utils.Linear(t,e,i):(n=t<e?Y.Utils.Linear(t+s,e,i):Y.Utils.Linear(t,e+s,i),n%=s),n},RGBLinear(t,e,i){const s=Y.Utils.RGBsplit(t),n=Y.Utils.RGBsplit(e);return Y.Utils.Linear(s.a,n.a,i)<<24|Y.Utils.Linear(s.r,n.r,i)<<16|Y.Utils.Linear(s.g,n.g,i)<<8|Y.Utils.Linear(s.b,n.b,i)},HSVLinear(t,e,i){const s=Y.Utils.HSVsplit(t),n=Y.Utils.HSVsplit(e);let o;Math.abs(s.h-n.h)<=.5?o=Y.Utils.Linear(s.h,n.h,i):(o=s.h<n.h?Y.Utils.Linear(s.h+1,n.h,i):Y.Utils.Linear(s.h,n.h+1,i),o%=1);const l=Y.Utils.Linear(s.s,n.s,i),r=Y.Utils.Linear(s.v,n.v,i),a=Y.Utils.Linear(s.a,n.a,i);return Y.Utils.HSVJoin({a:a,h:o,s:l,v:r})},HCLLinear(t,e,i){const s=Y.Utils.HCLSplit(t),n=Y.Utils.HCLSplit(e);let o;Math.abs(s.h-n.h)<=.5?o=Y.Utils.Linear(s.h,n.h,i):(o=s.h<n.h?Y.Utils.Linear(s.h+1,n.h,i):Y.Utils.Linear(s.h,n.h+1,i),o%=1);const l=Y.Utils.Linear(s.c,n.c,i),r=Y.Utils.Linear(s.l,n.l,i),a=Y.Utils.Linear(s.a,n.a,i);return Y.Utils.HSVJoin({a:a,h:o,s:l,v:r})},Linear:(t,e,i)=>(e-t)*i+t,Bernstein(t,e){const i=Y.Utils.Factorial;return i(t)/i(e)/i(t-e)},Factorial:function(){const t=[1];return function(e){let i=1;if(t[e])return t[e];for(let t=e;t>1;t--)i*=t;return t[e]=i,i}}(),CatmullRom(t,e,i,s,n){const o=.5*(i-t),l=.5*(s-e),r=n*n;return(2*e-2*i+o+l)*(n*r)+(-3*e+3*i-2*o-l)*r+o*n+e}}};class X{static __initStatic(){this._nextId=0}static nextId(){return X._nextId++}}X.__initStatic();const $={safetyCheckFunction:t=>!0,easingFunction:q.Linear.None,yoyoEasingFunction:void 0,interpolationFunction:Y.Geom.Linear};class K{__init(){this._isPaused=!1}__init2(){this._valuesStart={}}__init3(){this._valuesEnd={}}__init4(){this._valuesStartRepeat={}}__init5(){this._duration=0}__init6(){this._repeatCount=0}__init7(){this._repeat=0}__init8(){this._yoyo=!1}__init9(){this._isPlaying=!1}get _reversed(){return this.yoyo&&this._repeatCount%2!=0}__init10(){this._delayTime=0}__init11(){this._startTime=0}__init12(){this._elapsedTime=0}__init13(){this._timescale=1}__init14(){this._safetyCheckFunction=$.safetyCheckFunction}__init15(){this._easingFunction=$.easingFunction}__init16(){this._yoyoEasingFunction=$.yoyoEasingFunction}__init17(){this._interpolationFunction=$.interpolationFunction}__init18(){this._chainedTweens=[]}__init19(){this._onStartCallbackFired=!1}__init20(){this._onAfterDelayCallbackFired=!1}__init21(){this._id=X.nextId()}__init22(){this._isChainStopped=!1}get _group(){return this._groupRef?this._groupRef:G.shared}set _group(t){this._groupRef=t}constructor(t,e){K.prototype.__init.call(this),K.prototype.__init2.call(this),K.prototype.__init3.call(this),K.prototype.__init4.call(this),K.prototype.__init5.call(this),K.prototype.__init6.call(this),K.prototype.__init7.call(this),K.prototype.__init8.call(this),K.prototype.__init9.call(this),K.prototype.__init10.call(this),K.prototype.__init11.call(this),K.prototype.__init12.call(this),K.prototype.__init13.call(this),K.prototype.__init14.call(this),K.prototype.__init15.call(this),K.prototype.__init16.call(this),K.prototype.__init17.call(this),K.prototype.__init18.call(this),K.prototype.__init19.call(this),K.prototype.__init20.call(this),K.prototype.__init21.call(this),K.prototype.__init22.call(this),this._object=t,this._group=e}getId(){return this._id}getGroup(){return this._group}getTimescale(){return this._timescale}isPlaying(){return this._isPlaying}isPaused(){return this._isPaused}from(t){try{JSON.stringify(t)}catch(t){throw new Error("The object you provided to the from() method has a circular reference!")}return this._setupProperties(t,this._valuesStart,t,this._valuesStartRepeat,!0),this}to(t,e){try{this._valuesEnd=JSON.parse(JSON.stringify(t))}catch(i){return console.warn("The object you provided to the to() method has a circular reference!. It can't be cloned. Falling back to dynamic targeting"),this.dynamicTo(t,e)}return void 0!==e&&(this._duration=e),this}dynamicTo(t,e){return this._valuesEnd=t,void 0!==e&&(this._duration=e),this}duration(t){return this._duration=t,this}start(t){return this._isPlaying||(null!=t&&(this._delayTime=t),this._group.add(this),this._reversed&&(this._swapEndStartRepeatValues(this._valuesStartRepeat,this._valuesEnd),this._valuesStart=JSON.parse(JSON.stringify(this._valuesStartRepeat))),this._repeatCount=0,this._isPlaying=!0,this._isPaused=!1,this._onStartCallbackFired=!1,this._onAfterDelayCallbackFired=!1,this._isChainStopped=!1,this._startTime=-this._delayTime,this._elapsedTime=0,this._setupProperties(this._object,this._valuesStart,this._valuesEnd,this._valuesStartRepeat,!1)),this}restart(t){return this.reset(),this.start(t)}reset(){return this._isPlaying&&this.stop(),this._valuesStart={},this._valuesStartRepeat={},this}rewind(){this._isPlaying&&this.stop(),this._reversed&&this._swapEndStartRepeatValues(this._valuesStartRepeat,this._valuesEnd);const t=this._easingFunction(0);return this._updateProperties(this._object,this._valuesStart,this._valuesEnd,t),this}_setupProperties(t,e,i,s,n){for(const o in i){const l=t[o],r=Array.isArray(l),a=!Number.isNaN(Number(l)),h=r?"array":typeof l,d="object"==h,u="object"==typeof i[o],c=!r&&Array.isArray(i[o]);"undefined"!=h&&"function"!=h&&null!=i[o]&&(r||a||d)&&((d||r||u)&&l&&!c?(void 0===e[o]&&(e[o]=r?[]:{}),void 0===s[o]&&(s[o]=r?[]:{}),this._setupProperties(l,e[o],i[o],s[o],n)):((void 0===e[o]||n)&&(e[o]=l),(void 0===s[o]||n)&&(s[o]=c?i[o].slice().reverse()[0]:e[o]||0)))}}stop(){return this._isChainStopped||(this._isChainStopped=!0,this.stopChainedTweens()),this._isPlaying?(this._group.remove(this),this._isPlaying=!1,this._isPaused=!1,this._onStopCallback&&this._onStopCallback(this._object,this),this):this}end(t=!1){let e=[];if(t||(e=this._chainedTweens,this._chainedTweens=[]),this.resume(),this.update(1/0),!t){this._chainedTweens=e;for(let t=0,e=this._chainedTweens.length;t<e;t++)this._chainedTweens[t].start()}return this}skip(t,e=!1){return this.resume(),this.update(t*this._duration-(e?this._elapsedTime:0)),this}pause(){return this._isPaused||!this._isPlaying||(this._isPaused=!0,this._group.remove(this)),this}resume(){return this._isPaused&&this._isPlaying?(this._isPaused=!1,this._group.add(this),this):this}stopChainedTweens(){for(let t=0,e=this._chainedTweens.length;t<e;t++)this._chainedTweens[t].stop();return this}startChainedTweens(t=!1){t&&this.stop();for(let t=0,e=this._chainedTweens.length;t<e;t++)this._chainedTweens[t].start();return this}group(t){return this._group=t,this}delay(t){return this._delayTime=t,this}timescale(t){return this._timescale=t,this}repeat(t=1/0){return this._repeat=t,this}repeatDelay(t){return this._repeatDelayTime=t,this}yoyo(t=!0){return this._yoyo=t,this}easing(t){return this._easingFunction=t,this}safetyCheck(t){return this._safetyCheckFunction=t,this}yoyoEasing(t){return this._yoyoEasingFunction=t,this}interpolation(t){return this._interpolationFunction=t,this}chain(...t){return this._chainedTweens=t,this}onStart(t){return this._onStartCallback=t,this}onAfterDelay(t){return this._onAfterDelayCallback=t,this}onUpdate(t){return this._onUpdateCallback=t,this}onRepeat(t){return this._onRepeatCallback=t,this}onComplete(t){return this._onCompleteCallback=t,this}onStop(t){return this._onStopCallback=t,this}update(t,e=!1){const i=this._internalUpdate(t);return i||e||this._group.remove(this),i}_internalUpdate(t){if(!this._safetyCheckFunction(this._object))return!1;if(this._isPaused)return!1;let e;t*=this._timescale,this._elapsedTime+=t;const i=this._duration,s=this._startTime+this._elapsedTime;if(s>i&&!this._isPlaying)return!1;this.isPlaying||this.start(),0==this._onStartCallbackFired&&(this._onStartCallback&&this._onStartCallback(this._object,this),this._onStartCallbackFired=!0),0==this._onAfterDelayCallbackFired&&s>=0&&(this._onAfterDelayCallback&&this._onAfterDelayCallback(this._object,this),this._onAfterDelayCallbackFired=!0),e=s/this._duration,0==this._duration&&(e=s>=0?1:0),e=Math.min(1,e),e=Math.max(0,e);let n=Number.isFinite(s)?s%this._duration:s;Number.isNaN(n)&&(n=0);const o=Math.floor(s/this._duration);let l;if(l=this._reversed&&this._yoyoEasingFunction?this._yoyoEasingFunction(e):this._easingFunction(e),this._updateProperties(this._object,this._valuesStart,this._valuesEnd,l),this._onUpdateCallback&&(1!=e||this._repeat-this._repeatCount<=0)&&this._onUpdateCallback(this._object,e,this),1==e){if(this._repeat-this._repeatCount>0){const t=this._repeatCount;if(this._repeatCount=Math.min(this._repeat+1,this._repeatCount+o),this._onUpdateCallback&&(this._repeat-this._repeatCount<0||n<=0)&&this._onUpdateCallback(this._object,e,this),this._yoyo?this._swapEndStartRepeatValues(this._valuesStartRepeat,this._valuesEnd):this._moveForwardStartRepeatValues(this._valuesStartRepeat,this._valuesEnd),this._valuesStart=JSON.parse(JSON.stringify(this._valuesStartRepeat)),void 0!==this._repeatDelayTime?this._startTime=-this._repeatDelayTime:this._startTime=0,this._onRepeatCallback){let e=1;Number.isFinite(o)?e=this._repeatCount-t:Number.isFinite(this._repeat)&&(e=this._repeat-t);for(let i=0;i<e;i++)this._onRepeatCallback(this._object,t+1+i,this)}if(this._elapsedTime=0,this._repeat-this._repeatCount>=0)return n>0&&Number.isFinite(this._repeat)&&this._internalUpdate(n),!0}this._onCompleteCallback&&this._onCompleteCallback(this._object,this);for(let t=0,e=this._chainedTweens.length;t<e;t++)this._chainedTweens[t].start(),n>0&&this._chainedTweens[t].update(n);return this._isPlaying=!1,!1}return!0}_updateProperties(t,e,i,s){for(const n in i){if(null==e[n])continue;const o=e[n];let l=i[n];const r=Array.isArray(t[n]),a=Array.isArray(l);!r&&a?this._reversed?t[n]=this._interpolationFunction(l.concat([o]),s):t[n]=this._interpolationFunction([o].concat(l),s):"object"==typeof l&&l?this._updateProperties(t[n],o,l,s):(l=this._handleRelativeValue(o,l),"number"!=typeof l||"number"!=typeof o&&"string"!=typeof o||(t[n]=Number(o)+(l-Number(o))*s,"string"==typeof o&&(t[n]=String(t[n]))))}}_handleRelativeValue(t,e){return"string"!=typeof e?e:"+"==e.charAt(0)||"-"==e.charAt(0)?t+Number(e):Number(e)}_swapEndStartRepeatValues(t,e){for(const i in t){const s=!Array.isArray(t[i])&&Array.isArray(e[i]);if("object"==typeof t[i])this._swapEndStartRepeatValues(t[i],e[i]);else{const n=t[i];if("string"==typeof e[i])t[i]=Number(t[i])+Number(e[i]),e[i]=n;else if(s){const s=e[i].slice().reverse();t[i]=s[0],e[i]=s}else t[i]=e[i],e[i]=n}}}_moveForwardStartRepeatValues(t,e){for(const i in t)"object"==typeof e[i]?this._moveForwardStartRepeatValues(t[i],e[i]):"string"==typeof e[i]&&(t[i]=Number(t[i])+Number(e[i]))}}function J(t,e,i=0,s=!0){let n=e.scale.x,o=e.scale.y;if(!t)throw new Error("Parent is not defined");const l=t.width-2*i,r=t.height-2*i,a=l-Math.round(e.width),h=r-Math.round(e.height);if(a<0&&(n=l/(e.width/n)),h<0&&(o=r/(e.height/o)),n<=0||o<=0)e.scale.set(0);else if(s||e.scale.x===e.scale.y){const t=Math.min(n,o);e.scale.set(t,t)}else{const t=e.scale.x/e.scale.y;a<h?e.scale.set(n,n/t):e.scale.set(o*t,o)}}function Z(t){return"string"==typeof t||"number"==typeof t?new s.Text({text:String(t)}):t}var Q=Object.defineProperty,tt=(t,e,i)=>((t,e,i)=>e in t?Q(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i)(t,"symbol"!=typeof e?e+"":e,i);class et extends A{constructor(t){var e,i;super(),tt(this,"animations"),tt(this,"originalInnerViewState"),tt(this,"defaultDuration",100),tt(this,"options"),tt(this,"_padding",0),tt(this,"_offset",{}),tt(this,"_textOffset",{}),tt(this,"iconOffset",{}),tt(this,"innerView",new s.Container),tt(this,"_views",{}),tt(this,"state","default"),tt(this,"anchor"),tt(this,"_defaultTextScale",{x:1,y:1}),tt(this,"_defaultIconScale",{x:1,y:1}),tt(this,"_defaultTextAnchor",{x:.5,y:.5}),tt(this,"_defaultIconAnchor",{x:.5,y:.5}),this.options=null!=t?t:{};const{defaultView:n,hoverView:o,pressedView:l,disabledView:r,text:a,padding:h,offset:d,textOffset:u,iconOffset:c,defaultTextScale:p,defaultIconScale:v,defaultTextAnchor:g,defaultIconAnchor:f,scale:m,anchor:w,anchorX:_,anchorY:b,icon:y,animations:x}=null!=t?t:{};this.addChild(this.innerView),this.anchor=new s.ObservablePoint({_onUpdate:()=>this.updateAnchor()}),this.anchor.set(null!=(e=null!=_?_:w)?e:0,null!=(i=null!=b?b:w)?i:0),this.padding=null!=h?h:0,this.offset=null!=d?d:{},this.textOffset=null!=u?u:{},this.iconOffset=null!=c?c:{},this.defaultTextScale=null!=p?p:{x:1,y:1},this.defaultIconScale=null!=v?v:{x:1,y:1},this.defaultTextAnchor=null!=g?g:{x:.5,y:.5},this.defaultIconAnchor=null!=f?f:{x:.5,y:.5},this.scale.set(null!=m?m:1),x&&(this.animations=x,this.setOriginalInnerViewState(),s.Ticker.shared.add(()=>G.shared.update())),this.setState("default"),this.defaultView=n,this.hoverView=o,this.pressedView=l,this.disabledView=r,this.text=null!=a?a:"",void 0!==y&&(this.iconView=y),this.initStateControl()}set text(t){t&&0!==t?this._views.textView?this._views.textView.text=t.toString():this.createTextView(t):this.removeView("textView")}get text(){var t;return null===(t=this._views.textView)||void 0===t?void 0:t.text}set enabled(t){this.button.enabled=t,this.setState(t?"default":"disabled")}get enabled(){return this.button.enabled}setState(t,e=!1){if(!e&&this.state===t)return;const i=this.getStateView(this.state);i&&(i.visible=!1),this.state=t;const s=this.getStateView(t);s&&(this.setOffset(s,t,this.offset),s.visible=!0),this.updateAnchor(),this.playAnimations(t)}createTextView(t){var e;if(this._views.textView=Z(t),void 0===(null===(e=this.options)||void 0===e?void 0:e.defaultTextScale)){const{x:t,y:e}=this._views.textView.scale;this._defaultTextScale={x:t,y:e}}this.innerView.addChild(this._views.textView),this.adjustTextView(this.state)}setOffset(t,e,i){const s=i?i[e]:{x:0,y:0},n=null==i?void 0:i.default;var o,l;if(s)t.x+=null!=(o=s.x)?o:0,t.y+=null!=(l=s.y)?l:0;else if(n){var r,a;t.x+=null!=(r=n.x)?r:0,t.y+=null!=(a=n.y)?a:0}else if(i.x||i.y){var h,d;t.x+=null!=(h=i.x)?h:0,t.y+=null!=(d=i.y)?d:0}}getStateView(t){var e,i,s,n,o,l,r,a;if(this._views)switch(t){case"hover":return null!=(e=null!=(i=this._views.hoverView)?i:this._views.defaultView)?e:void 0;case"pressed":return null!=(s=null!=(n=null!=(o=this._views.pressedView)?o:this._views.hoverView)?n:this._views.defaultView)?s:void 0;case"disabled":return null!=(l=null!=(r=this._views.disabledView)?r:this._views.defaultView)?l:void 0;case"default":return null!=(a=this._views.defaultView)?a:void 0;default:return}}adjustTextView(t){var e,i;if(!this.text)return;if(!this._views.textView)return;const s=this.getStateView(this.state),n=null!=(e=this._defaultTextAnchor.x)?e:.5,o=null!=(i=this._defaultTextAnchor.y)?i:.5;if(s){var l;if(null!==(l=this.options)&&void 0!==l&&l.ignoreRefitting||this._views.textView.scale.set(this._defaultTextScale.x,this._defaultTextScale.y),"default"===this.contentFittingMode&&J(s,this._views.textView,this.padding,!1),"fill"===this.contentFittingMode){var r,a;this._views.textView.scale.set(1);const t=s.width-2*this.padding,e=s.height-2*this.padding,i=t/this._views.textView.width,n=e/this._views.textView.height,o=Math.min(i,n);this._views.textView.scale.set(o*(null!=(r=this._defaultTextScale.x)?r:1),o*(null!=(a=this._defaultTextScale.y)?a:1))}this._views.textView.x=s.x+s.width/2,this._views.textView.y=s.y+s.height/2}this._views.textView.anchor.set(n,o),this.setOffset(this._views.textView,t,this.textOffset)}adjustIconView(t){var e,i,s;if(!this._views.iconView)return;const n=this.getStateView(t);if(!n)return;if(null!==(e=this.options)&&void 0!==e&&e.ignoreRefitting||this._views.iconView.scale.set(this._defaultIconScale.x,this._defaultIconScale.y),"default"===this.contentFittingMode&&J(n,this._views.iconView,this.padding,!1),"fill"===this.contentFittingMode){var o,l;this._views.iconView.scale.set(1);const t=n.width-2*this.padding,e=n.height-2*this.padding,i=t/this._views.iconView.width,s=e/this._views.iconView.height,r=Math.min(i,s);this._views.iconView.scale.set(r*(null!=(o=this._defaultIconScale.x)?o:1),r*(null!=(l=this._defaultIconScale.y)?l:1))}const r=null!=(i=this._defaultIconAnchor.x)?i:.5,a=null!=(s=this._defaultIconAnchor.y)?s:.5;"anchor"in this._views.iconView?this._views.iconView.anchor.set(r,a):this._views.iconView.pivot.set(r*(this._views.iconView.width/this._views.iconView.scale.x),a*(this._views.iconView.height/this._views.iconView.scale.y)),this._views.iconView.x=n.x+n.width/2,this._views.iconView.y=n.y+n.height/2,this.setOffset(this._views.iconView,t,this.iconOffset)}updateAnchor(){var t,e;if(!this._views)return;const i=null!=(t=this.anchor.x)?t:0,n=null!=(e=this.anchor.y)?e:0;if([this._views.defaultView,this._views.hoverView,this._views.pressedView,this._views.disabledView].forEach(t=>{var e;t&&(null===(e=t.anchor)||void 0===e||e.set(0),t.x=-t.width*i,t.y=-t.height*n)}),this._views.defaultView){const{x:t,y:e,width:i,height:n}=this._views.defaultView;this.hitArea=new s.Rectangle(t,e,i,n)}this.adjustIconView(this.state),this.adjustTextView(this.state)}set contentFittingMode(t){this.options.contentFittingMode=t}get contentFittingMode(){var t;return null!=(t=this.options.contentFittingMode)?t:"default"}set defaultView(t){this.updateView("defaultView",t),this._views.disabledView&&"default"!==this.state&&(this._views.disabledView.visible=!1)}get defaultView(){return this._views.defaultView}set hoverView(t){this.updateView("hoverView",t),this._views.hoverView&&"hover"!==this.state&&(this._views.hoverView.visible=!1)}get hoverView(){return this._views.hoverView}set pressedView(t){this.updateView("pressedView",t),this._views.pressedView&&"pressed"!==this.state&&(this._views.pressedView.visible=!1)}get pressedView(){return this._views.pressedView}set disabledView(t){this.updateView("disabledView",t),this._views.disabledView&&"disabled"!==this.state&&(this._views.disabledView.visible=!1)}get disabledView(){return this._views.disabledView}updateView(t,e){var i;void 0!==e&&(this.removeView(t),null!==(i=this.options)&&void 0!==i&&i.nineSliceSprite&&("string"==typeof e?this._views[t]=new s.NineSliceSprite({texture:s.Texture.from(e),leftWidth:this.options.nineSliceSprite[0],topHeight:this.options.nineSliceSprite[1],rightWidth:this.options.nineSliceSprite[2],bottomHeight:this.options.nineSliceSprite[3]}):e instanceof s.Texture?this._views[t]=new s.NineSliceSprite({texture:e,leftWidth:this.options.nineSliceSprite[0],topHeight:this.options.nineSliceSprite[1],rightWidth:this.options.nineSliceSprite[2],bottomHeight:this.options.nineSliceSprite[3]}):console.warn("NineSliceSprite can not be used with views set as Container. Pass the texture or texture name as instead of the Container extended instance.")),this._views[t]||(this._views[t]=E(e)),this.setOffset(this._views[t],this.state,this.offset),this._views[t].parent||this.innerView.addChild(this._views[t]),this.updateAnchor(),this._views.iconView&&this.innerView.addChild(this._views.iconView),this._views.textView&&this.innerView.addChild(this._views.textView),this.setState(this.state,!0))}removeView(t){this._views[t]&&(this.innerView.removeChild(this._views[t]),this._views[t]=void 0)}set textView(t){void 0!==t&&(this.removeView("textView"),null!==t&&this.createTextView(t))}get textView(){return this._views.textView}set iconView(t){var e;if(void 0!==t&&(this.removeView("iconView"),null!==t)){if(this._views.iconView=E(t),void 0===(null===(e=this.options)||void 0===e?void 0:e.defaultIconScale)){const{x:t,y:e}=this._views.iconView.scale;this._defaultIconScale={x:t,y:e}}this._views.iconView.parent||this.innerView.addChild(this._views.iconView),this.setState(this.state,!0)}}get iconView(){return this._views.iconView}playAnimations(t){var e;if(!this.animations)return;const i=null!=(e=this.animations[t])?e:this.animations.default;if(i){var s;const t=i;return this.defaultDuration=null!=(s=t.duration)?s:this.defaultDuration,void new K(this.innerView).to(t.props,t.duration).start()}new K(this.innerView).to(this.originalInnerViewState,this.defaultDuration).start()}setOriginalInnerViewState(){var t;this.originalInnerViewState={x:this.innerView.x,y:this.innerView.y,width:this.innerView.width,height:this.innerView.height,scale:{x:this.innerView.scale.x,y:this.innerView.scale.y}};const e=null===(t=this.animations)||void 0===t?void 0:t.default;var i,s,n,o,l,r,a,h,d,u,c,p,v,g,f,m;e&&(this.innerView.x=null!=(i=null!=(s=e.props.x)?s:this.originalInnerViewState.x)?i:0,this.innerView.y=null!=(n=null!=(o=e.props.y)?o:this.originalInnerViewState.y)?n:0,this.innerView.width=null!=(l=null!=(r=e.props.width)?r:this.originalInnerViewState.width)?l:0,this.innerView.height=null!=(a=null!=(h=e.props.height)?h:this.originalInnerViewState.height)?a:0,this.innerView.scale.x=null!=(d=null!=(u=null===(c=e.props.scale)||void 0===c?void 0:c.x)?u:null===(p=this.originalInnerViewState.scale)||void 0===p?void 0:p.x)?d:1,this.innerView.scale.y=null!=(v=null!=(g=null===(f=e.props.scale)||void 0===f?void 0:f.y)?g:null===(m=this.originalInnerViewState.scale)||void 0===m?void 0:m.y)?v:1)}initStateControl(){this.onDown.connect(()=>{this.setState("pressed")}),this.onUp.connect(()=>{this.setState(s.isMobile.any?"default":"hover")}),this.onUpOut.connect(()=>{this.setState("default")}),this.onOut.connect(()=>{this.button.isDown||this.setState("default")}),this.onPress.connect(()=>{this.setState(s.isMobile.any?"default":"hover")}),this.onHover.connect(()=>{this.button.isDown||this.setState(s.isMobile.any?"default":"hover")})}set padding(t){this._padding=t,this.adjustTextView(this.state),this.adjustIconView(this.state)}get padding(){return this._padding}set offset(t){this._offset=t,this.updateAnchor()}get offset(){return this._offset}set textOffset(t){this._textOffset=t,this.adjustTextView(this.state)}get textOffset(){return this._textOffset}set defaultTextScale(t){var e,i;if(void 0===t)return;this.options.defaultTextScale=t;const s="number"==typeof t;this._defaultTextScale.x=s?t:null!=(e=t.x)?e:1,this._defaultTextScale.y=s?t:null!=(i=t.y)?i:1,this.adjustTextView(this.state)}get defaultTextScale(){return this.defaultTextScale}set defaultIconScale(t){var e,i;if(void 0===t)return;this.options.defaultIconScale=t;const s="number"==typeof t;this._defaultIconScale.x=s?t:null!=(e=t.x)?e:1,this._defaultIconScale.y=s?t:null!=(i=t.y)?i:1,this.adjustIconView(this.state)}get defaultIconScale(){return this.defaultIconScale}set defaultTextAnchor(t){var e,i;if(void 0===t)return;this.options.defaultTextAnchor=t;const s="number"==typeof t;this._defaultTextAnchor.x=s?t:null!=(e=t.x)?e:1,this._defaultTextAnchor.y=s?t:null!=(i=t.y)?i:1,this.adjustTextView(this.state)}get defaultTextAnchor(){return this.defaultTextAnchor}set defaultIconAnchor(t){var e,i;if(void 0===t)return;this.options.defaultIconAnchor=t;const s="number"==typeof t;this._defaultIconAnchor.x=s?t:null!=(e=t.x)?e:1,this._defaultIconAnchor.y=s?t:null!=(i=t.y)?i:1,this.adjustIconView(this.state)}get defaultIconAnchor(){return this.defaultIconAnchor}set width(t){var e;null!==(e=this.options)&&void 0!==e&&e.nineSliceSprite?(this._views.defaultView&&(this._views.defaultView.width=t),this._views.hoverView&&(this._views.hoverView.width=t),this._views.pressedView&&(this._views.pressedView.width=t),this._views.disabledView&&(this._views.disabledView.width=t),this.adjustTextView(this.state),this.adjustIconView(this.state),this.updateAnchor()):super.width=t}get width(){return super.width}set height(t){var e;null!==(e=this.options)&&void 0!==e&&e.nineSliceSprite?(this._views.defaultView&&(this._views.defaultView.height=t),this._views.hoverView&&(this._views.hoverView.height=t),this._views.pressedView&&(this._views.pressedView.height=t),this._views.disabledView&&(this._views.disabledView.height=t),this.adjustTextView(this.state),this.adjustIconView(this.state),this.updateAnchor()):super.height=t}get height(){return super.height}setSize(t,e){var i;null!==(i=this.options)&&void 0!==i&&i.nineSliceSprite?(this._views.defaultView&&this._views.defaultView.setSize(t,e),this._views.hoverView&&this._views.hoverView.setSize(t,e),this._views.pressedView&&this._views.pressedView.setSize(t,e),this._views.disabledView&&this._views.disabledView.setSize(t,e),this.adjustTextView(this.state),this.adjustIconView(this.state),this.updateAnchor()):super.setSize(t,e)}}var it=Object.defineProperty,st=(t,e,i)=>((t,e,i)=>e in t?it(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i)(t,"symbol"!=typeof e?e+"":e,i);class nt extends s.Container{constructor(t){var e;super(),st(this,"options"),st(this,"_type","bidirectional"),st(this,"_maxWidth",0),st(this,"children",[]),t&&(t.maxWidth&&(this._maxWidth=t.maxWidth),this.init(t)),null==t||null===(e=t.items)||void 0===e||e.forEach(t=>this.addChild(t)),this.on("added",()=>this.arrangeChildren()),this.on("childAdded",()=>this.arrangeChildren())}init(t){this.options=t,null!=t&&t.type&&(this.type=t.type),null!=t&&t.children&&t.children.forEach(t=>this.addChild(t))}set type(t){this._type=t,this.arrangeChildren()}get type(){return this._type}set elementsMargin(t){if(!this.options)throw new Error("List has not been initiated!");this.options.elementsMargin=t,this.arrangeChildren()}get elementsMargin(){var t,e;return null!=(t=null===(e=this.options)||void 0===e?void 0:e.elementsMargin)?t:0}set padding(t){if(!this.options)throw new Error("List has not been initiated!");this.options.padding=t,this.options.vertPadding=t,this.options.horPadding=t,this.options.leftPadding=t,this.options.rightPadding=t,this.options.topPadding=t,this.options.bottomPadding=t,this.arrangeChildren()}get padding(){var t,e;return null!=(t=null===(e=this.options)||void 0===e?void 0:e.padding)?t:0}set vertPadding(t){if(!this.options)throw new Error("List has not been initiated!");this.options.vertPadding=t,this.options.topPadding=t,this.options.bottomPadding=t,this.arrangeChildren()}get vertPadding(){var t,e,i;return null!=(t=null!=(e=null===(i=this.options)||void 0===i?void 0:i.vertPadding)?e:this.padding)?t:0}set horPadding(t){if(!this.options)throw new Error("List has not been initiated!");this.options.horPadding=t,this.options.leftPadding=t,this.options.rightPadding=t,this.arrangeChildren()}get horPadding(){var t,e,i;return null!=(t=null!=(e=null===(i=this.options)||void 0===i?void 0:i.horPadding)?e:this.padding)?t:0}set leftPadding(t){if(!this.options)throw new Error("List has not been initiated!");this.options.leftPadding=t,this.arrangeChildren()}get leftPadding(){var t,e;return null!=(t=null===(e=this.options)||void 0===e?void 0:e.leftPadding)?t:this.horPadding}set rightPadding(t){if(!this.options)throw new Error("List has not been initiated!");this.options.rightPadding=t,this.arrangeChildren()}get rightPadding(){var t,e;return null!=(t=null===(e=this.options)||void 0===e?void 0:e.rightPadding)?t:this.horPadding}set topPadding(t){if(!this.options)throw new Error("List has not been initiated!");this.options.topPadding=t,this.arrangeChildren()}get topPadding(){var t,e;return null!=(t=null===(e=this.options)||void 0===e?void 0:e.topPadding)?t:this.vertPadding}set bottomPadding(t){if(!this.options)throw new Error("List has not been initiated!");this.options.bottomPadding=t,this.arrangeChildren()}get bottomPadding(){var t,e;return null!=(t=null===(e=this.options)||void 0===e?void 0:e.bottomPadding)?t:this.vertPadding}arrangeChildren(){var t,e,i;let s=0,n=this.leftPadding,o=this.topPadding;const l=null!=(t=null===(e=this.options)||void 0===e?void 0:e.elementsMargin)?t:0;let r=this.maxWidth||(null===(i=this.parent)||void 0===i?void 0:i.width);this.rightPadding&&(r-=this.rightPadding),this.children.forEach((t,e)=>{switch(this.type){case"vertical":t.y=o,t.x=n,o+=l+t.height;break;case"horizontal":t.x=n,t.y=o,n+=l+t.width;break;default:t.x=n,t.y=o,t.x+t.width>r&&e>0&&(o+=l+s,n=this.leftPadding,t.x=n,t.y=o,s=0),s=Math.max(s,t.height),n+=l+t.width}})}removeItem(t){const e=this.children[t];e&&(this.removeChild(e),this.arrangeChildren())}set maxWidth(t){this._maxWidth=t,this.arrangeChildren()}get maxWidth(){return this._maxWidth}}var ot=Object.defineProperty,lt=(t,e,i)=>((t,e,i)=>e in t?ot(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i)(t,"symbol"!=typeof e?e+"":e,i);class rt{constructor(t={}){var e,i,s;lt(this,"x"),lt(this,"ax"),lt(this,"dx"),lt(this,"tx"),lt(this,"_options"),this.x=0,this.ax=0,this.dx=0,this.tx=0,this._options={max:null!=(e=t.max)?e:160,damp:null!=(i=t.damp)?i:.8,springiness:null!=(s=t.springiness)?s:.1}}update(){this.ax=(this.tx-this.x)*this._options.springiness,this.dx+=this.ax,this.dx*=this._options.damp,this.dx<-this._options.max?this.dx=-this._options.max:this.dx>this._options.max&&(this.dx=this._options.max),this.x+=this.dx}reset(){this.x=0,this.ax=0,this.dx=0,this.tx=0}get max(){return this._options.max}set max(t){this._options.max=t}get damp(){return this._options.damp}set damp(t){this._options.damp=t}get springiness(){return this._options.springiness}set springiness(t){this._options.springiness=t}}var at=Object.defineProperty,ht=(t,e,i)=>((t,e,i)=>e in t?at(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i)(t,"symbol"!=typeof e?e+"":e,i);class dt{constructor(){ht(this,"done",!1),ht(this,"to",0),ht(this,"_spring"),ht(this,"_pos",0),ht(this,"_speed",0),ht(this,"_correctSpeed",!1),this._spring=new rt,this._pos=0,this.to=0}start(t,e,i){this._speed=t,this._pos=e,this.to=i,this.done=!1,this._spring.x=this._pos,this._spring.tx=this.to;const s=this.to-this._pos,n=Math.abs(s)/s,o=Math.abs(this._speed)/this._speed;this._correctSpeed=n!==o}update(){if(this._correctSpeed)this._speed*=.6,Math.abs(this._speed)<2&&(this._correctSpeed=!1),this._pos+=this._speed,this._spring.x=this._pos;else{const t=this.to-this._pos;Math.abs(t)<.05?(this._pos=this.to,this.done=!0):(this._spring.tx=this.to,this._spring.update(),this._pos=this._spring.x)}return this._pos}cancel(){}}var ut=Object.defineProperty,ct=(t,e,i)=>((t,e,i)=>e in t?ut(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i)(t,"symbol"!=typeof e?e+"":e,i);class pt{constructor(t={}){var e,i,s;ct(this,"position",0),ct(this,"constrain",!0),ct(this,"min",0),ct(this,"max",0),ct(this,"maxSpeed",400),ct(this,"_ease"),ct(this,"_offset",0),ct(this,"_prev",0),ct(this,"_speed",0),ct(this,"_hasStopped",!1),ct(this,"_targetSpeed",0),ct(this,"_speedChecker",0),ct(this,"_grab",0),ct(this,"_activeEase"),this.constrain=null==(e=t.constrain)||e,this.maxSpeed=null!=(i=t.maxSpeed)?i:400,this._ease=null!=(s=t.ease)?s:new dt}set value(t){this._speed=0,this.position=t}get value(){return this.position}grab(t){this._grab=t,this._offset=this.position-t,this._speedChecker=0,this._targetSpeed=this._speed=0,this._hasStopped=!1}hold(t){this._speedChecker++,this.position=t+this._offset,this._speedChecker>1&&(this._targetSpeed=this.position-this._prev),this._speed+=(this._targetSpeed-this._speed)/2,this._speed>this.maxSpeed?this._speed=this.maxSpeed:this._speed<-this.maxSpeed&&(this._speed=-this.maxSpeed),this._prev=this.position,this.constrain&&(this._activeEase=void 0,this.position>this.min?this.position-=(this.position-this.min)/1.5:this.position<this.max&&(this.position+=(this.max-this.position)/1.5))}slide(t=!1){this._hasStopped||(this.constrain?this._updateConstrain(t):this._updateDefault())}get moveAmount(){return-(this.position-this._offset-this._grab)}_updateDefault(){this._speed*=.9,this.position+=this._speed,(this._speed<0?-1*this._speed:this._speed)<.01&&(this._hasStopped=!0)}_updateConstrain(t=!1){const e=this.max;t?(this.value>0&&(this.value=0),this.value>0&&(this.value=0),this.value<this.max&&(this.value=this.max),this.value<this.max&&(this.value=this.max)):this.position>this.min||this.position<e||this._activeEase?(this._activeEase||(this._activeEase=this._ease,this.position>this.min?this._activeEase.start(this._speed,this.position,this.min):this._activeEase.start(this._speed,this.position,e)),this.position=this._activeEase.update(),this._activeEase.done&&(this.position=this._activeEase.to,this._speed=0,this._activeEase=void 0)):this._updateDefault()}}var vt=Object.defineProperty,gt=(t,e,i)=>((t,e,i)=>e in t?vt(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i)(t,"symbol"!=typeof e?e+"":e,i);class ft{constructor(t){var e;gt(this,"xAxis"),gt(this,"yAxis"),gt(this,"_isDown",!1),gt(this,"_globalPosition"),gt(this,"_frame"),gt(this,"_bounds"),gt(this,"_dirty",!1),gt(this,"disableEasing",!1),this.xAxis=new pt({ease:t.xEase,maxSpeed:t.maxSpeed,constrain:t.constrain}),this.yAxis=new pt({ease:t.yEase,maxSpeed:t.maxSpeed,constrain:t.constrain}),this.disableEasing=null!=(e=t.disableEasing)&&e,this._frame=new s.Rectangle,this._bounds=new s.Rectangle,this._globalPosition=new s.Point}pointerDown(t){this._globalPosition=t,this.xAxis.grab(t.x),this.yAxis.grab(t.y),this._isDown=!0}pointerUp(){this._isDown=!1}pointerMove(t){this._globalPosition=t}update(){this._dirty&&this._bounds&&this._frame&&(this._dirty=!1,this.xAxis.min=this._bounds.left,this.xAxis.min=this._bounds.right-this._frame.width,this.xAxis.min=this._bounds.top,this.xAxis.min=this._bounds.bottom-this._frame.height),this._isDown&&this._globalPosition?(this.xAxis.hold(this._globalPosition.x),this.yAxis.hold(this._globalPosition.y)):(this.xAxis.slide(this.disableEasing),this.yAxis.slide(this.disableEasing))}resize(t,e){this._frame&&(this._frame.x=0,this._frame.width=t,this._frame.y=0,this._frame.height=e,this._dirty=!0)}setBounds(t,e,i,s){this._bounds&&(this._bounds.x=t,this._bounds.width=e-t,this._bounds.y=i,this._bounds.height=s-i,this._dirty=!0)}get x(){return this.xAxis.value}get y(){return this.yAxis.value}}var mt=Object.defineProperty,wt=(t,e,i)=>((t,e,i)=>e in t?mt(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i)(t,"symbol"!=typeof e?e+"":e,i);class _t extends s.Container{constructor(t){super(),wt(this,"background"),wt(this,"borderMask"),wt(this,"lastWidth",0),wt(this,"lastHeight",0),wt(this,"_width",0),wt(this,"_height",0),wt(this,"_dimensionChanged",!1),wt(this,"list"),wt(this,"_trackpad"),wt(this,"isDragging",0),wt(this,"interactiveStorage",[]),wt(this,"visibleItems",[]),wt(this,"pressedChild"),wt(this,"ticker",s.Ticker.shared),wt(this,"options",{}),wt(this,"stopRenderHiddenItemsTimeout"),wt(this,"onMouseScrollBinding",this.onMouseScroll.bind(this)),wt(this,"dragStarTouchPoint"),wt(this,"isOver",!1),wt(this,"proximityRange",0),wt(this,"proximityStatusCache",[]),wt(this,"lastScrollX"),wt(this,"lastScrollY"),wt(this,"proximityCheckFrameCounter",0),wt(this,"onProximityChange",new V.Signal),wt(this,"onScroll",new V.Signal),t&&this.init(t),this.ticker.add(this.update,this)}init(t){var e,i,s,n,o,l,r,a,h,d;this.options=t,this.setBackground(t.background),this._width=null!=(e=null!=(i=t.width)?i:null===(s=this.background)||void 0===s?void 0:s.width)?e:100,this._height=null!=(n=null!=(o=t.height)?o:null===(l=this.background)||void 0===l?void 0:l.height)?n:100,this.proximityRange=null!=(r=t.proximityRange)?r:0,this.list||(this.list=new nt,super.addChild(this.list)),null===(a=this.list)||void 0===a||a.init({type:t.type,elementsMargin:t.elementsMargin,padding:t.padding,vertPadding:t.vertPadding,horPadding:t.horPadding,topPadding:t.topPadding,bottomPadding:t.bottomPadding,leftPadding:t.leftPadding,rightPadding:t.rightPadding,maxWidth:t.maxWidth||("horizontal"!==t.type&&"vertical"!==t.type?this._width:0)}),t.items&&this.addItems(t.items),this.hasBounds&&(this.addMask(),this.makeScrollable()),this._trackpad&&(this._trackpad.xAxis.value=0,this._trackpad.yAxis.value=0),this.options.globalScroll=null==(h=t.globalScroll)||h,this.options.shiftScroll=null!=(d=t.shiftScroll)&&d,this.resize()}get hasBounds(){return!!this._width||!!this._height}addItems(t){null!=t&&t.length&&t.forEach(t=>this.addItem(t))}removeItems(){var t;this.proximityStatusCache.length=0,null===(t=this.list)||void 0===t||t.removeChildren()}addItem(...t){if(t.length>1)t.forEach(t=>this.addItem(t));else{var e;const i=t[0];i.width&&i.height||console.error("ScrollBox item should have size"),i.eventMode="static",null===(e=this.list)||void 0===e||e.addChild(i),this.proximityStatusCache.push(!1),this.options.disableDynamicRendering||(i.renderable=this.isItemVisible(i))}return this.resize(),t[0]}removeItem(t){var e;null===(e=this.list)||void 0===e||e.removeItem(t),this.proximityStatusCache.splice(t,1),this.resize()}isItemVisible(t,e=0){let i=!1;const s=this.list;if(!s)return!1;if(this.isVertical||this.isBidirectional){var n;const o=t.y+s.y;o+t.height>=-e&&o<=(null!=(n=this.options.height)?n:this._height)+e&&(i=!0)}if(this.isHorizontal||this.isBidirectional){var o;const n=t.x+s.x;n+t.width>=-e&&n<=(null!=(o=this.options.width)?o:this._width)+e&&(i=!0)}return i}get items(){var t,e;return null!=(t=null===(e=this.list)||void 0===e?void 0:e.children)?t:[]}setBackground(t){this.background&&this.removeChild(this.background),this.options.background=t,this.background=new s.Graphics,this.addChildAt(this.background,0),this.resize()}addMask(){this.borderMask||(this.borderMask=new s.Graphics,super.addChild(this.borderMask),this.mask=this.borderMask),this.resize()}makeScrollable(){this._trackpad||(this._trackpad=new ft({disableEasing:this.options.disableEasing})),this.on("pointerdown",t=>{var e;this.renderAllItems(),this.isDragging=1,this.dragStarTouchPoint=this.worldTransform.applyInverse(t.global),this._trackpad&&this.dragStarTouchPoint&&this._trackpad.pointerDown(new s.Point(this.dragStarTouchPoint.x,this.dragStarTouchPoint.y));const i=null===(e=this.list)||void 0===e?void 0:e.worldTransform.applyInverse(t.global);i&&this.visibleItems.forEach(t=>{t.x<i.x&&t.x+t.width>i.x&&t.y<i.y&&t.y+t.height>i.y&&(this.pressedChild=t)})}),this.on("pointerup",()=>{var t;this.isDragging=0,null===(t=this._trackpad)||void 0===t||t.pointerUp(),this.restoreItemsInteractivity(),this.pressedChild=void 0,this.stopRenderHiddenItems()}),this.on("pointerover",()=>{this.isOver=!0}),this.on("pointerout",()=>{this.isOver=!1}),this.on("pointerupoutside",()=>{var t;this.isDragging=0,null===(t=this._trackpad)||void 0===t||t.pointerUp(),this.restoreItemsInteractivity(),this.pressedChild=void 0,this.stopRenderHiddenItems()}),this.on("globalpointermove",t=>{var e;if(!this.isDragging)return;const i=this.worldTransform.applyInverse(t.global);if(this.dragStarTouchPoint){var n;const t=null!=(n=this.options.dragTrashHold)?n:10;if(this.isHorizontal||this.isBidirectional){const e=i.x-this.dragStarTouchPoint.x;Math.abs(e)>t&&(this.isDragging=2)}if(this.isVertical||this.isBidirectional){const e=i.y-this.dragStarTouchPoint.y;Math.abs(e)>t&&(this.isDragging=2)}}var o,l;this.dragStarTouchPoint&&2!==this.isDragging||(null===(e=this._trackpad)||void 0===e||e.pointerMove(new s.Point(i.x,i.y)),this.pressedChild&&(this.revertClick(this.pressedChild),this.pressedChild=void 0),this.isBidirectional?null===(o=this.onScroll)||void 0===o||o.emit({x:this.scrollX,y:this.scrollY}):null===(l=this.onScroll)||void 0===l||l.emit(this.isVertical?this.scrollY:this.scrollX))}),document.addEventListener("wheel",this.onMouseScrollBinding,!0)}setInteractive(t){this.eventMode=t?"static":"auto"}get listHeight(){var t,e,i,s,n,o;return(null!=(t=null===(e=this.list)||void 0===e?void 0:e.height)?t:0)+(null!=(i=null===(s=this.list)||void 0===s?void 0:s.topPadding)?i:0)+(null!=(n=null===(o=this.list)||void 0===o?void 0:o.bottomPadding)?n:0)}get listWidth(){var t,e,i,s,n,o;return(null!=(t=null===(e=this.list)||void 0===e?void 0:e.width)?t:0)+(null!=(i=null===(s=this.list)||void 0===s?void 0:s.leftPadding)?i:0)+(null!=(n=null===(o=this.list)||void 0===o?void 0:o.rightPadding)?n:0)}resize(t=!1){if(this.hasBounds){if(this.renderAllItems(),this.borderMask&&(t||this._dimensionChanged||this.lastWidth!==this.listWidth||this.lastHeight!==this.listHeight)){var e,i,s,n;this.options.width||(this._width+=this.listWidth),this.options.height||(this._height+=this.listHeight),null===(e=this.borderMask)||void 0===e||e.clear().roundRect(0,0,this._width,this._height,0|(null!=(i=this.options.radius)?i:0)).fill(16711935).stroke(0),this.borderMask&&(this.borderMask.eventMode="none");const t=this.options.background;null===(s=this.background)||void 0===s||s.clear().roundRect(0,0,this._width,this._height,0|(null!=(n=this.options.radius)?n:0)).fill({color:null!=t?t:0,alpha:t?1:1e-7}),this.isBidirectional?this.setInteractive(this.listWidth>this._width||this.listHeight>this._height):this.isHorizontal?this.setInteractive(this.listWidth>this._width):this.setInteractive(this.listHeight>this._height),this.lastWidth=this.listWidth,this.lastHeight=this.listHeight}if(this._trackpad&&this.borderMask){var o,l,r,a,h,d,u,c,p,v,g,f;const t=this.borderMask.width-(null!=(o=null===(l=this.list)||void 0===l?void 0:l.width)?o:0)-(null!=(r=null===(a=this.list)||void 0===a?void 0:a.leftPadding)?r:0)-(null!=(h=null===(d=this.list)||void 0===d?void 0:d.rightPadding)?h:0),e=this.borderMask.height-(null!=(u=null===(c=this.list)||void 0===c?void 0:c.height)?u:0)-(null!=(p=null===(v=this.list)||void 0===v?void 0:v.topPadding)?p:0)-(null!=(g=null===(f=this.list)||void 0===f?void 0:f.bottomPadding)?g:0);this.isBidirectional?(this._trackpad.yAxis.max=-Math.abs(e),this._trackpad.xAxis.max=-Math.abs(t)):this.isVertical?this._trackpad.yAxis.max=-Math.abs(e):this.isHorizontal&&(this._trackpad.xAxis.max=-Math.abs(t))}var m,w;if(this._dimensionChanged)null===(m=this.list)||void 0===m||m.arrangeChildren(),this.stopRenderHiddenItems(),this._dimensionChanged=!1;else t&&(null===(w=this.list)||void 0===w||w.arrangeChildren()),this.updateVisibleItems();this.lastScrollX=void 0,this.lastScrollY=void 0}}onMouseScroll(t){if(!this.isOver&&!this.options.globalScroll)return;this.renderAllItems();const e=!!this.options.shiftScroll,i=e?void 0!==t.deltaX||void 0!==t.deltaY:void 0!==t.deltaX,s=void 0!==t.deltaY;if((this.isHorizontal||this.isBidirectional)&&i){var n,o;const i=e||this.isBidirectional?t.deltaX:t.deltaY,s=(null!=(n=null===(o=this.list)||void 0===o?void 0:o.x)?n:0)-i;if(this.listWidth<this._width)this._trackpad&&(this._trackpad.xAxis.value=0);else{const t=this._width-this.listWidth,e=0;this._trackpad&&(this._trackpad.xAxis.value=Math.min(e,Math.max(t,s)))}}if((this.isVertical||this.isBidirectional)&&s){var l,r;const e=(null!=(l=null===(r=this.list)||void 0===r?void 0:r.y)?l:0)-t.deltaY;if(this.listHeight<this._height)this._trackpad&&(this._trackpad.yAxis.value=0);else{const t=this._height-this.listHeight,i=0;this._trackpad&&(this._trackpad.yAxis.value=Math.min(i,Math.max(t,e)))}}var a,h,d,u,c;if(this.isBidirectional&&(i||s))null===(a=this.onScroll)||void 0===a||a.emit({x:null!=(h=null===(d=this._trackpad)||void 0===d?void 0:d.xAxis.value)?h:0,y:null!=(u=null===(c=this._trackpad)||void 0===c?void 0:c.yAxis.value)?u:0});else if(this.isHorizontal&&i){var p,v,g;null===(p=this.onScroll)||void 0===p||p.emit(null!=(v=null===(g=this._trackpad)||void 0===g?void 0:g.xAxis.value)?v:0)}else if(this.isVertical&&s){var f,m,w;null===(f=this.onScroll)||void 0===f||f.emit(null!=(m=null===(w=this._trackpad)||void 0===w?void 0:w.yAxis.value)?m:0)}this.stopRenderHiddenItems()}scrollBottom(){var t,e;this.interactive?this.scrollTo((null!=(t=null===(e=this.list)||void 0===e?void 0:e.children.length)?t:1)-1):this.scrollTop()}scrollTop(){this.renderAllItems(),this._trackpad&&(this._trackpad.xAxis.value=0,this._trackpad.yAxis.value=0),this.stopRenderHiddenItems()}renderAllItems(){clearTimeout(this.stopRenderHiddenItemsTimeout),this.stopRenderHiddenItemsTimeout=void 0,this.options.disableDynamicRendering||this.items.forEach(t=>{t.renderable=!0})}stopRenderHiddenItems(){this.options.disableDynamicRendering||(this.stopRenderHiddenItemsTimeout&&(clearTimeout(this.stopRenderHiddenItemsTimeout),this.stopRenderHiddenItemsTimeout=void 0),this.stopRenderHiddenItemsTimeout=setTimeout(()=>this.updateVisibleItems(),2e3))}updateVisibleItems(){this.visibleItems.length=0,this.items.forEach(t=>{t.renderable=this.isItemVisible(t),this.visibleItems.push(t)})}scrollTo(t){if(!this.interactive||!this._trackpad||!this.list)return;const e=this.list.children[t];e&&(this.renderAllItems(),this._trackpad.xAxis.value=this.isHorizontal||this.isBidirectional?this._width-e.x-e.width-this.list.rightPadding:0,this._trackpad.yAxis.value=this.isVertical||this.isBidirectional?this._height-e.y-e.height-this.list.bottomPadding:0,this.stopRenderHiddenItems())}scrollToPosition({x:t,y:e}){void 0===t&&void 0===e||(this.renderAllItems(),void 0!==t&&(this.scrollX=-t),void 0!==e&&(this.scrollY=-e),this.stopRenderHiddenItems())}get height(){return this._height}set height(t){this._height=t,this._dimensionChanged=!0,this.resize(),this.scrollTop()}get width(){return this._width}set width(t){this._width=t,this._dimensionChanged=!0,this.resize(),this.scrollTop()}setSize(t,e){var i;"object"==typeof t?(e=null!=(i=t.height)?i:t.width,t=t.width):e=null!=e?e:t;this._width=t,this._height=e,this._dimensionChanged=!0,this.resize(),this.scrollTop()}getSize(t){return(t=t||{width:0,height:0}).width=this._width,t.height=this._height,t}get scrollX(){var t,e;return null!=(t=null===(e=this._trackpad)||void 0===e?void 0:e.xAxis.value)?t:0}set scrollX(t){this._trackpad&&(this._trackpad.xAxis.value=t)}get scrollY(){var t,e;return null!=(t=null===(e=this._trackpad)||void 0===e?void 0:e.yAxis.value)?t:0}set scrollY(t){this._trackpad&&(this._trackpad.yAxis.value=t)}update(){var t;this.list&&this._trackpad&&(this._trackpad.update(),(this.isHorizontal||this.isBidirectional)&&this.list.x!==this._trackpad.x&&(this.list.x=this._trackpad.x),(this.isVertical||this.isBidirectional)&&this.list.y!==this._trackpad.y&&(this.list.y=this._trackpad.y),this.options.disableProximityCheck||this._trackpad.x===this.lastScrollX&&this._trackpad.y===this.lastScrollY||(this.proximityCheckFrameCounter++,this.proximityCheckFrameCounter>=(null!=(t=this.options.proximityDebounce)?t:10)&&(this.items.forEach((t,e)=>{const i=this.isItemVisible(t,this.proximityRange);i!==this.proximityStatusCache[e]&&(this.proximityStatusCache[e]=i,this.onProximityChange.emit({item:t,index:e,inRange:i}))}),this.lastScrollX=this._trackpad.x,this.lastScrollY=this._trackpad.y,this.proximityCheckFrameCounter=0)))}destroy(t){var e,i;this.ticker.remove(this.update,this),document.removeEventListener("wheel",this.onMouseScrollBinding,!0),null===(e=this.background)||void 0===e||e.destroy(),null===(i=this.list)||void 0===i||i.destroy(),super.destroy(t)}restoreItemsInteractivity(){this.interactiveStorage.forEach(t=>{t.item.eventMode=t.eventMode}),this.interactiveStorage.length=0}revertClick(t){var e;"auto"!==t.eventMode&&(s.isMobile.any?t.emit("pointerupoutside",{target:t}):t.emit("mouseupoutside",{target:t}),this.interactiveStorage.push({item:t,eventMode:null!=(e=t.eventMode)?e:"auto"}),t.eventMode="auto");t instanceof s.Container&&t.children&&t.children.forEach(t=>this.revertClick(t))}get scrollHeight(){var t,e;return null!=(t=null===(e=this.list)||void 0===e?void 0:e.height)?t:0}get scrollWidth(){var t,e;return null!=(t=null===(e=this.list)||void 0===e?void 0:e.width)?t:0}get isVertical(){var t;return"vertical"===(null!=(t=this.options.type)?t:"vertical")}get isHorizontal(){return"horizontal"===this.options.type}get isBidirectional(){return"bidirectional"===this.options.type}}var bt=Object.defineProperty,yt=(t,e,i)=>((t,e,i)=>e in t?bt(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i)(t,"symbol"!=typeof e?e+"":e,i);class xt extends s.Container{constructor(t){var e;super(),yt(this,"backdrop"),yt(this,"innerView"),yt(this,"contentView"),yt(this,"titleText"),yt(this,"contentBody"),yt(this,"scrollBox"),yt(this,"buttonContainer"),yt(this,"options"),yt(this,"_isOpen",!1),yt(this,"onSelect"),yt(this,"onClose"),this.options=t,this.onSelect=new V.Signal,this.onClose=new V.Signal,this.backdrop=new s.Container,this.contentView=new s.Container,this.buttonContainer=new nt(_objectSpread({type:"horizontal",elementsMargin:10},t.buttonList)),this.initBackdrop(),this.initInnerView(),this.initTitle(),this.initButtons();const i=this.dialogPadding,{width:n}=this.options;let{height:o}=this.options;var l;o&&(o=o-2*i-this.buttonContainer.height,null!==(l=this.titleText)&&void 0!==l&&l.height&&(o-=this.titleText.height));this.scrollBox=new _t(_objectSpread(_objectSpread({background:0,elementsMargin:10,radius:0,type:"bidirectional",padding:10},this.options.scrollBox),{},{width:n?n-2*i:0,height:o})),null===(e=this.innerView)||void 0===e||e.addChild(this.scrollBox),this.visible=!1,this.initContent(),s.Ticker.shared.add(()=>G.shared.update())}get dialogWidth(){var t,e,i;return null!=(t=null!=(e=this.options.width)?e:null===(i=this.innerView)||void 0===i?void 0:i.width)?t:0}get dialogHeight(){var t,e,i;return null!=(t=null!=(e=this.options.height)?e:null===(i=this.innerView)||void 0===i?void 0:i.height)?t:0}get dialogPadding(){var t;return null!=(t=this.options.padding)?t:20}get isOpen(){return this._isOpen}initBackdrop(){if(this.options.backdrop)this.backdrop=E(this.options.backdrop);else{var t,e;const i=new s.Sprite(s.Texture.WHITE);i.tint=null!=(t=this.options.backdropColor)?t:0,i.alpha=null!=(e=this.options.backdropAlpha)?e:.5,i.width=1e4,i.height=1e4,this.backdrop=i}this.backdrop.eventMode="static",this.backdrop.x=-5e3,this.backdrop.y=-5e3,this.options.closeOnBackdropClick&&this.backdrop.on("pointertap",()=>this.close()),this.addChild(this.backdrop)}initInnerView(){const{background:t,nineSliceSprite:e}=this.options;e?"string"==typeof t?this.innerView=new s.NineSliceSprite({texture:s.Texture.from(t),leftWidth:e[0],topHeight:e[1],rightWidth:e[2],bottomHeight:e[3]}):t instanceof s.Texture?this.innerView=new s.NineSliceSprite({texture:t,leftWidth:e[0],topHeight:e[1],rightWidth:e[2],bottomHeight:e[3]}):(console.warn("NineSliceSprite can not be used with views set as Container. Pass the texture or texture name as instead of the Container extended instance."),this.innerView=E(t)):this.innerView=E(t),this.options.width&&this.options.height&&(this.innerView instanceof s.NineSliceSprite||this.innerView instanceof s.Graphics)&&(this.innerView.width=this.options.width,this.innerView.height=this.options.height),"anchor"in this.innerView?this.innerView.anchor.set(.5,.5):this.innerView.pivot.set(this.dialogWidth/2,this.dialogHeight/2),this.innerView.eventMode="static",this.addChild(this.innerView),this.innerView.addChild(this.contentView)}initTitle(){this.options.title&&(this.titleText=Z(this.options.title),"anchor"in this.titleText&&this.titleText.anchor.set(.5,0),this.titleText.x=this.dialogWidth/2,this.titleText.y=this.dialogPadding,this.contentView.addChild(this.titleText))}initContent(){if(!this.options.content)return;let t=this.dialogPadding;if(this.titleText&&(t+=this.titleText.height),"string"==typeof this.options.content||"number"==typeof this.options.content){const t=Z(this.options.content);this.scrollBox.addItem(t)}else Array.isArray(this.options.content)?this.options.content.forEach(t=>this.scrollBox.addItem(t)):this.scrollBox.addItem(this.options.content);this.scrollBox.x=this.dialogPadding,this.scrollBox.y=t,this.contentView.addChild(this.scrollBox)}initButtons(){if(!this.options.buttons||0===this.options.buttons.length)return;this.options.buttons.forEach((t,e)=>{let i;switch(!0){case t instanceof B:t.onPress.connect(()=>{this.onSelect.emit(e,"")}),t.view&&this.buttonContainer.addChild(t.view);break;case t instanceof et:t.onPress.connect(()=>{var i;this.onSelect.emit(e,null!=(i=t.text)?i:"")}),this.buttonContainer.addChild(t);break;default:i=new et(t),i.onPress.connect(()=>{var t;this.onSelect.emit(e,null!=(t=i.text)?t:"")}),this.buttonContainer.addChild(i)}}),this.buttonContainer.x=this.dialogWidth/2-this.buttonContainer.width/2,this.buttonContainer.y=this.dialogHeight-this.dialogPadding-this.buttonContainer.height,this.contentView.addChild(this.buttonContainer)}open(){var t,e,i;if(!this.innerView)return;this.visible=!0,this._isOpen=!0;const s=null===(t=this.options.animations)||void 0===t?void 0:t.open;var n;if(!s)return this.backdrop.alpha=null!=(n=this.options.backdropAlpha)?n:.5,void this.innerView.scale.set(1);this.backdrop.alpha=0,this.innerView.scale.set(.8);const o=null!=(e=s.duration)?e:300;new K(this.backdrop).to({alpha:null!=(i=this.options.backdropAlpha)?i:.5},o).start(),new K(this.innerView.scale).to({x:1,y:1},o).start()}close(){var t,e;if(!this.innerView)return;const i=null===(t=this.options.animations)||void 0===t?void 0:t.close;if(!i)return this.visible=!1,this._isOpen=!1,void this.onClose.emit();const s=null!=(e=i.duration)?e:300;new K(this.backdrop).to({alpha:0},s).start(),new K(this.innerView.scale).to({x:.8,y:.8},s).onComplete(()=>{this.visible=!1,this._isOpen=!1,this.onClose.emit()}).start()}show(){this.open()}hide(){this.close()}}var St=Object.defineProperty,kt=(t,e,i)=>((t,e,i)=>e in t?St(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i)(t,"symbol"!=typeof e?e+"":e,i);class Ct extends s.Container{constructor(t){super(),kt(this,"bg"),kt(this,"fill"),kt(this,"fillMask"),kt(this,"progressStart",0),kt(this,"_progress",0),kt(this,"options"),kt(this,"innerView");const e={bg:s.Texture.WHITE,fill:s.Texture.WHITE,fillPaddings:{top:0,right:0,bottom:0,left:0},progress:0};this.options=_objectSpread(_objectSpread({},e),t),this.innerView=new s.Container,this.addChild(this.innerView),this.init(this.options)}init({bg:t,fill:e,fillPaddings:i,progress:s}){this.setBackground(t),this.setFill(e,i),this.progress=null!=s?s:0}setBackground(t){var e;this.bg&&this.bg.destroy(),null!==(e=this.options)&&void 0!==e&&e.nineSliceSprite&&("string"==typeof t?this.bg=new s.NineSliceSprite({texture:s.Texture.from(t),leftWidth:this.options.nineSliceSprite.bg[0],topHeight:this.options.nineSliceSprite.bg[1],rightWidth:this.options.nineSliceSprite.bg[2],bottomHeight:this.options.nineSliceSprite.bg[3]}):t instanceof s.Texture?this.bg=new s.NineSliceSprite({texture:t,leftWidth:this.options.nineSliceSprite.bg[0],topHeight:this.options.nineSliceSprite.bg[1],rightWidth:this.options.nineSliceSprite.bg[2],bottomHeight:this.options.nineSliceSprite.bg[3]}):console.warn("NineSliceSprite can not be used with views set as Container.\n Pass the texture or texture name as instead of the Container extended instance.")),this.bg||(this.bg=E(t)),this.innerView.addChildAt(this.bg,0)}setFill(t,e){var i,n,o;if(this.fill&&this.fill.destroy(),this.bg instanceof s.Sprite&&t===this.bg)return void console.warn("Can not use same Sprite instance for bg and fill.");null!==(i=this.options)&&void 0!==i&&i.nineSliceSprite?"string"==typeof t||t instanceof s.Texture?this.fill=new s.NineSliceSprite({texture:"string"==typeof t?s.Texture.from(t):t,leftWidth:this.options.nineSliceSprite.fill[0],topHeight:this.options.nineSliceSprite.fill[1],rightWidth:this.options.nineSliceSprite.fill[2],bottomHeight:this.options.nineSliceSprite.fill[3]}):(console.warn("NineSliceSprite can not be used with views set as Container.\n Pass the texture or texture name as instead of the Container extended instance."),this.fill=E(t)):this.fill=E(t),this.innerView.addChildAt(this.fill,1);const l=null!=(n=null==e?void 0:e.left)?n:0,r=null!=(o=null==e?void 0:e.top)?o:0;this.fill.x=l,this.fill.y=r,this.fillMask&&(this.fill.mask=null,this.fillMask.destroy());const a=this.fill.width/2,h=this.fill.width/2,d=this.fill.height/2,u=this.fill.height/2;let c=s.Texture.WHITE;this.fill instanceof s.Sprite&&this.fill.texture&&(c=this.fill.texture),this.fillMask=new s.NineSliceSprite({texture:c,leftWidth:a,topHeight:d,rightWidth:h,bottomHeight:u}),this.fillMask.position.copyFrom(this.fill),this.addChild(this.fillMask),this.fill.mask=this.fillMask}validate(t){return(t=Math.round(t))<0?0:t>100?100:t}set progress(t){this._progress=this.validate(t),this.fill&&this.fillMask&&(this.fill.mask=null,this.fillMask.width=this.fill.width/100*(this._progress-this.progressStart),this.fillMask.x=this.progressStart/100*this.fill.width+this.fill.x,this.fillMask.height=this.fill.height,this.fill.mask=this.fillMask)}get progress(){return this._progress}set width(t){var e;if(null!==(e=this.options)&&void 0!==e&&e.nineSliceSprite){if(this.bg&&(this.bg.width=t),this.fill){var i,s,n,o;const e=null!=(i=null===(s=this.options.fillPaddings)||void 0===s?void 0:s.left)?i:0,l=null!=(n=null===(o=this.options.fillPaddings)||void 0===o?void 0:o.right)?n:0;this.fill.width=t-e-l,this.fillMask.width=t-e-l}this.progress=this._progress}else super.width=t}get width(){return super.width}set height(t){var e;if(null!==(e=this.options)&&void 0!==e&&e.nineSliceSprite){if(this.bg&&(this.bg.height=t),this.fill){var i,s,n,o;const e=null!=(i=null===(s=this.options.fillPaddings)||void 0===s?void 0:s.top)?i:0,l=null!=(n=null===(o=this.options.fillPaddings)||void 0===o?void 0:o.bottom)?n:0;this.fill.height=t-e-l,this.fillMask.height=t-e-l}this.progress=this._progress}else super.height=t}get height(){return super.height}setSize(t,e){var i;if(null!==(i=this.options)&&void 0!==i&&i.nineSliceSprite){if(this.bg&&this.bg.setSize(t,e),this.fill){var s,n,o,l,r,a,h,d,u;if("object"==typeof t)e=null!=(u=t.height)?u:t.width,t=t.width;else e=null!=e?e:t;const i=null!=(s=null===(n=this.options.fillPaddings)||void 0===n?void 0:n.top)?s:0,c=null!=(o=null===(l=this.options.fillPaddings)||void 0===l?void 0:l.bottom)?o:0,p=null!=(r=null===(a=this.options.fillPaddings)||void 0===a?void 0:a.left)?r:0,v=null!=(h=null===(d=this.options.fillPaddings)||void 0===d?void 0:d.right)?h:0;this.fill.setSize(t-p-v,e-i-c),this.fillMask.setSize(t-p-v,e-i-c)}this.progress=this._progress}else super.setSize(t,e)}}var Vt=Object.defineProperty,Tt=(t,e,i)=>((t,e,i)=>e in t?Vt(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i)(t,"symbol"!=typeof e?e+"":e,i);class Pt extends Ct{constructor(t){var e,i;super(t),Tt(this,"_slider1"),Tt(this,"_slider2"),Tt(this,"value1Text"),Tt(this,"value2Text"),Tt(this,"_value1",0),Tt(this,"_value2",0),Tt(this,"dragging",0),Tt(this,"_min",0),Tt(this,"_max",100),Tt(this,"_step",1),Tt(this,"startX"),Tt(this,"startUpdateValue1"),Tt(this,"startUpdateValue2"),Tt(this,"settings"),this.settings=t,t.slider1&&(this.slider1=t.slider1),t.slider2&&(this.slider2=t.slider2),this.min=null!=(e=t.min)?e:0,this.max=null!=(i=t.max)?i:100}init(t){super.init(t),this.fill&&(this.fill.eventMode="none")}set slider1(t){if(t&&(this._slider1&&(this._slider1.removeAllListeners(),this._slider1.destroy()),this._slider1=this.createSlider(t),this.settings.showValue&&!this.value1Text)){var e;const t=null!=(e=this.settings.valueTextClass)?e:s.Text;this.value1Text=new t({text:"",style:this.settings.valueTextStyle||{fill:16777215}}),this.value1Text.anchor.set(.5),this.addChild(this.value1Text)}}get slider1(){return this._slider1}set slider2(t){if(t&&(this._slider2&&(this._slider2.removeAllListeners(),this._slider2.destroy()),this._slider2=this.createSlider(t),this.settings.showValue&&!this.value2Text)){var e;const t=null!=(e=this.settings.valueTextClass)?e:s.Text;this.value2Text=new t({text:"",style:this.settings.valueTextStyle||{fill:16777215}}),this.value2Text.anchor.set(.5),this.addChild(this.value2Text)}}get slider2(){return this._slider2}setBackground(t){this.bg&&this.bg.removeAllListeners(),super.setBackground(t),this.activateBG()}activateBG(){this.bg.eventMode="static",this.bg.on("pointerdown",this.startUpdate,this).on("globalpointermove",this.update,this).on("pointerup",this.endUpdate,this).on("pointerupoutside",this.endUpdate,this)}createSlider(t){var e,i;const n=E(t);n.eventMode="static",n.on("pointerdown",t=>{this.bg&&(t.currentTarget=this.bg),this.startUpdate(t)}).on("pointerup",this.endUpdate,this).on("pointerupoutside",this.endUpdate,this),n.x=n.width/2;const o=new s.Container;return o.addChild(n),n instanceof s.Sprite&&n.anchor.set(.5),o.y=null!==(e=this.bg)&&void 0!==e&&e.height?(null===(i=this.bg)||void 0===i?void 0:i.height)/2:0,this.addChild(o),o}startUpdate(t){this.dragging=1;const e=t.currentTarget;this.startX=e.parent.worldTransform.applyInverse(t.global).x,this.startUpdateValue1=this._value1,this.startUpdateValue2=this._value2,this.update(t)}endUpdate(){this.dragging&&(this.dragging=0,(this.startX||this.startUpdateValue1!==this._value1||this.startUpdateValue2!==this._value2)&&this.change(),this.startUpdateValue1=0,this.startUpdateValue2=0)}onClick(){this.change()}update(t){const e=t.currentTarget,{x:i}=e.parent.worldTransform.applyInverse(t.global);i!==this.startX&&(this.startX=0)}change(){}set max(t){this._max=t}get max(){return this._max}set min(t){this._min=t}get min(){return this._min}set step(t){this._step=t}get step(){return this._step}}var Mt=Object.defineProperty,Ot=(t,e,i)=>((t,e,i)=>e in t?Mt(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i)(t,"symbol"!=typeof e?e+"":e,i);var It=Object.defineProperty,Bt=(t,e,i)=>((t,e,i)=>e in t?It(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i)(t,"symbol"!=typeof e?e+"":e,i);class At extends s.Container{constructor(t){super(),Bt(this,"_bg"),Bt(this,"inputMask"),Bt(this,"_cursor"),Bt(this,"_value",""),Bt(this,"_secure",!1),Bt(this,"inputField"),Bt(this,"placeholder"),Bt(this,"editing",!1),Bt(this,"tick",0),Bt(this,"lastInputData",""),Bt(this,"activation",!1),Bt(this,"options"),Bt(this,"input"),Bt(this,"handleActivationBinding",this.handleActivation.bind(this)),Bt(this,"onKeyUpBinding",this.onKeyUp.bind(this)),Bt(this,"stopEditingBinding",this.stopEditing.bind(this)),Bt(this,"onInputBinding",this.onInput.bind(this)),Bt(this,"onPasteBinding",this.onPaste.bind(this)),Bt(this,"onEnter"),Bt(this,"onChange"),Bt(this,"paddingTop",0),Bt(this,"paddingRight",0),Bt(this,"paddingBottom",0),Bt(this,"paddingLeft",0);const e={bg:s.Texture.WHITE,textStyle:{fill:0,align:"center"},TextClass:s.Text,placeholder:"",value:"",maxLength:void 0,secure:!1,align:"left",padding:0,cleanOnFocus:!1,addMask:!1};this.options=_objectSpread(_objectSpread({},e),t);const{padding:i=0,secure:n=!1}=this.options;this.padding=i,this._secure=n,this.cursor="text",this.interactive=!0,this.on("pointertap",()=>{this.activation=!0,s.isMobile.any&&this.handleActivation()}),window.addEventListener(s.isMobile.any?"touchstart":"click",this.handleActivationBinding),this.onEnter=new V.Signal,this.onChange=new V.Signal,s.Ticker.shared.add(t=>this.update(t.deltaTime)),t.bg?this.bg=t.bg:console.error("Input: bg is not defined, please define it.")}onInput(t){var e;this.lastInputData=null!=(e=t.data)?e:""}onKeyUp(t){const e=t.key;["Shift","Control","Alt","Meta","ArrowLeft","ArrowRight","ArrowUp","ArrowDown","CapsLock","AltGraph","Tab","ContextMenu","F1","F2","F3","F4","F5","F6","F7","F8","F9","F10","F11","F12","ScrollLock","Pause","Insert","Delete","Home","End","PageUp","PageDown","NumLock","Dead"].includes(e)||t.metaKey||t.ctrlKey||("Backspace"===e?this._delete():"Escape"===e||"Enter"===e?this.stopEditing():1===e.length?this._add(e):this.lastInputData&&1===this.lastInputData.length&&this._add(this.lastInputData),this.input&&(this.input.value=""))}init(){var t;const{textStyle:e={fill:0,align:"center"},TextClass:i=s.Text,placeholder:n=""}=this.options,o=e.fill&&s.Color.isColorLike(e.fill)?e.fill:0;this.inputField=new i({text:"",style:e}),this._cursor=new s.Sprite(s.Texture.WHITE),this._cursor.tint=o,this._cursor.anchor.set(.5),this._cursor.width=2,this._cursor.height=.8*this.inputField.height,this._cursor.alpha=0,this.placeholder=new i({text:n,style:e}),this.placeholder.visible=!!n,this.addChild(this.inputField,this.placeholder,this._cursor),this.value=null!=(t=this.options.value)?t:"",this.align()}set bg(t){var e;this._bg&&this._bg.destroy();const i=null!=t?t:s.Texture.WHITE;null!==(e=this.options)&&void 0!==e&&e.nineSliceSprite&&("string"==typeof i?this._bg=new s.NineSliceSprite({texture:s.Texture.from(i),leftWidth:this.options.nineSliceSprite[0],topHeight:this.options.nineSliceSprite[1],rightWidth:this.options.nineSliceSprite[2],bottomHeight:this.options.nineSliceSprite[3]}):i instanceof s.Texture?this._bg=new s.NineSliceSprite({texture:i,leftWidth:this.options.nineSliceSprite[0],topHeight:this.options.nineSliceSprite[1],rightWidth:this.options.nineSliceSprite[2],bottomHeight:this.options.nineSliceSprite[3]}):console.warn("NineSliceSprite can not be used with views set as Container.\n Pass the texture or texture name as instead of the Container extended instance.")),this._bg||(this._bg=E(i)),this._bg.cursor="text",this._bg.interactive=!0,this.addChildAt(this._bg,0),this.inputField||this.init(),this.options.addMask&&this.createInputMask(t)}get bg(){return this._bg}_add(t){this.editing&&(this.options.maxLength&&this.value.length>=this.options.maxLength||(this.value=this.value+t,this.onChange.emit(this.value)))}_delete(){const t=this.value.length;this.editing&&0!==t&&(this.value=this.value.substring(0,t-1),this.onChange.emit(this.value))}_startEditing(){this.options.cleanOnFocus&&(this.value=""),this.tick=0,this.editing=!0,this.placeholder&&(this.placeholder.visible=!1),this._cursor&&(this._cursor.alpha=1),this.createInputField(),this.align()}createInputField(){var t,e,i,n,o,l;this.input&&(this.input.removeEventListener("blur",this.stopEditingBinding),this.input.removeEventListener("keydown",this.onKeyUpBinding),this.input.removeEventListener("input",this.onInputBinding),this.input.removeEventListener("paste",this.onPasteBinding),null===(o=this.input)||void 0===o||o.blur(),null===(l=this.input)||void 0===l||l.remove(),this.input=void 0);const r=document.createElement("input");document.body.appendChild(r),r.style.position="fixed",r.style.left=`${this.getGlobalPosition().x}px`,r.style.top=`${this.getGlobalPosition().y}px`,r.style.opacity="0.0000001",r.style.width=`${null!=(t=null===(e=this._bg)||void 0===e?void 0:e.width)?t:100}px`,r.style.height=`${null!=(i=null===(n=this._bg)||void 0===n?void 0:n.height)?i:30}px`,r.style.border="none",r.style.outline="none",r.style.background="white",s.isMobile.android.device?setTimeout(()=>{r.focus(),r.click()},100):(r.focus(),r.click()),r.addEventListener("blur",this.stopEditingBinding),r.addEventListener("keydown",this.onKeyUpBinding),r.addEventListener("input",this.onInputBinding),r.addEventListener("paste",this.onPasteBinding),this.input=r,this.align()}handleActivation(){this.editing||(this.stopEditing(),this.activation&&(this._startEditing(),this.activation=!1))}stopEditing(){var t,e;this.editing&&(this._cursor&&(this._cursor.alpha=0),this.editing=!1,this.placeholder&&0===this.value.length&&(this.placeholder.visible=!0),null===(t=this.input)||void 0===t||t.blur(),null===(e=this.input)||void 0===e||e.remove(),this.input=void 0,this.align(),this.onEnter.emit(this.value))}update(t){this.editing&&(this.tick+=.1*t,this._cursor&&(this._cursor.alpha=Math.round(.5*Math.sin(this.tick)+.5)))}align(){if(!this._bg)return;const t=this.getAlign();this.inputField&&(this.inputField.anchor.set(t,.5),this.inputField.x=this._bg.width*t+(1===t?-this.paddingRight:this.paddingLeft),this.inputField.y=this._bg.height/2+this.paddingTop-this.paddingBottom),this.placeholder&&(this.placeholder.anchor.set(t,.5),this.placeholder.x=this._bg.width*t+(1===t?-this.paddingRight:this.paddingLeft),this.placeholder.y=this._bg.height/2),this._cursor&&this.inputField&&(this._cursor.x=this.getCursorPosX(),this._cursor.y=this.inputField.y)}getAlign(){if(!this._bg||!this.inputField)return 0;const t=.95*this._bg.width,e=this.paddingLeft+this.paddingRight-10;if(this.inputField.width+e>t)return this.editing?1:0;switch(this.options.align){case"left":default:return 0;case"center":return.5;case"right":return 1}}getCursorPosX(){if(!this.inputField)return 0;switch(this.getAlign()){case 0:return this.inputField.x+this.inputField.width;case.5:return this.inputField.x+.5*this.inputField.width;case 1:return this.inputField.x;default:return 0}}set value(t){const e=t.length;this._value=t,this.inputField&&(this.inputField.text=this.secure?"*".repeat(e):t),this.placeholder&&(this.placeholder.visible=0===e&&!this.editing),this.align()}get value(){return this._value}set secure(t){this._secure=t,this.value=this._value}get secure(){return this._secure}set padding(t){var e,i,s,n,o,l,r,a;if("number"==typeof t&&(this.paddingTop=t,this.paddingRight=t,this.paddingBottom=t,this.paddingLeft=t),Array.isArray(t))this.paddingTop=null!=(e=t[0])?e:0,this.paddingRight=null!=(i=null!=(s=t[1])?s:t[0])?i:0,this.paddingBottom=null!=(n=null!=(o=t[2])?o:t[0])?n:0,this.paddingLeft=null!=(l=null!=(r=null!=(a=t[3])?a:t[1])?r:t[0])?l:0;else if("object"==typeof t){var h,d,u,c;this.paddingTop=null!=(h=t.top)?h:0,this.paddingRight=null!=(d=t.right)?d:0,this.paddingBottom=null!=(u=t.bottom)?u:0,this.paddingLeft=null!=(c=t.left)?c:0}}get padding(){return[this.paddingTop,this.paddingRight,this.paddingBottom,this.paddingLeft]}destroy(t){this.off("pointertap"),window.removeEventListener(s.isMobile.any?"touchstart":"click",this.handleActivationBinding),super.destroy(t)}set width(t){var e;null!==(e=this.options)&&void 0!==e&&e.nineSliceSprite?(this._bg&&(this._bg.width=t),this.updateInputMaskSize(),this.align()):super.width=t}get width(){return super.width}set height(t){var e;null!==(e=this.options)&&void 0!==e&&e.nineSliceSprite?(this._bg&&(this._bg.height=t),this.updateInputMaskSize(),this.align()):super.height=t}get height(){return super.height}setSize(t,e){var i;null!==(i=this.options)&&void 0!==i&&i.nineSliceSprite?(this._bg&&this._bg.setSize(t,e),this.updateInputMaskSize(),this.align()):super.setSize(t,e)}createInputMask(t){var e;this.inputMask&&(this.inputField&&(this.inputField.mask=null),this._cursor&&(this._cursor.mask=null),this.inputMask.destroy()),null!==(e=this.options)&&void 0!==e&&e.nineSliceSprite&&"string"==typeof t?this.inputMask=new s.NineSliceSprite({texture:s.Texture.from(t),leftWidth:this.options.nineSliceSprite[0],topHeight:this.options.nineSliceSprite[1],rightWidth:this.options.nineSliceSprite[2],bottomHeight:this.options.nineSliceSprite[3]}):t instanceof s.Sprite?this.inputMask=new s.Sprite(t.texture):t instanceof s.Graphics?this.inputMask=t.clone(!0):this.inputMask=E(t),this.inputField&&(this.inputField.mask=this.inputMask),this._cursor&&(this._cursor.mask=this.inputMask),this.updateInputMaskSize(),this.addChildAt(this.inputMask,0)}updateInputMaskSize(){this.inputMask&&this._bg&&(this.inputMask.setSize(this._bg.width-this.paddingLeft-this.paddingRight,this._bg.height-this.paddingTop-this.paddingBottom),this.inputMask.position.set(this.paddingLeft,this.paddingTop))}onPaste(t){t.preventDefault();const e=(t.clipboardData||window.clipboardData).getData("text");e&&this._add(e)}}var Et=Object.defineProperty,jt=(t,e,i)=>((t,e,i)=>e in t?Et(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i)(t,"symbol"!=typeof e?e+"":e,i);class Rt extends s.Container{constructor(t){super(),jt(this,"target"),jt(this,"border",new s.Graphics),jt(this,"_targetMask"),jt(this,"maskData"),jt(this,"borderWidth",0),jt(this,"borderColor",0),null!=t&&t.target&&this.init(t)}init({target:t,mask:e,borderWidth:i,borderColor:s}){this.target&&this.removeChild(this.target),t&&(this.target=E(t)),this.addChild(this.border),this.target&&this.addChild(this.target),e&&this.applyMask(e),i&&this.setBorder(i,null!=s?s:0)}applyMask(t){this.maskData=t,this._targetMask=E(t),this.addChild(this._targetMask),this.target&&(this.target.mask=this._targetMask)}setBorder(t,e){if(this.borderWidth=t,this.borderColor=e,this.showBorder(),this.maskData&&this._targetMask){const e="string"==typeof this.maskData?s.Sprite.from(this.maskData):this.maskData.clone(!0);e.width+=2*t,e.height+=2*t,this.mask=e,this.addChild(e),this._targetMask.position.set(t)}}showBorder(){if(!this.target)return;const t=2*this.borderWidth;this.border.clear().rect(0,0,this.target.width+t,this.target.height+t).fill(this.borderColor),this.target.x=this.borderWidth,this.target.y=this.borderWidth}hideBorder(){this.border.clear()}}var Ft=Object.defineProperty,Lt=(t,e,i)=>((t,e,i)=>e in t?Ft(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i)(t,"symbol"!=typeof e?e+"":e,i);class Dt extends s.Container{constructor(t){super(),Lt(this,"items",[]),Lt(this,"innerView"),Lt(this,"value",""),Lt(this,"selected",0),Lt(this,"onChange"),Lt(this,"options");this.options=_objectSpread(_objectSpread({},{items:[],type:"vertical",elementsMargin:0,selectedItem:0}),t),this.onChange=new V.Signal,this.init(this.options)}init(t){var e,i,s,n;this.options=t,this.selected=null!=(e=t.selectedItem)?e:0,this.value=null!=(i=null===(s=t.items[this.selected])||void 0===s||null===(n=s.labelText)||void 0===n?void 0:n.text)?i:"",this.innerView?(this.innerView.type=t.type,this.innerView.elementsMargin=t.elementsMargin):this.innerView=new nt({type:t.type,elementsMargin:t.elementsMargin}),this.addItems(t.items),this.addChild(this.innerView),this.selectItem(this.selected)}addItems(t){t.forEach((t,e)=>{var i;t.onChange.connect(()=>this.selectItem(e)),this.items.push(t),null===(i=this.innerView)||void 0===i||i.addChild(t)})}removeItems(t){t.forEach(t=>{var e;const i=this.items[t];i&&(i.onChange.disconnectAll(),null===(e=this.innerView)||void 0===e||e.removeChild(i),this.items.splice(t,1))})}selectItem(t){var e,i,s,n;(this.items.forEach((e,i)=>{e.forceCheck(i===t)}),this.selected!==t)&&this.onChange.emit(t,null!=(s=null===(n=this.items[t].labelText)||void 0===n?void 0:n.text)?s:"");this.value=null!=(e=null===(i=this.options.items[t].labelText)||void 0===i?void 0:i.text)?e:"",this.selected=t}}var Ut=Object.defineProperty,Nt=(t,e,i)=>((t,e,i)=>e in t?Ut(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i)(t,"symbol"!=typeof e?e+"":e,i);class Ht extends s.Container{constructor(t){super(),Nt(this,"view",new s.Container),Nt(this,"openButton"),Nt(this,"closeButton"),Nt(this,"openView"),Nt(this,"scrollBox"),Nt(this,"value",-1),Nt(this,"onSelect"),this.addChild(this.view),this.onSelect=new V.Signal,t&&this.init(t)}init({closedBG:t,textStyle:e,TextClass:i,items:n,openBG:o,selected:l,selectedTextOffset:r,scrollBox:a,visibleItems:h}){var d,u;(i=null!=i?i:s.Text,this.openView&&this.openView!==o&&this.view.removeChild(this.openView),this.openButton?(this.openButton.defaultView=E(t),this.openButton.textView=new i({text:null!=n&&n.items?n.items[0]:"",style:e}),this.openButton.textOffset=null!=r?r:{}):(this.openButton=new et({defaultView:t,text:new i({text:null!=n&&n.items?n.items[0]:"",style:e}),textOffset:r}),this.openButton.onPress.connect(()=>this.toggle()),this.addChild(this.openButton)),this.openView!==o&&(this.openView=E(o),this.view.visible=!1,this.view.addChild(this.openView)),this.closeButton?(this.closeButton.defaultView=(new s.Graphics).rect(0,0,this.openButton.width,this.openButton.height).fill({color:0,alpha:1e-5}),this.closeButton.textView=new i({text:null!=n&&n.items?n.items[0]:"",style:e}),this.openButton.textOffset=null!=r?r:{}):(this.closeButton=new et({defaultView:(new s.Graphics).rect(0,0,this.openButton.width,this.openButton.height).fill({color:0,alpha:1e-5}),text:new i({text:null!=n&&n.items?n.items[0]:"",style:e}),textOffset:r}),this.closeButton.onPress.connect(()=>this.toggle()),this.view.addChild(this.closeButton)),this.scrollBox?this.scrollBox.removeItems():(this.scrollBox=new _t,this.view.addChild(this.scrollBox)),this.scrollBox.init(_objectSpread({type:"vertical",elementsMargin:0,width:this.openButton.width,height:this.openButton.height*(null!=h?h:5),radius:0,padding:0},a)),this.scrollBox.y=this.openButton.height,null!=a&&a.offset)&&(this.scrollBox.x=null!=(d=a.offset.x)?d:0,this.scrollBox.y+=null!=(u=a.offset.y)?u:0);this.addItems(n,l)}addItems(t,e=0){this.convertItemsToButtons(t).forEach((t,i)=>{var s;const n=t.text;i===e&&(this.openButton.text=null!=n?n:"",this.closeButton.text=null!=n?n:""),t.onPress.connect(()=>{this.value=i,this.onSelect.emit(i,null!=n?n:""),this.openButton.text=null!=n?n:"",this.closeButton.text=null!=n?n:"",this.close()}),null===(s=this.scrollBox)||void 0===s||s.addItem(t)})}removeItem(t){this.scrollBox&&this.scrollBox.removeItem(t)}toggle(){this.view.visible=!this.view.visible,this.openButton.visible=!this.openButton.visible}open(){this.view.visible=!0,this.openButton.visible=!1}close(){this.view.visible=!1,this.openButton.visible=!0}convertItemsToButtons({items:t,backgroundColor:e,hoverColor:i,width:n,height:o,textStyle:l,TextClass:r,radius:a}){r=null!=r?r:s.Text;const h=[];return t.forEach(t=>{const d=(new s.Graphics).roundRect(0,0,n,o,a).fill(e),u=null!=i?i:e,c=(new s.Graphics).roundRect(0,0,n,o,a).fill(u),p=new r({text:t,style:l}),v=new et({defaultView:d,hoverView:c,text:p});h.push(v)}),h}}var zt=Object.defineProperty,Wt=(t,e,i)=>((t,e,i)=>e in t?zt(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i)(t,"symbol"!=typeof e?e+"":e,i);function Gt(t,e){var i,s,n;if(!t||!e)return null;const o=function(t){var e,i,s,n,o,l;const r=null===(i=(e=t).getSystem)||void 0===i?void 0:i.call(e,"Renderer");if(r)return r;const a=null!==(s=t.systems)&&void 0!==s?s:[];for(const t of a){const e=null!==(o=null===(n=null==t?void 0:t.constructor)||void 0===n?void 0:n.systemName)&&void 0!==o?o:null===(l=null==t?void 0:t.constructor)||void 0===l?void 0:l.name;if("Renderer"===e||"RendererSystem"===e)return t;if("Renderer"===(null==t?void 0:t.name)||"RendererSystem"===(null==t?void 0:t.name))return t;if(null==t?void 0:t.containerManager)return t}return null}(t),l=null!==(i=null==o?void 0:o.containerManager)&&void 0!==i?i:null===(s=null==o?void 0:o.rendererManager)||void 0===s?void 0:s.containerManager;return(null==l?void 0:l.getContainer)&&null!==(n=l.getContainer(e.id))&&void 0!==n?n:null}function qt(t,e,i){const s=Gt(t,e);if(!s)return!1;try{return i.parent&&i.parent!==s&&i.parent.removeChild(i),"function"==typeof s.addChildAt?s.addChildAt(i,0):s.addChild(i),!0}catch(t){return!1}}function Yt(t,e,i){if(!i)return;const s=Gt(t,e);try{s&&i.parent===s&&s.removeChild(i),"function"==typeof i.destroy&&i.destroy({children:!0})}catch(t){}}function Xt(t,e,i,s=4){const n=Gt(t,e);n?i(n):s<=0||queueMicrotask(()=>Xt(t,e,i,s-1))}function $t(t,e,i){var n,o;if(!i)return null;if("entityName"in i){const n=function(t,e){var i,s,n;if("function"==typeof t.findChildByName)try{const i=t.findChildByName(e);if(i)return i}catch(t){}const o=null!==(s=null===(i=t.transform)||void 0===i?void 0:i.children)&&void 0!==s?s:[];for(const t of o)if((null===(n=null==t?void 0:t.gameObject)||void 0===n?void 0:n.name)===e)return t.gameObject;return null}(e,i.entityName);if(n){const e=Gt(t,n);if(e){try{e.parent&&e.parent.removeChild(e)}catch(t){}return function(t,e){const i=new s.Container;return i.label=e?`${e}:view-ref`:"plugin-ui-view-ref",i.addChild(t),i}(e,n.name)}}return i.fallback?$t(t,e,i.fallback):null}if("shape"in i)return null!==(n=Zt(i.shape))&&void 0!==n?n:i.fallback?$t(t,e,i.fallback):null;if("ui"in i)return null!==(o=Zt(i.ui))&&void 0!==o?o:i.fallback?$t(t,e,i.fallback):null;if("texture"in i){const n=Jt(t,i.texture);return n?new s.Sprite(n):i.fallback?$t(t,e,i.fallback):null}if("color"in i)try{const t=new s.Graphics;return i.radius&&i.radius>0?t.roundRect(0,0,i.width,i.height,i.radius):t.rect(0,0,i.width,i.height),t.fill(i.color),t}catch(t){return console.error("[view-resolver] color view create failed",t),null}return null}function Kt(t,e,i){if(!t)return t;const s=function(t){return{top:Qt(null==t?void 0:t.top),right:Qt(null==t?void 0:t.right),bottom:Qt(null==t?void 0:t.bottom),left:Qt(null==t?void 0:t.left)}}(e);if(0===s.top&&0===s.right&&0===s.bottom&&0===s.left)return t;const n=t.fallback?Kt(t.fallback,s,i):void 0;if("color"in t){const e=te(t.width,s.left+s.right),i=te(t.height,s.top+s.bottom);return _extends(_extends(_extends({},t),{width:e,height:i,radius:ie(t.radius,e,i)}),n?{fallback:n}:{})}return"shape"in t?_extends(_extends(_extends({},t),{shape:se(t.shape,s,i)}),n?{fallback:n}:{}):"ui"in t?_extends(_extends(_extends({},t),{ui:se(t.ui,s,i)}),n?{fallback:n}:{}):n?_extends(_extends({},t),{fallback:n}):t}function Jt(t,e){var i,n,o;const l=null!==(i=null==t?void 0:t.resource)&&void 0!==i?i:null;if(null===(n=null==l?void 0:l.instances)||void 0===n?void 0:n[e]){const t=l.instances[e];if(t instanceof s.Texture)return t;if((null==t?void 0:t.image)instanceof s.Texture)return t.image}try{return null!==(o=s.Texture.from(e))&&void 0!==o?o:null}catch(t){return null}}function Zt(t){var e,i,n,o,l;if(!t||!t.type)return null;const r=new s.Graphics,{style:a}=t,h=null!==(e=a.x)&&void 0!==e?e:0,d=null!==(i=a.y)&&void 0!==i?i:0,u=null!==(n=a.width)&&void 0!==n?n:0,c=null!==(o=a.height)&&void 0!==o?o:0,p=null!==(l=a.radius)&&void 0!==l?l:0;switch(t.type){case"rect":!function(t,e,i,s,n){const o=t;if("function"==typeof o.rect)return void o.rect(e,i,s,n);o.drawRect(e,i,s,n)}(r,h,d,u,c);break;case"roundedRect":!function(t,e,i,s,n,o){const l=t;if("function"==typeof l.roundRect)return void l.roundRect(e,i,s,n,o);l.drawRoundedRect(e,i,s,n,o)}(r,h,d,u,c,p);break;case"circle":!function(t,e,i,s){const n=t;if("function"==typeof n.circle)return void n.circle(e,i,s);n.drawCircle(e,i,s)}(r,h+p,d+p,p);break;case"ellipse":!function(t,e,i,s,n){const o=t;if("function"==typeof o.ellipse)return void o.ellipse(e,i,s,n);o.drawEllipse(e,i,s,n)}(r,h+u/2,d+c/2,u/2,c/2)}void 0!==a.fill&&r.fill(a.fill),void 0!==a.stroke&&void 0!==a.lineWidth?r.stroke({color:a.stroke,width:a.lineWidth}):void 0!==a.stroke&&r.stroke({color:a.stroke,width:1}),void 0!==a.alpha&&(r.alpha=a.alpha);try{Object.defineProperty(r,"clone",{value:()=>{var e;return null!==(e=Zt(t))&&void 0!==e?e:new s.Graphics},configurable:!0})}catch(t){}return r}function Qt(t){return"number"==typeof t&&Number.isFinite(t)?Math.max(0,t):0}function te(t,e){return Math.max(0,t-e)}function ee(t,e,i){return"number"==typeof t?te(t,i):"number"==typeof e?te(e,i):t}function ie(t,e,i){if("number"!=typeof t||!Number.isFinite(t))return t;const s=[t];return"number"==typeof e&&s.push(e/2),"number"==typeof i&&s.push(i/2),Math.max(0,Math.min(...s))}function se(t,e,i){var s;const n=null!==(s=t.style)&&void 0!==s?s:{},o=ee(n.width,null==i?void 0:i.width,e.left+e.right),l=ee(n.height,null==i?void 0:i.height,e.top+e.bottom),r=ie(n.radius,o,l);return _extends(_extends({},t),{style:_extends(_extends(_extends(_extends({},n),void 0!==o?{width:o}:{}),void 0!==l?{height:l}:{}),void 0!==r?{radius:r}:{})})}class ne extends e.Component{constructor(){super(...arguments),this.toggleCount=0,this.pressCount=0,this.downCount=0,this.upCount=0,this.hoverCount=0,this.outCount=0,this.upOutCount=0,this.changeCount=0,this.updateCount=0,this.selectCount=0,this.lastSignal="idle",this.visualState="default",this.focused=!1,this.__evaExplicitFields=new Set}init(t){t&&this.applyParams(t)}applyDeclarativeProps(t,e){this.applyParams(t)}applyParams(t){const e=this.constructor.__def;if(e)for(const[i,s]of Object.entries(e.fields)){if(!(i in t))continue;const e=t[i];if(void 0!==e)switch(this.__evaExplicitFields.add(i),s.kind){case"scalar":case"opaque":this[i]=e;break;case"shallowMerge":this[i]=_extends(_extends({},this[i]),e);break;case"arrayCopy":Array.isArray(e)&&(this[i]=e.slice());break;case"tuple":!Array.isArray(e)||s.tupleLength&&e.length!==s.tupleLength||(this[i]=e.slice())}}}}function oe(t){const e=t.name;class i extends ne{constructor(i){super(i),this.componentName=e;for(const[e,i]of Object.entries(t.fields))void 0!==i.default?this[e]=le(i.default):e in this||(this[e]=void 0)}static getInspectorMetadata(){return function(t){const e=[];for(const[i,s]of Object.entries(t.fields))s.inspector&&e.push(_extends(_extends({},s.inspector),{name:s.inspector.name||i}));return{name:t.name,type:"object",isArray:!1,isFolder:!0,children:e}}(t)}}const s=i;s.componentName=e,s.__def=t;try{Object.defineProperty(s,"name",{value:e})}catch(t){}if(t.mixin)for(const[e,s]of Object.entries(t.mixin))i.prototype[e]=s;return s}function le(t){return null===t||"object"!=typeof t?t:Array.isArray(t)?t.slice():_extends({},t)}function re(t,e={}){var i;const s=null===(i=null==t?void 0:t.transform)||void 0===i?void 0:i.size;if(!s)return null;const n=ce(s.width,e.allowZero),o=ce(s.height,e.allowZero);return void 0===n&&void 0===o?null:{width:n,height:o}}function ae(t){if(!t)return!1;const e=t.__evaExplicitFields;return e&&"function"==typeof e.has?e.has("width")||e.has("height"):void 0!==t.width||void 0!==t.height}function he(t,e,i,s,n){const o=re(s,{allowZero:"transform-change"===n});if(!o)return!1;const l={componentName:t.name,component:i,gameObject:s,source:n};return t.applySize?t.applySize(e,o,null!=i?i:{},l):de(e,o),!0}function de(t,e){if(!t||!e)return;const i=ce(e.width,!0),s=ce(e.height,!0);if(void 0===i&&void 0===s)return;const n=null!=i?i:pe(t,"width"),o=null!=s?s:pe(t,"height");let l=!1;if("function"==typeof t.setSize&&void 0!==n&&void 0!==o)try{t.setSize(n,o),l=!0}catch(t){l=!1}l||(void 0!==i&&(t.width=i),void 0!==s&&(t.height=s)),ue(t)}function ue(t){var e,i,s,n;try{null===(i=null===(e=null==t?void 0:t.list)||void 0===e?void 0:e.arrangeChildren)||void 0===i||i.call(e)}catch(t){}try{null===(s=null==t?void 0:t.arrangeChildren)||void 0===s||s.call(t)}catch(t){}try{null===(n=null==t?void 0:t.resize)||void 0===n||n.call(t,!0)}catch(t){}}function ce(t,e=!1){const i=Number(t);if(Number.isFinite(i)&&!(e?i<0:i<=0))return i}function pe(t,e){const i=Number(null==t?void 0:t[e]);return Number.isFinite(i)&&i>=0?i:void 0}const ve={kind:"scalar",default:!0,inspector:{name:"enabled",type:"boolean"}},ge={kind:"scalar",inspector:{name:"bindToStore",type:"string"}};function fe(){const[t,e]=this.valueRange;if(e<=t)return 0;return(Math.max(t,Math.min(e,this.value))-t)/(e-t)*100}function me(t){if(void 0!==t)return"string"==typeof t?parseInt(t.replace("#",""),16):t}const we={name:"Button",signalPrefix:"button",pixiClass:A,fields:{enabled:ve,view:{kind:"opaque",inspector:{name:"view",type:"object"}}},views:{kind:"single",key:"view",required:!0},positional:!0,optionsBuilder:(t,e)=>[e.single],postCreate:(t,e)=>{t.enabled=e.enabled},signalMap:t=>({press:()=>(t.pressCount+=1,t.lastSignal="press",t.visualState="default",{pressCount:t.pressCount,lastSignal:t.lastSignal,visualState:t.visualState}),down:()=>(t.downCount+=1,t.lastSignal="down",t.visualState="pressed",{downCount:t.downCount,lastSignal:t.lastSignal,visualState:t.visualState}),up:()=>(t.upCount+=1,t.lastSignal="up",t.visualState="default",{upCount:t.upCount,lastSignal:t.lastSignal,visualState:t.visualState}),hover:()=>(t.hoverCount+=1,t.lastSignal="hover",t.visualState="hover",{hoverCount:t.hoverCount,lastSignal:t.lastSignal,visualState:t.visualState}),out:()=>(t.outCount+=1,t.lastSignal="out",t.visualState="default",{outCount:t.outCount,lastSignal:t.lastSignal,visualState:t.visualState}),upOut:()=>(t.upOutCount+=1,t.lastSignal="upOut",t.visualState="default",{upOutCount:t.upOutCount,lastSignal:t.lastSignal,visualState:t.visualState})}),syncOnChange:(t,e)=>{t.enabled=e.enabled}},_e={name:"FancyButton",signalPrefix:"fancybutton",pixiClass:et,fields:{enabled:ve,state:{kind:"scalar",default:"default",inspector:{name:"state",type:"string"}},selected:{kind:"scalar",default:!1,inspector:{name:"selected",type:"boolean"}},text:{kind:"scalar",inspector:{name:"text",type:"string"}},padding:{kind:"scalar",inspector:{name:"padding",type:"number"}},selectedTint:{kind:"scalar",default:"#FFD680",inspector:{name:"selectedTint",type:"color"}},views:{kind:"shallowMerge",default:{},inspector:{name:"views",type:"object",isFolder:!0,children:[{name:"default",type:"object"},{name:"hover",type:"object"},{name:"pressed",type:"object"},{name:"disabled",type:"object"},{name:"icon",type:"object"}]}},offset:{kind:"shallowMerge",default:{}},textOffset:{kind:"shallowMerge",default:{}},iconOffset:{kind:"shallowMerge",default:{}},nineSliceSprite:{kind:"opaque"},textStyle:{kind:"shallowMerge",default:{}},textClass:{kind:"scalar",default:"text"},bitmapFontName:{kind:"scalar",default:"TitleFont"},defaultTextScale:{kind:"opaque"},defaultIconScale:{kind:"opaque"},defaultTextAnchor:{kind:"opaque"},defaultIconAnchor:{kind:"opaque"},anchor:{kind:"scalar"},anchorX:{kind:"scalar"},anchorY:{kind:"scalar"},scale:{kind:"scalar"},animations:{kind:"opaque"},contentFittingMode:{kind:"scalar"},ignoreRefitting:{kind:"scalar"},width:{kind:"scalar",inspector:{name:"width",type:"number"}},height:{kind:"scalar",inspector:{name:"height",type:"number"}}},views:{kind:"object",folder:"views",keys:[{name:"default",required:!1},{name:"hover",required:!1},{name:"pressed",required:!1},{name:"disabled",required:!1},{name:"icon",required:!1}]},optionsBuilder:(t,e)=>{var i,s,n,o,l;const r={text:ye(t),padding:t.padding,offset:t.offset,textOffset:t.textOffset,iconOffset:t.iconOffset,nineSliceSprite:t.nineSliceSprite,defaultTextScale:t.defaultTextScale,defaultIconScale:t.defaultIconScale,defaultTextAnchor:t.defaultTextAnchor,defaultIconAnchor:t.defaultIconAnchor,anchor:t.anchor,anchorX:t.anchorX,anchorY:t.anchorY,scale:t.scale,animations:t.animations,contentFittingMode:t.contentFittingMode,ignoreRefitting:t.ignoreRefitting};return(null===(i=e.object)||void 0===i?void 0:i.default)&&(r.defaultView=Se(t,"default",e.object.default)),(null===(s=e.object)||void 0===s?void 0:s.hover)&&(r.hoverView=Se(t,"hover",e.object.hover)),(null===(n=e.object)||void 0===n?void 0:n.pressed)&&(r.pressedView=Se(t,"pressed",e.object.pressed)),(null===(o=e.object)||void 0===o?void 0:o.disabled)&&(r.disabledView=Se(t,"disabled",e.object.disabled)),(null===(l=e.object)||void 0===l?void 0:l.icon)&&(r.icon=e.object.icon),r},postCreate:(t,e)=>{t.enabled=e.enabled,e.state&&"function"==typeof t.setState&&t.setState(e.state,!0),be(t,e),Be(t,e),e.selected&&ke(t,e)},signalMap:t=>({press:()=>(t.pressCount+=1,{}),hover:()=>(t.hoverCount+=1,{}),down:!0,up:!0}),syncOnChange:(t,e)=>{t.enabled=e.enabled,void 0!==e.text&&t.text!==e.text&&(t.text=e.text),void 0!==e.padding&&t.padding!==e.padding&&(t.padding=e.padding),void 0!==e.textOffset&&(t.textOffset=e.textOffset),void 0!==e.iconOffset&&(t.iconOffset=e.iconOffset),void 0!==e.defaultTextScale&&(t.defaultTextScale=e.defaultTextScale),void 0!==e.defaultIconScale&&(t.defaultIconScale=e.defaultIconScale),void 0!==e.defaultTextAnchor&&(t.defaultTextAnchor=e.defaultTextAnchor),void 0!==e.defaultIconAnchor&&(t.defaultIconAnchor=e.defaultIconAnchor),void 0!==e.contentFittingMode&&(t.contentFittingMode=e.contentFittingMode),void 0!==e.ignoreRefitting&&t.options&&(t.options.ignoreRefitting=e.ignoreRefitting),e.state&&"function"==typeof t.setState&&t.setState(e.state,!0),be(t,e),Be(t,e),ke(t,e)}};function be(t,e){var i,s,n,o,l,r,a;if(!(void 0!==e.anchor||void 0!==e.anchorX||void 0!==e.anchorY)||!(null===(i=null==t?void 0:t.anchor)||void 0===i?void 0:i.set))return;const h=null!==(o=null!==(n=null!==(s=e.anchorX)&&void 0!==s?s:e.anchor)&&void 0!==n?n:t.anchor.x)&&void 0!==o?o:0,d=null!==(a=null!==(r=null!==(l=e.anchorY)&&void 0!==l?l:e.anchor)&&void 0!==r?r:t.anchor.y)&&void 0!==a?a:0;try{t.anchor.set(h,d)}catch(t){}}function ye(t){var e,i,n;if(void 0===t.text)return;const o=String(t.text);if("html"===t.textClass)return new s.HTMLText({text:o,style:t.textStyle});if("bitmap"===t.textClass){const l=null!==(e=t.bitmapFontName)&&void 0!==e?e:"TitleFont";return function(t,e){if(xe.has(t))return;try{s.BitmapFontManager.install({name:t,style:null!=e?e:{}})}catch(t){}xe.add(t)}(l,t.textStyle),new s.BitmapText({text:o,style:{fontFamily:l,fontSize:null!==(n=null===(i=t.textStyle)||void 0===i?void 0:i.fontSize)&&void 0!==n?n:40}})}return t.textStyle&&Object.keys(t.textStyle).length>0?new s.Text({text:o,style:t.textStyle}):t.text}const xe=new Set;function Se(t,e,i){var s;const n=null===(s=t.views)||void 0===s?void 0:s[e];return t.nineSliceSprite&&n&&"texture"in n?Ie(n.texture):i}function ke(t,e){try{const i=t.defaultView;i&&"tint"in i&&(i.tint=e.selected?e.selectedTint:16777215)}catch(t){}}const Ce={name:"CheckBox",signalPrefix:"checkbox",pixiClass:U,fields:{enabled:ve,checked:{kind:"scalar",default:!1,inspector:{name:"checked",type:"boolean"}},text:{kind:"scalar",inspector:{name:"text",type:"string"}},bindToStore:ge,views:{kind:"shallowMerge",default:{},inspector:{name:"views",type:"object",isFolder:!0,children:[{name:"checked",type:"object"},{name:"unchecked",type:"object"}]}},textStyle:{kind:"shallowMerge",default:{fill:16777215}},textOffset:{kind:"shallowMerge",default:{}},disabledStyle:{kind:"shallowMerge",default:{alpha:.4,scale:1}}},views:{kind:"object",folder:"views",keys:[{name:"checked",required:!0},{name:"unchecked",required:!0}]},optionsBuilder:(t,e)=>({style:{checked:e.object.checked,unchecked:e.object.unchecked,text:t.textStyle,textOffset:t.textOffset},text:t.text,checked:t.checked}),signalMap:t=>({check:e=>(t.checked=e,t.toggleCount+=1,{value:e})}),syncOnChange:(t,e)=>{t.checked!==e.checked&&(t.checked=e.checked),void 0!==e.text&&t.text!==e.text&&(t.text=e.text),function(t,e){var i,s,n;const o=t.style;if(!o||!e.textStyle&&!e.textOffset)return;const l=_extends(_extends({},o),{text:null!==(i=e.textStyle)&&void 0!==i?i:o.text,textOffset:null!==(s=e.textOffset)&&void 0!==s?s:o.textOffset});t._style=l,t.labelText&&e.textStyle&&(t.labelText.style=e.textStyle);try{null===(n=t.alignText)||void 0===n||n.call(t)}catch(t){}}(t,e)}},Ve={name:"Switcher",signalPrefix:"switcher",pixiClass:F,fields:{active:{kind:"scalar",default:0,inspector:{name:"active",type:"number"}},views:{kind:"arrayCopy",default:[]},triggerEvent:{kind:"scalar",default:"onPress",inspector:{name:"triggerEvent",type:"string"}},bindToStore:ge},views:{kind:"array",key:"views",minLength:2},positional:!0,optionsBuilder:(t,e)=>[e.array,t.triggerEvent,t.active],signalMap:t=>({change:e=>(t.active="number"==typeof e?e:e?1:0,t.changeCount+=1,{active:t.active})}),syncOnChange:(t,e)=>{t.active!==e.active&&(t.active=e.active),void 0!==e.triggerEvent&&(t.triggerEvents=e.triggerEvent)}},Te={name:"Slider",signalPrefix:"slider",pixiClass:class extends Pt{constructor(t){var e;super(_objectSpread({slider1:t.slider,value1:t.value},t)),Wt(this,"sliderOptions"),Wt(this,"onUpdate",new V.Signal),Wt(this,"onChange",new V.Signal),this.sliderOptions=t,this.step=t.step||1,this.value=null!=(e=t.value)?e:this.min,this.updateSlider()}get value(){return this._value1}set value(t){var e;t!==this._value1&&(t<this.min&&(t=this.min),t>this.max&&(t=this.max),this._value1=t,this.updateSlider(),null===(e=this.onUpdate)||void 0===e||e.emit(this.value))}set max(t){super.max=t,this.updateSlider()}get max(){return super.max}set min(t){super.min=t,this.updateSlider()}get min(){return super.min}set step(t){super.step=t,this.updateSlider()}get step(){return super.step}set slider(t){this.slider1=t,this.updateSlider()}update(t){var e;if(super.update(t),!this.dragging)return;const i=t.currentTarget,{x:s}=i.parent.worldTransform.applyInverse(t.global),n=s/((null===(e=this.bg)||void 0===e?void 0:e.width)||1),o=this.min+n*(this.max-this.min);this.value=Math.round(o/this.step)*this.step}change(){var t;null===(t=this.onChange)||void 0===t||t.emit(this.value)}updateSlider(){var t,e,i,s,n,o;if(this._slider1&&(this.progress=((null!=(t=this.value)?t:this.min)-this.min)/(this.max-this.min)*100,this._slider1.x=(null!=(e=null===(i=this.bg)||void 0===i?void 0:i.width)?e:0)/100*this.progress-this._slider1.width/2,this._slider1.y=(null!=(s=null===(n=this.bg)||void 0===n?void 0:n.height)?s:0)/2,null!==(o=this.sliderOptions)&&void 0!==o&&o.showValue&&this.value1Text)){var l,r,a,h;this.value1Text.text=`${Math.round(this.value)}`;const t=this._slider1.x+this._slider1.width/2,e=this._slider1.y;this.value1Text.x=t+(null!=(l=null===(r=this.sliderOptions.valueTextOffset)||void 0===r?void 0:r.x)?l:0),this.value1Text.y=e+(null!=(a=null===(h=this.sliderOptions.valueTextOffset)||void 0===h?void 0:h.y)?a:0)}}set width(t){super.width=t,this.updateSlider()}get width(){return super.width}set height(t){super.height=t,this.updateSlider()}get height(){return super.height}setSize(t,e){super.setSize(t,e),this.updateSlider()}},fields:{enabled:ve,value:{kind:"scalar",default:0,inspector:{name:"value",type:"number"}},min:{kind:"scalar",default:0,inspector:{name:"min",type:"number"}},max:{kind:"scalar",default:100,inspector:{name:"max",type:"number"}},step:{kind:"scalar",default:1,inspector:{name:"step",type:"number"}},orientation:{kind:"scalar",default:"horizontal",inspector:{name:"orientation",type:"string"}},showValue:{kind:"scalar",default:!1,inspector:{name:"showValue",type:"boolean"}},views:{kind:"shallowMerge",default:{}},nineSliceSprite:{kind:"opaque"},fillPaddings:{kind:"shallowMerge",default:{}},valueTextStyle:{kind:"shallowMerge",default:{fill:16777215}},valueTextOffset:{kind:"shallowMerge",default:{}},width:{kind:"scalar",inspector:{name:"width",type:"number"}},height:{kind:"scalar",inspector:{name:"height",type:"number"}},bindToStore:ge},views:{kind:"object",folder:"views",keys:[{name:"bg",required:!0},{name:"fill",required:!0},{name:"thumb",required:!0}]},optionsBuilder:(t,e)=>{var i,s,n;return{bg:Oe(null===(i=t.views)||void 0===i?void 0:i.bg,e.object.bg),fill:Oe(null===(s=t.views)||void 0===s?void 0:s.fill,e.object.fill),slider:Oe(null===(n=t.views)||void 0===n?void 0:n.thumb,e.object.thumb),min:t.min,max:t.max,step:t.step,value:t.value,showValue:t.showValue,fillPaddings:t.fillPaddings,nineSliceSprite:t.nineSliceSprite,valueTextStyle:t.valueTextStyle,valueTextOffset:t.valueTextOffset}},postCreate:(t,e)=>Be(t,e),signalMap:t=>({update:e=>(t.value=e,t.updateCount+=1,{value:e}),change:e=>(t.value=e,t.changeCount+=1,{value:e})}),syncOnChange:(t,e)=>{t.value!==e.value&&(t.value=e.value),Be(t,e)}},Pe={name:"DoubleSlider",signalPrefix:"doubleslider",pixiClass:class extends Pt{constructor(t){super(t),Ot(this,"sliderOptions"),Ot(this,"activeValue"),Ot(this,"onChange",new V.Signal),Ot(this,"onUpdate",new V.Signal),this.sliderOptions=t,this.setInitialState()}setInitialState(){this.validateValues();const{value1:t,value2:e}=this.sliderOptions;this.updateProgress(t,e),this.value2=null!=e?e:0,this.value1=null!=t?t:0}updateProgress(t=this.value1,e=this.value2){this.progressStart=(t-this.min)/(this.max-this.min)*100,this.progress=(e-this.min)/(this.max-this.min)*100}validateValues(){var t,e,i,s;const n=null!=(t=this.sliderOptions.min)?t:this.min,o=null!=(e=this.sliderOptions.max)?e:this.max;this.sliderOptions.value1||(this.sliderOptions.value1=n),this.sliderOptions.value2||(this.sliderOptions.value2=o);let l=null!=(i=this.sliderOptions.value1)?i:n,r=null!=(s=this.sliderOptions.value2)?s:o;r<l&&(r=l),l<n&&(l=n),l>o&&(l=o),r>o&&(r=o),this.sliderOptions.value1=l,this.sliderOptions.value2=r}get value1(){return this._value1}set value1(t){var e;t!==this._value1&&(t<this.min&&(t=this.min),t>this._value2&&(t=this._value2),this._value1=t,this.updateSlider1(),null===(e=this.onUpdate)||void 0===e||e.emit(this.value1,this.value2))}get value2(){return this._value2}set value2(t){var e;t!==this._value2&&(t<this._value1&&(t=this._value1),t>this.max&&(t=this.max),this._value2=t,this.updateSlider2(),null===(e=this.onUpdate)||void 0===e||e.emit(this.value1,this.value2))}update(t){var e;if(super.update(t),!this.dragging)return;const i=t.currentTarget,{x:s}=i.parent.worldTransform.applyInverse(t.global),n=this._slider1?Math.abs(s-this._slider1.x-this._slider1.width):1/0,o=this._slider2?Math.abs(s-this._slider2.x):1/0;this.activeValue||(this.slider1&&s<this.slider1.x?this.activeValue="value1":this.slider2&&s>this.slider2.x?this.activeValue="value2":this.activeValue=n<o?"value1":"value2");const l=this.validate(s/(null===(e=this.bg)||void 0===e?void 0:e.width)*100);"value1"===this.activeValue?(this.progressStart=l,this.value1=this.min+(this.max-this.min)/100*l,this.updateProgress(this.value1,this.value2)):(this.progress=l,this.value2=this.min+(this.max-this.min)/100*l,this.updateProgress(this.value1,this.value2))}endUpdate(){super.endUpdate(),this.activeValue=void 0}change(){var t;null===(t=this.onChange)||void 0===t||t.emit(this.value1,this.value2)}set slider1(t){super.slider1=t,this.updateSlider1()}get slider1(){return this._slider1}set slider2(t){super.slider2=t,this.updateSlider2()}get slider2(){return this._slider2}updateSlider1(){var t,e,i,s,n;if(this._slider1&&(this.updateProgress(this.value1,this.value2),this._slider1.x=(null!=(t=null===(e=this.bg)||void 0===e?void 0:e.width)?t:0)/100*this.progressStart-this._slider1.width/2,this._slider1.y=(null!=(i=null===(s=this.bg)||void 0===s?void 0:s.height)?i:0)/2,this._slider2&&this._slider1.x>this._slider2.x&&(this._slider1.x=this._slider2.x),null!==(n=this.sliderOptions)&&void 0!==n&&n.showValue&&this.value1Text&&this._slider1)){var o,l,r,a;this.value1Text.text=`${Math.round(this.value1)}`;const t=this._slider1.x+this._slider1.width/2,e=this._slider1.y;this.value1Text.x=t+(null!=(o=null===(l=this.sliderOptions.valueTextOffset)||void 0===l?void 0:l.x)?o:0),this.value1Text.y=e+(null!=(r=null===(a=this.sliderOptions.valueTextOffset)||void 0===a?void 0:a.y)?r:0)}}updateSlider2(){var t,e,i,s,n;if(this._slider2&&(this.updateProgress(this.value1,this.value2),this._slider2.x=(null!=(t=null===(e=this.bg)||void 0===e?void 0:e.width)?t:0)/100*this.progress-this._slider2.width/2,this._slider2.y=(null!=(i=null===(s=this.bg)||void 0===s?void 0:s.height)?i:0)/2,this._slider1&&this._slider2.x<this._slider1.x&&(this._slider2.x=this._slider1.x),null!==(n=this.sliderOptions)&&void 0!==n&&n.showValue&&this.value2Text&&this._slider2)){var o,l,r,a;this.value2Text.text=`${Math.round(this.value2)}`;const t=this._slider2.x+this._slider2.width/2,e=this._slider2.y;this.value2Text.x=t+(null!=(o=null===(l=this.sliderOptions.valueTextOffset)||void 0===l?void 0:l.x)?o:0),this.value2Text.y=e+(null!=(r=null===(a=this.sliderOptions.valueTextOffset)||void 0===a?void 0:a.y)?r:0)}}set width(t){super.width=t,this.updateSlider1(),this.updateSlider2()}get width(){return super.width}set height(t){super.height=t,this.updateSlider1(),this.updateSlider2()}get height(){return super.height}setSize(t,e){super.setSize(t,e),this.updateSlider1(),this.updateSlider2()}},fields:{enabled:ve,value1:{kind:"scalar",default:0,inspector:{name:"value1",type:"number"}},value2:{kind:"scalar",default:100,inspector:{name:"value2",type:"number"}},min:{kind:"scalar",default:0,inspector:{name:"min",type:"number"}},max:{kind:"scalar",default:100,inspector:{name:"max",type:"number"}},step:{kind:"scalar",default:1},showValue:{kind:"scalar",default:!1,inspector:{name:"showValue",type:"boolean"}},views:{kind:"shallowMerge",default:{}},nineSliceSprite:{kind:"opaque"},fillPaddings:{kind:"shallowMerge",default:{}},valueTextStyle:{kind:"shallowMerge",default:{fill:16777215}},valueTextOffset:{kind:"shallowMerge",default:{}},width:{kind:"scalar",inspector:{name:"width",type:"number"}},height:{kind:"scalar",inspector:{name:"height",type:"number"}},bindToStore1:{kind:"scalar"},bindToStore2:{kind:"scalar"}},views:{kind:"object",folder:"views",keys:[{name:"bg",required:!0},{name:"fill",required:!0},{name:"slider1",required:!0},{name:"slider2",required:!0}]},optionsBuilder:(t,e)=>{var i,s,n,o;return{bg:Oe(null===(i=t.views)||void 0===i?void 0:i.bg,e.object.bg),fill:Oe(null===(s=t.views)||void 0===s?void 0:s.fill,e.object.fill),slider1:Oe(null===(n=t.views)||void 0===n?void 0:n.slider1,e.object.slider1),slider2:Oe(null===(o=t.views)||void 0===o?void 0:o.slider2,e.object.slider2),min:t.min,max:t.max,step:t.step,value1:t.value1,value2:t.value2,showValue:t.showValue,fillPaddings:t.fillPaddings,nineSliceSprite:t.nineSliceSprite,valueTextStyle:t.valueTextStyle,valueTextOffset:t.valueTextOffset}},postCreate:(t,e)=>Be(t,e),signalMap:t=>({update:(e,i)=>(t.value1=e,t.value2=i,t.updateCount+=1,{value1:e,value2:i}),change:(e,i)=>(t.value1=e,t.value2=i,t.changeCount+=1,{value1:e,value2:i})}),syncOnChange:(t,e)=>{t.value1!==e.value1&&(t.value1=e.value1),t.value2!==e.value2&&(t.value2=e.value2),Be(t,e)}},Me={name:"ProgressBar",signalPrefix:"progressbar",pixiClass:Ct,fields:{value:{kind:"scalar",default:0,inspector:{name:"value",type:"number"}},valueRange:{kind:"tuple",tupleLength:2,default:[0,100],inspector:{name:"valueRange",type:"number",isArray:!0}},bgView:{kind:"opaque"},fillView:{kind:"opaque"},nineSliceSprite:{kind:"opaque"},fillPaddings:{kind:"shallowMerge",default:{}},width:{kind:"scalar",inspector:{name:"width",type:"number"}},height:{kind:"scalar",inspector:{name:"height",type:"number"}},bindToStore:ge},views:{kind:"object",folder:"__progress_views__",keys:[]},optionsBuilder:(t,e)=>({bg:t.__resolved_bg_view,fill:t.__resolved_fill_view,fillPaddings:t.fillPaddings,nineSliceSprite:t.nineSliceSprite,progress:Ae(t)}),postCreate:(t,e)=>Be(t,e),syncOnChange:(t,e)=>{const i=Ae(e);t.progress!==i&&(t.progress=i),Be(t,e)},mixin:{getProgressPct:fe}};function Oe(t,e){return t&&"texture"in t?Ie(t.texture):e}function Ie(t){var e;return null!==(e=Jt(void 0,t))&&void 0!==e?e:t}function Be(t,e){var i,s;if(void 0===e.width&&void 0===e.height)return;const n=null!==(i=e.width)&&void 0!==i?i:t.width,o=null!==(s=e.height)&&void 0!==s?s:t.height;if("function"==typeof t.setSize)try{return void t.setSize(n,o)}catch(t){}void 0!==e.width&&(t.width=e.width),void 0!==e.height&&(t.height=e.height)}function Ae(t){const[e,i]=t.valueRange;if(i<=e)return 0;return(Math.max(e,Math.min(i,t.value))-e)/(i-e)*100}const Ee={name:"CircularProgressBar",signalPrefix:"circularprogressbar",pixiClass:z,fields:{value:{kind:"scalar",default:0,inspector:{name:"value",type:"number"}},valueRange:{kind:"tuple",tupleLength:2,default:[0,100],inspector:{name:"valueRange",type:"number",isArray:!0}},radius:{kind:"scalar",default:60,inspector:{name:"radius",type:"number"}},lineWidth:{kind:"scalar",default:12,inspector:{name:"lineWidth",type:"number"}},startAngle:{kind:"scalar",default:-90,inspector:{name:"startAngle",type:"number",step:5}},backgroundColor:{kind:"scalar",default:"#1f2937",inspector:{name:"backgroundColor",type:"color"}},fillColor:{kind:"scalar",default:"#22c55e",inspector:{name:"fillColor",type:"color"}},backgroundAlpha:{kind:"scalar",default:1,inspector:{name:"backgroundAlpha",type:"number",step:.05}},fillAlpha:{kind:"scalar",default:1,inspector:{name:"fillAlpha",type:"number",step:.05}},cap:{kind:"scalar",inspector:{name:"cap",type:"string"}},rotation:{kind:"scalar",default:0},offset:{kind:"shallowMerge",default:{}},bindToStore:ge},optionsBuilder:t=>({radius:t.radius,lineWidth:t.lineWidth,backgroundColor:t.backgroundColor,fillColor:t.fillColor,backgroundAlpha:t.backgroundAlpha,fillAlpha:t.fillAlpha,cap:t.cap,value:Ae(t)}),postCreate:(t,e)=>je(t,e),syncOnChange:(t,e)=>{const i=Ae(e);t.progress!==i&&(t.progress=i),je(t,e)},mixin:{getProgressPct:fe}};function je(t,e){var i,s;void 0!==e.rotation&&(t.rotation=e.rotation),e.offset&&(t.x=null!==(i=e.offset.x)&&void 0!==i?i:0,t.y=null!==(s=e.offset.y)&&void 0!==s?s:0)}const Re={name:"Input",signalPrefix:"input",pixiClass:At,fields:{enabled:ve,value:{kind:"scalar",default:"",inspector:{name:"value",type:"string"}},placeholder:{kind:"scalar",default:"",inspector:{name:"placeholder",type:"string"}},maxLength:{kind:"scalar",default:100,inspector:{name:"maxLength",type:"number"}},secure:{kind:"scalar",default:!1,inspector:{name:"secure",type:"boolean"}},align:{kind:"scalar",default:"left",inspector:{name:"align",type:"string"}},padding:{kind:"tuple",tupleLength:4,default:[8,8,8,8]},textStyle:{kind:"shallowMerge",default:{fontFamily:"Arial",fontSize:16,fill:"#222"}},bgView:{kind:"opaque"},nineSliceSprite:{kind:"opaque"},cleanOnFocus:{kind:"scalar",default:!1,inspector:{name:"cleanOnFocus",type:"boolean"}},addMask:{kind:"scalar",default:!1,inspector:{name:"addMask",type:"boolean"}},width:{kind:"scalar",inspector:{name:"width",type:"number"}},height:{kind:"scalar",inspector:{name:"height",type:"number"}},bindToStore:ge},views:{kind:"single",key:"bgView",required:!0},optionsBuilder:(t,e)=>{return{bg:(i=t.bgView,s=e.single,n=t.nineSliceSprite,n&&i&&"texture"in i?Ie(i.texture):s),textStyle:t.textStyle,placeholder:t.placeholder,value:t.value,maxLength:t.maxLength,secure:t.secure,align:t.align,padding:t.padding,cleanOnFocus:t.cleanOnFocus,nineSliceSprite:t.nineSliceSprite,addMask:t.addMask};var i,s,n},postCreate:(t,e)=>{t.enabled=e.enabled,Be(t,e)},signalMap:t=>({change:e=>(t.value=e,t.changeCount+=1,{value:e}),enter:t=>({value:t})}),syncOnChange:(t,e)=>{t.value!==e.value&&(t.value=e.value),t.enabled!==e.enabled&&(t.enabled=e.enabled),Be(t,e)}},Fe={name:"List",signalPrefix:"list",pixiClass:nt,fields:{type:{kind:"scalar",default:"vertical",inspector:{name:"type",type:"string"}},elementsMargin:{kind:"scalar",default:0,inspector:{name:"elementsMargin",type:"number"}},padding:{kind:"scalar"},vertPadding:{kind:"scalar"},horPadding:{kind:"scalar"},topPadding:{kind:"scalar"},bottomPadding:{kind:"scalar"},leftPadding:{kind:"scalar"},rightPadding:{kind:"scalar"},maxWidth:{kind:"scalar"},maxHeight:{kind:"scalar"},itemsChildName:{kind:"scalar",default:"items"}},optionsBuilder:(t,e)=>({type:t.type,elementsMargin:t.elementsMargin,padding:t.padding,vertPadding:t.vertPadding,horPadding:t.horPadding,topPadding:t.topPadding,bottomPadding:t.bottomPadding,leftPadding:t.leftPadding,rightPadding:t.rightPadding,maxWidth:t.maxWidth,maxHeight:t.maxHeight}),postCreate:(t,e)=>{var i;for(const s of null!==(i=e.__resolved_items)&&void 0!==i?i:[])try{t.addChild(s)}catch(t){}"function"==typeof t.arrangeChildren&&t.arrangeChildren()},syncOnChange:(t,e)=>{t.type!==e.type&&(t.type=e.type),t.elementsMargin!==e.elementsMargin&&(t.elementsMargin=e.elementsMargin),"function"==typeof t.arrangeChildren&&t.arrangeChildren()},applySize:function(t,e){const i=ce(e.width,!0),s=ce(e.height,!0);if(void 0!==i)try{t.maxWidth=i}catch(t){}if(void 0!==s)try{t.maxHeight=s}catch(t){}ue(t)}},Le={name:"ScrollBox",signalPrefix:"scrollbox",pixiClass:_t,fields:{width:{kind:"scalar",default:320,inspector:{name:"width",type:"number"}},height:{kind:"scalar",default:240,inspector:{name:"height",type:"number"}},direction:{kind:"scalar",default:"vertical",inspector:{name:"direction",type:"string"}},contentChildName:{kind:"scalar",default:"content"},background:{kind:"scalar",inspector:{name:"background",type:"color"}},radius:{kind:"scalar",default:0,inspector:{name:"radius",type:"number"}},elementsMargin:{kind:"scalar",default:0},disableDynamicRendering:{kind:"scalar",default:!1},disableEasing:{kind:"scalar",default:!1,inspector:{name:"disableEasing",type:"boolean"}},padding:{kind:"scalar",default:0},vertPadding:{kind:"scalar"},horPadding:{kind:"scalar"},topPadding:{kind:"scalar"},bottomPadding:{kind:"scalar"},leftPadding:{kind:"scalar"},rightPadding:{kind:"scalar"},globalScroll:{kind:"scalar",default:!0},shiftScroll:{kind:"scalar",default:!1},proximityRange:{kind:"scalar"},proximityDebounce:{kind:"scalar"},inertia:{kind:"scalar",default:!0},inertiaDecay:{kind:"scalar",default:.92},bounceFactor:{kind:"scalar",default:.18}},mixin:{applyOffset(){},getBounds:()=>({minX:0,maxX:0,minY:0,maxY:0})},optionsBuilder:(t,e)=>{var i;return{width:t.width,height:t.height,type:null!==(i={horizontal:"horizontal",vertical:"vertical",both:"bidirectional"}[t.direction])&&void 0!==i?i:"vertical",background:t.background,radius:t.radius,elementsMargin:t.elementsMargin,padding:t.padding,vertPadding:t.vertPadding,horPadding:t.horPadding,topPadding:t.topPadding,bottomPadding:t.bottomPadding,leftPadding:t.leftPadding,rightPadding:t.rightPadding,disableEasing:t.disableEasing,disableDynamicRendering:t.disableDynamicRendering,globalScroll:t.globalScroll,shiftScroll:t.shiftScroll,proximityRange:t.proximityRange,proximityDebounce:t.proximityDebounce}},signalMap:()=>({scroll:t=>({value:t})}),postCreate:(t,e)=>{var i,s;if("function"==typeof t.addItems)try{t.addItems(null!==(i=e.__resolved_items)&&void 0!==i?i:[])}catch(t){}if("function"==typeof(null===(s=t.list)||void 0===s?void 0:s.arrangeChildren)&&t.list.arrangeChildren(),"function"==typeof t.resize)try{t.resize()}catch(t){}},syncOnChange:(t,e)=>{Be(t,e)}},De={name:"Select",signalPrefix:"select",pixiClass:Ht,fields:{items:{kind:"arrayCopy",default:[]},selectedIndex:{kind:"scalar",default:-1,inspector:{name:"selectedIndex",type:"number"}},placeholder:{kind:"scalar",default:"",inspector:{name:"placeholder",type:"string"}},closedView:{kind:"opaque"},openView:{kind:"opaque"},textStyle:{kind:"shallowMerge",default:{fontFamily:"Arial",fontSize:14,fill:"#222"}},nineSliceSprite:{kind:"opaque"},width:{kind:"scalar",inspector:{name:"width",type:"number"}},height:{kind:"scalar",inspector:{name:"height",type:"number"}},radius:{kind:"scalar",default:4},visibleItems:{kind:"scalar"},itemWidth:{kind:"scalar"},itemHeight:{kind:"scalar"},itemBackgroundColor:{kind:"scalar",default:0},itemHoverColor:{kind:"scalar",default:6710886},selectedTextOffset:{kind:"shallowMerge",default:{}},scrollBox:{kind:"shallowMerge",default:{}},textClass:{kind:"scalar",default:"text"},open:{kind:"scalar",default:!1},bindToStore:ge},views:{kind:"object",folder:"__select_views__",keys:[]},optionsBuilder:t=>{var e,i,n,o,l;return{closedBG:t.__resolved_closedView,openBG:t.__resolved_openView,textStyle:t.textStyle,TextClass:"html"===t.textClass?s.HTMLText:void 0,selectedTextOffset:t.selectedTextOffset,items:{items:(null!==(e=t.items)&&void 0!==e?e:[]).map(t=>t.text),backgroundColor:t.itemBackgroundColor,hoverColor:t.itemHoverColor,width:null!==(n=null!==(i=t.itemWidth)&&void 0!==i?i:t.width)&&void 0!==n?n:200,height:null!==(l=null!==(o=t.itemHeight)&&void 0!==o?o:t.height)&&void 0!==l?l:30,textStyle:t.textStyle,TextClass:"html"===t.textClass?s.HTMLText:void 0,radius:t.radius},selected:t.selectedIndex>=0?t.selectedIndex:void 0,visibleItems:t.visibleItems,scrollBox:_extends({width:t.width,height:t.height&&t.visibleItems?t.height*t.visibleItems:void 0,radius:t.radius},t.scrollBox),nineSliceSprite:t.nineSliceSprite}},postCreate:(t,e)=>{e.open&&"function"==typeof t.open&&t.open()},signalMap:t=>({select:(e,i)=>(t.selectedIndex=e,t.selectCount+=1,{index:e,text:i})}),syncOnChange:(t,e)=>{e.open&&"function"==typeof t.open&&t.open(),e.open||"function"!=typeof t.close||t.close()}},Ue={name:"Dialog",signalPrefix:"dialog",pixiClass:xt,fields:{open:{kind:"scalar",default:!1,inspector:{name:"open",type:"boolean"}},title:{kind:"scalar",inspector:{name:"title",type:"string"}},width:{kind:"scalar",inspector:{name:"width",type:"number"}},height:{kind:"scalar",inspector:{name:"height",type:"number"}},padding:{kind:"scalar",inspector:{name:"padding",type:"number"}},backdropColor:{kind:"scalar",default:0,inspector:{name:"backdropColor",type:"color"}},backdropAlpha:{kind:"scalar",default:.5,inspector:{name:"backdropAlpha",type:"number",step:.05}},backdropView:{kind:"opaque"},backgroundView:{kind:"opaque"},closeOnBackdropClick:{kind:"scalar",default:!0,inspector:{name:"closeOnBackdropClick",type:"boolean"}},contentChildName:{kind:"scalar",default:"content",inspector:{name:"contentChildName",type:"string"}},nineSliceSprite:{kind:"opaque"},titleStyle:{kind:"shallowMerge",default:{}},content:{kind:"scalar"},contentStyle:{kind:"shallowMerge",default:{}},contentButtons:{kind:"arrayCopy",default:[]},contentCheckBoxes:{kind:"arrayCopy",default:[]},buttons:{kind:"arrayCopy",default:[]},buttonList:{kind:"shallowMerge",default:{}},buttonListOffset:{kind:"shallowMerge",default:{}},scrollBox:{kind:"shallowMerge",default:{}},animations:{kind:"opaque"},bindToStore:ge},optionsBuilder:t=>{var e;const i=t.nineSliceSprite&&t.backgroundView&&"texture"in t.backgroundView?t.backgroundView.texture:null!==(e=t.__resolved_background_view)&&void 0!==e?e:new s.Container;return{backdrop:t.__resolved_backdropView,backdropColor:me(t.backdropColor),backdropAlpha:t.backdropAlpha,background:i,title:We(t.title,t.titleStyle),content:Ge(t),buttons:qe(t.buttons),buttonList:t.buttonList,scrollBox:t.scrollBox,width:t.width,height:t.height,padding:t.padding,closeOnBackdropClick:t.closeOnBackdropClick,nineSliceSprite:t.nineSliceSprite,animations:t.animations}},postCreate:(t,e)=>{He(t,e),e.open&&"function"==typeof t.open&&t.open()},applySize:function(t,e,i){var s,n,o,l,r,a,h,d,u,c,p,v,g,f,m,w,_,b,y,x,S;const k=Ne(null!==(n=null!==(s=e.width)&&void 0!==s?s:i.width)&&void 0!==n?n:null===(o=null==t?void 0:t.options)||void 0===o?void 0:o.width),C=Ne(null!==(r=null!==(l=e.height)&&void 0!==l?l:i.height)&&void 0!==r?r:null===(a=null==t?void 0:t.options)||void 0===a?void 0:a.height);if(void 0===k&&void 0===C)return;t.options=null!==(h=t.options)&&void 0!==h?h:{},void 0!==k&&(t.options.width=k);void 0!==C&&(t.options.height=C);const V=null!=k?k:Number(t.options.width)||Number(null===(d=t.innerView)||void 0===d?void 0:d.width)||0,T=null!=C?C:Number(t.options.height)||Number(null===(u=t.innerView)||void 0===u?void 0:u.height)||0,P=Number(null!==(p=null!==(c=i.padding)&&void 0!==c?c:t.options.padding)&&void 0!==p?p:20)||20;if(t.innerView)if(void 0!==k&&(t.innerView.width=k),void 0!==C&&(t.innerView.height=C),"anchor"in t.innerView&&(null===(v=t.innerView.anchor)||void 0===v?void 0:v.set))t.innerView.anchor.set(.5,.5);else try{null===(f=null===(g=t.innerView.pivot)||void 0===g?void 0:g.set)||void 0===f||f.call(g,V/2,T/2)}catch(t){}t.titleText&&(t.titleText.x=V/2,t.titleText.y=P);const M=Number(null===(m=t.titleText)||void 0===m?void 0:m.height)||0,O=Number(null===(w=t.buttonContainer)||void 0===w?void 0:w.height)||0;t.buttonContainer&&(t.buttonContainer.x=V/2-(Number(t.buttonContainer.width)||0)/2,t.buttonContainer.y=T-P-O);if(t.scrollBox){t.scrollBox.x=P,t.scrollBox.y=P+M;const e=null===(_=i.scrollBox)||void 0===_?void 0:_.size,s=null!==(b=Ne(null==e?void 0:e.width))&&void 0!==b?b:Math.max(0,V-2*P),n=null!==(y=Ne(null==e?void 0:e.height))&&void 0!==y?y:Math.max(0,T-2*P-M-O);"function"==typeof t.scrollBox.setSize?t.scrollBox.setSize(s,n):(t.scrollBox.width=s,t.scrollBox.height=n);try{null===(S=(x=t.scrollBox).resize)||void 0===S||S.call(x,!0)}catch(t){}}He(t,_extends(_extends({},i),{width:V,height:T}))},onAttachedExtra:(t,e,i)=>{!function(t,e,i){const s=e.__dialogContentButtons;if(!Array.isArray(s)||0===s.length||t.__evaDialogContentButtonPressesWired)return;t.__evaDialogContentButtonPressesWired=!0,t.__evaDialogContentButtonPressCleanups=s.map(s=>{var n;const o=null===(n=s.button)||void 0===n?void 0:n.onPress;if(!o||"function"!=typeof o.connect)return;const l=o.connect(()=>{var n,o,l,r;const a=null!==(o=null!==(n=s.params.value)&&void 0!==n?n:s.params.text)&&void 0!==o?o:s.index;e.selectedContentIndex=s.index,e.selectedContentValue=a,e.selectCount=(null!==(l=e.selectCount)&&void 0!==l?l:0)+1,e.lastSignal="select",function(t,e){var i,s,n;const o=_extends({entityName:null==t?void 0:t.name},e);try{null===(i=null==t?void 0:t.emit)||void 0===i||i.call(t,"select",o)}catch(t){}try{null===(s=null==t?void 0:t.emit)||void 0===s||s.call(t,"dialog:select",o)}catch(t){}const l="undefined"!=typeof globalThis?globalThis.mx:void 0;if(null===(n=null==l?void 0:l.event)||void 0===n?void 0:n.emit)try{l.event.emit("dialog:select",o)}catch(t){}}(i,{index:s.index,text:String(null!==(r=s.params.text)&&void 0!==r?r:""),value:a}),s.params.closeOnPress&&"function"==typeof t.close&&t.close();const h=Number(s.params.reopenDelay);Number.isFinite(h)&&h>=0&&"function"==typeof t.open&&setTimeout(()=>{try{t.open()}catch(t){}},h)});return()=>{try{l.disconnect()}catch(t){}}}).filter(Boolean)}(t,e,i)},signalMap:t=>({close:()=>(t.open=!1,{}),select:(t,e)=>({index:t,text:e})}),syncOnChange:(t,e)=>{He(t,e),e.open&&!t.isOpen&&"function"==typeof t.open?t.open():!e.open&&t.isOpen&&"function"==typeof t.close&&t.close()}};function Ne(t){const e=Number(t);return Number.isFinite(e)&&e>0?e:void 0}function He(t,e){var i,s;const n=null==t?void 0:t.innerView,o=null==t?void 0:t.contentView;(null==n?void 0:n.anchor)&&o&&e.width&&e.height&&(o.x=-e.width/2,o.y=-e.height/2),ze(t,"buttonListOffset",t.buttonContainer,e.buttonListOffset),ze(t,"scrollBoxOffset",t.scrollBox,null===(i=e.scrollBox)||void 0===i?void 0:i.offset),function(t,e){var i,s,n;const o=null==t?void 0:t.scrollBox;if(!o)return;const l=null!==(i=t.__evaDialogBaseScrollBoxSize)&&void 0!==i?i:{width:o.width,height:o.height};t.__evaDialogBaseScrollBoxSize=l;const r=t.__evaDialogAppliedScrollBoxSize;if(!e&&!r)return;const a=null!==(s=null==e?void 0:e.width)&&void 0!==s?s:l.width,h=null!==(n=null==e?void 0:e.height)&&void 0!==n?n:l.height;"function"==typeof o.setSize?o.setSize(a,h):(o.width=a,o.height=h);"function"==typeof o.resize&&o.resize(!0);t.__evaDialogAppliedScrollBoxSize=!!e}(t,null===(s=e.scrollBox)||void 0===s?void 0:s.size)}function ze(t,e,i,s){var n,o,l,r;if(!i)return;const a=null!==(n=t.__evaDialogAppliedOffsets)&&void 0!==n?n:{},h=null!==(o=a[e])&&void 0!==o?o:{x:0,y:0},d={x:null!==(l=null==s?void 0:s.x)&&void 0!==l?l:0,y:null!==(r=null==s?void 0:s.y)&&void 0!==r?r:0};i.x+=d.x-h.x,i.y+=d.y-h.y,t.__evaDialogAppliedOffsets=_extends(_extends({},a),{[e]:d})}function We(t,e){if(void 0!==t)return e&&Object.keys(e).length>0?new s.Text({text:t,style:e}):t}function Ge(t){var e,i;if(null===(e=t.contentButtons)||void 0===e?void 0:e.length){const e=[],i=t.contentButtons.map((t,i)=>{const s=new et(Ye(t));return Be(s,t),void 0!==t.disabled&&(s.enabled=!t.disabled),e.push({button:s,params:t,index:i}),s});return t.__dialogContentButtons=e,i}return(null===(i=t.contentCheckBoxes)||void 0===i?void 0:i.length)?t.contentCheckBoxes.map(t=>new U(function(t){var e,i,n,o,l,r;const a=null!==(e=t.size)&&void 0!==e?e:30,h=null!==(i=t.radius)&&void 0!==i?i:5,d=null!==(n=t.strokeColor)&&void 0!==n?n:Ke,u=null!==(o=t.strokeWidth)&&void 0!==o?o:2;return{style:{unchecked:(new s.Graphics).roundRect(0,0,a,a,h).fill(null!==(l=t.uncheckedColor)&&void 0!==l?l:"#3e3f40").stroke({color:d,width:u}),checked:(new s.Graphics).roundRect(0,0,a,a,h).fill(null!==(r=t.checkedColor)&&void 0!==r?r:$e).stroke({color:d,width:u}),text:t.textStyle},text:t.text,checked:t.checked}}(t))):We(t.content,t.contentStyle)}function qe(t){if(null==t?void 0:t.length)return t.map(t=>{const e=Ye(t),i=void 0!==t.disabled||!(!t.nineSliceSprite||void 0===t.width&&void 0===t.height);if("button"===t.kind||!i)return e;const s=new et(e);return Be(s,t),s.enabled=!t.disabled,s})}function Ye(t){var e,i,s,n,o,l,r,a,h,d;if("button"===t.kind)return function(t){var e,i,s,n,o,l;const r=null!==(e=t.width)&&void 0!==e?e:110,a=null!==(i=t.height)&&void 0!==i?i:48,h=null!==(s=t.radius)&&void 0!==s?s:12,d=Je(r,a,h,null!==(n=t.color)&&void 0!==n?n:$e),u=We(t.text,t.textStyle);if(u){u.x=r/2,u.y=a/2;try{null===(l=null===(o=u.anchor)||void 0===o?void 0:o.set)||void 0===l||l.call(o,.5)}catch(t){}d.addChild(u)}const c=new B(d);void 0!==t.disabled&&(c.enabled=!t.disabled);return c}(t);const u=null!==(e=t.width)&&void 0!==e?e:110,c=null!==(i=t.height)&&void 0!==i?i:48,p=null!==(s=t.radius)&&void 0!==s?s:12,v=null!==(n=t.color)&&void 0!==n?n:$e;return{text:We(t.text,t.textStyle),defaultView:null!==(o=Xe(t.defaultView))&&void 0!==o?o:Je(u,c,p,v),hoverView:null!==(l=Xe(t.hoverView))&&void 0!==l?l:Je(u,c,p,null!==(r=t.hoverColor)&&void 0!==r?r:v),pressedView:null!==(a=Xe(t.pressedView))&&void 0!==a?a:Je(u,c,p,null!==(h=t.pressedColor)&&void 0!==h?h:v),disabledView:null!==(d=Xe(t.disabledView))&&void 0!==d?d:t.disabledColor?Je(u,c,p,t.disabledColor):void 0,nineSliceSprite:t.nineSliceSprite,enabled:void 0===t.disabled?void 0:!t.disabled,animations:t.animations}}function Xe(t){return t?Ie(t):void 0}const $e="#e91e63",Ke="#ffffff";function Je(t,e,i,n){return(new s.Graphics).roundRect(0,0,t,e,i).fill(n)}const Ze={name:"MaskedFrame",signalPrefix:"maskedframe",pixiClass:Rt,fields:{targetView:{kind:"opaque"},maskView:{kind:"opaque"},borderView:{kind:"opaque"},borderWidth:{kind:"scalar",default:0,inspector:{name:"borderWidth",type:"number"}},borderColor:{kind:"scalar",default:0,inspector:{name:"borderColor",type:"color"}}},optionsBuilder:t=>({target:t.__resolved_target_view,mask:t.__resolved_mask_view,borderWidth:t.borderWidth,borderColor:t.borderColor})},Qe=oe(we),ti=oe(_e),ei=oe(Ce),ii=oe(Ve),si=oe(Te),ni=oe(Pe),oi=oe(Me),li=oe(Ee),ri=oe(Re),ai=oe(Fe),hi=oe(Le),di=oe(De),ui=oe(Ue),ci=oe(Ze),pi={Button:we,FancyButton:_e,CheckBox:Ce,Switcher:Ve,Slider:Te,DoubleSlider:Pe,ProgressBar:Me,CircularProgressBar:Ee,Input:Re,List:Fe,ScrollBox:Le,Select:De,Dialog:Ue,MaskedFrame:Ze};class vi extends e.Component{constructor(){super(...arguments),this.componentName="RadioGroup",this.selectedId=void 0,this.direction="vertical",this.elementsMargin=4,this.boundCheckBoxes=[]}static getInspectorMetadata(){return{name:vi.componentName,type:"object",isArray:!1,isFolder:!0,children:[{name:"selectedId",type:"string",isArray:!1},{name:"direction",type:"string",isArray:!1},{name:"elementsMargin",type:"number",isArray:!1},{name:"childNames",type:"string",isArray:!0}]}}init(t){t&&this.applyParams(t)}applyDeclarativeProps(t,e){this.applyParams(t)}applySelection(){for(const{name:t,cb:e}of this.boundCheckBoxes){const i=t===this.selectedId;e.checked!==i&&(e.checked=i)}}applyParams(t){"string"==typeof t.selectedId&&(this.selectedId=t.selectedId),Array.isArray(t.childNames)&&(this.childNames=t.childNames.slice()),t.direction&&(this.direction=t.direction),"number"==typeof t.elementsMargin&&(this.elementsMargin=t.elementsMargin)}}function gi(t,e,i){const s=[],{go:n,prefix:o,emitToMx:l=!0}=e;for(const[e,r]of Object.entries(i)){const i=fi(t,e);if(!i)continue;const a=i.connect((...t)=>{var i,s,a,h,d;const u=!0===r?t[0]:mi(r,t),c="object"==typeof u&&null!==u?_extends({entityName:n.name},u):{entityName:n.name,value:u};try{null===(s=(i=n).emit)||void 0===s||s.call(i,e,c)}catch(t){}try{null===(h=(a=n).emit)||void 0===h||h.call(a,`${o}:${e}`,c)}catch(t){}if(l){const t="undefined"!=typeof globalThis?globalThis.mx:void 0;if(null===(d=null==t?void 0:t.event)||void 0===d?void 0:d.emit)try{t.event.emit(`${o}:${e}`,c)}catch(t){}}});s.push(()=>{try{a.disconnect()}catch(t){}})}return s}function fi(t,e){const i=[`on${e.charAt(0).toUpperCase()}${e.slice(1)}`,`on${e.charAt(0).toUpperCase()}${e.slice(1)}Change`];for(const e of i){const i=null==t?void 0:t[e];if(i&&"function"==typeof i.connect)return i}return null}function mi(t,e){var i;try{return null!==(i=t(...e))&&void 0!==i?i:{}}catch(t){return{}}}vi.componentName="RadioGroup";let wi=class extends e.System{constructor(){super(...arguments),this.name="UISystem",this.instances=new Map,this.signalCleanups=new Map,this.transformSizeAuthorities=new Set,this.radioGroupInstances=new Map}get checkBoxInstances(){let t=this.instances.get("CheckBox");return t||(t=new Map,this.instances.set("CheckBox",t)),t}update(t){var e,i,s;const n=null!==(s=null===(i=null===(e=this.componentObserver)||void 0===e?void 0:e.clear)||void 0===i?void 0:i.call(e))&&void 0!==s?s:[];for(const t of n)this.componentChanged(t)}componentChanged(t){const e=t.componentName;if("Transform"===e)return this.handleTransformSizeChanged(t);if(function(t){return"Shape"===t||"UI"===t||"UIComponent"===t}(e))return this.handleShape(t);if("RadioGroup"===e)return this.handleRadioGroup(t);const i=pi[e];return i?this.handleGeneric(i,t):void 0}handleShape(t){if(t.type===e.OBSERVER_TYPE.ADD||t.type===e.OBSERVER_TYPE.CHANGE){const e=t.component;"function"==typeof e.redraw&&e.redraw()}}handleGeneric(t,i){var s;const n=i.component,o=n.gameObject;if(!o)return;const l=this.getInstanceMap(t.name);if(i.type===e.OBSERVER_TYPE.ADD)Xt(this.gameRef(o),o,()=>this.attachGeneric(t,n,o,l));else if(i.type===e.OBSERVER_TYPE.CHANGE){const e=l.get(o.id);if(!e)return void Xt(this.gameRef(o),o,()=>this.attachGeneric(t,n,o,l));null===(s=t.syncOnChange)||void 0===s||s.call(t,e,n),this.transformSizeAuthorities.has(o.id)&&he(t,e,n,o,"component-change")}else i.type===e.OBSERVER_TYPE.REMOVE&&this.detachGeneric(o.id,l,o)}attachGeneric(t,e,i,s){var n,o,l,r,a,h,d,u,c;if(s.has(i.id))return;const p=this.gameRef(i),v=function(t,e,i,s){var n,o;if(!s)return{};switch(s.kind){case"single":{const n=i[s.key],o=$t(t,e,n);return s.required&&!o?null:{single:o}}case"object":{const o=null!==(n=i[s.folder])&&void 0!==n?n:{},l={};for(const{name:i,required:n}of s.keys){const s=$t(t,e,o[i]);if(n&&!s)return null;l[i]=s}return{object:l}}case"array":{const n=(null!==(o=i[s.key])&&void 0!==o?o:[]).map(i=>$t(t,e,i)).filter(Boolean);return n.length<s.minLength?null:{array:n}}}}(p,i,e,t.views);if(t.views&&null===v)return;if(function(t,e,i,s){switch(t){case"ProgressBar":{const t=e.nineSliceSprite?e.fillView:Kt(e.fillView,e.fillPaddings,{width:e.width,height:e.height});e.__resolved_bg=$t(i,s,e.bgView),e.__resolved_fill=$t(i,s,t),e.__resolved_bg_view=e.nineSliceSprite&&e.bgView&&"texture"in e.bgView?e.bgView.texture:e.__resolved_bg,e.__resolved_fill_view=e.nineSliceSprite&&e.fillView&&"texture"in e.fillView?e.fillView.texture:e.__resolved_fill;break}case"Select":e.__resolved_closedView=$t(i,s,e.closedView),e.__resolved_openView=$t(i,s,e.openView);break;case"Dialog":e.__resolved_backdropView=$t(i,s,e.backdropView),e.__resolved_backgroundView=$t(i,s,e.backgroundView),e.__resolved_background_view=e.nineSliceSprite&&e.backgroundView&&"texture"in e.backgroundView?e.backgroundView.texture:e.__resolved_backgroundView;break;case"MaskedFrame":e.__resolved_targetView=$t(i,s,e.targetView),e.__resolved_maskView=$t(i,s,e.maskView),e.__resolved_target_view=e.targetView&&"texture"in e.targetView?e.targetView.texture:e.__resolved_targetView,e.__resolved_mask_view=e.maskView&&"texture"in e.maskView?e.maskView.texture:e.__resolved_maskView}}(t.name,e,p,i),!function(t,e){switch(t){case"ProgressBar":return!(!e.__resolved_bg_view||!e.__resolved_fill_view);case"Select":return!(!e.__resolved_closedView||!e.__resolved_openView);case"Dialog":default:return!0;case"MaskedFrame":return!(!e.__resolved_target_view||!e.__resolved_mask_view)}}(t.name,e))return;if("List"===t.name||"ScrollBox"===t.name){const l="List"===t.name?e.itemsChildName:e.contentChildName;e.__resolved_items=function(t,e,i){var s,n,o;const l=[],r=xi(e,i);if(!r)return l;const a=(null===(s=r.transform)||void 0===s?void 0:s.children)||[];for(const e of a){const i=null==e?void 0:e.gameObject;if(!i)continue;const s=Gt(t,i);if(s){if(s.width<=0||s.height<=0)continue;try{null===(o=null===(n=s.parent)||void 0===n?void 0:n.removeChild)||void 0===o||o.call(n,s)}catch(t){}l.push(bi(s,i))}}return l}(p,i,l);const r=function(t,e){var i,s,n;const o=xi(t,e);return null!==(n=null===(s=null===(i=null==o?void 0:o.transform)||void 0===i?void 0:i.children)||void 0===s?void 0:s.length)&&void 0!==n?n:0}(i,l);if(r>0&&e.__resolved_items.length<r&&(null!==(n=e.__collect_retry)&&void 0!==n?n:0)<10)return e.__collect_retry=(null!==(o=e.__collect_retry)&&void 0!==o?o:0)+1,void requestAnimationFrame(()=>this.attachGeneric(t,e,i,s))}const g=this.applyTransientTransformSize(e,i),f=t.optionsBuilder(e,null!=v?v:{}),m=t.positional?new t.pixiClass(...f):new t.pixiClass(f);if(null===(l=t.postCreate)||void 0===l||l.call(t,m,e),this.transformSizeAuthorities.has(i.id)||!ae(e)){he(t,m,e,i,"initial-transform")&&this.transformSizeAuthorities.add(i.id)}if(s.set(i.id,m),qt(p,i,m),"Dialog"===t.name){const t=xi(i,null!==(r=e.contentChildName)&&void 0!==r?r:"content");if(t){const e=Gt(p,t);if(e)try{null===(h=(a=m).addChild)||void 0===h||h.call(a,e)}catch(t){}}}if("MaskedFrame"===t.name&&e.borderView){const t=$t(p,i,e.borderView);if(t)try{null===(u=(d=m).addChild)||void 0===u||u.call(d,t)}catch(t){}}if(t.signalMap){const s=gi(m,{go:i,prefix:t.signalPrefix},t.signalMap(e));this.signalCleanups.set(i.id,s)}null===(c=t.onAttachedExtra)||void 0===c||c.call(t,m,e,i,p),g()}detachGeneric(t,e,i){const s=e.get(t);Yt(this.gameRef(i),i,s),e.delete(t);const n=this.signalCleanups.get(t);n&&(n.forEach(t=>t()),this.signalCleanups.delete(t))}handleRadioGroup(t){const i=t.component,s=i.gameObject;if(s)if(t.type===e.OBSERVER_TYPE.ADD)Xt(this.gameRef(s),s,()=>queueMicrotask(()=>this.attachRadioGroup(i)));else if(t.type===e.OBSERVER_TYPE.CHANGE)i.applySelection();else if(t.type===e.OBSERVER_TYPE.REMOVE){const t=this.radioGroupInstances.get(s.id);Yt(this.gameRef(s),s,t),this.radioGroupInstances.delete(s.id);const e=this.signalCleanups.get(s.id);e&&(e.forEach(t=>t()),this.signalCleanups.delete(s.id))}}attachRadioGroup(t){var e,i,s,n,o;const l=t.gameObject,r=this.gameRef(l);if(!l||this.radioGroupInstances.has(l.id))return;t.boundCheckBoxes=[];const a=[],h=[],d=(null===(e=l.transform)||void 0===e?void 0:e.children)||[];for(const e of d){const o=null==e?void 0:e.gameObject;if(!o)continue;if(t.childNames&&!t.childNames.includes(o.name))continue;const l=null===(i=o.getComponent)||void 0===i?void 0:i.call(o,"CheckBox");if(!l)continue;const r=this.checkBoxInstances.get(o.id);if(r){try{null===(n=null===(s=r.parent)||void 0===s?void 0:s.removeChild)||void 0===n||n.call(s,r)}catch(t){}a.push(r),h.push(o.name),t.boundCheckBoxes.push({name:o.name,cb:l})}}if(0===a.length)return;const u=t.selectedId?Math.max(0,h.indexOf(t.selectedId)):0,c=new Dt({items:a,type:null!==(o={horizontal:"horizontal",vertical:"vertical",bidirectional:"bidirectional"}[t.direction])&&void 0!==o?o:"vertical",elementsMargin:t.elementsMargin,selectedItem:u});if(this.transformSizeAuthorities.has(l.id)){const t=re(l,{allowZero:!0});t&&de(c,t)}this.radioGroupInstances.set(l.id,c),qt(r,l,c);const p=gi(c,{go:l,prefix:"radiogroup"},{change:(e,i)=>{var s;const n=null!==(s=h[e])&&void 0!==s?s:i;return t.selectedId=n,{selectedId:t.selectedId,index:e}}});this.signalCleanups.set(l.id,p)}getInstanceMap(t){let e=this.instances.get(t);return e||(e=new Map,this.instances.set(t,e)),e}gameRef(t){var e,i,s;const n=this.game;return n||(t&&null!==(s=null!==(e=t.game)&&void 0!==e?e:null===(i=t.scene)||void 0===i?void 0:i.game)&&void 0!==s?s:null)}handleTransformSizeChanged(t){var i,s;if(t.type!==e.OBSERVER_TYPE.CHANGE)return;const n=t.component,o=null!==(i=t.gameObject)&&void 0!==i?i:null==n?void 0:n.gameObject;if(!o)return;let l=!1;for(const[t,e]of Object.entries(pi)){const i=null===(s=this.instances.get(t))||void 0===s?void 0:s.get(o.id);if(!i)continue;he(e,i,Si(o,t),o,"transform-change")&&(l=!0)}const r=this.radioGroupInstances.get(o.id);if(r){const t=re(o,{allowZero:!0});t&&(de(r,t),l=!0)}l&&this.transformSizeAuthorities.add(o.id),this.relayoutLayoutInstances()}relayoutLayoutInstances(){for(const t of["List","ScrollBox"]){const e=this.instances.get(t);if(e)for(const t of e.values())ue(t)}}applyTransientTransformSize(t,e){if(ae(t))return()=>{};const i=re(e);if(!i)return()=>{};const s=Object.prototype.hasOwnProperty.call(t,"width"),n=Object.prototype.hasOwnProperty.call(t,"height"),o=t.width,l=t.height;return void 0!==i.width&&(t.width=i.width),void 0!==i.height&&(t.height=i.height),()=>{s?t.width=o:delete t.width,n?t.height=l:delete t.height}}};wi.systemName="UISystem",wi=function(t,e,i,s){var n,o=arguments.length,l=o<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)l=Reflect.decorate(t,e,i,s);else for(var r=t.length-1;r>=0;r--)(n=t[r])&&(l=(o<3?n(l):o>3?n(e,i,l):n(e,i))||l);return o>3&&l&&Object.defineProperty(e,i,l),l}([e.decorators.componentObserver(function(){const t={Transform:[{prop:["size"],deep:!0}],Shape:[{prop:["shapes"],deep:!0}],UI:[{prop:["shapes"],deep:!0}],UIComponent:[{prop:["shapes"],deep:!0}],RadioGroup:[{prop:["selectedId"],deep:!1},{prop:["direction"],deep:!1},{prop:["elementsMargin"],deep:!1}]};for(const[e,i]of Object.entries(pi)){const s=[];for(const[t,e]of Object.entries(i.fields)){const i="shallowMerge"===e.kind||"tuple"===e.kind||"arrayCopy"===e.kind;s.push({prop:[t],deep:i})}t[e]=s}return t}())],wi);var _i=wi;function bi(t,e){const i=new s.Container,n=null==e?void 0:e.name;return i.label=n?`${n}:layout-item`:"plugin-ui-layout-item",i.addChild(t),Object.defineProperty(i,"width",{get:()=>yi(e,t,"width"),set:()=>{},configurable:!0}),Object.defineProperty(i,"height",{get:()=>yi(e,t,"height"),set:()=>{},configurable:!0}),i}function yi(t,e,i){var s,n;const o=Number(null===(n=null===(s=null==t?void 0:t.transform)||void 0===s?void 0:s.size)||void 0===n?void 0:n[i]);if(Number.isFinite(o)&&o>0)return o;const l=Number(null==e?void 0:e[i]);return Number.isFinite(l)?l:0}function xi(t,e){var i,s;if(!t)return null;if("function"==typeof t.findChildByName)try{const i=t.findChildByName(e);if(i)return i}catch(t){}const n=(null===(i=t.transform)||void 0===i?void 0:i.children)||[];for(const t of n)if((null===(s=null==t?void 0:t.gameObject)||void 0===s?void 0:s.name)===e)return t.gameObject;return null}function Si(t,e){var i;try{return null===(i=null==t?void 0:t.getComponent)||void 0===i?void 0:i.call(t,e)}catch(t){return}}return t.Button=Qe,t.COMPONENT_DEFINITIONS=pi,t.CheckBox=ei,t.CircularProgressBar=li,t.Dialog=ui,t.DoubleSlider=ni,t.FancyButton=ti,t.Input=ri,t.List=ai,t.MaskedFrame=ci,t.PixiUiComponent=ne,t.PluginUiSystem=_i,t.ProgressBar=oi,t.RadioGroup=vi,t.ScrollBox=hi,t.Select=di,t.Shape=l,t.Slider=si,t.Switcher=ii,t.UI=l,t.UIShapeType=o,t.UISystem=_i,t.defineUiComponent=oe,Object.defineProperty(t,"__esModule",{value:!0}),t}({},EVA,EVA.plugin.renderer.graphics,PIXI);globalThis.EVA.plugin.ui=globalThis.EVA.plugin.ui||_EVA_IIFE_ui;
|